SEBA-455 eliminate synchronizer service dependency code

Change-Id: Ia939069a593e869a774a3c5b269aaeaba8245ba8
diff --git a/VERSION b/VERSION
index 80e3d81..693a232 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-2.1.40
+2.1.41
 
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index f9e0a87..cc83a90 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.40
+FROM xosproject/xos-base:2.1.41
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 7a9b45b..1a9a4eb 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.40
+FROM xosproject/xos-libraries:2.1.41
 
 # Install XOS client
 COPY lib/xos-api /tmp/xos-api
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index ae63707..13e555d 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-libraries
-FROM xosproject/xos-base:2.1.40
+FROM xosproject/xos-base:2.1.41
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index 86b1d87..397de0d 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.40
+FROM xosproject/xos-client:2.1.41
 
 COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
 COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index f96146f..dbf8fab 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.40
+FROM xosproject/xos-libraries:2.1.41
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/lib/xos-synchronizer/xossynchronizer/event_loop.py b/lib/xos-synchronizer/xossynchronizer/event_loop.py
index bdff10b..6df3fab 100644
--- a/lib/xos-synchronizer/xossynchronizer/event_loop.py
+++ b/lib/xos-synchronizer/xossynchronizer/event_loop.py
@@ -113,7 +113,7 @@
             # src_port is the field that accesses Model2 from Model1
             # dst_port is the field that accesses Model1 from Model2
             static_dependencies = json.loads(dep_graph_str)
-            dynamic_dependencies = self.compute_service_dependencies()
+            dynamic_dependencies = []  # Dropped Service and ServiceInstance dynamic dependencies
 
             joint_dependencies = dict(
                 static_dependencies.items() + dynamic_dependencies
@@ -402,75 +402,6 @@
             self.reset_model_accessor()
             self.model_accessor.connection_close()
 
-    def tenant_class_name_from_service(self, service_name):
-        """ This code supports legacy functionality. To be cleaned up. """
-        name1 = service_name + "Instance"
-        if hasattr(self.model_accessor.Slice().stub, name1):
-            return name1
-        else:
-            name2 = service_name.replace("Service", "Tenant")
-            if hasattr(self.model_accessor.Slice().stub, name2):
-                return name2
-            else:
-                return None
-
-    def compute_service_dependencies(self):
-        """ FIXME: Implement more cleanly via xproto """
-
-        model_names = self.model_to_step.keys()
-        ugly_tuples = [
-            (m, m.replace("Instance", "").replace("Tenant", "Service"))
-            for m in model_names
-            if m.endswith("ServiceInstance") or m.endswith("Tenant")
-        ]
-        ugly_rtuples = [(v, k) for k, v in ugly_tuples]
-
-        ugly_map = dict(ugly_tuples)
-        ugly_rmap = dict(ugly_rtuples)
-
-        s_model_names = [v for k, v in ugly_tuples]
-        s_models0 = [
-            getattr(self.model_accessor.Slice().stub, model_name, None) for model_name in s_model_names
-        ]
-        s_models1 = [model.objects.first() for model in s_models0]
-        s_models = [m for m in s_models1 if m is not None]
-
-        dependencies = []
-        for model in s_models:
-            deps = self.model_accessor.ServiceDependency.objects.filter(subscriber_service_id=model.id)
-            if deps:
-                services = [
-                    self.tenant_class_name_from_service(
-                        d.provider_service.leaf_model_name
-                    )
-                    for d in deps
-                ]
-                dependencies.append(
-                    (ugly_rmap[model.leaf_model_name], [(s, "", "") for s in services])
-                )
-
-        return dependencies
-
-    def compute_service_instance_dependencies(self, objects):
-        link_set = [
-            self.model_accessor.ServiceInstanceLink.objects.filter(subscriber_service_instance_id=o.id)
-            for o in objects
-        ]
-
-        dependencies = [
-            (l.provider_service_instance, l.subscriber_service_instance)
-            for links in link_set
-            for l in links
-        ]
-        providers = []
-
-        for p, s in dependencies:
-            if not p.enacted or p.enacted < p.updated:
-                p.dependent = s
-                providers.append(p)
-
-        return providers
-
     def run(self):
         # Cleanup: Move self.driver into a synchronizer context
         # made available to every sync step.
@@ -512,15 +443,7 @@
                     step.log = self.log.new(step=step)
                     obj.synchronizer_step = step
 
-                pending_service_dependencies = self.compute_service_instance_dependencies(
-                    pending
-                )
-
-                for obj in pending_service_dependencies:
-                    obj.synchronizer_step = None
-
                 pending_objects.extend(pending)
-                pending_objects.extend(pending_service_dependencies)
             else:
                 # Support old and broken legacy synchronizers
                 # This needs to be dropped soon.