Added support for invokers, non-docker runtime. Added ETREE and ELAN models, admin GUI, REST API and test domain

Change-Id: Iade143ba72f967390f0782a4e46e5aa289f9ffbb
diff --git a/xos/synchronizer/invokers/__init__.py b/xos/synchronizer/invokers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xos/synchronizer/invokers/__init__.py
diff --git a/xos/synchronizer/invokers/invoker.py b/xos/synchronizer/invokers/invoker.py
new file mode 100644
index 0000000..e645285
--- /dev/null
+++ b/xos/synchronizer/invokers/invoker.py
@@ -0,0 +1,25 @@
+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
new file mode 100644
index 0000000..786f99d
--- /dev/null
+++ b/xos/synchronizer/invokers/invokerfactory.py
@@ -0,0 +1,20 @@
+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
+
+
+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()
+        else:
+            return None
diff --git a/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py b/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py
new file mode 100644
index 0000000..ebc4d12
--- /dev/null
+++ b/xos/synchronizer/invokers/networkedgetoedgepointinvoker.py
@@ -0,0 +1,33 @@
+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
+        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
new file mode 100644
index 0000000..a0b7ffd
--- /dev/null
+++ b/xos/synchronizer/invokers/networkedgetomultipointinvoker.py
@@ -0,0 +1,45 @@
+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
+        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
+        #
+        #
+        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
new file mode 100644
index 0000000..78b617c
--- /dev/null
+++ b/xos/synchronizer/invokers/networkmultipointtomultipointinvoker.py
@@ -0,0 +1,42 @@
+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
+        #
+        #
+        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/manifest b/xos/synchronizer/manifest
index 3f33fbc..98cb0d9 100644
--- a/xos/synchronizer/manifest
+++ b/xos/synchronizer/manifest
@@ -6,6 +6,12 @@
 providers/providerfactory.py
 providers/__init__.py
 providers/metronetworkprovider.py
+invokers/invoker.py
+invokers/invokerfactory.py
+invokers/networkedgetoedgepointinvoker.py
+invokers/networkedgetomultipointinvoker.py
+invokers/networkmultipointtomultipointinvoker.py
+invokers/__init__.py
 run_devel.sh
 metronetwork-synchronizer-devel.py
 manifest
diff --git a/xos/synchronizer/providers/metronetworkprovider.py b/xos/synchronizer/providers/metronetworkprovider.py
index d36a384..c316815 100644
--- a/xos/synchronizer/providers/metronetworkprovider.py
+++ b/xos/synchronizer/providers/metronetworkprovider.py
@@ -26,11 +26,6 @@
         # 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
diff --git a/xos/synchronizer/providers/metronetworktestprovider.py b/xos/synchronizer/providers/metronetworktestprovider.py
index 48ee215..3c3f179 100644
--- a/xos/synchronizer/providers/metronetworktestprovider.py
+++ b/xos/synchronizer/providers/metronetworktestprovider.py
@@ -1,4 +1,5 @@
 import random
+import json
 
 from xos.logger import Logger, logging
 from services.metronetwork.models import *
@@ -13,7 +14,41 @@
 
     # 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
+        #
+        # Our Test Network Consists of three NetworkDevices (which correspond to ONOS instances):
+        #
+        #                    ONOS1-CORDPOD1
+        #                    ONOS2-MetroNetwork
+        #                    ONOW3-CORDPOD2
+        #
+        #
+        #    Uni-NetworkEdgePort3--
+        #    Uni-NetworkEdgePort11-
+        #    Uni-NetworkEdgePort5--ONOS1-CORDPOD1-NetworkPort6
+        #            NetworkPort4--                     |
+        #                                        NetworkPort1-ONOS2-MetroNetwork
+        #                                        NetworkPort2-
+        #                                             |
+        #    Uni-NetworkEdgePort7--ONOS3-CORDPOD2-NetworkPort10
+        #    Uni-NetworkEdgePort9--
+        #    Uni-NetworkEdgePort12-
+        #        NetworkPort8--
+        #
+        #  Note: NetworkPorts can be endpoints of Interlinks and NetworkPointToPointConnections
+        #              they can be seem as a simple port.
+        #        NetworkEdgePorts are UNIs in the network, so are specicially user facing.
+        #
+        #
+        # InterLinks - Port1 - Port6
+        #              Port2 - Port10
+        #
+        # NetworkPointToPointConnections: Port1 - Port2
+        #                                 Port4 - Port6
+        #                                 Port8 - Port10
+        #
+        # NetworkEdgeToEdgePointConnections: Port3 - Port7
+        #
+        # NetworkMultipointConnection: Port11 - Port5 - Port9 - Port12
 
         objs = []
 
@@ -21,108 +56,111 @@
         if self.networkdevice.id != 'TestMetroNet':
             return objs
 
-        # Ok - in the test class we cheat and create the adjunct NetworkDevices Devices
+        # Ok - in the test class we cheat and create one NetworkDevice with 8 NetworkEdgePorts
         device1 = NetworkDevice()
-        device1.id = 'TestCORD1Net'
+        device1.id = 'TestCORDNet'
         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"
+        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 = NetworkPort()
-        port2.element = self.networkdevice
-        port2.pid = self.networkdevice.id + "." + "of:000000001/2"
+        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)
 
-        # CORD POD1
-        cordpod1device = NetworkDevice()
-        cordpod1device.id = 'TestCORD1Net'
-
         port3 = NetworkEdgePort()
-        port3.element = cordpod1device
-        port3.pid = cordpod1device.id + "." + "of:000000001/1"
+        port3.element = device1
+        port3.pid = device1.id + "." + "of:000000001/3"
         port3.bwpCfgCbs = 1000000
         port3.bwpCfgEbs = 1000000
         port3.bwpCfgEir = 1000000
         port3.bwpCfgCir = 1000000
-        port3.bwpCfgCir = 1000000
+        port3.location = "Palo Alto"
+        port3.name = "Central Office 3"
+        port3.latlng = "[-122.143019, 37.441883]"
         objs.append(port3)
 
-        port4 = NetworkPort()
-        port4.element = cordpod1device
-        port4.pid = cordpod1device.id + "." + "of:000000001/2"
+        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)
 
-        # Internal Switch 3
         port5 = NetworkEdgePort()
-        port5.element = cordpod1device
-        port5.pid = cordpod1device.id + "." + "of:000000001/3"
+        port5.element = device1
+        port5.pid = device1.id + "." + "of:000000001/5"
         port5.bwpCfgCbs = 1000000
         port5.bwpCfgEbs = 1000000
         port5.bwpCfgEir = 1000000
         port5.bwpCfgCir = 1000000
-        port5.bwpCfgCir = 1000000
+        port5.location = "San Rafael"
+        port5.name = "Central Office 5"
+        port5.latlng = "[-122.531087, 37.973535]"
         objs.append(port5)
 
-        port6 = NetworkPort()
-        port6.element = cordpod1device
-        port6.capacity = 1000000000
-        port6.usedCapacity = 1000000000
-        port6.pid = cordpod1device.id + "." + "of:000000001/4"
+        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)
 
-        # CORD POD2
-        cordpod2device = NetworkDevice()
-        cordpod2device.id = 'TestCORD2Net'
-
         port7 = NetworkEdgePort()
-        port7.element = cordpod2device
-        port7.pid = cordpod2device.id + "." + "of:000000001/1"
+        port7.element = device1
+        port7.pid = device1.id + "." + "of:000000001/7"
         port7.bwpCfgCbs = 1000000
         port7.bwpCfgEbs = 1000000
         port7.bwpCfgEir = 1000000
         port7.bwpCfgCir = 1000000
-        port7.bwpCfgCir = 1000000
+        port7.location = "Hayward"
+        port7.name = "Central Office 7"
+        port7.latlng = "[-122.080796, 37.668821]"
         objs.append(port7)
 
-        port8 = NetworkPort()
-        port8.element = cordpod2device
-        port8.pid = cordpod2device.id + "." + "of:000000001/2"
+        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)
 
-        # 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):
@@ -140,95 +178,68 @@
 
         # Ok - in the test class we cheat and take down the adjunct Fake NetworkDevices Devices
         device1 = NetworkDevice()
-        device1.id = 'TestCORD1Net'
+        device1.id = 'TestCORDNet'
         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
+        # 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)
+        cordpod1device.id = 'TestCORDNet'
 
         # 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.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 = 'EdgePointToEdgePointConnectivity_1'
+        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)
+
+
         return objs
 
     def get_network_links_for_deletion(self):
diff --git a/xos/synchronizer/steps/sync_metronetworkservice.py b/xos/synchronizer/steps/sync_metronetworkservice.py
index 724bb9a..5c3fe70 100644
--- a/xos/synchronizer/steps/sync_metronetworkservice.py
+++ b/xos/synchronizer/steps/sync_metronetworkservice.py
@@ -5,6 +5,7 @@
 from services.metronetwork.models 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__), "..")
@@ -13,9 +14,9 @@
 logger = Logger(level=logging.INFO)
 
 
-class SyncMetroNetworkService(SyncStep):
-    provides = [MetroNetworkService]
-    observes = MetroNetworkService
+class SyncMetroNetworkSystem(SyncStep):
+    provides = [MetroNetworkSystem]
+    observes = MetroNetworkSystem
     requested_interval = 0
     initialized = False
 
@@ -35,18 +36,18 @@
 
         objs = []
 
-        # Get the NetworkService object - if it exists it will test us
+        # 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
 
-        metronetworkservice = self.get_metronetwork_service()
-        if not metronetworkservice:
+        metronetworksystem = self.get_metronetwork_system()
+        if not metronetworksystem:
             logger.debug("No Service configured")
             return objs
 
-        # Check to make sure the Service is enabled
-        metronetworkservice = self.get_metronetwork_service()
-        if metronetworkservice.administrativeState == 'disabled':
+        # 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
@@ -163,19 +164,33 @@
         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_service(self):
+    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
-        metronetworkservices = MetroNetworkService.get_service_objects().all()
-        if not metronetworkservices:
+        metronetworksystem = MetroNetworkSystem.objects.all()
+        if not metronetworksystem:
             return None
 
-        return metronetworkservices[0]
+        return metronetworksystem[0]