SEBA-497 delayering, Makefile, and tox for fabric-crossconnect-synchronizer

Change-Id: Ibcf8fd06b9ad94d3f198887c18be7adfa4d5a954
diff --git a/xos/synchronizer/models/__init__.py b/xos/synchronizer/models/__init__.py
new file mode 100644
index 0000000..19d1424
--- /dev/null
+++ b/xos/synchronizer/models/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/xos/synchronizer/models/convenience/fabric_crossconnect_service.py b/xos/synchronizer/models/convenience/fabric_crossconnect_service.py
index c2bb8bf..863f40c 100644
--- a/xos/synchronizer/models/convenience/fabric_crossconnect_service.py
+++ b/xos/synchronizer/models/convenience/fabric_crossconnect_service.py
@@ -14,9 +14,10 @@
 # limitations under the License.
 
 
-from xosapi.orm import ORMWrapper, register_convenience_wrapper
+from xosapi.orm import register_convenience_wrapper
 from xosapi.convenience.service import ORMWrapperService
 
+
 class ORMWrapperFabricCrossconnectService(ORMWrapperService):
 
     """ Calling convention. Assume the subscribing service does approximately (needs some checks to see
@@ -45,9 +46,9 @@
             provider_service_instance = candidates[0]
         else:
             provider_service_instance = FabricCrossconnectServiceInstance(owner=self,
-                                                                        s_tag=s_tag,
-                                                                        switch_datapath_id=switch_datapath_id,
-                                                                        source_port=source_port)
+                                                                          s_tag=s_tag,
+                                                                          switch_datapath_id=switch_datapath_id,
+                                                                          source_port=source_port)
             provider_service_instance.save()
 
         # NOTE: Lack-of-atomicity vulnerability -- provider_service_instance could be deleted before we created the
@@ -77,7 +78,7 @@
             if link.provider_service_instance.owner.id == self.id:
                 fcsi = link.provider_service_instance.leaf_model
                 if (fcsi.s_tag == s_tag) and (fcsi.switch_datapath_id == switch_datapath_id) and \
-                    (fcsi.source_port == source_port):
+                        (fcsi.source_port == source_port):
                     matched.append(fcsi)
                 else:
                     link.delete()
@@ -91,7 +92,8 @@
         """
 
         s_tag = subscriber_si.get_westbound_service_instance_properties("s_tag", include_self=True)
-        switch_datapath_id = subscriber_si.get_westbound_service_instance_properties("switch_datapath_id", include_self=True)
+        switch_datapath_id = subscriber_si.get_westbound_service_instance_properties(
+            "switch_datapath_id", include_self=True)
         source_port = subscriber_si.get_westbound_service_instance_properties("switch_port", include_self=True)
 
         if (s_tag is None):
@@ -108,4 +110,5 @@
 
         return (s_tag, switch_datapath_id, source_port)
 
+
 register_convenience_wrapper("FabricCrossconnectService", ORMWrapperFabricCrossconnectService)
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 8c75a2e..13b56ed 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -16,14 +16,17 @@
 
 from models_decl import FabricCrossconnectService_decl, FabricCrossconnectServiceInstance_decl, BNGPortMapping_decl
 
+
 class FabricCrossconnectService(FabricCrossconnectService_decl):
     class Meta:
         proxy = True
 
+
 class FabricCrossconnectServiceInstance(FabricCrossconnectServiceInstance_decl):
-   class Meta:
+    class Meta:
         proxy = True
 
+
 class BNGPortMapping(BNGPortMapping_decl):
     class Meta:
         proxy = True
@@ -38,7 +41,7 @@
                     int(last.strip())
                 except ValueError:
                     raise XOSValidationError("Malformed range %s" % pattern)
-            elif this_range.lower()=="any":
+            elif this_range.lower() == "any":
                 pass
             else:
                 try:
@@ -50,4 +53,3 @@
         self.validate_range(self.s_tag)
 
         super(BNGPortMapping, self).save(*args, **kwargs)
-
diff --git a/xos/synchronizer/models/test_models.py b/xos/synchronizer/models/test_models.py
index 47b1bb2..25f83ed 100755
--- a/xos/synchronizer/models/test_models.py
+++ b/xos/synchronizer/models/test_models.py
@@ -13,20 +13,25 @@
 # limitations under the License.
 
 import unittest
-import os, sys
+import os
+import sys
 from mock import patch, Mock, MagicMock
 
-test_path=os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+test_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
 
 # mocking XOS exception, as they're based in Django
+
+
 class Exceptions:
     XOSValidationError = Exception
     XOSProgrammingError = Exception
     XOSPermissionDenied = Exception
 
+
 class XOS:
     exceptions = Exceptions
 
+
 class TestFabricCrossconnectModels(unittest.TestCase):
     def setUp(self):
 
@@ -40,7 +45,6 @@
         self.models_decl.BNGPortMapping_decl.objects = Mock()
         self.models_decl.BNGPortMapping_decl.objects.filter.return_value = []
 
-
         modules = {
             'xos': MagicMock(),
             'xos.exceptions': self.xos.exceptions,
@@ -115,5 +119,6 @@
 
         self.assertEqual(e.exception.message, 'Malformed range 123,')
 
+
 if __name__ == '__main__':
     unittest.main()