Nokia: Putting in support for metro network services within XOS for E-CORD

Change-Id: Idbc7e09ca53b0d9705d24bf1730fd9b05347a241
diff --git a/xos/admin.py b/xos/admin.py
new file mode 100644
index 0000000..f1fdddb
--- /dev/null
+++ b/xos/admin.py
@@ -0,0 +1,19 @@
+# admin.py - MetroNetworkService Django Admin
+
+from core.admin import ReadOnlyAwareAdmin
+from django.contrib import admin
+from services.metronetwork.models import *
+
+
+class MetroServiceAdmin(ReadOnlyAwareAdmin):
+    model = MetroNetworkService
+    verbose_name = "MetroNetwork Service"
+    verbose_name_plural = "MetroNetwork Services"
+    list_display = ("name", "administrativeState")
+    list_display_links = ('name',)
+    fieldsets = [(None, {
+        'fields': ['name', 'administrativeState', 'description'],
+        'classes': ['suit-tab suit-tab-general']})]
+
+
+admin.site.register(MetroNetworkService, MetroServiceAdmin)
diff --git a/xos/api/service/metronetworkservice.py b/xos/api/service/metronetworkservice.py
new file mode 100644
index 0000000..0a80034
--- /dev/null
+++ b/xos/api/service/metronetworkservice.py
@@ -0,0 +1,187 @@
+from rest_framework.response import Response
+from rest_framework import serializers, filters, status
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+from services.metronetwork.models import MetroNetworkService
+from core.models.netw import NetworkEdgePort, NetworkEdgeToEdgePointConnection
+from django.core.exceptions import ObjectDoesNotExist
+from django.core import serializers as jsonserializer
+
+class MetroNetworkServiceSerializer(PlusModelSerializer):
+        id = ReadOnlyField()
+        humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+
+        class Meta:
+            model = MetroNetworkService
+            fields = ('humanReadableName',
+                      'id',
+                      'restUrl',
+                      'administrativeState',
+                      'operationalState')
+
+        def getHumanReadableName(self, obj):
+            return obj.__unicode__()
+
+class MetroNetworkServiceViewSet(XOSViewSet):
+    base_name = "metronetworkservice"
+    method_name = "metronetworkservice/metronetwork"
+    method_kind = "viewset"
+    queryset = MetroNetworkService.get_service_objects().all()
+    serializer_class = MetroNetworkServiceSerializer
+
+    @classmethod
+    def get_urlpatterns(self, api_path="^"):
+        patterns = super(MetroNetworkServiceViewSet, 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 = "SCA_ETH_FPP_UNI_N"
+    method_name = "metronetworkservice/SCA_ETH_FPP_UNI_N"
+    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 = "SCA_ETH_FDFr_EC"
+    method_name = "metronetworkservice/SCA_ETH_FDFr_EC"
+    method_kind = "viewset"
+    queryset = NetworkEdgeToEdgePointConnection.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.type = validated_data.data.get('type')
+
+        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)
\ No newline at end of file
diff --git a/xos/make_synchronizer_manifest.sh b/xos/make_synchronizer_manifest.sh
new file mode 100755
index 0000000..4058982
--- /dev/null
+++ b/xos/make_synchronizer_manifest.sh
@@ -0,0 +1,2 @@
+#! /bin/bash
+find synchronizer -type f | cut -b 14- > synchronizer/manifest 
diff --git a/xos/metronetworkservice-onboard.yaml b/xos/metronetworkservice-onboard.yaml
new file mode 100644
index 0000000..b8a966d
--- /dev/null
+++ b/xos/metronetworkservice-onboard.yaml
@@ -0,0 +1,20 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the metronetwork service
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    metronetwork:
+      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.
+          models: models.py
+          admin: admin.py
+          rest_service: api/service/metronetworkservice.py
+          synchronizer: synchronizer/manifest
+          synchronizer_run: metronetworkervice-synchronizer.py
\ No newline at end of file
diff --git a/xos/models.py b/xos/models.py
new file mode 100644
index 0000000..2c68fab
--- /dev/null
+++ b/xos/models.py
@@ -0,0 +1,56 @@
+# models.py -  Metro Network Service
+
+from django.db import models
+from core.models import Service
+
+METRONETWORK_KIND = "metronetwork"
+SERVICE_NAME = 'metronetwork'
+SERVICE_NAME_VERBOSE = 'Metro Network Service'
+
+class MetroNetworkService(Service):
+
+    KIND = METRONETWORK_KIND
+
+    class Meta:
+        app_label = SERVICE_NAME
+        verbose_name = SERVICE_NAME_VERBOSE
+
+    ADMINISTRATIVE_STATE = (
+        ('enabled', 'Enabled'),
+        ('disabled', 'Disabled')
+    )
+
+    OPERATIONALSTATE = (
+        ('active', 'Active'),
+        ('inactive', 'Inactive')
+    )
+
+    restUrl = models.CharField(verbose_name="Rest URL",
+                               max_length=256,
+                               editable=True)
+
+    administrativeState = models.CharField(choices=ADMINISTRATIVE_STATE,
+                                           default='disabled',
+                                           verbose_name="AdministrativeState",
+                                           max_length=16,
+                                           editable=True)
+
+    operationalState = models.CharField(choices=OPERATIONALSTATE,
+                                        verbose_name="OperationalState",
+                                        max_length=256,
+                                        editable=True)
+
+    def __init__(self, *args, **kwargs):
+        super(MetroNetworkService, 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
\ No newline at end of file
diff --git a/xos/synchronizer/__init__.py b/xos/synchronizer/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/synchronizer/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
new file mode 100644
index 0000000..3f33fbc
--- /dev/null
+++ b/xos/synchronizer/manifest
@@ -0,0 +1,14 @@
+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
+run.sh
+metronetwork_synchronizer_config
diff --git a/xos/synchronizer/metronetwork-synchronizer-devel.py b/xos/synchronizer/metronetwork-synchronizer-devel.py
new file mode 100755
index 0000000..df697ec
--- /dev/null
+++ b/xos/synchronizer/metronetwork-synchronizer-devel.py
@@ -0,0 +1,13 @@
+#!/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/metronetwork-synchronizer.py b/xos/synchronizer/metronetwork-synchronizer.py
new file mode 100755
index 0000000..64d0b08
--- /dev/null
+++ b/xos/synchronizer/metronetwork-synchronizer.py
@@ -0,0 +1,12 @@
+#!/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(observer_path)
+mod = importlib.import_module("xos-synchronizer")
+mod.main()
diff --git a/xos/synchronizer/metronetwork_synchronizer_config b/xos/synchronizer/metronetwork_synchronizer_config
new file mode 100644
index 0000000..86847b9
--- /dev/null
+++ b/xos/synchronizer/metronetwork_synchronizer_config
@@ -0,0 +1,38 @@
+
+[plc]
+name=plc
+deployment=VICCI
+
+[db]
+name=xos
+user=postgres
+password=password
+host=localhost
+port=5432
+
+[api]
+host=128.112.171.237
+port=8000
+ssl_key=None
+ssl_cert=None
+ca_ssl_cert=None
+ratelimit_enabled=0
+omf_enabled=0
+mail_support_address=support@localhost
+nova_enabled=True
+
+[observer]
+name=metronetwork
+dependency_graph=/opt/xos/synchronizers/metronetwork/model-deps
+steps_dir=/opt/xos/synchronizers/metronetwork/steps
+sys_dir=/opt/xos/synchronizers/metronetwork/sys
+deleters_dir=/opt/xos/synchronizers/metronetwork/deleters
+log_file=console
+driver=None
+pretend=False
+backoff_disabled=True
+fofum_disabled=True
+
+[feefie]
+client_id='vicci_dev_central'
+user_id='pl'
diff --git a/xos/synchronizer/model-deps b/xos/synchronizer/model-deps
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/xos/synchronizer/model-deps
@@ -0,0 +1 @@
+{}
diff --git a/xos/synchronizer/providers/__init__.py b/xos/synchronizer/providers/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/synchronizer/providers/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/synchronizer/providers/metronetworkprovider.py b/xos/synchronizer/providers/metronetworkprovider.py
new file mode 100644
index 0000000..db651c3
--- /dev/null
+++ b/xos/synchronizer/providers/metronetworkprovider.py
@@ -0,0 +1,95 @@
+from xos.logger import Logger, logging
+from core.models.netw 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 = []
+        # ports = NetworkPort.objects.filter(networkdevice=self.networkdevice.id)
+        ports = NetworkPort.objects.all()
+        for port in ports:
+            objs.append(port)
+
+        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
new file mode 100644
index 0000000..fa9ef71
--- /dev/null
+++ b/xos/synchronizer/providers/metronetworkrestprovider.py
@@ -0,0 +1,232 @@
+from xos.logger import Logger, logging

+from core.models.netw 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_links(self):

+

+        objs = []

+

+        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():

+                id = evc['id']

+                evcServiceType = evc['evcServiceType']

+

+                if (evcServiceType == "Point_To_Point"):

+                    uni1 = evc['SCA_ETH_Flow_Points'][0]

+                    hostname = uni1['scaEthFppUniN']['transportPort']['Hostname']

+                    port = uni1['scaEthFppUniN']['transportPort']['Port']

+

+                    if 'interfaceCfgIngressBwp' in uni1['scaEthFppUniN']:

+                        bwpCfgCbs = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']

+                        bwpCfgEbs = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']

+                        bwpCfgCir = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']

+                        bwpCfgEir = uni1['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']

+

+                    edgePort1 = NetworkEdgePort()

+                    edgePort1.element = self.networkdevice

+                    edgePort1.pid = "{}.{}/{}".format(self.networkdevice.id, hostname, port)

+                    edgePort1.bwpCfgCbs = bwpCfgCbs

+                    edgePort1.bwpCfgEbs = bwpCfgEbs

+                    edgePort1.bwpCfgCir = bwpCfgCir

+                    edgePort1.bwpCfgEir = bwpCfgEir

+

+                    uni2 = evc['SCA_ETH_Flow_Points'][1]

+                    hostname = uni2['scaEthFppUniN']['transportPort']['Hostname']

+                    port = uni2['scaEthFppUniN']['transportPort']['Port']

+

+                    if 'interfaceCfgIngressBwp' in uni1['scaEthFppUniN']:

+                        bwpCfgCbs = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCbs']

+                        bwpCfgEbs = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEbs']

+                        bwpCfgCir = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgCir']

+                        bwpCfgEir = uni2['scaEthFppUniN']['interfaceCfgIngressBwp']['bwpCfgEir']

+

+                    edgePort2 = NetworkEdgePort()

+                    edgePort2.element = self.networkdevice

+                    edgePort2.pid = "{}.{}/{}".format(self.networkdevice.id, hostname, port)

+                    edgePort2.bwpCfgCbs = bwpCfgCbs

+                    edgePort2.bwpCfgEbs = bwpCfgEbs

+                    edgePort2.bwpCfgCir = bwpCfgCir

+                    edgePort2.bwpCfgEir = bwpCfgEir

+

+                edgeToEdgeConnectivity = NetworkEdgeToEdgePointConnection()

+                edgeToEdgeConnectivity.sid = id

+                edgeToEdgeConnectivity.type = evcServiceType

+                edgeToEdgeConnectivity.uni1 = edgePort1

+                edgeToEdgeConnectivity.uni2 = edgePort2

+                edgeToEdgeConnectivity.operstate = "active"

+                edgeToEdgeConnectivity.adminstate = "enabled"

+

+                objs.append(edgeToEdgeConnectivity)

+

+            return objs

+

+        else:

+            raise Exception("OnosApiError: get_network_links()")

+

+    def create_point_to_point_connectivity(self, obj):

+

+        restCtrlUrl = self.networkdevice.restCtrlUrl

+        username = self.networkdevice.username

+        password = self.networkdevice.password

+

+        evcServiceType = obj.type

+        # 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

+

+        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

+

+        data = {

+            "evcServiceType": evcServiceType,

+            "SCA_ETH_Flow_Points": [

+                {

+                    "scaEthFppUniN": {"transportPort": {"Hostname": uni1Hostname, "Port": uni1Port},

+                                      "interfaceCfgIngressBwp": {"bwpCfgCbs": uni1BwpCfgCbs,

+                                                                 "bwpCfgEbs": uni1BwpCfgEbs,

+                                                                 "bwpCfgCir": uni1BwpCfgCir,

+                                                                 "bwpCfgEir": uni1BwpCfgEir}}},

+                {

+                    "scaEthFppUniN": {"transportPort": {"Hostname": uni2Hostname, "Port": uni2Port},

+                                      "interfaceCfgIngressBwp": {"bwpCfgCbs": uni2BwpCfgCbs,

+                                                                 "bwpCfgEbs": uni2BwpCfgEbs,

+                                                                 "bwpCfgCir": uni2BwpCfgCir,

+                                                                 "bwpCfgEir": uni2BwpCfgEir}}}]

+        }

+

+        headers = {'Content-Type': 'application/json'}

+

+        resp = requests.post('{}/mef-sca-api/SCA_ETH_FDFr_EC'.format(restCtrlUrl),

+                             data=json.dumps(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_point_to_point_connectivity()")

+

+    def delete_point_to_point_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_point_to_point_connectivity()")

diff --git a/xos/synchronizer/providers/metronetworktestprovider.py b/xos/synchronizer/providers/metronetworktestprovider.py
new file mode 100644
index 0000000..b88427d
--- /dev/null
+++ b/xos/synchronizer/providers/metronetworktestprovider.py
@@ -0,0 +1,284 @@
+import random
+
+from xos.logger import Logger, logging
+from core.models.netw import *
+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 6 ports - two on each of three internal switches
+
+        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
+
+        # Ok - in the test class we cheat and create the adjunct NetworkDevices Devices
+        device1 = NetworkDevice()
+        device1.id = 'TestCORD1Net'
+        device1.administrativeState = 'enabled'
+        device1.restCtrlUrl = 'testCordPod1.onlab.net:8000'
+        device1.username = 'karaf'
+        device1.password = 'karaf'
+        objs.append(device1)
+
+        device2 = NetworkDevice()
+        device2.id = 'TestCORD2Net'
+        device2.administrativeState = 'enabled'
+        device2.restCtrlUrl = 'testCordPod2.onlabl.net:8000'
+        device2.username = 'karaf'
+        device2.password = 'karaf'
+        objs.append(device2)
+
+        # Ok - here we go creating ports - its 4 ports for each CORD Pod and 2 for MetroNetwork
+
+        # Metro Network Switch
+        port1 = NetworkPort()
+        port1.element = self.networkdevice
+        port1.pid = self.networkdevice.id + "." + "of:000000001/1"
+        objs.append(port1)
+
+        port2 = NetworkPort()
+        port2.element = self.networkdevice
+        port2.pid = self.networkdevice.id + "." + "of:000000001/2"
+        objs.append(port2)
+
+        # CORD POD1
+        cordpod1device = NetworkDevice()
+        cordpod1device.id = 'TestCORD1Net'
+
+        port3 = NetworkEdgePort()
+        port3.element = cordpod1device
+        port3.pid = cordpod1device.id + "." + "of:000000001/1"
+        port3.bwpCfgCbs = 1000000
+        port3.bwpCfgEbs = 1000000
+        port3.bwpCfgEir = 1000000
+        port3.bwpCfgCir = 1000000
+        port3.bwpCfgCir = 1000000
+        objs.append(port3)
+
+        port4 = NetworkPort()
+        port4.element = cordpod1device
+        port4.pid = cordpod1device.id + "." + "of:000000001/2"
+        objs.append(port4)
+
+        # Internal Switch 3
+        port5 = NetworkEdgePort()
+        port5.element = cordpod1device
+        port5.pid = cordpod1device.id + "." + "of:000000001/3"
+        port5.bwpCfgCbs = 1000000
+        port5.bwpCfgEbs = 1000000
+        port5.bwpCfgEir = 1000000
+        port5.bwpCfgCir = 1000000
+        port5.bwpCfgCir = 1000000
+        objs.append(port5)
+
+        port6 = NetworkPort()
+        port6.element = cordpod1device
+        port6.capacity = 1000000000
+        port6.usedCapacity = 1000000000
+        port6.pid = cordpod1device.id + "." + "of:000000001/4"
+        objs.append(port6)
+
+        # CORD POD2
+        cordpod2device = NetworkDevice()
+        cordpod2device.id = 'TestCORD2Net'
+
+        port7 = NetworkEdgePort()
+        port7.element = cordpod2device
+        port7.pid = cordpod2device.id + "." + "of:000000001/1"
+        port7.bwpCfgCbs = 1000000
+        port7.bwpCfgEbs = 1000000
+        port7.bwpCfgEir = 1000000
+        port7.bwpCfgCir = 1000000
+        port7.bwpCfgCir = 1000000
+        objs.append(port7)
+
+        port8 = NetworkPort()
+        port8.element = cordpod2device
+        port8.pid = cordpod2device.id + "." + "of:000000001/2"
+        objs.append(port8)
+
+        # Internal Switch 3
+        port9 = NetworkEdgePort()
+        port9.element = cordpod2device
+        port9.pid = cordpod2device.id + "." + "of:000000001/3"
+        port9.bwpCfgCbs = 1000000
+        port9.bwpCfgEbs = 1000000
+        port9.bwpCfgEir = 1000000
+        port9.bwpCfgCir = 1000000
+        port9.bwpCfgCir = 1000000
+        objs.append(port9)
+
+        port10 = NetworkPort()
+        port10.element = cordpod2device
+        port10.pid = cordpod2device.id + "." + "of:000000001/4"
+        objs.append(port10)
+
+        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)
+
+        # Ok - in the test class we cheat and take down the adjunct Fake NetworkDevices Devices
+        device1 = NetworkDevice()
+        device1.id = 'TestCORD1Net'
+        objs.append(device1)
+
+        device2 = NetworkDevice()
+        device2.id = 'TestCORD2Net'
+        objs.append(device2)
+
+        return objs
+
+    def get_network_links(self):
+
+        objs = []
+
+        # Metro Link Connectivity object - Point to Point
+        metronetconnectivity = NetworkPointToPointConnection()
+        port1 = NetworkPort()
+        port1.pid = self.networkdevice.id + "." + "of:000000001/1"
+        port2 = NetworkPort()
+        port2.pid = self.networkdevice.id + "." + "of:000000001/2"
+        metronetconnectivity.src = port1
+        metronetconnectivity.dest = port2
+        metronetconnectivity.type = 'direct'
+        metronetconnectivity.operstate = 'active'
+        metronetconnectivity.adminstate = 'enabled'
+        metronetconnectivity.sid = 'MetroNetworkPointToPointConnectivity_1'
+        objs.append(metronetconnectivity)
+
+        # CORDPOD1 Connectivity object - Point to Point
+        cordpod1device = NetworkDevice()
+        cordpod1device.id = 'TestCORD1Net'
+
+        cordpod1connectivity = NetworkPointToPointConnection()
+        port6 = NetworkPort()
+        port6.pid = cordpod1device.id + "." + "of:000000001/4"
+        port4 = NetworkPort()
+        port4.pid = cordpod1device.id + "." + "of:000000001/2"
+        cordpod1connectivity.src = port6
+        cordpod1connectivity.dest = port4
+        cordpod1connectivity.type = 'direct'
+        cordpod1connectivity.operstate = 'active'
+        cordpod1connectivity.adminstate = 'enabled'
+        cordpod1connectivity.sid = 'CordPod1PointToPointConnectivity_1'
+        objs.append(cordpod1connectivity)
+
+        # CORDPOD2 Connectivity object - Point to Point
+        cordpod2device = NetworkDevice()
+        cordpod2device.id = 'TestCORD2Net'
+
+        cordpod2connectivity = NetworkPointToPointConnection()
+        port8 = NetworkPort()
+        port8.pid = cordpod2device.id + "." + "of:000000001/2"
+        port10 = NetworkPort()
+        port10.pid = cordpod2device.id + "." + "of:000000001/4"
+        cordpod2connectivity.src = port10
+        cordpod2connectivity.dest = port8
+        cordpod2connectivity.type = 'direct'
+        cordpod2connectivity.operstate = 'active'
+        cordpod2connectivity.adminstate = 'enabled'
+        cordpod2connectivity.sid = 'CordPod2PointToPointConnectivity_1'
+        objs.append(cordpod2connectivity)
+
+        # InterLink object between CORDPOD1 and MetroNet
+        interlink1 = NetworkInterLink()
+        interlink1.src = port1
+        interlink1.dest = port6
+        interlink1.state = 'active'
+        objs.append(interlink1)
+
+        # InterLink object between CORDPOD2 and MetroNet
+        interlink2 = NetworkInterLink()
+        interlink2.src = port2
+        interlink2.dest = port10
+        interlink2.state = 'active'
+        objs.append(interlink2)
+
+        # Edge to Edge Point Connectivity Objects
+        edgetoedgeconnectivity = NetworkEdgeToEdgePointConnection()
+        port3 = NetworkEdgePort()
+        port3.pid = cordpod1device.id + "." + "of:000000001/1"
+        port7 = NetworkEdgePort()
+        port7.pid = cordpod2device.id + "." + "of:000000001/1"
+        edgetoedgeconnectivity.uni1 = port3
+        edgetoedgeconnectivity.uni2 = port7
+        edgetoedgeconnectivity.type = 'direct'
+        edgetoedgeconnectivity.operstate = 'active'
+        edgetoedgeconnectivity.adminstate = 'enabled'
+        edgetoedgeconnectivity.sid = 'EdgePointToEdgePointConnectivity_1'
+        objs.append(edgetoedgeconnectivity)
+
+        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
new file mode 100644
index 0000000..9ef6cb8
--- /dev/null
+++ b/xos/synchronizer/providers/providerfactory.py
@@ -0,0 +1,21 @@
+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.sh b/xos/synchronizer/run.sh
new file mode 100755
index 0000000..87b6b7d
--- /dev/null
+++ b/xos/synchronizer/run.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python metronetwork-synchronizer.py  -C $XOS_DIR/synchronizers/metronetwork/metronetwork_synchronizer_config
diff --git a/xos/synchronizer/run_devel.sh b/xos/synchronizer/run_devel.sh
new file mode 100755
index 0000000..1fc515d
--- /dev/null
+++ b/xos/synchronizer/run_devel.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python metronetwork-synchronizer-devel.py  -C $XOS_DIR/synchronizers/metronetwork/metronetwork_synchronizer_config
diff --git a/xos/synchronizer/steps/sync_metronetworkservice.py b/xos/synchronizer/steps/sync_metronetworkservice.py
new file mode 100644
index 0000000..3b5bf27
--- /dev/null
+++ b/xos/synchronizer/steps/sync_metronetworkservice.py
@@ -0,0 +1,182 @@
+import os
+import sys
+
+from synchronizers.base.syncstep import SyncStep
+from core.models.netw import *
+from services.metronetwork.models import MetroNetworkService
+from xos.logger import Logger, logging
+from synchronizers.metronetwork.providers.providerfactory import ProviderFactory
+
+# metronetwork will be in steps/..
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+logger = Logger(level=logging.INFO)
+
+
+class SyncMetroNetworkService(SyncStep):
+    provides = [MetroNetworkService]
+    observes = MetroNetworkService
+    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 NetworkService 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
+
+        metronetworkservice = self.get_metronetwork_service()
+        if not metronetworkservice:
+            logger.debug("No Service configured")
+            return objs
+
+        # Check to make sure the Service is enabled
+        metronetworkservice = self.get_metronetwork_service()
+        if metronetworkservice.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
+                activatereqs = NetworkEdgeToEdgePointConnection.objects.filter(adminstate='activationrequested')
+                for activatereq in activatereqs:
+
+                    # Call the XOS Interface to create the service
+                    logger.debug("Attempting to create EdgePointToEdgePointConnectivity: %s" % activatereq.id)
+                    if (provider.create_point_to_point_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
+                deactivatereqs = NetworkEdgeToEdgePointConnection.objects.filter(adminstate='deactivationrequested')
+                for deactivatereq in deactivatereqs:
+
+                    # Call the XOS Interface to delete the service
+                    logger.debug("Attempting to delete EdgePointToEdgePointConnectivity: %s" % deactivatereq.id)
+                    if provider.delete_point_to_point_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)
+
+        # In add cases return the objects we are interested in
+        return objs
+
+    def sync_record(self, o):
+        # Simply save the record to the DB - both updates and adds are handled the same way
+        o.save()
+
+    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_service(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
+        metronetworkservices = MetroNetworkService.get_service_objects().all()
+        if not metronetworkservices:
+            return None
+
+        return metronetworkservices[0]