[CORD-1324-1328-1330-1331] Models for refactored Global ECORD service
Change-Id: Ib9c02d25bd65729c7faaa48d40b54a2ce6ffffac
diff --git a/xos/synchronizer/invokers/__init__.py b/__init__.py
similarity index 100%
copy from xos/synchronizer/invokers/__init__.py
copy to __init__.py
diff --git a/xos/Makefile.service b/xos/Makefile.service
new file mode 100644
index 0000000..9fb96f4
--- /dev/null
+++ b/xos/Makefile.service
@@ -0,0 +1,18 @@
+# Replace the line below with the location of xosgen
+PREFIX=.
+XOSGEN=$(PREFIX)/tool/xosgen
+
+DJANGO_TARGET=$(PREFIX)/targets/service.xtarget
+XPROTOS_TMP := $(shell mktemp)
+
+xprotos = $(wildcard *.xproto)
+
+all: models.py
+
+models.py: $(xprotos)
+ $(XOSGEN) --attic attic --target $(DJANGO_TARGET) --output $@ $<
+
+.PHONY: all
+
+clean:
+ rm -f models.py
diff --git a/xos/admin.py b/xos/admin.py
index 9f5a2b0..10814b0 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -4,120 +4,36 @@
from core.admin import XOSBaseAdmin
from django.contrib import admin
from django import forms
-from services.metronetwork.models import *
-class MetroNetworkSystemAdmin(ReadOnlyAwareAdmin):
- model = MetroNetworkSystem
- verbose_name = "MetroNetwork System"
- verbose_name_plural = "MetroNetwork System"
- list_display = ("name", "administrativeState")
- list_display_links = ('name',)
- fieldsets = [(None, {
- 'fields': ['name', 'administrativeState', 'description'],
- 'classes': ['suit-tab suit-tab-general']})]
-
-class NetworkDeviceAdminForm(forms.ModelForm):
-
- password = forms.CharField(required=False, widget = forms.PasswordInput(render_value=True))
-
- class Meta:
- model = NetworkDevice
- fields = '__all__'
-
-
-class NetworkDeviceAdmin(XOSBaseAdmin):
- verbose_name = "Network Device"
- verbose_name_plural = "Network Devices"
- form = NetworkDeviceAdminForm
- list_display = ('id', 'restCtrlUrl', 'administrativeState', 'username')
- list_display_links = ('id', 'restCtrlUrl', 'administrativeState', 'username')
-
- fields = ('id', 'restCtrlUrl', 'administrativeState', 'username', 'password')
-
-class NetworkEdgePortAdmin(XOSBaseAdmin):
- verbose_name = "Network Edge Port"
- verbose_name_plural = "Network Edge Ports"
- list_display = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
- list_display_links = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
-
- fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
- readonly_fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
-
-class NetworkEdgeToEdgePointConnectionAdmin(XOSBaseAdmin):
- verbose_name = "Metro Network E-Line Service"
- verbose_name_plural = "Metro Network E-Line Services"
- list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate')
- list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate')
-
- fields = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate', 'backend_status')
- readonly_fields = ('id', 'sid', 'backend_status')
-
-class NetworkMultipointToMultipointConnectionAdmin(XOSBaseAdmin):
- verbose_name = "Metro Network E-LAN Service"
- verbose_name_plural = "Metro Network E-LAN Services"
- list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
- list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
-
- fields = ('id', 'name', 'sid', 'type', 'vlanid', 'eps', 'adminstate', 'operstate', 'backend_status')
- readonly_fields = ('id', 'sid', 'backend_status')
-
-class NetworkEdgeToMultipointConnectionAdmin(XOSBaseAdmin):
- verbose_name = "Metro Network E-Tree Service"
- verbose_name_plural = "Metro Network E-Tree Services"
- list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
- list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
-
- fields = ('id', 'name', 'sid', 'type', 'vlanid', 'root', 'eps', 'adminstate', 'operstate', 'backend_status')
- readonly_fields = ('id', 'sid', 'backend_status')
-
-class RemotePortAdmin(XOSBaseAdmin):
- verbose_name = "Remote Port"
- verbose_name_plural = "Remote Ports"
- list_display = ('name', 'remoteportsite', 'edgeport')
- list_display_links = ('name', 'remoteportsite', 'edgeport')
-
- fields = ('name', 'remoteportsite', 'edgeport')
-
-class BandwidthProfileAdmin(XOSBaseAdmin):
+class XOSMetronetBandwithProfileAdmin(XOSBaseAdmin):
verbose_name = "Bandwidth Profile"
- verbose_name_plural = "Bandwidth Profiles"
- list_display = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
- list_display_links = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
+ list_display = ('cbs','ebs','cir','eir','name')
- fields = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
+ fields = ('cbs', 'ebs', 'cir', 'eir', 'name')
-class ServiceSpokeAdmin(XOSBaseAdmin):
- verbose_name = "Service Spoke"
- verbose_name_plural = "Service Spokes"
- list_display = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached')
- list_display_links = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached')
+class XOSMetronetUNIAdmin(XOSBaseAdmin):
+ verbose_name = "User Network Interface"
+ list_display = ('tenant', 'vlanIds', 'cpe_id', 'latlng', 'name')
+ fields = ('tenant','vlanIds', 'cpe_id', 'latlng', 'name')
- fields = ('name', 'id','vnodlocalsite', 'vnodlocalport', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status', 'autoattached')
- readonly_fields = ('id', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status')
+class XOSMetronetEnterpriseLocationAdmin(XOSBaseAdmin):
+ verbose_name = "Enterprise Location"
+ list_display = ('name', 'cord_site_ip', 'cord_site_port', 'cord_site_username', 'cord_site_password', 'cord_site_type')
+ fields = ('name', 'cord_site_ip', 'cord_site_port', 'cord_site_username', 'cord_site_password', 'cord_site_type')
-class VnodGlobalServiceAdmin(XOSBaseAdmin):
- verbose_name = "VNOD Global Service"
- verbose_name_plural = "VNOD Global Services"
- list_display = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate')
- list_display_links = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate')
+class XOSMetronetOnosModelAdmin(XOSBaseAdmin):
+ verbose_name = "Open Network Operating System"
+ list_display = ('name', 'onos_ip', 'onos_port', 'onos_username', 'onos_password', 'onos_type')
+ fields = ('name', 'onos_ip', 'onos_port', 'onos_username', 'onos_password', 'onos_type')
- fields = (
- 'id', 'servicehandle', 'vlanid', 'type', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint', 'operstate', 'adminstate', 'spokes', 'bandwidthProfile')
- readonly_fields = (
- 'id', 'operstate', 'backend_status', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint')
+class XOSMetronetELineAdmin(XOSBaseAdmin):
+ verbose_name = "Ethernet Virtual Private Line"
+ list_display = ('name', 'connect_point_1_id', 'connect_point_2_id', 'vlanids', 'cord_site_name', 'bwp')
+ fields = ('name', 'connect_point_1_id', 'connect_point_2_id', 'vlanids', 'cord_site_name', 'bwp')
-admin.site.register(MetroNetworkSystem, MetroNetworkSystemAdmin)
-admin.site.register(NetworkDevice, NetworkDeviceAdmin)
-admin.site.register(NetworkEdgePort, NetworkEdgePortAdmin)
-admin.site.register(NetworkEdgeToEdgePointConnection, NetworkEdgeToEdgePointConnectionAdmin)
-admin.site.register(NetworkMultipointToMultipointConnection, NetworkMultipointToMultipointConnectionAdmin)
-admin.site.register(NetworkEdgeToMultipointConnection, NetworkEdgeToMultipointConnectionAdmin)
-admin.site.register(BandwidthProfile, BandwidthProfileAdmin)
-admin.site.register(ServiceSpoke, ServiceSpokeAdmin)
-admin.site.register(VnodGlobalService, VnodGlobalServiceAdmin)
-admin.site.register(RemotePort, RemotePortAdmin)
-
-
-
-
+admin.site.register(XOSMetronetBandwithProfile, XOSMetronetBandwithProfileAdmin)
+admin.site.register(XOSMetronetUNI, XOSMetronetUNIAdmin)
+admin.site.register(XOSMetronetEnterpriseLocation, XOSMetronetEnterpriseLocationAdmin)
+admin.site.register(XOSMetronetOnosModel, XOSMetronetOnosModelAdmin)
+admin.site.register(XOSMetronetELine, XOSMetronetELineAdmin)
\ No newline at end of file
diff --git a/xos/api/service/metronetworkservice/metronetworkservice.py b/xos/api/service/metronetworkservice/metronetworkservice.py
deleted file mode 100644
index cf6623d..0000000
--- a/xos/api/service/metronetworkservice/metronetworkservice.py
+++ /dev/null
@@ -1,908 +0,0 @@
-from django.http import HttpResponseBadRequest
-from rest_framework.response import Response
-from rest_framework.views import APIView
-from rest_framework import serializers, filters, status
-from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
-from services.metronetwork.models import *
-from random import randint
-import json
-from django.core.exceptions import ObjectDoesNotExist
-from django.core import serializers as jsonserializer
-
-class MetroNetworkSystemSerializer(PlusModelSerializer):
- id = ReadOnlyField()
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-
- class Meta:
- model = MetroNetworkSystem
- fields = ('humanReadableName',
- 'id',
- 'restUrl',
- 'administrativeState',
- 'operationalState')
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class MetroNetworkSystemViewSet(XOSViewSet):
- base_name = "metronetworksystem"
- method_name = "metronetworksystem"
- method_kind = "viewset"
- queryset = MetroNetworkSystem.objects.all()
- serializer_class = MetroNetworkSystemSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(MetroNetworkSystemViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
-
-class NetworkEdgePortSerializer(PlusModelSerializer):
- id = ReadOnlyField()
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-
- class Meta:
- model = NetworkEdgePort
- fields = ('humanReadableName',
- 'pid',
- 'id',
- 'element',
- 'bwpCfgCbs',
- 'bwpCfgEbs',
- 'bwpCfgCir',
- 'bwpCfgEir',
- 'name',
- 'location',
- 'latlng')
-
-
- def getHumanReadableName(self, obj):
- return obj.id
-
-class NetworkEdgePortViewSet(XOSViewSet):
- base_name = "UNI"
- method_name = "UNI"
- method_kind = "viewset"
- queryset = NetworkEdgePort.objects.all()
- serializer_class = NetworkEdgePortSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(NetworkEdgePortViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
-class NetworkEdgeToEdgePointConnectionSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- uni1 = NetworkEdgePortSerializer(required=True, read_only=False)
- uni2 = NetworkEdgePortSerializer(required=True, read_only=False)
-
- class Meta:
- model = NetworkEdgeToEdgePointConnection
-
- fields = ('humanReadableName',
- 'sid',
- 'id',
- 'type',
- 'uni1',
- 'uni2',
- 'operstate',
- 'adminstate'
- )
-
- def getHumanReadableName(self, obj):
- return obj.id
-
-class NetworkEdgeToEdgePointConnectionViewSet(XOSViewSet):
- base_name = "ELINE"
- method_name = "ELINE"
- method_kind = "viewset"
- queryset = NetworkEdgeToEdgePointConnection.get_service_objects().all()
- serializer_class = NetworkEdgeToEdgePointConnectionSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(NetworkEdgeToEdgePointConnectionViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def destroy(self, request, pk=None):
- ELineConnectionToDelete = NetworkEdgeToEdgePointConnection.objects.get(pk=pk)
-
- if (ELineConnectionToDelete):
- ELineConnectionToDelete.adminstate = 'deactivationrequested'
- ELineConnectionToDelete.save()
- else:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- return Response(status=status.HTTP_200_OK)
-
-
- def create(self, validated_data):
-
- ELineConnection = NetworkEdgeToEdgePointConnection()
- ELineConnection.sid = validated_data.data.get('sid')
- ELineConnection.adminstate = validated_data.data.get('adminstate')
- ELineConnection.operstate = validated_data.data.get('operstate')
- ELineConnection.sid = validated_data.data.get('sid')
- ELineConnection.type = 'Point_To_Point'
-
- uni1 = validated_data.data.get('uni1')
- uni2 = validated_data.data.get('uni2')
-
- uni1 = NetworkEdgePort.objects.get(pk=uni1['id'])
- uni2 = NetworkEdgePort.objects.get(pk=uni2['id'])
-
- ELineConnection.uni1 = uni1
- ELineConnection.uni2 = uni2
- ELineConnection.save()
-
- response_data = {}
- response_data['sid'] = ELineConnection.sid
- response_data['adminstate'] = ELineConnection.adminstate
- response_data['operstate'] = ELineConnection.operstate
- response_data['type'] = ELineConnection.type
-
- response_data['uni1'] = {}
- response_data['uni1']['id'] = uni1.id
- response_data['uni1']['pid'] = uni1.pid
- response_data['uni1']['bwpCfgCbs'] = uni1.bwpCfgCbs
- response_data['uni1']['bwpCfgEbs'] = uni1.bwpCfgEbs
- response_data['uni1']['bwpCfgCir'] = uni1.bwpCfgCir
- response_data['uni1']['bwpCfgEir'] = uni1.bwpCfgEir
- response_data['uni1']['name'] = uni1.name
- response_data['uni1']['location'] = uni1.location
- response_data['uni1']['latlng'] = uni1.latlng
-
- response_data['uni2'] = {}
- response_data['uni2']['id'] = uni2.id
- response_data['uni2']['pid'] = uni2.pid
- response_data['uni2']['bwpCfgCbs'] = uni2.bwpCfgCbs
- response_data['uni2']['bwpCfgEbs'] = uni2.bwpCfgEbs
- response_data['uni2']['bwpCfgCir'] = uni2.bwpCfgCir
- response_data['uni2']['bwpCfgEir'] = uni2.bwpCfgEir
- response_data['uni2']['name'] = uni1.name
- response_data['uni2']['location'] = uni1.location
- response_data['uni2']['latlng'] = uni1.latlng
-
- return Response(response_data)
-
-class NetworkEdgeToMultipointConnectionSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- root = NetworkEdgePortSerializer(required=True, read_only=False)
- eps = NetworkEdgePortSerializer(required=True, read_only=False, many=True)
-
- class Meta:
- model = NetworkEdgeToMultipointConnection
-
- fields = ('humanReadableName',
- 'sid',
- 'id',
- 'type',
- 'root',
- 'eps',
- 'operstate',
- 'adminstate'
- )
-
- def getHumanReadableName(self, obj):
- return obj.id
-
-class NetworkEdgeToMultipointConnectionViewSet(XOSViewSet):
- base_name = "ETREE"
- method_name = "ETREE"
- method_kind = "viewset"
- queryset = NetworkEdgeToMultipointConnection.get_service_objects().all()
- serializer_class = NetworkEdgeToMultipointConnectionSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(NetworkEdgeToMultipointConnectionViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def destroy(self, request, pk=None):
- ETreeConnectionToDelete = NetworkEdgeToMultipointConnection.objects.get(pk=pk)
-
- if (ETreeConnectionToDelete):
- ETreeConnectionToDelete.adminstate = 'deactivationrequested'
- ETreeConnectionToDelete.save()
- else:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- return Response(status=status.HTTP_200_OK)
-
- def create(self, validated_data):
-
- ETreeConnection = NetworkEdgeToMultipointConnection()
- ETreeConnection.sid = validated_data.data.get('sid')
- ETreeConnection.adminstate = validated_data.data.get('adminstate')
- ETreeConnection.operstate = validated_data.data.get('operstate')
- ETreeConnection.sid = validated_data.data.get('sid')
- ETreeConnection.type = 'Root_Multipoint'
-
- root_id = validated_data.data.get('root')
- eps_list = validated_data.data.get('eps')
-
- root = NetworkEdgePort.objects.get(pk=root_id)
- ETreeConnection.root = root
- ETreeConnection.save()
-
- for ep in eps_list:
- port = NetworkEdgePort.objects.get(pk=ep['id'])
- ETreeConnection.eps.add(port)
-
- response_data = {}
- response_data['sid'] = ETreeConnection.sid
- response_data['adminstate'] = ETreeConnection.adminstate
- response_data['operstate'] = ETreeConnection.operstate
- response_data['type'] = ETreeConnection.type
-
- response_data['root'] = {}
- response_data['root']['id'] = root.id
- response_data['root']['pid'] = root.pid
- response_data['root']['bwpCfgCbs'] = root.bwpCfgCbs
- response_data['root']['bwpCfgEbs'] = root.bwpCfgEbs
- response_data['root']['bwpCfgCir'] = root.bwpCfgCir
- response_data['root']['bwpCfgEir'] = root.bwpCfgEir
- response_data['root']['name'] = root.name
- response_data['root']['location'] = root.location
- response_data['root']['latlng'] = root.latlng
-
- eps_data = []
- for ep in ETreeConnection.eps.all():
- port = {}
- port['id'] = ep.id
- port['pid'] = ep.pid
- port['bwpCfgCbs'] = ep.bwpCfgCbs
- port['bwpCfgEbs'] = ep.bwpCfgEbs
- port['bwpCfgCir'] = ep.bwpCfgCir
- port['bwpCfgEir'] = ep.bwpCfgEir
- port['name'] = ep.name
- port['location'] = ep.location
- port['latlng'] = ep.latlng
- eps_data.append(port)
-
- response_data['eps'] = eps_data
-
- return Response(response_data)
-
-class NetworkMultipointToMultipointConnectionSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- eps = NetworkEdgePortSerializer(required=True, read_only=False, many=True)
-
- class Meta:
- model = NetworkMultipointToMultipointConnection
-
- fields = ('humanReadableName',
- 'sid',
- 'id',
- 'type',
- 'eps',
- 'operstate',
- 'adminstate'
- )
-
- def getHumanReadableName(self, obj):
- return obj.id
-
-class NetworkMultipointToMultipointConnectionViewSet(XOSViewSet):
- base_name = "ELAN"
- method_name = "ELAN"
- method_kind = "viewset"
- queryset = NetworkMultipointToMultipointConnection.get_service_objects().all()
- serializer_class = NetworkMultipointToMultipointConnectionSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(NetworkMultipointToMultipointConnectionViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def destroy(self, request, pk=None):
- ETreeConnectionToDelete = NetworkMultipointToMultipointConnection.objects.get(pk=pk)
-
- if (ETreeConnectionToDelete):
- ETreeConnectionToDelete.adminstate = 'deactivationrequested'
- ETreeConnectionToDelete.save()
- else:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- return Response(status=status.HTTP_200_OK)
-
- def create(self, validated_data):
-
- ELanConnection = NetworkMultipointToMultipointConnection()
- ELanConnection.sid = validated_data.data.get('sid')
- ELanConnection.adminstate = validated_data.data.get('adminstate')
- ELanConnection.operstate = validated_data.data.get('operstate')
- ELanConnection.sid = validated_data.data.get('sid')
- ELanConnection.type = 'Multipoint_To_Multipoint'
-
- eps_list = validated_data.data.get('eps')
- ELanConnection.save()
-
- for ep in eps_list:
- port = NetworkEdgePort.objects.get(pk=ep['id'])
- ELanConnection.eps.add(port)
-
- response_data = {}
- response_data['sid'] = ELanConnection.sid
- response_data['adminstate'] = ELanConnection.adminstate
- response_data['operstate'] = ELanConnection.operstate
- response_data['type'] = ELanConnection.type
-
- eps_data = []
- for ep in ELanConnection.eps.all():
- port = {}
- port['id'] = ep.id
- port['pid'] = ep.pid
- port['bwpCfgCbs'] = ep.bwpCfgCbs
- port['bwpCfgEbs'] = ep.bwpCfgEbs
- port['bwpCfgCir'] = ep.bwpCfgCir
- port['bwpCfgEir'] = ep.bwpCfgEir
- port['name'] = ep.name
- port['location'] = ep.location
- port['latlng'] = ep.latlng
- eps_data.append(port)
-
- response_data['eps'] = eps_data
-
- return Response(response_data)
-
-############################
-
-class BandwidthProfileSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-
- class Meta:
- model = BandwidthProfile
-
-
- fields = ('humanReadableName',
- 'id',
- 'bwpcfgcbs',
- 'bwpcfgebs',
- 'bwpcfgcir',
- 'bwpcfgeir',
- 'name'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class BandwidthProfileViewSet(XOSViewSet):
- base_name = "BANDWIDTH_PROFILE"
- method_name = "BANDWIDTH_PROFILE"
- method_kind = "viewset"
- queryset = BandwidthProfile.objects.all()
- serializer_class = BandwidthProfileSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(BandwidthProfileViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def create(self, validated_data):
-
- bandwidthProfile = BandwidthProfile()
- bandwidthProfile.name = validated_data.data.get('name')
- bandwidthProfile.bwpcfgcbs = validated_data.data.get('bwpcfgcbs')
- bandwidthProfile.bwpcfgebs = validated_data.data.get('bwpcfgebs')
- bandwidthProfile.bwpcfgcir = validated_data.data.get('bwpcfgcir')
- bandwidthProfile.bwpcfgeir = validated_data.data.get('bwpcfgeir')
-
- bandwidthProfile.save()
-
- response_data = {}
- response_data['name'] = bandwidthProfile.name
- response_data['bwpcfgcbs'] = bandwidthProfile.bwpcfgcbs
- response_data['bwpcfgebs'] = bandwidthProfile.bwpcfgebs
- response_data['bwpcfgcir'] = bandwidthProfile.bwpcfgeir
- response_data['bwpcfgcir'] = bandwidthProfile.bwpcfgcir
- response_data['id'] = bandwidthProfile.id
-
- return Response(response_data)
-
-class UserNetworkInterfaceSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-
- class Meta:
- model = UserNetworkInterface
-
- fields = ('humanReadableName',
- 'id',
- 'bwpcfgcbs',
- 'bwpcfgebs',
- 'bwpcfgcir',
- 'bwpcfgeir',
- 'name'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class UserNetworkInterfaceViewSet(XOSViewSet):
- base_name = "USER_NETWORK_INTERFACE"
- method_name = "USER_NETWORK_INTERFACE"
- method_kind = "viewset"
- queryset = UserNetworkInterface.objects.all()
- serializer_class = UserNetworkInterfaceSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(UserNetworkInterfaceViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def create(self, validated_data):
-
- userNetworkInterface = UserNetworkInterface()
-
- userNetworkInterface.name = validated_data.data.get('name')
- userNetworkInterface.capacity = validated_data.data.get('capacity')
- userNetworkInterface.bw_used = validated_data.data.get('bw_used')
- userNetworkInterface.vlanIds = validated_data.data.get('vlanIds')
- userNetworkInterface.location = validated_data.data.get('location')
- userNetworkInterface.latlng = validated_data.data.get('latlng')
-
- copyin_props = ['enabled', 'capacity', 'bw_used', 'vlanIds', 'location', 'latlng', 'name']
-
- userNetworkInterface.save()
-
- response_data = {}
- response_data['name'] = userNetworkInterface.name
- response_data['capacity'] = userNetworkInterface.capacity
- response_data['bw_used'] = userNetworkInterface.bw_used
- response_data['vlanIds'] = userNetworkInterface.vlanIds
- response_data['location'] = userNetworkInterface.location
- response_data['latlng'] = userNetworkInterface.latlng
- response_data['id'] = userNetworkInterface.id
-
- return Response(response_data)
-
-class VnodSiteSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-
- class Meta:
- model = Site
-
- fields = ('humanReadableName',
- 'site_url',
- 'enabled',
- 'longitude',
- 'latitude',
- 'name'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class RemotePortSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- edgeport = NetworkEdgePortSerializer(read_only=True)
- remoteportsite = VnodSiteSerializer(read_only=True)
-
- class Meta:
- model = RemotePort
-
- fields = ('humanReadableName',
- 'name',
- 'edgeport',
- 'id',
- 'remoteportsite'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class ServiceSpokeSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- vnodlocalsite = VnodSiteSerializer(read_only=True)
- vnodlocalport = RemotePortSerializer(read_only=True)
-
- class Meta:
- model = ServiceSpoke
-
- fields = ('humanReadableName',
- 'id',
- 'name',
- 'remotesubscriber',
- 'remotevnodid',
- 'autoattached',
- 'operstate',
- 'vnodlocalsite',
- 'vnodlocalport'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class VnodGlobalServiceSerializer(PlusModelSerializer):
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- metronetworkroottomultipoint = NetworkEdgeToMultipointConnectionSerializer(read_only=True)
- metronetworkmultipoint = NetworkMultipointToMultipointConnectionSerializer(read_only=True)
- metronetworkpointtopoint = NetworkEdgeToEdgePointConnectionSerializer(read_only=True)
- spokes = ServiceSpokeSerializer(read_only=True, many=True)
- bandwidthProfile = BandwidthProfileSerializer(read_only=True)
-
- class Meta:
- model = VnodGlobalService
-
- fields = ('humanReadableName',
- 'servicehandle',
- 'vlanid',
- 'id',
- 'type',
- 'operstate',
- 'adminstate',
- 'metronetworkroottomultipoint',
- 'metronetworkmultipoint',
- 'metronetworkpointtopoint',
- 'spokes',
- 'bandwidthProfile',
- 'name'
- )
-
- def getHumanReadableName(self, obj):
- return obj.name
-
-class VnodGlobalServiceViewSet(XOSViewSet):
- base_name = "VNOD_GLOBAL_SERVICE"
- method_name = "VNOD_GLOBAL_SERVICE"
- method_kind = "viewset"
- queryset = VnodGlobalService.get_service_objects().all()
- serializer_class = VnodGlobalServiceSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = super(VnodGlobalServiceViewSet, self).get_urlpatterns(api_path=api_path)
-
- return patterns
-
- def list(self, request):
-
- object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
-
- return Response(serializer.data)
-
- def destroy(self, request, pk=None):
- VnodGlobalServiceToDelete = VnodGlobalService.objects.get(pk=pk)
-
- if (VnodGlobalServiceToDelete):
- VnodGlobalServiceToDelete.adminstate = 'deactivationrequested'
- VnodGlobalServiceToDelete.save()
- else:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- return Response(status=status.HTTP_200_OK)
-
- def create(self, validated_data):
-
- vnodGlobalService = VnodGlobalService()
-
- vnodGlobalService.name = validated_data.data.get('name')
-
- if VnodGlobalService.objects.filter(
- name=vnodGlobalService.name).exists():
- return HttpResponseBadRequest('Error: VnodGlobalService name \'' + vnodGlobalService.name
- + '\' already exists.')
-
- vnodGlobalService.servicehandle = validated_data.data.get('servicehandle')
- vnodGlobalService.adminstate = 'enabled'
- vnodGlobalService.operstate = 'inactive'
- vnodGlobalService.type = validated_data.data.get('type')
-
- vnodGlobalService.vlanid = self.getUniqueVlandId()
-
- bandwidth_profile = validated_data.data.get('bandwidthProfile')
- bandwidthprofile = BandwidthProfile.objects.get(pk=bandwidth_profile['id'])
- if (bandwidth_profile):
- vnodGlobalService.bandwidthProfile = bandwidthprofile
-
- vnodGlobalService.save()
-
- spokes_list = validated_data.data.get('spokes')
- if (spokes_list is None):
- vnodGlobalService.delete()
- return HttpResponseBadRequest('Error: No spokes found in request.')
-
- for spoke in spokes_list:
- vnodlocalsite = Site.objects.get(pk=spoke['vnodlocalsite']['id'])
- servicespoke = ServiceSpoke()
- servicespoke.vnodlocalsite = vnodlocalsite
- servicespoke.vnodlocalport = self.getRandomRemotePort(vnodlocalsite)
- servicespoke.name = spoke['name']
- if (spoke.get('autoattached')):
- servicespoke.autoattached = spoke['autoattached']
- servicespoke.operstate = 'inactive'
- servicespoke.adminstate = 'disabled'
- servicespoke.save()
- vnodGlobalService.spokes.add(servicespoke)
-
- serializer = self.get_serializer(vnodGlobalService)
- return Response(serializer.data)
-
- def getUniqueVlandId(self):
- unique = False
- while not unique:
- vlanid = randint(1, 4095)
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(vlanid=vlanid)
- if (not vnodglobalservice):
- unique = True
- return vlanid
-
- def getRandomRemotePort(self, site):
- remotePort = RemotePort.objects.get(remoteportsite__name=site.name)
- if (remotePort):
- return remotePort
- return None
-
- @classmethod
- def calculateVnodGlobalOperState(self, servicehandle):
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(servicehandle=servicehandle)
- if (not vnodglobalservice):
- HttpResponseBadRequest('Error: Could not find VnodGlobalObject with servicehandle=' + servicehandle)
-
- vnodglobalservice = vnodglobalservice[0]
- all_spokes_active_and_enabled = True
-
- for spoke in vnodglobalservice.spokes.all():
- if (spoke.operstate != 'active' or spoke.adminstate != 'enabled'):
- all_spokes_active_and_enabled = False
- break;
-
- if (all_spokes_active_and_enabled):
- vnodglobalservice.operstate = 'active'
- else:
- vnodglobalservice.operstate = 'inactive'
-
- vnodglobalservice.save()
- return all_spokes_active_and_enabled
-
- @classmethod
- def createService(self, servicehandle):
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(servicehandle=servicehandle)
- if (not vnodglobalservice):
- HttpResponseBadRequest('Error: Could not find VnodGlobalObject with servicehandle=' + servicehandle)
-
- vnodglobalservice = vnodglobalservice[0]
- if (vnodglobalservice.type == 'eline'):
-
- spokes = vnodglobalservice.spokes.all()
- uni1 = spokes[0].vnodlocalport.edgeport
- uni2 = spokes[1].vnodlocalport.edgeport
- name = 'ELine-' + str(vnodglobalservice.id)
- type = 'Point_To_Point'
- operstate = 'active'
- adminstate = 'activationrequested'
-
- eline = NetworkEdgeToEdgePointConnection()
- eline.name = name
- eline.type = type
- eline.operstate = operstate
- eline.adminstate = adminstate
- eline.vlanid = vnodglobalservice.vlanid
- eline.sid = name
- eline.uni1 = NetworkEdgePort.objects.get(pid=uni1.pid)
- eline.uni2 = NetworkEdgePort.objects.get(pid=uni2.pid)
-
- eline.save()
- vnodglobalservice.metronetworkpointtopoint = eline
- vnodglobalservice.save()
-
- elif (vnodglobalservice.type == 'elan'):
-
- spokes = vnodglobalservice.spokes.all()
-
- name = 'ELAN-' + str(vnodglobalservice.id)
- type = 'Multipoint_To_Multipoint'
- operstate = 'active'
- adminstate = 'activationrequested'
-
- elan = NetworkMultipointToMultipointConnection()
- elan.name = name
- elan.type = type
- elan.operstate = 'inactive'
- elan.adminstate = 'disabled'
- elan.vlanid = vnodglobalservice.vlanid
- elan.save()
-
- for spoke in spokes:
- uni = NetworkEdgePort.objects.get(pid=spoke.vnodlocalport.edgeport.pid)
- elan.eps.add(uni)
-
- elan.operstate = operstate
- elan.adminstate = adminstate
- elan.save()
-
- vnodglobalservice.metronetworkmultipoint = elan
- vnodglobalservice.save()
-
- # TODO: elif (vnodglobalservice.type == 'etree'):
-
-class VnodGlobalServiceAutoAttachmentView(APIView):
- method_kind = "list"
- method_name = "vnodglobal_api_autoattach"
-
- def get(self, request, format=None):
- params = request.query_params
- sitename = params.get('sitename')
-
- if ( sitename is None):
- HttpResponseBadRequest("Error: Request requires] 'sitename' as a query param.")
-
- vnodglobalservices = VnodGlobalService.get_service_objects().filter(spokes__autoattached=True,
- spokes__operstate='inactive',
- spokes__vnodlocalsite__name=sitename)
-
- if (not vnodglobalservices):
- HttpResponseBadRequest({"handles" : []})
-
- handles = []
- for vnodglobalservice in vnodglobalservices:
- if (vnodglobalservice.adminstate != 'disabled'):
- handles.append(vnodglobalservice.servicehandle)
-
- response_data = {'servicehandles' : handles}
- return Response(response_data)
-
-class VnodGlobalServiceConfigurationView(APIView):
- method_kind = "list"
- method_name = "vnodglobal_api_configuration"
-
- def get(self, request, format=None):
- params = request.query_params
- servicehandle = params.get('servicehandle')
- sitename = params.get('sitename')
-
- if (servicehandle is None or sitename is None):
- HttpResponseBadRequest("Error: Request requires 'servicehandle' and 'sitename' as query params.")
-
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(servicehandle=servicehandle)
- if (not vnodglobalservice):
- HttpResponseBadRequest('Error: Could not find VnodGlobalObject with servicehandle=' + servicehandle)
-
- vnodglobalservice = vnodglobalservice[0]
- response_data = {}
- response_data['vlanid'] = vnodglobalservice.vlanid
-
- for spoke in vnodglobalservice.spokes.all():
- if (spoke.vnodlocalsite.name == sitename and spoke.adminstate != 'configured'):
- response_data['port'] = {}
- response_data['port']['name'] = spoke.vnodlocalport.name
- break;
-
- return Response(response_data)
-
-class VnodGlobalServiceActivationView(APIView):
- method_kind = "list"
- method_name = "vnodglobal_api_activation"
-
- def post(self, request, format=None):
- body_json = request.body
- body = json.loads(body_json)
-
- servicehandle=body['servicehandle']
- sitename=body['sitename']
- activate = body['activate']
- vnodlocalid = body['vnodlocalid']
- portid = body.get('portid')
-
- if (activate == 'true' or activate == 'True'):
- isActivate = True
- else:
- isActivate = False
-
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(servicehandle=servicehandle)
- if (not vnodglobalservice):
- HttpResponseBadRequest('Error: Could not find VnodGlobalObject with servicehandle=' + servicehandle)
-
- vnodglobalservice = vnodglobalservice[0]
-
- for spoke in vnodglobalservice.spokes.all():
- if (spoke.vnodlocalsite.name == sitename and spoke.vnodlocalport.name == portid):
- spoke_id = spoke.id
- servicespoke = ServiceSpoke.objects.get(id=spoke_id)
- servicespoke.remotevnodid = vnodlocalid
- servicespoke.save()
- break;
-
- return Response()
-
-class VnodGlobalServiceAdminOperationalStateView(APIView):
- method_kind = "list"
- method_name = "vnodglobal_api_status"
-
- def post(self, request, format=None):
- body_json = request.body
- body = json.loads(body_json)
-
- servicehandle = body['servicehandle']
- sitename = body['sitename']
- operstate = body.get('operstate')
- adminstate = body.get('adminstate')
- portid = body.get('portid')
-
- vnodglobalservice = VnodGlobalService.get_service_objects().filter(servicehandle=servicehandle)
- if (not vnodglobalservice):
- HttpResponseBadRequest('Error: Could not find VnodGlobalObject with servicehandle=' + servicehandle)
-
- vnodglobalservice = vnodglobalservice[0]
-
- for spoke in vnodglobalservice.spokes.all():
- if (spoke.vnodlocalsite.name == sitename and spoke.vnodlocalport.name == portid):
- spoke_id = spoke.id
- servicespoke = ServiceSpoke.objects.get(id=spoke_id)
- if (operstate):
- servicespoke.operstate = operstate
- if (adminstate):
- servicespoke.adminstate = adminstate
- servicespoke.save()
- break;
-
- isGlobalActive = VnodGlobalServiceViewSet.calculateVnodGlobalOperState(servicehandle=servicehandle)
-
- if (vnodglobalservice.metronetworkmultipoint is None and vnodglobalservice.metronetworkpointtopoint is None and
- vnodglobalservice.metronetworkroottomultipoint is None and isGlobalActive):
- VnodGlobalServiceViewSet.createService(servicehandle=servicehandle)
-
- return Response()
diff --git a/xos/attic/remoteport_model.py b/xos/attic/eline_model.py
similarity index 100%
rename from xos/attic/remoteport_model.py
rename to xos/attic/eline_model.py
diff --git a/xos/attic/remoteport_model.py b/xos/attic/enterprisetenant_model.py
similarity index 100%
copy from xos/attic/remoteport_model.py
copy to xos/attic/enterprisetenant_model.py
diff --git a/xos/attic/header.py b/xos/attic/header.py
index f4db591..83b7a8c 100644
--- a/xos/attic/header.py
+++ b/xos/attic/header.py
@@ -6,8 +6,8 @@
from core.models import PlCoreBase
from core.models import Site
-METRONETWORK_KIND = "metronetwork"
-SERVICE_NAME = 'metronetwork'
+METRONETWORK_KIND = "metronet"
+SERVICE_NAME = 'metronet'
SERVICE_NAME_ELINE_VERBOSE = 'E-Line Service'
SERVICE_NAME_ELAN_VERBOSE = 'E-LAN Service'
SERVICE_NAME_ETREE_VERBOSE = 'E-Tree Service'
diff --git a/xos/attic/metronetworksystem_model.py b/xos/attic/metronetworksystem_model.py
deleted file mode 100644
index 358cf8d..0000000
--- a/xos/attic/metronetworksystem_model.py
+++ /dev/null
@@ -1,15 +0,0 @@
-def __init__(self, *args, **kwargs):
- super(MetroNetworkSystem, self).__init__(*args, **kwargs)
-
-def getAdminstrativeState(self):
- return self.administrativeState
-
-def setAdminstrativeState(self, value):
- self.administrativeState = value
-
-def getOperationalState(self):
- return self.operationalState
-
-def getRestUrl(self):
- return self.restUrl
-
diff --git a/xos/attic/networkedgeport_model.py b/xos/attic/networkedgeport_model.py
deleted file mode 100644
index 52f17fe..0000000
--- a/xos/attic/networkedgeport_model.py
+++ /dev/null
@@ -1,22 +0,0 @@
-def __unicode__(self):
- return u'%s' % (self.pid)
-
-def save(self, *args, **kwargs):
-
- if self.latlng:
- try:
- latlng_value = getattr(self, 'latlng').strip()
- if (latlng_value.startswith('[') and latlng_value.endswith(']') and latlng_value.index(',') > 0):
- lat = latlng_value[1: latlng_value.index(',')].strip()
- lng = latlng_value[latlng_value.index(',') + 1: len(latlng_value) - 1].strip()
-
- #If lat and lng are not floats, the code below should result in an error.
- lat_validation = float(lat)
- lng_validation = float(lng)
- else:
- raise ValueError("The lat/lng value is not formatted correctly.")
- except:
- raise ValueError("The lat/lng value is not formatted correctly.")
-
- super(NetworkEdgePort, self).save(*args, **kwargs)
-
diff --git a/xos/attic/servicespoke_model.py b/xos/attic/servicespoke_model.py
deleted file mode 100644
index 3fd623e..0000000
--- a/xos/attic/servicespoke_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/attic/remoteport_model.py b/xos/attic/transportnetowrk_model.py
similarity index 100%
copy from xos/attic/remoteport_model.py
copy to xos/attic/transportnetowrk_model.py
diff --git a/xos/attic/usernetworkinterfaces_model.py b/xos/attic/usernetworkinterface_model.py
similarity index 100%
rename from xos/attic/usernetworkinterfaces_model.py
rename to xos/attic/usernetworkinterface_model.py
diff --git a/xos/metronetwork-onboard.yaml b/xos/metro-net-onboard.yaml
similarity index 70%
rename from xos/metronetwork-onboard.yaml
rename to xos/metro-net-onboard.yaml
index e4ecb69..4608141 100644
--- a/xos/metronetwork-onboard.yaml
+++ b/xos/metro-net-onboard.yaml
@@ -7,16 +7,16 @@
topology_template:
node_templates:
- servicecontroller#metronetwork:
+ # this is the culprit probably
+ metronet:
type: tosca.nodes.ServiceController
properties:
base_url: file:///opt/xos_services/metro-net/xos/
# The following will concatenate with base_url automatically, if
# base_url is non-null.
xproto: ./
- admin: admin.py
- rest_service: subdirectory:metronetworkservice api/service/metronetworkservice/metronetworkservice.py
synchronizer: synchronizer/manifest
- synchronizer_run: metronetworkervice-synchronizer.py
- tosca_resource: tosca/resources/metronetservice.py
+ synchronizer_run: metronetwork-synchronizer.py
tosca_custom_types: metronet.yaml
+ tosca_resource: tosca/resources/metronetservice.py
+ #admin: admin.py
diff --git a/xos/metronet.m4 b/xos/metronet.m4
index c9e6eb8..9c5a807 100644
--- a/xos/metronet.m4
+++ b/xos/metronet.m4
@@ -7,110 +7,198 @@
node_types:
- tosca.nodes.VNodGlobalService:
- description: >
- CORD: The MetroNet Service.
- derived_from: tosca.nodes.Root
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.MetroNetworkSystem:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Metro Network Service.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
- administrativeState:
- type: string
- required: true
- restUrl:
- type: string
- required: false
-
-
- tosca.nodes.MetroNetworkDevice:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Metro Network Device.
- properties:
- xos_base_props
- restCtrlUrl:
- type: string
- required: true
- username:
- type: string
- required: true
- password:
- type: string
- required: true
- administrativeState:
- type: string
- required: true
- authType:
- type: string
- required: false
- id:
- type: string
- required: true
-
- tosca.nodes.EcordBandwidthProfile:
+ tosca.nodes.BandwidthProfile:
derived_from: tosca.nodes.Root
description: >
CORD: The ecord bandwith profile.
capabilities:
properties:
- xos_base_props
- bwpcfgcbs:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ cbs:
type: integer
required: false
- bwpcfgebs:
+ ebs:
type: integer
required: false
- bwpcfgcir:
+ cir:
type: integer
required: false
- bwpcfgeir:
+ eir:
type: integer
required: false
name:
type: string
required: true
- tosca.nodes.EcordUserNetworkInterface:
+ tosca.nodes.UserNetworkInterface:
derived_from: tosca.nodes.Root
description: >
CORD: The ecord user netowrk interface
capabilities:
properties:
- xos_base_props
- enabled:
+ no-delete:
type: boolean
- required: false
- capacity:
- type: integer
- required: false
- bw_used:
- type: integer
- required: false
- vlanIds:
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
type: string
required: false
+ descrption: Replaces/renames this object
+ cpe_id:
+ type: string
+ required: false
+ tenant:
+ type: string
+ required: true
name:
type: string
required: true
- location:
- type: string
- required: false
latlng:
type: string
required: false
- tosca.relationships.UsesBandwidthProfile:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.EcordBandwidthProfile ]
\ No newline at end of file
+ tosca.nodes.OnosModel:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord ONOS model
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ onos_ip:
+ type: string
+ required: false
+ onos_port:
+ type: integer
+ required: false
+ onos_username:
+ type: string
+ required: false
+ onos_password:
+ type: string
+ required: false
+ onos_type:
+ type: string
+ required: false
+
+ tosca.nodes.EnterpriseLocation:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord enterprise location
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ cord_site_ip:
+ type: string
+ required: false
+ cord_site_port:
+ type: integer
+ required: false
+ cord_site_username:
+ type: string
+ required: false
+ cord_site_password:
+ type: string
+ required: false
+ cord_site_type:
+ type: string
+ required: false
+
+ tosca.nodes.ELine:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord Ethernet Virtual Private Line
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ connect_point_1_id:
+ type: string
+ required: false
+ connect_point_2_id:
+ type: string
+ required: false
+ vlanids:
+ type: string
+ required: false
+ cord_site_name:
+ type: string
+ required: false
+ bwp:
+ type: string
+ required: false
\ No newline at end of file
diff --git a/xos/metronet.m4.old b/xos/metronet.m4.old
new file mode 100644
index 0000000..c9e6eb8
--- /dev/null
+++ b/xos/metronet.m4.old
@@ -0,0 +1,116 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 metronet.m4 > metronet.yaml"
+
+# include macros
+include(macros.m4)
+
+node_types:
+
+ tosca.nodes.VNodGlobalService:
+ description: >
+ CORD: The MetroNet Service.
+ derived_from: tosca.nodes.Root
+ capabilities:
+ xos_base_service_caps
+ properties:
+ xos_base_props
+ xos_base_service_props
+
+ tosca.nodes.MetroNetworkSystem:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The Metro Network Service.
+ capabilities:
+ xos_base_service_caps
+ properties:
+ xos_base_props
+ xos_base_service_props
+ administrativeState:
+ type: string
+ required: true
+ restUrl:
+ type: string
+ required: false
+
+
+ tosca.nodes.MetroNetworkDevice:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The Metro Network Device.
+ properties:
+ xos_base_props
+ restCtrlUrl:
+ type: string
+ required: true
+ username:
+ type: string
+ required: true
+ password:
+ type: string
+ required: true
+ administrativeState:
+ type: string
+ required: true
+ authType:
+ type: string
+ required: false
+ id:
+ type: string
+ required: true
+
+ tosca.nodes.EcordBandwidthProfile:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord bandwith profile.
+ capabilities:
+ properties:
+ xos_base_props
+ bwpcfgcbs:
+ type: integer
+ required: false
+ bwpcfgebs:
+ type: integer
+ required: false
+ bwpcfgcir:
+ type: integer
+ required: false
+ bwpcfgeir:
+ type: integer
+ required: false
+ name:
+ type: string
+ required: true
+
+ tosca.nodes.EcordUserNetworkInterface:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord user netowrk interface
+ capabilities:
+ properties:
+ xos_base_props
+ enabled:
+ type: boolean
+ required: false
+ capacity:
+ type: integer
+ required: false
+ bw_used:
+ type: integer
+ required: false
+ vlanIds:
+ type: string
+ required: false
+ name:
+ type: string
+ required: true
+ location:
+ type: string
+ required: false
+ latlng:
+ type: string
+ required: false
+
+ tosca.relationships.UsesBandwidthProfile:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.EcordBandwidthProfile ]
\ No newline at end of file
diff --git a/xos/metronet.xproto b/xos/metronet.xproto
index 4094bf4..0e6b35a 100644
--- a/xos/metronet.xproto
+++ b/xos/metronet.xproto
@@ -1,136 +1,59 @@
-option name = "metronetwork";
+option name = "metronet";
-message MetroNetworkSystem (PlCoreBase){
- option verbose_name = "Metro Network System";
+message EnterpriseLocation (PlCoreBase){
+ option verbose_name = "Enterprise Localation";
required string name = 1 [db_index = False, max_length = 256, null = False, blank = False];
- required string description = 2 [db_index = False, max_length = 1024, null = False, blank = False];
- required string restUrl = 3 [db_index = False, max_length = 256, null = False, blank = False];
- required string administrativeState = 4 [default = "disabled", choices = "(('enabled', 'Enabled'), ('disabled', 'Disabled'))", max_length = 16, blank = False, null = False, db_index = False];
- required string operationalState = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+ required string cord_site_ip = 2 [help_text = "ip of the local site", db_index = False, max_length = 64, null = False, blank = False];
+ required int32 cord_site_port = 3 [help_text = "port of the local site", db_index = False, null = False, blank = False];
+ required string cord_site_username = 4 [help_text = "username of the local site", db_index = False, max_length = 64, null = False, blank = False];
+ required string cord_site_password = 5 [help_text = "password of the local site", db_index = False, max_length = 64, null = False, blank = False];
+ required string cord_site_type = 6 [default = "xos", choices = "(('onos', 'ONOS'), ('xos', 'XOS'))", db_index = False, max_length = 64, null = False, blank = False];
+
}
-message NetworkDevice (PlCoreBase){
- option verbose_name = "Network Device";
+message OnosModel (PlCoreBase){
+ option verbose_name = "Open Network Operating System";
- optional string name = 1 [help_text = "Device friendly name", max_length = 20, null = True, db_index = False, blank = True];
- required string restCtrlUrl = 2 [db_index = False, max_length = 256, null = False, blank = False];
- required string authType = 3 [blank = False, max_length = 16, null = False, db_index = False, choices = "(('basic', 'Basic'), ('key', 'Key'), ('oauth', 'OAuth'))"];
- required string username = 4 [db_index = False, max_length = 32, null = False, blank = True];
- required string password = 5 [db_index = False, max_length = 32, null = False, blank = True];
- required string administrativeState = 6 [default = "disabled", choices = "(('enabled', 'Enabled'), ('disabled', 'Disabled'), ('syncrequested', 'SyncRequested'), ('syncinprogress', 'SyncInProgress'))", max_length = 16, blank = False, null = False, db_index = False];
+ required string name = 1 [db_index = False, max_length = 256, null = False, blank = False];
+ required string onos_ip = 2 [help_text = "ip of the transport manager", db_index = False, max_length = 64, null = False, blank = False];
+ required int32 onos_port = 3 [help_text = "port of the transport manager", db_index = False, null = False, blank = False];
+ required string onos_username = 4 [help_text = "username of the transport manager", db_index = False, max_length = 64, null = False, blank = False];
+ required string onos_password = 5 [help_text = "password of the transport manager", db_index = False, max_length = 64, null = False, blank = False];
+ required string onos_type = 6 [default = "local", choices = "(('local', 'Local'), ('global', 'Global'))", db_index = False, max_length = 64, null = False, blank = False];
+
}
-message NetworkEdgePort (PlCoreBase){
- option verbose_name = "Network Edge Port";
+message UserNetworkInterface (PlCoreBase){
+ option verbose_name = "User Network Interface";
- required manytoone element->NetworkDevice:networkedgeport = 1 [db_index = True, null = False, blank = False];
- required string pid = 2 [db_index = False, max_length = 256, null = False, blank = False];
- required int32 bwpCfgCbs = 3 [db_index = False, null = False, blank = True];
- required int32 bwpCfgEbs = 4 [db_index = False, null = False, blank = True];
- required int32 bwpCfgCir = 5 [db_index = False, null = False, blank = True];
- required int32 bwpCfgEir = 6 [db_index = False, null = False, blank = True];
- required string name = 7 [db_index = False, max_length = 256, null = False, blank = True];
- required string location = 8 [db_index = False, max_length = 256, null = False, blank = True];
- required string latlng = 9 [db_index = False, max_length = 50, null = False, blank = True];
+ required string tenant = 1 [help_text = "tenat name",db_index = False, max_length = 256, null = False, blank = False];
+ required string cpe_id = 2 [db_index = False, max_length = 1024, null = False, blank = False];
+ required string latlng = 3 [help_text = "location, i.e. [37.773972, -122.431297]", db_index = False, max_length = 256, null = False, blank = False];
+ optional string name = 4 [db_index = False, max_length = 256, null = False, blank = False];
}
-message NetworkEdgeToEdgePointConnection (Service){
- option verbose_name = "E-Line Service";
-
- required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
- required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('direct', 'Direct'), ('tunnel', 'Tunnel'), ('optical', 'Optical'), ('virtual', 'Virtual'), ('Point_To_Point', 'Point To Point'))"];
- required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
- required manytoone uni1->NetworkEdgePort:EdgePointToEdgePointSrc = 4 [db_index = True, null = False, blank = False];
- required manytoone uni2->NetworkEdgePort:EdgePointToEdgePointDst = 5 [db_index = True, null = False, blank = False];
- required string operstate = 6 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
- required string adminstate = 7 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
-}
-
-
-message NetworkEdgeToMultipointConnection (Service){
- option verbose_name = "E-Line Service";
-
- required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
- required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('vlan', 'VLAN'), ('ip', 'IP'), ('ethernet', 'Ethernet'), ('Root_Multipoint', 'Root Multipoint'))"];
- required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
- required manytoone root->NetworkEdgePort:EdgeToMultipointRoot = 4 [db_index = True, null = False, blank = False];
- required string operstate = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
- required string adminstate = 6 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
- required manytomany eps->NetworkEdgePort/NetworkMultipointToMultipointConnection_eps:networkedgetomultipointconnection_eps = 7 [db_index = False, null = False, blank = False];
-}
-
-
-message NetworkMultipointToMultipointConnection (Service){
- option verbose_name = "E-LAN Service";
-
- required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
- required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('vlan', 'VLAN'), ('ip', 'IP'), ('ethernet', 'Ethernet'), ('Multipoint_To_Multipoint', 'Multipoint To Multipoint'))"];
- required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
- required string operstate = 4 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
- required string adminstate = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
- required manytomany eps->NetworkEdgePort/NetworkMultipointToMultipointConnection_eps:networkmultipointtomultipointconnection_eps = 6 [db_index = False, null = False, blank = False];
-}
-
message BandwidthProfile (PlCoreBase){
option verbose_name = "Bandwidth Profile";
- required int32 bwpcfgcbs = 1 [db_index = False, null = False, blank = False];
- required int32 bwpcfgebs = 2 [db_index = False, null = False, blank = False];
- required int32 bwpcfgcir = 3 [db_index = False, null = False, blank = False];
- required int32 bwpcfgeir = 4 [db_index = False, null = False, blank = False];
- required string name = 5 [db_index = False, max_length = 256, null = False, blank = False];
+ required string name = 1 [db_index = False, max_length = 256, null = False, blank = False];
+ required int32 cbs = 2 [help_text = "committed burst size", db_index = False, null = False, blank = False];
+ required int32 ebs = 3 [help_text = "expected burst size", db_index = False, null = False, blank = False];
+ required int32 cir = 4 [help_text = "committed information rate", db_index = False, null = False, blank = False];
+ required int32 eir = 5 [help_text = "expected information rate", db_index = False, null = False, blank = False];
+
}
-message RemotePort (PlCoreBase){
- option verbose_name = "Remote Port";
+message ELine (PlCoreBase){
+ option verbose_name = "Ethernet Virtual Private Line";
- required manytoone remoteportsite->Site:RemotePortSite = 1 [db_index = True, null = False, blank = False];
- required manytoone edgeport->NetworkEdgePort:RemotePortEdgePort = 2 [db_index = True, null = False, blank = False];
- required string name = 3 [db_index = False, max_length = 256, null = False, blank = False];
+ required string name = 1 [db_index = False, max_length = 256, null = False, blank = False];
+ required string connect_point_1_id = 2 [db_index = False, max_length = 256, null = False, blank = False];
+ required string connect_point_2_id = 3 [db_index = False, max_length = 64, null = False, blank = False];
+ required string vlanids = 4 [help_text = "comma separated list of vlanIds", db_index = False, null = False, blank = False];
+ required string cord_site_name = 5 [db_index = False, max_length = 64, null = False, blank = False];
+ required string bwp = 6 [help_text = "bandwidth profile name", db_index = False, max_length = 256, null = False, blank = False];
+
}
-
-message ServiceSpoke (PlCoreBase){
- option verbose_name = "Service Spoke";
-
- required manytoone vnodlocalsite->Site:VnodLocalSite = 1 [db_index = True, null = False, blank = False];
- required manytoone vnodlocalport->RemotePort:VnodLocalPort = 2 [db_index = True, null = False, blank = False];
- required string name = 3 [db_index = False, max_length = 256, null = False, blank = False];
- required string remotesubscriber = 4 [db_index = False, max_length = 256, null = False, blank = True];
- required string remotevnodid = 5 [db_index = False, max_length = 256, null = False, blank = True];
- required bool autoattached = 6 [default = False, null = False, db_index = False, blank = True];
- required string operstate = 7 [default = "inactive", choices = "(('active', 'Active'), ('inactive', 'Inactive'))", max_length = 256, blank = False, null = False, db_index = False];
- required string adminstate = 8 [default = "disabled", choices = "(('disabled', 'Disabled'), ('configured', 'Configured'), ('impaired', 'Impaired'), ('enabled', 'Enabled'))", max_length = 64, blank = False, null = False, db_index = False];
-}
-
-message VnodGlobalService (Service){
- option verbose_name = "Virtual Network On Demand Global Service";
-
- required string servicehandle = 1 [db_index = False, max_length = 64, null = False, blank = False];
- required string vlanid = 2 [db_index = False, max_length = 64, null = False, blank = False];
- required string type = 3 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('eline', 'E-Line Service'), ('elan', 'E-LAN Service'), ('etree', 'E-Tree Service'))"];
- optional manytoone metronetworkroottomultipoint->NetworkEdgeToMultipointConnection:EtreeService = 4 [db_index = True, null = True, blank = False];
- optional manytoone metronetworkmultipoint->NetworkMultipointToMultipointConnection:ElanService = 5 [db_index = True, null = True, blank = False];
- optional manytoone metronetworkpointtopoint->NetworkEdgeToEdgePointConnection:ElineService = 6 [db_index = True, null = True, blank = False];
- required string operstate = 7 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
- required string adminstate = 8 [default = "enabled", choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))", max_length = 256, blank = False, null = False, db_index = False];
- required manytoone bandwidthProfile->BandwidthProfile:BandwidthProfile = 9 [db_index = True, null = False, blank = False];
- required manytomany spokes->ServiceSpoke/VnodGlobalService_spokes:ServiceSpokes = 10 [db_index = False, null = False, blank = False];
-}
-
-message UserNetworkInterface (PlCoreBase){
- option verbose_name = "User Network Interface";
-
- required int32 enabled = 1 [db_index = False, null = False, blank = False];
- required int32 capacity = 2 [db_index = False, null = False, blank = False];
- required int32 bw_used = 3 [db_index = False, null = False, blank = False];
- required string vlanIds = 4 [db_index = False, max_length = 256, null = False, blank = False];
- required string location = 5 [db_index = False, max_length = 256, null = False, blank = True];
- required string latlng = 6 [db_index = False, max_length = 50, null = False, blank = True];
- required string name = 7 [db_index = False, max_length = 256, null = False, blank = False];
-}
-
-
-
diff --git a/xos/metronet.yaml b/xos/metronet.yaml
index 6a700fa..9ac1400 100644
--- a/xos/metronet.yaml
+++ b/xos/metronet.yaml
@@ -22,170 +22,7 @@
node_types:
- tosca.nodes.VNodGlobalService:
- description: >
- CORD: The MetroNet Service.
- derived_from: tosca.nodes.Root
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.MetroNetworkSystem:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Metro Network Service.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
- administrativeState:
- type: string
- required: true
- restUrl:
- type: string
- required: false
-
-
- tosca.nodes.MetroNetworkDevice:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Metro Network Device.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- restCtrlUrl:
- type: string
- required: true
- username:
- type: string
- required: true
- password:
- type: string
- required: true
- administrativeState:
- type: string
- required: true
- authType:
- type: string
- required: false
- id:
- type: string
- required: true
-
- tosca.nodes.EcordBandwidthProfile:
+ tosca.nodes.BandwidthProfile:
derived_from: tosca.nodes.Root
description: >
CORD: The ecord bandwith profile.
@@ -207,23 +44,23 @@
type: string
required: false
descrption: Replaces/renames this object
- bwpcfgcbs:
+ cbs:
type: integer
required: false
- bwpcfgebs:
+ ebs:
type: integer
required: false
- bwpcfgcir:
+ cir:
type: integer
required: false
- bwpcfgeir:
+ eir:
type: integer
required: false
name:
type: string
required: true
- tosca.nodes.EcordUserNetworkInterface:
+ tosca.nodes.UserNetworkInterface:
derived_from: tosca.nodes.Root
description: >
CORD: The ecord user netowrk interface
@@ -245,28 +82,138 @@
type: string
required: false
descrption: Replaces/renames this object
- enabled:
- type: boolean
- required: false
- capacity:
- type: integer
- required: false
- bw_used:
- type: integer
- required: false
- vlanIds:
+ cpe_id:
type: string
required: false
+ tenant:
+ type: string
+ required: true
name:
type: string
required: true
- location:
- type: string
- required: false
latlng:
type: string
required: false
- tosca.relationships.UsesBandwidthProfile:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.EcordBandwidthProfile ]
\ No newline at end of file
+ tosca.nodes.OnosModel:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord ONOS model
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ onos_ip:
+ type: string
+ required: false
+ onos_port:
+ type: integer
+ required: false
+ onos_username:
+ type: string
+ required: false
+ onos_password:
+ type: string
+ required: false
+ onos_type:
+ type: string
+ required: false
+
+ tosca.nodes.EnterpriseLocation:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord enterprise location
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ cord_site_ip:
+ type: string
+ required: false
+ cord_site_port:
+ type: integer
+ required: false
+ cord_site_username:
+ type: string
+ required: false
+ cord_site_password:
+ type: string
+ required: false
+ cord_site_type:
+ type: string
+ required: false
+
+ tosca.nodes.ELine:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord Ethernet Virtual Private Line
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ name:
+ type: string
+ required: false
+ connect_point_1_id:
+ type: string
+ required: false
+ connect_point_2_id:
+ type: string
+ required: false
+ vlanids:
+ type: string
+ required: false
+ cord_site_name:
+ type: string
+ required: false
+ bwp:
+ type: string
+ required: false
\ No newline at end of file
diff --git a/xos/metronet.yaml.old b/xos/metronet.yaml.old
new file mode 100644
index 0000000..b6d2de3
--- /dev/null
+++ b/xos/metronet.yaml.old
@@ -0,0 +1,272 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 metronet.m4.old > metronet.yaml"
+
+# include macros
+# Note: Tosca derived_from isn't working the way I think it should, it's not
+# inheriting from the parent template. Until we get that figured out, use
+# m4 macros do our inheritance
+
+
+# Service
+
+
+# Subscriber
+
+
+
+
+# end m4 macros
+
+
+
+node_types:
+
+ tosca.nodes.VNodGlobalService:
+ description: >
+ CORD: The MetroNet Service.
+ derived_from: tosca.nodes.Root
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ service:
+ type: tosca.capabilities.xos.Service
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ kind:
+ type: string
+ default: generic
+ description: Type of service.
+ view_url:
+ type: string
+ required: false
+ description: URL to follow when icon is clicked in the Service Directory.
+ icon_url:
+ type: string
+ required: false
+ description: ICON to display in the Service Directory.
+ enabled:
+ type: boolean
+ default: true
+ published:
+ type: boolean
+ default: true
+ description: If True then display this Service in the Service Directory.
+ public_key:
+ type: string
+ required: false
+ description: Public key to install into Instances to allows Services to SSH into them.
+ private_key_fn:
+ type: string
+ required: false
+ description: Location of private key file
+ versionNumber:
+ type: string
+ required: false
+ description: Version number of Service.
+
+ tosca.nodes.MetroNetworkSystem:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The Metro Network Service.
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ service:
+ type: tosca.capabilities.xos.Service
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ kind:
+ type: string
+ default: generic
+ description: Type of service.
+ view_url:
+ type: string
+ required: false
+ description: URL to follow when icon is clicked in the Service Directory.
+ icon_url:
+ type: string
+ required: false
+ description: ICON to display in the Service Directory.
+ enabled:
+ type: boolean
+ default: true
+ published:
+ type: boolean
+ default: true
+ description: If True then display this Service in the Service Directory.
+ public_key:
+ type: string
+ required: false
+ description: Public key to install into Instances to allows Services to SSH into them.
+ private_key_fn:
+ type: string
+ required: false
+ description: Location of private key file
+ versionNumber:
+ type: string
+ required: false
+ description: Version number of Service.
+ administrativeState:
+ type: string
+ required: true
+ restUrl:
+ type: string
+ required: false
+
+
+ tosca.nodes.MetroNetworkDevice:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The Metro Network Device.
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ restCtrlUrl:
+ type: string
+ required: true
+ username:
+ type: string
+ required: true
+ password:
+ type: string
+ required: true
+ administrativeState:
+ type: string
+ required: true
+ authType:
+ type: string
+ required: false
+ id:
+ type: string
+ required: true
+
+ tosca.nodes.EcordBandwidthProfile:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord bandwith profile.
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ bwpcfgcbs:
+ type: integer
+ required: false
+ bwpcfgebs:
+ type: integer
+ required: false
+ bwpcfgcir:
+ type: integer
+ required: false
+ bwpcfgeir:
+ type: integer
+ required: false
+ name:
+ type: string
+ required: true
+
+ tosca.nodes.EcordUserNetworkInterface:
+ derived_from: tosca.nodes.Root
+ description: >
+ CORD: The ecord user netowrk interface
+ capabilities:
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ enabled:
+ type: boolean
+ required: false
+ capacity:
+ type: integer
+ required: false
+ bw_used:
+ type: integer
+ required: false
+ vlanIds:
+ type: string
+ required: false
+ name:
+ type: string
+ required: true
+ location:
+ type: string
+ required: false
+ latlng:
+ type: string
+ required: false
+
+ tosca.relationships.UsesBandwidthProfile:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.EcordBandwidthProfile ]
\ No newline at end of file
diff --git a/xos/metronet_old.xproto_old b/xos/metronet_old.xproto_old
new file mode 100644
index 0000000..4094bf4
--- /dev/null
+++ b/xos/metronet_old.xproto_old
@@ -0,0 +1,136 @@
+option name = "metronetwork";
+
+message MetroNetworkSystem (PlCoreBase){
+ option verbose_name = "Metro Network System";
+
+ required string name = 1 [db_index = False, max_length = 256, null = False, blank = False];
+ required string description = 2 [db_index = False, max_length = 1024, null = False, blank = False];
+ required string restUrl = 3 [db_index = False, max_length = 256, null = False, blank = False];
+ required string administrativeState = 4 [default = "disabled", choices = "(('enabled', 'Enabled'), ('disabled', 'Disabled'))", max_length = 16, blank = False, null = False, db_index = False];
+ required string operationalState = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+}
+
+message NetworkDevice (PlCoreBase){
+ option verbose_name = "Network Device";
+
+ optional string name = 1 [help_text = "Device friendly name", max_length = 20, null = True, db_index = False, blank = True];
+ required string restCtrlUrl = 2 [db_index = False, max_length = 256, null = False, blank = False];
+ required string authType = 3 [blank = False, max_length = 16, null = False, db_index = False, choices = "(('basic', 'Basic'), ('key', 'Key'), ('oauth', 'OAuth'))"];
+ required string username = 4 [db_index = False, max_length = 32, null = False, blank = True];
+ required string password = 5 [db_index = False, max_length = 32, null = False, blank = True];
+ required string administrativeState = 6 [default = "disabled", choices = "(('enabled', 'Enabled'), ('disabled', 'Disabled'), ('syncrequested', 'SyncRequested'), ('syncinprogress', 'SyncInProgress'))", max_length = 16, blank = False, null = False, db_index = False];
+}
+
+message NetworkEdgePort (PlCoreBase){
+ option verbose_name = "Network Edge Port";
+
+ required manytoone element->NetworkDevice:networkedgeport = 1 [db_index = True, null = False, blank = False];
+ required string pid = 2 [db_index = False, max_length = 256, null = False, blank = False];
+ required int32 bwpCfgCbs = 3 [db_index = False, null = False, blank = True];
+ required int32 bwpCfgEbs = 4 [db_index = False, null = False, blank = True];
+ required int32 bwpCfgCir = 5 [db_index = False, null = False, blank = True];
+ required int32 bwpCfgEir = 6 [db_index = False, null = False, blank = True];
+ required string name = 7 [db_index = False, max_length = 256, null = False, blank = True];
+ required string location = 8 [db_index = False, max_length = 256, null = False, blank = True];
+ required string latlng = 9 [db_index = False, max_length = 50, null = False, blank = True];
+}
+
+
+message NetworkEdgeToEdgePointConnection (Service){
+ option verbose_name = "E-Line Service";
+
+ required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
+ required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('direct', 'Direct'), ('tunnel', 'Tunnel'), ('optical', 'Optical'), ('virtual', 'Virtual'), ('Point_To_Point', 'Point To Point'))"];
+ required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
+ required manytoone uni1->NetworkEdgePort:EdgePointToEdgePointSrc = 4 [db_index = True, null = False, blank = False];
+ required manytoone uni2->NetworkEdgePort:EdgePointToEdgePointDst = 5 [db_index = True, null = False, blank = False];
+ required string operstate = 6 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+ required string adminstate = 7 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
+}
+
+
+message NetworkEdgeToMultipointConnection (Service){
+ option verbose_name = "E-Line Service";
+
+ required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
+ required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('vlan', 'VLAN'), ('ip', 'IP'), ('ethernet', 'Ethernet'), ('Root_Multipoint', 'Root Multipoint'))"];
+ required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
+ required manytoone root->NetworkEdgePort:EdgeToMultipointRoot = 4 [db_index = True, null = False, blank = False];
+ required string operstate = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+ required string adminstate = 6 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
+ required manytomany eps->NetworkEdgePort/NetworkMultipointToMultipointConnection_eps:networkedgetomultipointconnection_eps = 7 [db_index = False, null = False, blank = False];
+}
+
+
+message NetworkMultipointToMultipointConnection (Service){
+ option verbose_name = "E-LAN Service";
+
+ required string sid = 1 [db_index = False, max_length = 256, null = False, blank = True];
+ required string type = 2 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('vlan', 'VLAN'), ('ip', 'IP'), ('ethernet', 'Ethernet'), ('Multipoint_To_Multipoint', 'Multipoint To Multipoint'))"];
+ required string vlanid = 3 [db_index = False, max_length = 64, null = False, blank = False];
+ required string operstate = 4 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+ required string adminstate = 5 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))"];
+ required manytomany eps->NetworkEdgePort/NetworkMultipointToMultipointConnection_eps:networkmultipointtomultipointconnection_eps = 6 [db_index = False, null = False, blank = False];
+}
+
+message BandwidthProfile (PlCoreBase){
+ option verbose_name = "Bandwidth Profile";
+
+ required int32 bwpcfgcbs = 1 [db_index = False, null = False, blank = False];
+ required int32 bwpcfgebs = 2 [db_index = False, null = False, blank = False];
+ required int32 bwpcfgcir = 3 [db_index = False, null = False, blank = False];
+ required int32 bwpcfgeir = 4 [db_index = False, null = False, blank = False];
+ required string name = 5 [db_index = False, max_length = 256, null = False, blank = False];
+}
+
+message RemotePort (PlCoreBase){
+ option verbose_name = "Remote Port";
+
+ required manytoone remoteportsite->Site:RemotePortSite = 1 [db_index = True, null = False, blank = False];
+ required manytoone edgeport->NetworkEdgePort:RemotePortEdgePort = 2 [db_index = True, null = False, blank = False];
+ required string name = 3 [db_index = False, max_length = 256, null = False, blank = False];
+}
+
+
+message ServiceSpoke (PlCoreBase){
+ option verbose_name = "Service Spoke";
+
+ required manytoone vnodlocalsite->Site:VnodLocalSite = 1 [db_index = True, null = False, blank = False];
+ required manytoone vnodlocalport->RemotePort:VnodLocalPort = 2 [db_index = True, null = False, blank = False];
+ required string name = 3 [db_index = False, max_length = 256, null = False, blank = False];
+ required string remotesubscriber = 4 [db_index = False, max_length = 256, null = False, blank = True];
+ required string remotevnodid = 5 [db_index = False, max_length = 256, null = False, blank = True];
+ required bool autoattached = 6 [default = False, null = False, db_index = False, blank = True];
+ required string operstate = 7 [default = "inactive", choices = "(('active', 'Active'), ('inactive', 'Inactive'))", max_length = 256, blank = False, null = False, db_index = False];
+ required string adminstate = 8 [default = "disabled", choices = "(('disabled', 'Disabled'), ('configured', 'Configured'), ('impaired', 'Impaired'), ('enabled', 'Enabled'))", max_length = 64, blank = False, null = False, db_index = False];
+}
+
+message VnodGlobalService (Service){
+ option verbose_name = "Virtual Network On Demand Global Service";
+
+ required string servicehandle = 1 [db_index = False, max_length = 64, null = False, blank = False];
+ required string vlanid = 2 [db_index = False, max_length = 64, null = False, blank = False];
+ required string type = 3 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('eline', 'E-Line Service'), ('elan', 'E-LAN Service'), ('etree', 'E-Tree Service'))"];
+ optional manytoone metronetworkroottomultipoint->NetworkEdgeToMultipointConnection:EtreeService = 4 [db_index = True, null = True, blank = False];
+ optional manytoone metronetworkmultipoint->NetworkMultipointToMultipointConnection:ElanService = 5 [db_index = True, null = True, blank = False];
+ optional manytoone metronetworkpointtopoint->NetworkEdgeToEdgePointConnection:ElineService = 6 [db_index = True, null = True, blank = False];
+ required string operstate = 7 [blank = False, max_length = 256, null = False, db_index = False, choices = "(('active', 'Active'), ('inactive', 'Inactive'))"];
+ required string adminstate = 8 [default = "enabled", choices = "(('disabled', 'Disabled'), ('activationrequested', 'ActivationRequested'), ('enabled', 'Enabled'), ('invalid', 'Invalid'), ('deactivationrequested', 'DeactivationRequested'))", max_length = 256, blank = False, null = False, db_index = False];
+ required manytoone bandwidthProfile->BandwidthProfile:BandwidthProfile = 9 [db_index = True, null = False, blank = False];
+ required manytomany spokes->ServiceSpoke/VnodGlobalService_spokes:ServiceSpokes = 10 [db_index = False, null = False, blank = False];
+}
+
+message UserNetworkInterface (PlCoreBase){
+ option verbose_name = "User Network Interface";
+
+ required int32 enabled = 1 [db_index = False, null = False, blank = False];
+ required int32 capacity = 2 [db_index = False, null = False, blank = False];
+ required int32 bw_used = 3 [db_index = False, null = False, blank = False];
+ required string vlanIds = 4 [db_index = False, max_length = 256, null = False, blank = False];
+ required string location = 5 [db_index = False, max_length = 256, null = False, blank = True];
+ required string latlng = 6 [db_index = False, max_length = 50, null = False, blank = True];
+ required string name = 7 [db_index = False, max_length = 256, null = False, blank = False];
+}
+
+
+
diff --git a/xos/models.py b/xos/models.py
new file mode 100644
index 0000000..3c179f0
--- /dev/null
+++ b/xos/models.py
@@ -0,0 +1,177 @@
+from header import *
+
+
+
+#from core.models.tenant import Tenant
+from core.models import Tenant
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class EnterpriseLocation(Tenant):
+
+ KIND = "metronetwork"
+
+ class Meta:
+ app_label = "metronet"
+ name = "metronet"
+ verbose_name = "Enterprise Localation"
+
+ # Primitive Fields (Not Relations)
+ name = CharField( blank = False, max_length = 256, null = False, db_index = False )
+ cord_site_ip = CharField( help_text = "ip of the local site", max_length = 64, null = False, db_index = False, blank = False )
+ cord_site_ip = CharField( help_text = "ip of the local site", max_length = 64, null = False, db_index = False, blank = False )
+ cord_site_port = IntegerField( help_text = "port of the local site", max_length = 256, null = False, db_index = False, blank = False )
+ cord_site_username = CharField( help_text = "username of the local site", max_length = 64, null = False, db_index = False, blank = False )
+ cord_site_password = CharField( help_text = "password of the local site", max_length = 64, null = False, db_index = False, blank = False )
+ cord_site_type = CharField( default = "xos", choices = "(('onos', 'ONOS'), ('xos', 'XOS')", max_length = 64, blank = False, null = False, db_index = False )
+
+
+ # Relations
+
+
+
+ pass
+
+
+
+
+class OnosModel(PlCoreBase):
+
+ KIND = "metronetwork"
+
+ class Meta:
+ app_label = "metronet"
+ name = "metronet"
+ verbose_name = "Open Netowrk Operating System"
+
+ # Primitive Fields (Not Relations)
+ name = CharField( blank = False, max_length = 256, null = False, db_index = False )
+ onos_ip = CharField( help_text = "ip of the transport manager", max_length = 64, null = False, db_index = False, blank = False )
+ onos_port = IntegerField( help_text = "port of the transport manager", max_length = 256, null = False, db_index = False, blank = False )
+ onos_username = CharField( help_text = "username of the transport manager", max_length = 64, null = False, db_index = False, blank = False )
+ onos_password = CharField( help_text = "password of the transport manager", max_length = 64, null = False, db_index = False, blank = False )
+ onos_type = CharField( default = "local", choices = "(('local', 'Local'), ('global', 'Global')", max_length = 64, blank = False, null = False, db_index = False )
+
+
+ # Relations
+
+
+
+ pass
+
+
+
+
+class UserNetworkInterface(PlCoreBase):
+
+ KIND = "metronetwork"
+
+ class Meta:
+ app_label = "metronet"
+ name = "metronet"
+ verbose_name = "User Network Interface"
+
+ # Primitive Fields (Not Relations)
+ tenant = CharField( help_text = "tenat name", max_length = 256, null = False, db_index = False, blank = False )
+ cpe_id = CharField( blank = False, max_length = 1024, null = False, db_index = False )
+ latlng = CharField( help_text = "location, i.e. [37.773972, -122.431297]", max_length = 256, null = False, db_index = False, blank = False )
+ name = CharField( blank = False, max_length = 256, null = False, db_index = False )
+
+
+ # Relations
+
+
+ def __unicode__(self): return u'%s' % (self.name)
+
+ def save(self, *args, **kwargs):
+
+ if self.latlng:
+ try:
+ latlng_value = getattr(self, 'latlng').strip()
+ if (latlng_value.startswith('[') and latlng_value.endswith(']') and latlng_value.index(',') > 0):
+ lat = latlng_value[1: latlng_value.index(',')].strip()
+ lng = latlng_value[latlng_value.index(',') + 1: len(latlng_value) - 1].strip()
+
+ # If lat and lng are not floats, the code below should result in an error.
+ lat_validation = float(lat)
+ lng_validation = float(lng)
+ else:
+ raise ValueError("The lat/lng value is not formatted correctly.")
+ except:
+ raise ValueError("The lat/lng value is not formatted correctly.")
+
+ super(UserNetworkInterface, self).save(*args, **kwargs)
+ pass
+
+
+
+
+class BandwidthProfile(PlCoreBase):
+
+ KIND = "metronetwork"
+
+ class Meta:
+ app_label = "metronet"
+ name = "metronet"
+ verbose_name = "Bandwidth Profile"
+
+ # Primitive Fields (Not Relations)
+ name = CharField( blank = False, max_length = 256, null = False, db_index = False )
+ cbs = IntegerField( help_text = "committed burst size", null = False, blank = False, db_index = False )
+ ebs = IntegerField( help_text = "expected burst size", null = False, blank = False, db_index = False )
+ cir = IntegerField( help_text = "committed information rate", null = False, blank = False, db_index = False )
+ eir = IntegerField( help_text = "expected information rate", null = False, blank = False, db_index = False )
+
+
+ # Relations
+
+
+ def __unicode__(self): return u'%s' % (self.name)
+ pass
+
+
+
+
+class ELine(PlCoreBase):
+
+ KIND = "metronetwork"
+
+ class Meta:
+ app_label = "metronet"
+ name = "metronet"
+ verbose_name = "Ethernet Virtual Private Line"
+
+ # Primitive Fields (Not Relations)
+ name = CharField( blank = False, max_length = 256, null = False, db_index = False )
+ connect_point_1_id = CharField( blank = False, max_length = 256, null = False, db_index = False )
+ connect_point_2_id = CharField( blank = False, max_length = 64, null = False, db_index = False )
+ vlanids = TextField( help_text = "comma separated list of vlanIds", null = False, blank = False, db_index = False )
+ cord_site_username = CharField( blank = False, max_length = 64, null = False, db_index = False )
+ bwp = CharField( help_text = "bandwidth profile name", max_length = 256, null = False, db_index = False, blank = False )
+
+
+ # Relations
+
+
+ def __unicode__(self): return u'%s' % (self.name)
+ pass
+
+
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
index 9440751..3ff2ebc 100644
--- a/xos/synchronizer/Dockerfile.synchronizer
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -6,4 +6,4 @@
WORKDIR "/opt/xos/synchronizers/metro-net"
-CMD bash -c "cd /opt/xos/synchronizers/metro-net; ./run-from-api.sh
\ No newline at end of file
+CMD bash -c "cd /opt/xos/synchronizers/metro-net; ./run-from-api.sh"
\ No newline at end of file
diff --git a/xos/synchronizer/invokers/invoker.py b/xos/synchronizer/invokers/invoker.py
deleted file mode 100644
index e645285..0000000
--- a/xos/synchronizer/invokers/invoker.py
+++ /dev/null
@@ -1,25 +0,0 @@
-class Invoker(object):
-
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- return None
-
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def postsave(self, obj):
- return None
\ No newline at end of file
diff --git a/xos/synchronizer/invokers/invokerfactory.py b/xos/synchronizer/invokers/invokerfactory.py
deleted file mode 100644
index b3628fe..0000000
--- a/xos/synchronizer/invokers/invokerfactory.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from services.metronetwork.models import *
-from synchronizers.metronetwork.invokers.networkmultipointtomultipointinvoker import NetworkMultipointToMultipointInvoker
-from synchronizers.metronetwork.invokers.networkedgetoedgepointinvoker import NetworkEdgeToEdgePointInvoker
-from synchronizers.metronetwork.invokers.networkedgetomultipointinvoker import NetworkEdgeToMultipointInvoker
-from synchronizers.metronetwork.invokers.servicespokeinvoker import ServiceSpokeInvoker
-from synchronizers.metronetwork.invokers.vnodglobalserviceinvoker import VnodGlobalServiceInvoker
-from synchronizers.metronetwork.invokers.remoteportinvoker import RemotePortInvoker
-
-
-class InvokerFactory(object):
- @staticmethod
- def getinvoker(obj):
- #
- # Here is where we build various invokers
- #
- if isinstance(obj, NetworkMultipointToMultipointConnection):
- return NetworkMultipointToMultipointInvoker()
- elif isinstance(obj, NetworkEdgeToEdgePointConnection):
- return NetworkEdgeToEdgePointInvoker()
- elif isinstance(obj, NetworkEdgeToMultipointConnection):
- return NetworkEdgeToMultipointInvoker()
- elif isinstance(obj, ServiceSpoke):
- return ServiceSpokeInvoker()
- elif isinstance(obj, VnodGlobalService):
- return VnodGlobalServiceInvoker()
- elif isinstance(obj, RemotePort):
- return RemotePortInvoker()
- else:
- return None
diff --git a/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py b/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py
deleted file mode 100644
index 2c30d79..0000000
--- a/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from services.metronetwork.models import NetworkEdgePort
-
-
-class NetworkEdgeToEdgePointInvoker(Invoker):
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- # Now that the Ports are created - get a proper reference to them and update the
- # src and dst fields
- if hasattr(obj, 'uni1_createbuffer'):
- uni1port = NetworkEdgePort.objects.get(pid=obj.uni1_createbuffer)
- uni2port = NetworkEdgePort.objects.get(pid=obj.uni2_createbuffer)
- obj.uni1 = uni1port
- obj.uni2 = uni2port
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- pass
diff --git a/xos/synchronizer/invokers/networkedgetomultipointinvoker.py b/xos/synchronizer/invokers/networkedgetomultipointinvoker.py
deleted file mode 100644
index 9b8e88b..0000000
--- a/xos/synchronizer/invokers/networkedgetomultipointinvoker.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from services.metronetwork.models import NetworkEdgeToMultipointConnection, NetworkEdgePort
-
-class NetworkEdgeToMultipointInvoker(Invoker):
-
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- # Now that the Ports are created - get a proper reference to them and update the
- # root field
- if hasattr(obj, 'root_createbuffer'):
- rootEdgePort = NetworkEdgePort.objects.get(pid=obj.root_createbuffer)
- obj.root = rootEdgePort
-
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- #
- # Ok - we need to handle the multipoint many-to-many relationships in here
- #
- # By design convnetion we will look for them in the 'backend_register' object field
- # this is a json field that is general purpose - we will expect to find a JSON array
- # called 'eps' that just containts a reference to a bunch of NetworkEdgePorts
- #
- #
- if hasattr(obj, 'eps_createbuffer'):
- scratchpad = json.loads(obj.eps_createbuffer)
- eps = scratchpad['eps']
-
- for ep in eps:
- port = NetworkEdgePort.objects.get(pid=ep)
- obj.eps.add(port)
diff --git a/xos/synchronizer/invokers/networkmultipointtomultipointinvoker.py b/xos/synchronizer/invokers/networkmultipointtomultipointinvoker.py
deleted file mode 100644
index 6b2ab42..0000000
--- a/xos/synchronizer/invokers/networkmultipointtomultipointinvoker.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from services.metronetwork.models import NetworkMultipointToMultipointConnection, NetworkEdgePort
-
-class NetworkMultipointToMultipointInvoker(Invoker):
-
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- pass
-
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- #
- # Ok - we need to handle the multipoint many-to-many relationships in here
- #
- # By design convnetion we will look for them in the 'backend_register' object field
- # this is a json field that is general purpose - we will expect to find a JSON array
- # called 'eps' that just containts a reference to a bunch of NetworkEdgePorts
- #
- #
- if hasattr(obj, 'eps_createbuffer'):
- scratchpad = json.loads(obj.eps_createbuffer)
- eps = scratchpad['eps']
-
- for ep in eps:
- port = NetworkEdgePort.objects.get(pid=ep)
- obj.eps.add(port)
diff --git a/xos/synchronizer/invokers/remoteportinvoker.py b/xos/synchronizer/invokers/remoteportinvoker.py
deleted file mode 100644
index 1061dc4..0000000
--- a/xos/synchronizer/invokers/remoteportinvoker.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from core.models import Site
-from services.metronetwork.models import NetworkEdgePort
-
-class RemotePortInvoker(Invoker):
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- # Now that the Site and EdgePorts are created set the foreign keys
- if hasattr(obj, 'sitename'):
- site = Site.objects.get(login_base=obj.sitename)
- obj.remoteportsite = site
-
- if hasattr(obj, 'edgeportname'):
- edgeport = NetworkEdgePort.objects.get(pid=obj.edgeportname)
- obj.edgeport = edgeport
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- pass
\ No newline at end of file
diff --git a/xos/synchronizer/invokers/servicespokeinvoker.py b/xos/synchronizer/invokers/servicespokeinvoker.py
deleted file mode 100644
index 8470cf5..0000000
--- a/xos/synchronizer/invokers/servicespokeinvoker.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from core.models import Site
-from services.metronetwork.models import RemotePort
-
-
-class ServiceSpokeInvoker(Invoker):
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
- # Now that the Ports are created - get a proper reference to them and update the
- # src and dst fields
- if hasattr(obj, 'sitename'):
- site = Site.objects.get(login_base=obj.sitename)
- obj.vnodlocalsite = site
-
- if hasattr(obj, 'remoteportname'):
- remoteport = RemotePort.objects.get(name=obj.remoteportname)
- obj.vnodlocalport = remoteport
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- pass
\ No newline at end of file
diff --git a/xos/synchronizer/invokers/vnodglobalserviceinvoker.py b/xos/synchronizer/invokers/vnodglobalserviceinvoker.py
deleted file mode 100644
index a313171..0000000
--- a/xos/synchronizer/invokers/vnodglobalserviceinvoker.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import json
-from synchronizers.metronetwork.invokers.invoker import Invoker
-from services.metronetwork.models import ServiceSpoke
-from services.metronetwork.models import BandwidthProfile
-from services.metronetwork.models import NetworkEdgeToEdgePointConnection
-
-class VnodGlobalServiceInvoker(Invoker):
-
- def __init__(self, **args):
- pass
-
- # Method for handline pre save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - None - this is a pure invoke() call, return type is None
- #
- def presave(self, obj):
-
- if hasattr(obj, 'bwpname'):
- bwprofile = BandwidthProfile.objects.get(name=obj.bwpname)
- obj.bandwidthProfile = bwprofile
-
- if hasattr(obj, 'pointtopointsid'):
- connection = NetworkEdgeToEdgePointConnection.objects.get(sid=obj.pointtopointsid)
- obj.metronetworkpointtopoint = connection
-
- # Method for handline post save semantics
- # content here would be model specific but could include handling Many-to-Many relationship
- # creation - which must occur post save
- #
- # obj - Whatever obj was just saved
- # returns - N/A - this is a pure invoke() call
- #
- def postsave(self, obj):
- #
- # Ok - we need to handle the multipoint many-to-many relationships in here
- #
- # By design convnetion we will look for them in the 'backend_register' object field
- # this is a json field that is general purpose - we will expect to find a JSON array
- # called 'eps' that just containts a reference to a bunch of NetworkEdgePorts
- #
- if hasattr(obj, 'spokes_createbuffer'):
- scratchpad = json.loads(obj.spokes_createbuffer)
- spokes = scratchpad['spokes']
-
- for spokeid in spokes:
- spoke = ServiceSpoke.objects.get(name=spokeid)
- obj.spokes.add(spoke)
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
index 03f1088..4a4ccfe 100644
--- a/xos/synchronizer/manifest
+++ b/xos/synchronizer/manifest
@@ -1,23 +1,7 @@
metronetwork-synchronizer.py
__init__.py
model-deps
-providers/metronetworktestprovider.py
-providers/metronetworkrestprovider.py
-providers/providerfactory.py
-providers/__init__.py
-providers/metronetworkprovider.py
-run_devel.sh
-metronetwork-synchronizer-devel.py
manifest
-steps/sync_metronetworkservice.py
-invokers/servicespokeinvoker.py
-invokers/networkedgetoedgepointinvoker.py
-invokers/vnodglobalserviceinvoker.py
-invokers/networkmultipointtomultipointinvoker.py
-invokers/__init__.py
-invokers/invoker.py
-invokers/networkedgetomultipointinvoker.py
-invokers/invokerfactory.py
-invokers/remoteportinvoker.py
-run.sh
+steps/sync_metroneteline.py
+run-from-api.sh
metronetwork_synchronizer_config
diff --git a/xos/synchronizer/metronetwork-synchronizer-devel.py b/xos/synchronizer/metronetwork-synchronizer-devel.py
deleted file mode 100755
index df697ec..0000000
--- a/xos/synchronizer/metronetwork-synchronizer-devel.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-
-# This imports and runs ../../xos-observer.py
-
-import importlib
-import os
-import sys
-
-#observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../synchronizers/base")
-sys.path.append("/opt/xos/synchronizers/base")
-print sys.path
-mod = importlib.import_module("xos-synchronizer")
-mod.main()
diff --git a/xos/synchronizer/providers/__init__.py b/xos/synchronizer/providers/__init__.py
deleted file mode 100644
index 8b13789..0000000
--- a/xos/synchronizer/providers/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/xos/synchronizer/providers/metronetworkprovider.py b/xos/synchronizer/providers/metronetworkprovider.py
deleted file mode 100644
index c316815..0000000
--- a/xos/synchronizer/providers/metronetworkprovider.py
+++ /dev/null
@@ -1,90 +0,0 @@
-from xos.logger import Logger, logging
-from services.metronetwork.models import *
-
-logger = Logger(level=logging.INFO)
-
-
-class MetroNetworkProvider(object):
- networkdevice = None
-
- def __init__(self, networkdevice, **args):
- self.networkdevice = networkdevice
- pass
-
- # Methods to support for Synchronization - effectively list all interfaces
- #
- # Method for retrieving all network ports from the backend system
- # Intended for use when doing a re-sync
- def get_network_ports(self):
- # Default method needs to be overriden
- logger.debug("get_network_ports default called - should be overriden")
-
- # Method for getting a list of network ports to delete
- # The default imnplementation just gets a list from the local DB
- # Intended for use when doing a re-sync
- def get_network_ports_for_deletion(self):
- # Default method needs to be overriden
- logger.debug("get_network_ports for deletion called - default is all ports in the db related to this id")
- objs = []
- return objs
-
- # Method for retrieving all network links from the backend system
- # Includes Connectivity Objects
- # Intended for use when doing a re-sync
- def get_network_links(self):
- # Default method needs to be overriden
- logger.debug("get_network_links default called - should be overriden")
- objs = []
- return objs
-
- # Method for getting a list of network links to delete
- # Includes Connectivity Objects
- # Intended for use when doing a re-sync
- def get_network_links_for_deletion(self):
- # Default method needs to be overriden
- logger.debug("get_network_links for deletion called - should be overidden")
- objs = []
- return objs
-
- # Methods to support Event Management - movement of changes from the Domain to XOS
- #
- # Method for Create and Update - Create and Update are together given the base design
- def get_updated_or_created_objects(self):
- # Default method needs to be overriden
- logger.debug("get_updated_or_created_objects default called - should be overriden")
- objs = []
- return objs
-
- # Method for Delete - Create and Update are together given the base design
- def get_deleted_objects(self):
- # Default method needs to be overriden
- logger.debug("get_deleted_objects default called - should be overriden")
- objs = []
- return objs
-
- # Methods to support Movement of changes from XOS into the Domain
- #
- # Method for creating point to point connectivity object
- #
- # obj - Connection object - with all configuration variables set
- # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper
- # states are assigned - if False the backend_status field
- # should be assigned with the appropriate error code - in the case of True the
- # backend_status will be assigned by the system and should be unassigned
-
- def create_point_to_point_connectivity(self, obj):
- # Default method needs to be overriden
- logger.debug("create_point_to_point_connectivity called - should be overriden")
- return False
-
- # Method for deleting point to point connectivity object
- #
- # obj - Connection object
- # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper
- # states are assigned - if False the backend_status field
- # should be assigned with the appropriate error code - in the case of True the
- # backend_status will be assigned by the system and should be unassigned
- def delete_point_to_point_connectivity(self, obj):
- # Default method needs to be overriden
- logger.debug("delete_point_to_point_connectivity called - should be overriden")
- return False
diff --git a/xos/synchronizer/providers/metronetworkrestprovider.py b/xos/synchronizer/providers/metronetworkrestprovider.py
deleted file mode 100644
index 2cb03ab..0000000
--- a/xos/synchronizer/providers/metronetworkrestprovider.py
+++ /dev/null
@@ -1,472 +0,0 @@
-from xos.logger import Logger, logging
-from services.metronetwork.models import *
-from synchronizers.metronetwork.providers.metronetworkprovider import MetroNetworkProvider
-
-import requests, json
-from requests.auth import HTTPBasicAuth
-
-logger = Logger(level=logging.INFO)
-
-
-class MetroNetworkRestProvider(MetroNetworkProvider):
- def __init__(self, networkdevice, **args):
- MetroNetworkProvider.__init__(self, networkdevice, **args)
-
- def get_network_ports(self):
-
- objs = []
-
- restCtrlUrl = self.networkdevice.restCtrlUrl
- username = self.networkdevice.username
- password = self.networkdevice.password
-
- resp = requests.get("{}/mef-sca-api/SCA_ETH_FPP_UNI_N".format(restCtrlUrl),
- auth=HTTPBasicAuth(username, password))
-
- if resp.status_code == 200:
- for uni in resp.json():
- hostname = uni['transportPort']['Hostname']
- port = uni['transportPort']['Port']
-
- # Default values
- bwpCfgCbs = 0
- bwpCfgEbs = 0
- bwpCfgCir = 0
- bwpCfgEir = 0
-
- if 'interfaceCfgIngressBwp' in uni:
- bwpCfgCbs = uni['interfaceCfgIngressBwp']['bwpCfgCbs']
- bwpCfgEbs = uni['interfaceCfgIngressBwp']['bwpCfgEbs']
- bwpCfgCir = uni['interfaceCfgIngressBwp']['bwpCfgCir']
- bwpCfgEir = uni['interfaceCfgIngressBwp']['bwpCfgEir']
-
- uniPort = NetworkEdgePort()
- uniPort.element = self.networkdevice
- uniPort.pid = "{}.{}/{}".format(self.networkdevice.id, hostname, port)
- uniPort.bwpCfgCbs = bwpCfgCbs
- uniPort.bwpCfgEbs = bwpCfgEbs
- uniPort.bwpCfgCir = bwpCfgCir
- uniPort.bwpCfgEir = bwpCfgEir
-
- objs.append(uniPort)
-
- return objs
-
- else:
- raise Exception("OnosApiError: get_network_ports()")
-
- def get_network_ports(self):
-
- objs = []
-
- restCtrlUrl = self.networkdevice.restCtrlUrl
- username = self.networkdevice.username
- password = self.networkdevice.password
-
- resp = requests.get("{}/mef-sca-api/SCA_ETH_FPP_UNI_N".format(restCtrlUrl),
- auth=HTTPBasicAuth(username, password))
-
- if resp.status_code == 200:
- for uni in resp.json():
- hostname = uni['transportPort']['Hostname']
- port = uni['transportPort']['Port']
-
- # Default values
- bwpCfgCbs = 0
- bwpCfgEbs = 0
- bwpCfgCir = 0
- bwpCfgEir = 0
-
- if 'interfaceCfgIngressBwp' in uni:
- bwpCfgCbs = uni['interfaceCfgIngressBwp']['bwpCfgCbs']
- bwpCfgEbs = uni['interfaceCfgIngressBwp']['bwpCfgEbs']
- bwpCfgCir = uni['interfaceCfgIngressBwp']['bwpCfgCir']
- bwpCfgEir = uni['interfaceCfgIngressBwp']['bwpCfgEir']
-
- uniPort = NetworkEdgePort()
- uniPort.element = self.networkdevice
- uniPort.pid = "{}.{}/{}".format(self.networkdevice.id, hostname, port)
- uniPort.bwpCfgCbs = bwpCfgCbs
- uniPort.bwpCfgEbs = bwpCfgEbs
- uniPort.bwpCfgCir = bwpCfgCir
- uniPort.bwpCfgEir = bwpCfgEir
-
- objs.append(uniPort)
-
- return objs
-
- else:
- raise Exception("OnosApiError: get_network_ports()")
-
- def get_network_eline_link(self, networkDevice, evc):
-
- sid = evc['id']
- uni1 = evc['SCA_ETH_Flow_Points'][0]
- hostname = uni1['scaEthFppUniN']['transportPort']['Hostname']
- port = uni1['scaEthFppUniN']['transportPort']['Port']
-
- edgePort1 = NetworkEdgePort()
- edgePort1.element = networkDevice
- edgePort1.pid = "{}.{}/{}".format(networkDevice.id, hostname, port)
-
- if 'interfaceCfgIngressBwp' in uni1['scaEthFppUniN']:
- edgePort1.bwpCfgCbs = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']
- edgePort1.bwpCfgEbs = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']
- edgePort1.bwpCfgCir = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']
- edgePort1.bwpCfgEir = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']
-
- uni2 = evc['SCA_ETH_Flow_Points'][1]
- hostname = uni2['scaEthFppUniN']['transportPort']['Hostname']
- port = uni2['scaEthFppUniN']['transportPort']['Port']
-
- edgePort2 = NetworkEdgePort()
- edgePort2.element = networkDevice
- edgePort2.pid = "{}.{}/{}".format(networkDevice.id, hostname, port)
-
- if 'interfaceCfgIngressBwp' in uni1['scaEthFppUniN']:
- edgePort2.bwpCfgCbs = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']
- edgePort2.bwpCfgEbs = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']
- edgePort2.bwpCfgCir = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']
- edgePort2.bwpCfgEir = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']
-
- edgeToEdgeConnectivity = NetworkEdgeToEdgePointConnection()
- edgeToEdgeConnectivity.sid = sid
- edgeToEdgeConnectivity.type = "Point_To_Point"
- edgeToEdgeConnectivity.uni1 = edgePort1
- edgeToEdgeConnectivity.uni2 = edgePort2
- edgeToEdgeConnectivity.operstate = "active"
- edgeToEdgeConnectivity.adminstate = "enabled"
-
- return(edgeToEdgeConnectivity)
-
- def get_network_elan_link(self, networkDevice, evc):
-
- sid = evc['id']
- eps = []
-
- for ep in evc['SCA_ETH_Flow_Points']:
- hostname = ep['scaEthFppUniN']['transportPort']['Hostname']
- port = ep['scaEthFppUniN']['transportPort']['Port']
-
- edgePort = NetworkEdgePort()
- edgePort.element = networkDevice
- edgePort.pid = "{}.{}/{}".format(networkDevice.id, hostname, port)
-
- if 'interfaceCfgIngressBwp' in ep['scaEthFppUniN']:
- edgePort.bwpCfgCbs = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']
- edgePort.bwpCfgEbs = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']
- edgePort.bwpCfgCir = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']
- edgePort.bwpCfgEir = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']
-
- eps.append(edgePort)
-
- multipointToMultipointConnectivity = NetworkMultipointToMultipointConnection()
- multipointToMultipointConnectivity.sid = sid
- multipointToMultipointConnectivity.type = "Multipoint_To_Multipoint"
- multipointToMultipointConnectivity.eps = eps
- multipointToMultipointConnectivity.operstate = "active"
- multipointToMultipointConnectivity.adminstate = "enabled"
-
- return(multipointToMultipointConnectivity)
-
- def get_network_etree_link(self, networkDevice, evc):
-
- sid = evc['id']
- eps = []
-
- root = evc['SCA_ETH_Flow_Points'][0]
- hostname = root['scaEthFppUniN']['transportPort']['Hostname']
- port = root['scaEthFppUniN']['transportPort']['Port']
-
- edgePort = NetworkEdgePort()
- edgePort.element = networkDevice
- edgePort.pid = "{}.{}/{}".format(networkDevice.id, hostname, port)
-
- if 'interfaceCfgIngressBwp' in root['scaEthFppUniN']:
- edgePort.bwpCfgCbs = root['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']
- edgePort.bwpCfgEbs = root['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']
- edgePort.bwpCfgCir = root['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']
- edgePort.bwpCfgEir = root['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']
-
- edgeToMultipointConnectivity = NetworkEdgeToMultipointConnection()
- edgeToMultipointConnectivity.sid = sid
- edgeToMultipointConnectivity.type = "Root_Multipoint"
- edgeToMultipointConnectivity.root = edgePort
-
- for ep in evc['SCA_ETH_Flow_Points'][1:]:
- hostname = ep['scaEthFppUniN']['transportPort']['Hostname']
- port = ep['scaEthFppUniN']['transportPort']['Port']
-
- edgePort = NetworkEdgePort()
- edgePort.element = networkDevice
- edgePort.pid = "{}.{}/{}".format(networkDevice.id, hostname, port)
-
- if 'interfaceCfgIngressBwp' in ep['scaEthFppUniN']:
- edgePort.bwpCfgCbs = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']
- edgePort.bwpCfgEbs = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']
- edgePort.bwpCfgCir = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']
- edgePort.bwpCfgEir = ep['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']
-
- eps.append(edgePort)
-
- edgeToMultipointConnectivity.eps = eps
- edgeToMultipointConnectivity.operstate = "active"
- edgeToMultipointConnectivity.adminstate = "enabled"
-
- return(edgeToMultipointConnectivity)
-
- def get_network_links(self):
-
- objs = []
-
- networkDevice = self.networkdevice
- restCtrlUrl = self.networkdevice.restCtrlUrl
- username = self.networkdevice.username
- password = self.networkdevice.password
-
- resp = requests.get("{}/mef-sca-api/SCA_ETH_FDFr_EC/findByState?state=Active".format(restCtrlUrl),
- auth=HTTPBasicAuth(username, password))
-
- if resp.status_code == 200:
- for evc in resp.json():
- evcServiceType = evc['evcServiceType']
- if (evcServiceType == "Point_To_Point"):
- objs.append(self.get_network_eline_link(networkDevice, evc))
- elif (evcServiceType == "Multipoint_To_Multipoint"):
- objs.append(self.get_network_elan_link(networkDevice, evc))
- elif (evcServiceType == "Root_Multipoint"):
- objs.append(self.get_network_etree_link(networkDevice, evc))
- else:
- raise Exception("OnosApiError: get_network_links() - unknown link type")
- else:
- raise Exception("OnosApiError: get_network_links()")
-
- return objs
-
- def create_point_to_point_connectivity_json_data(self, obj):
-
- p2p_json_data = {}
- p2p_json_data["evcServiceType"] = "Point_To_Point"
-
- uni1 = obj.uni1
- uni1Id = uni1.pid
- uni1IdToken = (uni1Id.split('.', 1))[1].split('/', 1)
- uni1Hostname = uni1IdToken[0]
- uni1Port = uni1IdToken[1]
- uni1BwpCfgCbs = uni1.bwpCfgCbs
- uni1BwpCfgEbs = uni1.bwpCfgEbs
- uni1BwpCfgCir = uni1.bwpCfgCir
- uni1BwpCfgEir = uni1.bwpCfgEir
-
- uni1_json_data = {}
- uni1_json_data['scaEthFppUniN'] = {}
- uni1_json_data['scaEthFppUniN']['ceVlanId'] = obj.vlanid
- uni1_json_data['scaEthFppUniN']["transportPort"] = {}
- uni1_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"] = {}
-
- uni1_json_data['scaEthFppUniN']["transportPort"]["Hostname"] = uni1Hostname
- uni1_json_data['scaEthFppUniN']["transportPort"]["Port"] = uni1Port
- uni1_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCbs"] = uni1BwpCfgCbs
- uni1_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEbs"] = uni1BwpCfgEbs
- uni1_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCir"] = uni1BwpCfgCir
- uni1_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEir"] = uni1BwpCfgEir
-
- uni2 = obj.uni2
- uni2Id = uni2.pid
- uni2IdToken = (uni2Id.split('.', 1))[1].split('/', 1)
- uni2Hostname = uni2IdToken[0]
- uni2Port = uni2IdToken[1]
- uni2BwpCfgCbs = uni2.bwpCfgCbs
- uni2BwpCfgEbs = uni2.bwpCfgEbs
- uni2BwpCfgCir = uni2.bwpCfgCir
- uni2BwpCfgEir = uni2.bwpCfgEir
-
- uni2_json_data = {}
- uni2_json_data['scaEthFppUniN'] = {}
- uni2_json_data['scaEthFppUniN']['ceVlanId'] = obj.vlanid
- uni2_json_data['scaEthFppUniN']["transportPort"] = {}
- uni2_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"] = {}
-
- uni2_json_data['scaEthFppUniN']["transportPort"]["Hostname"] = uni2Hostname
- uni2_json_data['scaEthFppUniN']["transportPort"]["Port"] = uni2Port
- uni2_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCbs"] = uni2BwpCfgCbs
- uni2_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEbs"] = uni2BwpCfgEbs
- uni2_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCir"] = uni2BwpCfgCir
- uni2_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEir"] = uni2BwpCfgEir
-
- p2p_json_data["SCA_ETH_Flow_Points"] = []
- p2p_json_data["SCA_ETH_Flow_Points"].append(uni1_json_data)
- p2p_json_data["SCA_ETH_Flow_Points"].append(uni2_json_data)
-
- return p2p_json_data
-
- # nchoi: create elan service json data
- def create_multipoint_to_multipoint_connectivity_json_data(self, obj):
-
- mp2mp_json_data = {}
- mp2mp_json_data["evcServiceType"] = "Multipoint_To_Multipoint"
- mp2mp_json_data["SCA_ETH_Flow_Points"] = []
-
- for ep in obj.eps.all():
- uniId = ep.pid
- uniIdToken = (uniId.split('.', 1))[1].split('/', 1)
- uniHostname = uniIdToken[0]
- uniPort = uniIdToken[1]
- uniBwpCfgCbs = ep.bwpCfgCbs
- uniBwpCfgEbs = ep.bwpCfgEbs
- uniBwpCfgCir = ep.bwpCfgCir
- uniBwpCfgEir = ep.bwpCfgEir
-
- uni_json_data = {}
- uni_json_data['scaEthFppUniN'] = {}
- uni_json_data['scaEthFppUniN']['ceVlanId'] = obj.vlanid
- uni_json_data['scaEthFppUniN']["transportPort"] = {}
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"] = {}
-
- uni_json_data['scaEthFppUniN']["transportPort"]["Hostname"] = uniHostname
- uni_json_data['scaEthFppUniN']["transportPort"]["Port"] = uniPort
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCbs"] = uniBwpCfgCbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEbs"] = uniBwpCfgEbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCir"] = uniBwpCfgCir
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEir"] = uniBwpCfgEir
-
- mp2mp_json_data["SCA_ETH_Flow_Points"].append(uni_json_data)
-
- return mp2mp_json_data
-
- # nchoi: create etree service json data
- def create_root_multipoint_connectivity_json_data(self, obj):
-
- r2mp_json_data = {}
- r2mp_json_data["evcServiceType"] = "Root_Multipoint"
- r2mp_json_data["SCA_ETH_Flow_Points"] = []
-
- root = obj.root
- uniId = root.pid
- uniIdToken = (uniId.split('.', 1))[1].split('/', 1)
- uniHostname = uniIdToken[0]
- uniPort = uniIdToken[1]
- uniBwpCfgCbs = root.bwpCfgCbs
- uniBwpCfgEbs = root.bwpCfgEbs
- uniBwpCfgCir = root.bwpCfgCir
- uniBwpCfgEir = root.bwpCfgEir
-
- uni_json_data = {}
- uni_json_data['scaEthFppUniN'] = {}
- uni_json_data['scaEthFppUniN']['ceVlanId'] = obj.vlanid
- uni_json_data['scaEthFppUniN']["transportPort"] = {}
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"] = {}
-
- uni_json_data['scaEthFppUniN']["transportPort"]["Hostname"] = uniHostname
- uni_json_data['scaEthFppUniN']["transportPort"]["Port"] = uniPort
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCbs"] = uniBwpCfgCbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEbs"] = uniBwpCfgEbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCir"] = uniBwpCfgCir
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEir"] = uniBwpCfgEir
-
- r2mp_json_data["SCA_ETH_Flow_Points"].append(uni_json_data)
-
- for ep in obj.eps.all():
- uniId = ep.pid
- uniIdToken = (uniId.split('.', 1))[1].split('/', 1)
- uniHostname = uniIdToken[0]
- uniPort = uniIdToken[1]
- uniBwpCfgCbs = ep.bwpCfgCbs
- uniBwpCfgEbs = ep.bwpCfgEbs
- uniBwpCfgCir = ep.bwpCfgCir
- uniBwpCfgEir = ep.bwpCfgEir
-
- uni_json_data = {}
- uni_json_data['scaEthFppUniN'] = {}
- uni_json_data['scaEthFppUniN']['ceVlanId'] = obj.vlanid
- uni_json_data['scaEthFppUniN']["transportPort"] = {}
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"] = {}
-
- uni_json_data['scaEthFppUniN']["transportPort"]["Hostname"] = uniHostname
- uni_json_data['scaEthFppUniN']["transportPort"]["Port"] = uniPort
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCbs"] = uniBwpCfgCbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEbs"] = uniBwpCfgEbs
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgCir"] = uniBwpCfgCir
- uni_json_data['scaEthFppUniN']["interfaceCfgIngressBwp"]["bwpCfgEir"] = uniBwpCfgEir
-
- r2mp_json_data["SCA_ETH_Flow_Points"].append(uni_json_data)
-
- return r2mp_json_data
-
- def create_network_connectivity(self, obj):
-
- restCtrlUrl = self.networkdevice.restCtrlUrl
- username = self.networkdevice.username
- password = self.networkdevice.password
-
- evcServiceType = obj.type
- if (evcServiceType == "Point_To_Point"):
- network_connectivity_json_data = self.create_point_to_point_connectivity_json_data(obj)
- elif (evcServiceType == "Multipoint_To_Multipoint"):
- network_connectivity_json_data = self.create_multipoint_to_multipoint_connectivity_json_data(obj)
- elif (evcServiceType == "Root_Multipoint"):
- network_connectivity_json_data = self.create_root_multipoint_connectivity_json_data(obj)
- else:
- raise Exception("OnosApiError: get_network_links() - unknown link type")
-
- headers = {'Content-Type': 'application/json'}
- resp = requests.post('{}/mef-sca-api/SCA_ETH_FDFr_EC'.format(restCtrlUrl),
- data=json.dumps(network_connectivity_json_data), headers=headers, auth=HTTPBasicAuth(username, password))
-
- if resp.status_code == 201:
- result = resp.json()
- message = result['message']
-
- msg_token = message.split()
- for i, token in enumerate(msg_token):
- if token == 'id':
- service_id = msg_token[i + 1]
- obj.sid = service_id
- obj.adminstate = "enabled"
- obj.operstate = "active"
-
- return True
-
- elif resp.status_code == 204:
- obj.adminstate = "invalid" # what's the meaning?
- obj.operstate = "inactive"
- obj.backend_status = '204 - No network resource'
-
- return False
-
- elif resp.status_code == 500:
- obj.adminstate = "enabled"
- obj.operstate = "inactive"
- obj.backend_status = '500 - Internal Server Error'
- return False
-
- else:
- raise Exception("OnosApiError: create_network_connectivity()")
-
- def delete_network_connectivity(self, obj):
-
- restCtrlUrl = self.networkdevice.restCtrlUrl
- username = self.networkdevice.username
- password = self.networkdevice.password
- evcId = obj.sid
-
- resp = requests.delete("{}/mef-sca-api/SCA_ETH_FDFr_EC/{}".format(restCtrlUrl, evcId),
- auth=HTTPBasicAuth(username, password))
-
- if resp.status_code == 200:
- obj.adminstate = 'disabled'
- obj.operstate = 'inactive'
- return True
-
- elif resp.status_code == 204:
- obj.adminstate = "invalid" # what's the meaning?
- obj.backend_status = '204 - No such network resource: {}'.format(evcId)
- return False
-
- elif resp.status_code == 500:
- obj.adminstate = "disabled"
- obj.backend_status = '500 - Internal Server Error'
- return False
-
- else:
- raise Exception("OnosApiError: delete_network_connectivity()")
diff --git a/xos/synchronizer/providers/metronetworktestprovider.py b/xos/synchronizer/providers/metronetworktestprovider.py
deleted file mode 100644
index 3bcbb92..0000000
--- a/xos/synchronizer/providers/metronetworktestprovider.py
+++ /dev/null
@@ -1,339 +0,0 @@
-import random
-import json
-
-from xos.logger import Logger, logging
-from services.metronetwork.models import *
-from core.models import Site
-from synchronizers.metronetwork.providers.metronetworkprovider import MetroNetworkProvider
-
-logger = Logger(level=logging.INFO)
-
-
-class MetroNetworkTestProvider(MetroNetworkProvider):
- def __init__(self, networkdevice, **args):
- MetroNetworkProvider.__init__(self, networkdevice, **args)
-
- # Method for retrieving all network ports from the backend system
- def get_network_ports(self):
- #
- # Our Test Network Consists of one NetworkDevice (which correspond to ONOS instance):
- #
- # 8 Ports
- # 1 Eline (2 ports)
- # 1 Etree (3 ports)
- # 1 Elan (3 ports)
- #
- # 2 Sites - Representing Two R-CORD Pods
- # 2 Ports, One-per-site
- # 1 Bandwidth Profile
- # 2 Service Spokes
- # 1 VnodGlobalService
-
- objs = []
-
- # For The Test Provider we don't handle re-sync for anything but the Metro Test Network
- if self.networkdevice.id != 'TestMetroNet':
- return objs
-
- # Set the parent device id to just be the Test NetworkDevice
- device1 = NetworkDevice()
- device1.id = self.networkdevice.id
-
- port1 = NetworkEdgePort()
- port1.element = device1
- port1.pid = device1.id + "." + "of:000000001/1"
- port1.bwpCfgCbs = 1000000
- port1.bwpCfgEbs = 1000000
- port1.bwpCfgEir = 1000000
- port1.bwpCfgCir = 1000000
- port1.location = "San Francisco"
- port1.name = "Central Office 1"
- port1.latlng = "[-122.419416, 37.774929]"
- objs.append(port1)
-
- port2 = NetworkEdgePort()
- port2.element = device1
- port2.pid = device1.id + "." + "of:000000001/2"
- port2.bwpCfgCbs = 1000000
- port2.bwpCfgEbs = 1000000
- port2.bwpCfgEir = 1000000
- port2.bwpCfgCir = 1000000
- port2.location = "San Jose"
- port2.name = "Central Office 2"
- port2.latlng = "[-121.886329, 37.338208]"
- objs.append(port2)
-
- port3 = NetworkEdgePort()
- port3.element = device1
- port3.pid = device1.id + "." + "of:000000001/3"
- port3.bwpCfgCbs = 1000000
- port3.bwpCfgEbs = 1000000
- port3.bwpCfgEir = 1000000
- port3.bwpCfgCir = 1000000
- port3.location = "Palo Alto"
- port3.name = "Central Office 3"
- port3.latlng = "[-122.143019, 37.441883]"
- objs.append(port3)
-
- port4 = NetworkEdgePort()
- port4.element = device1
- port4.pid = device1.id + "." + "of:000000001/4"
- port4.bwpCfgCbs = 1000000
- port4.bwpCfgEbs = 1000000
- port4.bwpCfgEir = 1000000
- port4.bwpCfgCir = 1000000
- port4.location = "Oakland"
- port4.name = "Central Office 4"
- port4.latlng = "[-122.271114, 37.804364]"
- objs.append(port4)
-
- port5 = NetworkEdgePort()
- port5.element = device1
- port5.pid = device1.id + "." + "of:000000001/5"
- port5.bwpCfgCbs = 1000000
- port5.bwpCfgEbs = 1000000
- port5.bwpCfgEir = 1000000
- port5.bwpCfgCir = 1000000
- port5.location = "San Rafael"
- port5.name = "Central Office 5"
- port5.latlng = "[-122.531087, 37.973535]"
- objs.append(port5)
-
- port6 = NetworkEdgePort()
- port6.element = device1
- port6.pid = device1.id + "." + "of:000000001/6"
- port6.bwpCfgCbs = 1000000
- port6.bwpCfgEbs = 1000000
- port6.bwpCfgEir = 1000000
- port6.bwpCfgCir = 1000000
- port6.location = "San Mateo"
- port6.name = "Central Office 6"
- port6.latlng = "[-122.325525, 37.562992]"
- objs.append(port6)
-
- port7 = NetworkEdgePort()
- port7.element = device1
- port7.pid = device1.id + "." + "of:000000001/7"
- port7.bwpCfgCbs = 1000000
- port7.bwpCfgEbs = 1000000
- port7.bwpCfgEir = 1000000
- port7.bwpCfgCir = 1000000
- port7.location = "Hayward"
- port7.name = "Central Office 7"
- port7.latlng = "[-122.080796, 37.668821]"
- objs.append(port7)
-
- port8 = NetworkEdgePort()
- port8.element = device1
- port8.pid = device1.id + "." + "of:000000001/8"
- port8.bwpCfgCbs = 1000000
- port8.bwpCfgEbs = 1000000
- port8.bwpCfgEir = 1000000
- port8.bwpCfgCir = 1000000
- port8.location = "Fremont"
- port8.name = "Central Office 8"
- port8.latlng = "[-121.988572, 37.548270]"
- objs.append(port8)
-
- return objs
-
- def get_network_ports_for_deletion(self):
-
- objs = []
-
- # For The Test Provider we don't handle re-sync for anything but the Metro Test Network
- if self.networkdevice.id != 'TestMetroNet':
- return objs
-
- allports = MetroNetworkProvider.get_network_ports_for_deletion(self)
-
- for port in allports:
- objs.append(port)
-
- return objs
-
- def get_network_links(self):
-
- objs = []
-
- # Connectivity object - Point to Point
- cordpod1device = NetworkDevice()
- cordpod1device.id = self.networkdevice.id
-
- # Edge to Edge Point Connectivity Objects
- edgetoedgeconnectivity = NetworkEdgeToEdgePointConnection()
- edgetoedgeconnectivity.uni1_createbuffer = cordpod1device.id + "." + "of:000000001/1"
- edgetoedgeconnectivity.uni2_createbuffer = cordpod1device.id + "." + "of:000000001/2"
- edgetoedgeconnectivity.type = 'direct'
- edgetoedgeconnectivity.operstate = 'active'
- edgetoedgeconnectivity.adminstate = 'enabled'
- edgetoedgeconnectivity.sid = 'EdgeToEdgePointConnectivity_1'
- objs.append(edgetoedgeconnectivity)
-
-
- # Multipoint to Multipoint Connectivity Objects
- multipoint2multipointconnectivity=NetworkMultipointToMultipointConnection()
- multipoint2multipointconnectivity.operstate = 'active'
- multipoint2multipointconnectivity.adminstate = 'enabled'
- multipoint2multipointconnectivity.type = 'ethernet'
- multipoint2multipointconnectivity.sid = 'MultipointToMultipointConnectivity_1'
-
- #
- # Create JSON array for post-save behaviour
- #
- eps = []
- eps.append(cordpod1device.id + "." + "of:000000001/3")
- eps.append(cordpod1device.id + "." + "of:000000001/4")
- eps.append(cordpod1device.id + "." + "of:000000001/5")
-
- myjsonstr = {'eps': eps, 'foo':0, 'bar':0}
- multipoint2multipointconnectivity.eps_createbuffer = json.dumps(myjsonstr)
- objs.append(multipoint2multipointconnectivity)
-
- # Edge to Multipoint Connectivity Objects
- edge2multipointconnectivity = NetworkEdgeToMultipointConnection()
- edge2multipointconnectivity.operstate = 'active'
- edge2multipointconnectivity.adminstate = 'enabled'
- edge2multipointconnectivity.type = 'ethernet'
- edge2multipointconnectivity.sid = 'EdgeToMultipointConnectivity_1'
- edge2multipointconnectivity.root_createbuffer = cordpod1device.id + "." + "of:000000001/7"
- #
- # Create JSON array for post-save behaviour
- #
- eps = []
- eps.append(cordpod1device.id + "." + "of:000000001/6")
- eps.append(cordpod1device.id + "." + "of:000000001/8")
-
- myjsonstr = {'eps': eps, 'foo': 0, 'bar': 0}
- edge2multipointconnectivity.eps_createbuffer = json.dumps(myjsonstr)
- objs.append(edge2multipointconnectivity)
-
- # Create Objects for VnodGlobal Sort of Testing
-
- # Bandwidth Profile
-
- bwprofile = BandwidthProfile()
- bwprofile.bwpcfgcbs = 0
- bwprofile.bwpcfgcir = 0
- bwprofile.bwpcfgebs = 0
- bwprofile.bwpcfgeir = 0
- bwprofile.name = 'TestBWP'
- objs.append(bwprofile)
-
- # Two Sites
- site1 = Site()
- site1.name = 'CORDPod1'
- site1.login_base = 'CordPod1'
- site1.site_url = 'http://1.2.3.4:8080/VnodLocalApi'
- objs.append(site1)
-
- site2 = Site()
- site2.name = 'CORDPod2'
- site2.login_base = 'CordPod2'
- site2.site_url = 'http://10.11.12.13:8080/VnodLocalApi'
- objs.append(site2)
-
- # Two Ports - one per Site
-
- remoteport1 = RemotePort()
- remoteport1.name = "CORDPOD1:Port1"
- remoteport1.sitename = 'CordPod1'
- remoteport1.edgeportname = cordpod1device.id + "." + "of:000000001/1"
- objs.append(remoteport1)
-
- remoteport2 = RemotePort()
- remoteport2.name = "CORDPOD2:Port1"
- remoteport2.sitename = 'CordPod2'
- remoteport2.edgeportname = cordpod1device.id + "." + "of:000000001/2"
- objs.append(remoteport2)
-
- # One Spoke/Site
- spoke1 = ServiceSpoke()
- spoke1.name = 'TestSpoke1'
- spoke1.remoteportname = "CORDPOD1:Port1"
- spoke1.remotevnodid = 'CORDPod1:VnodLocal:1'
- spoke1.operstate = 'inactive'
- spoke1.adminstate = 'enabled'
- spoke1.sitename = 'CordPod1'
- objs.append(spoke1)
-
- spoke2 = ServiceSpoke()
- spoke2.name = 'TestSpoke2'
- spoke2.remoteportname = "CORDPOD2:Port1"
- spoke2.remotevnodid = 'CORDPod2:VnodLocal:1'
- spoke2.operstate = 'active'
- spoke2.adminstate = 'enabled'
- spoke2.sitename = 'CordPod2'
- objs.append(spoke2)
-
- # One VnodGlobal Service
- vnodglobal = VnodGlobalService()
- vnodglobal.name = 'VnodGlobalPtToPtTest1'
- vnodglobal.type = 'eline'
- vnodglobal.vlanid = '100'
- vnodglobal.operstate = 'active'
- vnodglobal.adminstate = 'enabled'
- vnodglobal.servicehandle = 'testhandle1'
- vnodglobal.pointtopointsid = 'onos_eline_id'
- vnodglobal.bwpname = 'TestBWP'
-
- # Create JSON array for post-save behaviour
- #
- spokes = ['TestSpoke1', 'TestSpoke2']
- myjsonstr = {'spokes': spokes}
- vnodglobal.spokes_createbuffer = json.dumps(myjsonstr)
- objs.append(vnodglobal)
-
- return objs
-
- def get_network_links_for_deletion(self):
-
- # For now we'll rely on cascade deletes in the port area - so from the test provider nothing to do
- objs = []
- return objs
-
- def create_point_to_point_connectivity(self, obj):
-
- # Ok - here is what we'll do to simulate the 'real world' - get a random number between 1 and 10
- # 1-7 is considered 'successful' 8 is considered a transient error - 9 is a configuration problem
- # 10 is a - resource exhausted problem - there you go!!
- scenario = random.randint(1, 10)
-
- if (scenario >= 1 and scenario <= 7):
- obj.adminstate = 'enabled'
- obj.operstate = 'active'
- return True
- elif (scenario == 8):
- obj.adminstate = 'enabled'
- obj.operstate = 'inactive'
- obj.backend_status = '8 - Transient Server Error'
- return False
- elif (scenario == 9):
- obj.adminstate = 'invalid'
- obj.operstate = 'inactive'
- obj.backend_status = '9 - Configuration Error'
- return False
- else:
- obj.adminstate = 'enabled'
- obj.operstate = 'inactive'
- obj.backend_status = '10 - Resource Exhaustion'
- return False
-
- def delete_point_to_point_connectivity(self, obj):
-
- # Ok - here is what we'll do to simulate the 'real world' - get a random number between 1 and 10
- # 1-8 is considered 'successful' 8 is considered a transient error - 9 is a configuration problem
- scenario = random.randint(1, 10)
-
- if (scenario >= 1 and scenario <= 8):
- obj.adminstate = 'disabled'
- obj.operstate = 'inactive'
- return True
- elif (scenario == 9):
- obj.adminstate = 'disabled'
- obj.backend_status = '8 - Transient Server Error'
- return False
- else:
- obj.adminstate = 'invalid'
- obj.backend_status = '9 - Configuration Error'
- return False
diff --git a/xos/synchronizer/providers/providerfactory.py b/xos/synchronizer/providers/providerfactory.py
deleted file mode 100644
index 9ef6cb8..0000000
--- a/xos/synchronizer/providers/providerfactory.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import sys
-
-from synchronizers.metronetwork.providers.metronetworktestprovider import MetroNetworkTestProvider
-from synchronizers.metronetwork.providers.metronetworkrestprovider import MetroNetworkRestProvider
-
-
-class ProviderFactory(object):
- @staticmethod
- def getprovider(networkdevice):
-
- undertest = False
-
- # We either return Test or Rest
- # By convention a NetworkDevice with name TestDomain will use test objects
- if networkdevice.id == 'TestMetroNet' or networkdevice.id == 'TestCORD1Net' or networkdevice.id == 'TestCORD2Net':
- undertest = True
-
- if undertest:
- return MetroNetworkTestProvider(networkdevice)
- else:
- return MetroNetworkRestProvider(networkdevice)
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
old mode 100644
new mode 100755
index 95ba5dd..73f5eec
--- a/xos/synchronizer/run-from-api.sh
+++ b/xos/synchronizer/run-from-api.sh
@@ -1,2 +1,3 @@
+#!/usr/bin/env bash
export XOS_DIR=/opt/xos
python metronetwork-synchronizer.py -C $XOS_DIR/synchronizers/metro-net/metronetwork_from_api_config
\ No newline at end of file
diff --git a/xos/synchronizer/invokers/__init__.py b/xos/synchronizer/steps/__init__.py
similarity index 100%
rename from xos/synchronizer/invokers/__init__.py
rename to xos/synchronizer/steps/__init__.py
diff --git a/xos/synchronizer/steps/sync_metroneteline.py b/xos/synchronizer/steps/sync_metroneteline.py
new file mode 100644
index 0000000..bd0bfef
--- /dev/null
+++ b/xos/synchronizer/steps/sync_metroneteline.py
@@ -0,0 +1,89 @@
+import os
+import sys
+import requests
+import json
+from synchronizers.new_base.syncstep import SyncStep
+from synchronizers.new_base.modelaccessor import *
+#from xos.logger import Logger, logging
+
+from requests.auth import HTTPBasicAuth
+#logger = Logger(level=logging.INFO)
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+
+class SyncMetroNetEline(SyncStep):
+ provides = [ELine]
+
+ observes = ELine
+
+ requested_interval = 0
+
+ def __init__(self, *args, **kwargs):
+ super(SyncMetroNetEline, self).__init__(*args, **kwargs)
+
+ def get_onos_global_addr(self, onos):
+ #Fetching ip and port from the Global ONOS, append the CE specif API
+
+ onos_url = "http://%s:%s/onos/" % (onos.onos_ip, onos.onos_port)
+ evc_endpoint = "carrierethernet/evc"
+ return onos_url + evc_endpoint
+
+ def get_onos_global_auth(self, onos):
+ #Fetching username and password from the Global ONOS
+
+ return HTTPBasicAuth(onos.onos_username, onos.onos_password)
+
+ def sync_record(self, evc):
+ print "POST %s " % (evc)
+ #logger.info("Syncing Edited EVC: %s" % evc.name)
+ # Fetch the bwp from the DB
+ bwp = BandwidthProfile.objects.get(name=evc.bwp)
+
+ # json to configure ONOS to start the EVC.
+ # {
+ # "evcId": "evc1",
+ # "evcCfgId": "evpl1",
+ # "uniList": [
+ # "netconf:192.168.56.10:830/0",
+ # "netconf:192.168.56.20:830/0"
+ # ],
+ # "evcType": "POINT_TO_POINT",
+ # "vlanId": 100,
+ # "cir": "400",
+ # "eir": "200",
+ # "cbs": "3000",
+ # "ebs": "2000"
+ # }
+
+ data = {}
+ data["evcId"] = evc.name
+ data["evcCfgId"] = evc.name
+ data["uniList"] = [evc.connect_point_1_id, evc.connect_point_2_id]
+ data["evcType"] = "POINT_TO_POINT"
+ data["vlanId"] = evc.vlanids.split(",")
+ data["cbs"] = bwp.cbs
+ data["ebs"] = bwp.ebs
+ data["cir"] = bwp.cir
+ data["eir"] = bwp.eir
+ print "data %s" % data
+ # assuming that the CPEs are controller by the fabric ONOS
+ onos = OnosModel.objects.get(onos_type="global")
+ onos_addr = self.get_onos_global_addr(onos)
+
+ # FIXME - hardcoded auth
+ auth = self.get_onos_global_auth(onos)
+
+ print "POST %s for app %s, data = %s" % (onos_addr, evc.name, data)
+
+ r = requests.post(onos_addr, data=json.dumps(data), auth=auth)
+ #TODO XOS might fail to connect to ONOS.
+ if (r.status_code != 200):
+ print r
+ raise Exception("Received error from EVC Installation update (%d)" % r.status_code)
+
+ def delete_record(self, evc):
+ # TODO evaluate what to in this case.
+ print "Syncing delete EVC: %s" % evc.name
+ #logger.info("Syncing delete EVC: %s" % evc.name)
diff --git a/xos/synchronizer/steps/sync_metronetworkservice.py b/xos/synchronizer/steps/sync_metronetworkservice.py
deleted file mode 100644
index 3468d2b..0000000
--- a/xos/synchronizer/steps/sync_metronetworkservice.py
+++ /dev/null
@@ -1,254 +0,0 @@
-import os, sys
-from itertools import chain
-
-from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible #if needed
-from synchronizers.new_base.ansible_helper import run_template_ssh #if needed
-from synchronizers.new_base.modelaccessor import *
-from xos.logger import Logger, logging
-from synchronizers.metronetwork.providers.providerfactory import ProviderFactory
-from synchronizers.metronetwork.invokers.invokerfactory import InvokerFactory
-
-# metronetwork will be in steps/..
-parentdir = os.path.join(os.path.dirname(__file__), "..")
-sys.path.insert(0, parentdir)
-
-logger = Logger(level=logging.INFO)
-
-
-class SyncMetroNetworkSystem(SyncStep):
- provides = [MetroNetworkSystem]
- observes = MetroNetworkSystem
- requested_interval = 0
- initialized = False
-
- def __init__(self, **args):
- SyncStep.__init__(self, **args)
-
- def fetch_pending(self, deletion=False):
-
- # The general idea:
- # We do one of two things in here:
- # 1. Full Synchronization of the DBS (XOS <-> MetroONOS)
- # 2. Look for updates between the two stores
- # The first thing is potentially a much bigger
- # operation and should not happen as often
- #
- # The Sync operation must take into account the 'deletion' flag
-
- objs = []
-
- # Get the NetworkSystem object - if it exists it will test us
- # whether we should do a full sync or not - it all has our config
- # information about the REST interface
-
- metronetworksystem = self.get_metronetwork_system()
- if not metronetworksystem:
- logger.debug("No Service configured")
- return objs
-
- # Check to make sure the Metro Network System is enabled
- metronetworksystem = self.get_metronetwork_system()
- if metronetworksystem.administrativeState == 'disabled':
- # Nothing to do
- logger.debug("MetroService configured - state is Disabled")
- return objs
-
- # The Main Loop - retrieve all the NetworkDevice objects - for each of these
- # Apply synchronization aspects
- networkdevices = NetworkDevice.objects.all()
-
- for dev in networkdevices:
-
- # Set up the provider
- provider = ProviderFactory.getprovider(dev)
-
- # First check is for the AdminState of Disabled - do nothing
- if dev.administrativeState == 'disabled':
- # Nothing to do with this device
- logger.debug("NetworkDevice %s: administrativeState set to Disabled - continuing" % dev.id)
-
- # Now to the main options - are we syncing - deletion portion
- elif dev.administrativeState == 'syncrequested' and deletion is True:
-
- logger.info("NetworkDevice %s: administrativeState set to SyncRequested" % dev.id)
-
- # Kill Links
- networklinks = provider.get_network_links_for_deletion()
- for link in networklinks:
- objs.append(link)
-
- # Kill Ports
- allports = provider.get_network_ports_for_deletion()
- for port in allports:
- objs.append(port)
-
- logger.info("NetworkDevice %s: Deletion part of Sync completed" % dev.id)
- dev.administrativeState = 'syncinprogress'
- dev.save(update_fields=['administrativeState'])
-
- # Now to the main options - are we syncing - creation portion
- elif dev.administrativeState == 'syncinprogress' and deletion is False:
-
- logger.info("NetworkDevice %s: administrativeState set to SyncRequested" % dev.id)
- # Reload objects in the reverse order of deletion
-
- # Add Ports
- networkports = provider.get_network_ports()
- for port in networkports:
- objs.append(port)
-
- # Add Links
- networklinks = provider.get_network_links()
- for link in networklinks:
- objs.append(link)
-
- logger.info("NetworkDevice %s: Creation part of Sync completed" % dev.id)
- dev.administrativeState = 'enabled'
- dev.save(update_fields=['administrativeState'])
-
- # If we are enabled - then check for events - in either direction and sync
- elif dev.administrativeState == 'enabled' and deletion is False:
- logger.debug("NetworkDevice: administrativeState set to Enabled - non deletion phase")
-
- # This should be the 'normal running state' when we are not deleting - a few things to do in here
-
- # Get the changed objects from the provider - deletions are handled separately
- eventobjs = provider.get_updated_or_created_objects()
- for eventobj in eventobjs:
- # Simply put in the queue for update - this will handle both new and changed objects
- objs.append(eventobj)
-
- # Handle changes XOS -> ONOS
- # Check for ConnectivityObjects that are in acticationequested state - creates to the backend
- p2pactivatereqs = NetworkEdgeToEdgePointConnection.objects.filter(adminstate='activationrequested')
- mp2mpactivatereqs = NetworkMultipointToMultipointConnection.objects.filter(adminstate='activationrequested')
- r2mpactivatereqs = NetworkEdgeToMultipointConnection.objects.filter(adminstate='activationrequested')
- activatereqs = list(chain(p2pactivatereqs, mp2mpactivatereqs, r2mpactivatereqs))
- for activatereq in activatereqs:
-
- # Call the XOS Interface to create the service
- logger.debug("Attempting to create EdgePointToEdgePointConnectivity: %s" % activatereq.id)
- if (provider.create_network_connectivity(activatereq)):
- # Everyting is OK, lets let the system handle the persist
- objs.append(activatereq)
- else:
- # In the case of an error we persist the state of the object directly to preserve
- # the error code - and because that is how the base synchronizer is designed
- activatereq.save()
-
- # Check for ConnectivityObjects that are in deacticationequested state - deletes to the backend
- p2pdeactivatereqs = NetworkEdgeToEdgePointConnection.objects.filter(adminstate='deactivationrequested')
- mp2mpdeactivatereqs = NetworkMultipointToMultipointConnection.objects.filter(adminstate='deactivationrequested')
- r2mpdeactivatereqs = NetworkEdgeToMultipointConnection.objects.filter(adminstate='deactivationrequested')
- deactivatereqs = list(chain(p2pdeactivatereqs, mp2mpdeactivatereqs, r2mpdeactivatereqs))
- for deactivatereq in deactivatereqs:
-
- # Call the XOS Interface to delete the service
- logger.debug("Attempting to delete EdgePointToEdgePointConnectivity: %s" % deactivatereq.id)
- if provider.delete_network_connectivity(deactivatereq):
- # Everyting is OK, lets let the system handle the persist
- objs.append(deactivatereq)
- else:
- # In the case of an error we persist the state of the object directly to preserve
- # the error code - and because that is how the base synchronizer is designed
- deactivatereq.save()
-
- # If we are enabled - and in our deletion pass then look for objects waiting for deletion
- elif dev.administrativeState == 'enabled' and deletion is True:
- logger.debug("NetworkDevice: administrativeState set to Enabled - deletion phase")
-
- # Any object that is simply deleted in the model gets removed automatically - the synchronizer
- # doesn't get involved - we just need to check for deleted objects in the domain and reflect that
- # in the model
- #
- # Get the deleted objects from the provider
- eventobjs = provider.get_deleted_objects()
- for eventobj in eventobjs:
- # Simply put in the queue for update - this will handle both new and changed objects
- objs.append(eventobj)
-
- # Handle the case where we have deleted Eline Services from our side - if the Service is in
- # enabled state then we call the provider, otherwise just queue it for deletion
- elinedeletedobjs = NetworkEdgeToEdgePointConnection.deleted_objects.all()
- for elinedeletedobj in elinedeletedobjs:
- if elinedeletedobj.adminstate == 'enabled':
- provider.delete_network_connectivity(elinedeletedobj)
- # Either way queue it for deletion
- objs.append(elinedeletedobj)
-
- # Handle the case where we have deleted Etree Services from our side - if the Service is in
- # enabled state then we call the provider, otherwise just queue it for deletion
- etreedeletedobjs = NetworkEdgeToMultipointConnection.deleted_objects.all()
- for etreedeletedobj in etreedeletedobjs:
- # TODO: Handle the case where its connected, we need to disconnect first
- if etreedeletedobj.adminstate == 'enabled':
- provider.delete_network_connectivity(etreedeletedobj)
- # Either way queue it for deletion
- objs.append(etreedeletedobj)
-
- # Handle the case where we have deleted Elan Services from our side - if the Service is in
- # enabled state then we call the provider, otherwise just queue it for deletion
- elandeletedobjs = NetworkMultipointToMultipointConnection.deleted_objects.all()
- for elandeletedobj in elandeletedobjs:
- # TODO: Handle the case where its connected, we need to disconnect first
- if elandeletedobj.adminstate == 'enabled':
- provider.delete_network_connectivity(elandeletedobj)
- # Either way queue it for deletion
- objs.append(elandeletedobj)
-
- # Handle the case where we have deleted VnodGlobal Services from our side - if there is
- # an attached Eline/Etree/Elan we set that to deleted
- vnodbloaldeletedobjs = VnodGlobalService.deleted_objects.all()
- for vnodbloaldeletedobj in vnodbloaldeletedobjs:
- # Check for dependent eline service
- if vnodbloaldeletedobj.metronetworkpointtopoint is not None:
- elineobj = vnodbloaldeletedobj.metronetworkpointtopoint
- elineobj.deleted = True
- objs.append(elineobj)
- # Check for dependent elan service
- if vnodbloaldeletedobj.metronetworkmultipoint is not None:
- elanobj = vnodbloaldeletedobj.metronetworkmultipoint
- elanobj.deleted = True
- objs.append(elanobj)
- # Check for dependent etree service
- if vnodbloaldeletedobj.metronetworkroottomultipoint is not None:
- etreeobj = vnodbloaldeletedobj.metronetworkroottomultipoint
- etreeobj.deleted = True
- objs.append(etreeobj)
-
- objs.append(vnodbloaldeletedobj)
-
- # In add cases return the objects we are interested in
- return objs
-
- def sync_record(self, o):
-
- # First we call and see if there is an invoker for this object - the idea of the invoker
- # is to wrap the save with a pre/post paradigm to handle special cases
- # It will only exist for a subset of ojbects
- invoker = InvokerFactory.getinvoker(o)
-
- # Call Pre-save on the inovker (if it exists)
- if invoker is not None:
- invoker.presave(o)
-
- # Simply save the record to the DB - both updates and adds are handled the same way
- o.save()
-
- # Call Post-save on the inovker (if it exists)
- if invoker is not None:
- invoker.postsave(o)
-
- def delete_record(self, o):
- # Overriden to customize our behaviour - the core sync step for will remove the record directly
- # We just log and return
- logger.debug("deleting Object %s" % str(o), extra=o.tologdict())
-
- def get_metronetwork_system(self):
- # We only expect to have one of these objects in the system in the curent design
- # So get the first element from the query
- metronetworksystem = MetroNetworkSystem.objects.all()
- if not metronetworksystem:
- return None
-
- return metronetworksystem[0]
diff --git a/xos/tosca/resources/metronetservice.py b/xos/tosca/resources/metronetservice.py
index 372337f..37d1d7d 100644
--- a/xos/tosca/resources/metronetservice.py
+++ b/xos/tosca/resources/metronetservice.py
@@ -1,37 +1,28 @@
from xosresource import XOSResource
from service import XOSService
-from services.metronetwork.models import *
-
-class XOSMetroNetworkSystem(XOSResource):
- provides = "tosca.nodes.MetroNetworkSystem"
- xos_model = MetroNetworkSystem
- copyin_props = ["name", "administrativeState", "restUrl"]
-
-class MetroNetworkDevice(XOSResource):
- provides = "tosca.nodes.MetroNetworkDevice"
- xos_model = NetworkDevice
- copyin_props = ["id", "name", "administrativeState", "username", "password", "authType", "restCtrlUrl"]
-
-class VnodGlobalService(XOSService):
- provides = "tosca.nodes.VNodGlobalService"
- xos_model = VnodGlobalService
- copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber"]
-
- def get_xos_args(self):
- args = super(VnodGlobalService, self).get_xos_args()
-
- profile = self.get_requirement("tosca.relationships.UsesBandwidthProfile", throw_exception=False)
- if profile:
- profile = self.get_xos_object(BandwidthProfile, name=profile)
- args["bandwidthProfile"] = profile
- return args
-
-class XOSMetronetBandwithProficle(XOSResource):
- provides = "tosca.nodes.EcordBandwidthProfile"
- xos_model = BandwidthProfile
- copyin_props = ['bwpcfgcbs','bwpcfgebs','bwpcfgcir','bwpcfgeir','name']
+from services.metronet.models import *
class XOSMetronetUNI(XOSResource):
- provides = "tosca.nodes.EcordUserNetworkInterface"
+ provides = "tosca.nodes.UserNetworkInterface"
xos_model = UserNetworkInterface
- copyin_props = ['enabled','capacity','bw_used','vlanIds', 'location', 'latlng', 'name']
\ No newline at end of file
+ copyin_props = ['tenant','vlanIds', 'cpe_id', 'latlng', 'name']
+
+class XOSMetronetEnterpriseLocation(XOSResource):
+ provides = "tosca.nodes.EnterpriseLocation"
+ xos_model = EnterpriseLocation
+ copyin_props = ['name', 'cord_site_ip', 'cord_site_port', 'cord_site_username', 'cord_site_password', 'cord_site_type']
+
+class XOSMetronetOnosModel(XOSResource):
+ provides = "tosca.nodes.OnosModel"
+ xos_model = OnosModel
+ copyin_props = ['name', 'onos_ip', 'onos_port', 'onos_username', 'onos_password', 'onos_type']
+
+class XOSMetronetBandwithProfile(XOSResource):
+ provides = "tosca.nodes.BandwidthProfile"
+ xos_model = BandwidthProfile
+ copyin_props = ['cbs', 'ebs', 'cir', 'eir', 'name']
+
+class XOSMetronetELine(XOSResource):
+ provides = "tosca.nodes.ELine"
+ xos_model = ELine
+ copyin_props = ['name', 'connect_point_1_id', 'connect_point_2_id', 'vlanids', 'cord_site_name', 'bwp']
\ No newline at end of file
diff --git a/xos/tosca/resources/metronetservice.py.old b/xos/tosca/resources/metronetservice.py.old
new file mode 100644
index 0000000..372337f
--- /dev/null
+++ b/xos/tosca/resources/metronetservice.py.old
@@ -0,0 +1,37 @@
+from xosresource import XOSResource
+from service import XOSService
+from services.metronetwork.models import *
+
+class XOSMetroNetworkSystem(XOSResource):
+ provides = "tosca.nodes.MetroNetworkSystem"
+ xos_model = MetroNetworkSystem
+ copyin_props = ["name", "administrativeState", "restUrl"]
+
+class MetroNetworkDevice(XOSResource):
+ provides = "tosca.nodes.MetroNetworkDevice"
+ xos_model = NetworkDevice
+ copyin_props = ["id", "name", "administrativeState", "username", "password", "authType", "restCtrlUrl"]
+
+class VnodGlobalService(XOSService):
+ provides = "tosca.nodes.VNodGlobalService"
+ xos_model = VnodGlobalService
+ copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber"]
+
+ def get_xos_args(self):
+ args = super(VnodGlobalService, self).get_xos_args()
+
+ profile = self.get_requirement("tosca.relationships.UsesBandwidthProfile", throw_exception=False)
+ if profile:
+ profile = self.get_xos_object(BandwidthProfile, name=profile)
+ args["bandwidthProfile"] = profile
+ return args
+
+class XOSMetronetBandwithProficle(XOSResource):
+ provides = "tosca.nodes.EcordBandwidthProfile"
+ xos_model = BandwidthProfile
+ copyin_props = ['bwpcfgcbs','bwpcfgebs','bwpcfgcir','bwpcfgeir','name']
+
+class XOSMetronetUNI(XOSResource):
+ provides = "tosca.nodes.EcordUserNetworkInterface"
+ xos_model = UserNetworkInterface
+ copyin_props = ['enabled','capacity','bw_used','vlanIds', 'location', 'latlng', 'name']
\ No newline at end of file