[SEBA-191] Updating the OLT app API

Change-Id: Ic5bb43e072104cf167642f0f57d98d909b2fa73a
diff --git a/Dockerfile.synchronizer b/Dockerfile.synchronizer
index ee05aa6..4f64e57 100644
--- a/Dockerfile.synchronizer
+++ b/Dockerfile.synchronizer
@@ -12,9 +12,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# docker build -t xosproject/volt-synchronizer:candidate -f Dockerfile.synchronizer .
+
 # xosproject/volt-synchronizer
 
-FROM xosproject/xos-synchronizer-base:2.0.0
+FROM xosproject/xos-synchronizer-base:master
 
 COPY xos/synchronizer /opt/xos/synchronizers/volt
 COPY VERSION /opt/xos/synchronizers/volt/
diff --git a/xos/synchronizer/config.yaml b/xos/synchronizer/config.yaml
index 8a1a51e..f83dfa5 100644
--- a/xos/synchronizer/config.yaml
+++ b/xos/synchronizer/config.yaml
@@ -25,7 +25,6 @@
 models_dir: "/opt/xos/synchronizers/volt/models"
 steps_dir: "/opt/xos/synchronizers/volt/steps"
 pull_steps_dir: "/opt/xos/synchronizers/volt/pull_steps"
-event_steps_dir: "/opt/xos/synchronizers/volt/event_steps"
 logging:
   version: 1
   handlers:
diff --git a/xos/synchronizer/steps/sync_volt_service_instance.py b/xos/synchronizer/steps/sync_volt_service_instance.py
index 10091cf..11675a4 100644
--- a/xos/synchronizer/steps/sync_volt_service_instance.py
+++ b/xos/synchronizer/steps/sync_volt_service_instance.py
@@ -36,16 +36,10 @@
         if o.policy_code != 1:
             raise DeferredException("Waiting for ModelPolicy to complete")
 
-
         volt_service = VOLTService.objects.get(id=o.owner_id)
 
-        si = ServiceInstance.objects.get(id=o.id)
-
         log.info("Synching OLTServiceInstance", object=str(o), **o.tologdict())
 
-        c_tag = si.get_westbound_service_instance_properties("c_tag")
-        s_tag = si.get_westbound_service_instance_properties("s_tag")
-
         olt_device = o.onu_device.pon_port.olt_device
 
         try:
@@ -59,27 +53,19 @@
             raise DeferredException("Waiting for OLTDevice %s to be synchronized" % olt_device.name)
 
         log.debug("Adding subscriber with info",
-                 c_tag = c_tag,
-                 s_tag = s_tag,
                  uni_port_id = uni_port_id,
-                 dp_id = olt_device.dp_id)
+                 dp_id = olt_device.dp_id
+        )
 
         # Send request to ONOS
         onos_voltha = Helpers.get_onos_voltha_info(volt_service)
         onos_voltha_basic_auth = HTTPBasicAuth(onos_voltha['user'], onos_voltha['pass'])
 
-        full_url = "%s:%d/onos/olt/oltapp/subscribers" % (onos_voltha['url'], onos_voltha['port'])
+        full_url = "%s:%d/onos/olt/oltapp/%s/%s" % (onos_voltha['url'], onos_voltha['port'], olt_device.dp_id, uni_port_id)
 
-        data = {
-            "deviceId" : olt_device.dp_id,
-            "port" : uni_port_id,
-            "sVlan" : s_tag,
-            "cVlan" : c_tag
-        }
+        log.info("Sending request to onos-voltha", url=full_url)
 
-        log.info("Sending request to onos-voltha", url=full_url, data=data)
-
-        request = requests.post(full_url, auth=onos_voltha_basic_auth, json=data)
+        request = requests.post(full_url, auth=onos_voltha_basic_auth)
 
         if request.status_code != 200:
             raise Exception("Failed to add subscriber in onos-voltha: %s" % request.text)
diff --git a/xos/synchronizer/steps/test_sync_volt_service_instance.py b/xos/synchronizer/steps/test_sync_volt_service_instance.py
index d7877f6..1f9505d 100644
--- a/xos/synchronizer/steps/test_sync_volt_service_instance.py
+++ b/xos/synchronizer/steps/test_sync_volt_service_instance.py
@@ -41,15 +41,6 @@
     raise Exception("Unable to find service=%s xproto=%s" % (service_name, xproto_name))
 # END generate model from xproto
 
-def mock_get_westbound_service_instance_properties(prop):
-    return prop
-
-def match_json(desired, req):
-    if desired!=req.json():
-        raise Exception("Got request %s, but body is not matching" % req.url)
-        return False
-    return True
-
 class TestSyncVOLTServiceInstance(unittest.TestCase):
     def setUp(self):
         global DeferredException
@@ -89,9 +80,6 @@
         volt_service.onos_voltha_user = "onos_voltha_user"
         volt_service.onos_voltha_pass = "onos_voltha_pass"
 
-        si = Mock()
-        si.get_westbound_service_instance_properties = mock_get_westbound_service_instance_properties
-
         uni_port = Mock()
         uni_port.port_no = "uni_port_id"
 
@@ -110,7 +98,6 @@
         o.tologdict.return_value = {}
 
         self.o = o
-        self.si = si
         self.onu_device = onu_device
         self.volt_service = volt_service
 
@@ -122,9 +109,7 @@
     def test_do_not_sync(self, m):
         self.onu_device.pon_port.olt_device.dp_id = None
 
-        with patch.object(ServiceInstance.objects, "get") as service_instance_mock, \
-                patch.object(VOLTService.objects, "get") as olt_service_mock:
-            service_instance_mock.return_value = self.si
+        with patch.object(VOLTService.objects, "get") as olt_service_mock:
             olt_service_mock.return_value = self.volt_service
 
             with self.assertRaises(DeferredException) as e:
@@ -137,19 +122,10 @@
     def test_do_sync(self, m):
 
         self.onu_device.pon_port.olt_device.dp_id = "of:dp_id"
-        
-        expected_conf = {
-            "deviceId" : "of:dp_id",
-            "port" : "uni_port_id",
-            "sVlan" : "s_tag",
-            "cVlan" : "c_tag"
-        }
 
-        m.post("http://onos_voltha_url:4321/onos/olt/oltapp/subscribers", status_code=200, json={}, additional_matcher=functools.partial(match_json, expected_conf))
+        m.post("http://onos_voltha_url:4321/onos/olt/oltapp/of:dp_id/uni_port_id", status_code=200, json={})
 
-        with patch.object(ServiceInstance.objects, "get") as service_instance_mock, \
-                patch.object(VOLTService.objects, "get") as olt_service_mock:
-            service_instance_mock.return_value = self.si
+        with patch.object(VOLTService.objects, "get") as olt_service_mock:
             olt_service_mock.return_value = self.volt_service
 
             self.sync_step().sync_record(self.o)
@@ -158,20 +134,11 @@
     @requests_mock.Mocker()
     def test_do_sync_fail(self, m):
 
-        expected_conf = {
-            "deviceId" : "of:dp_id",
-            "port" : "uni_port_id",
-            "sVlan" : "s_tag",
-            "cVlan" : "c_tag"
-        }
-
-        m.post("http://onos_voltha_url:4321/onos/olt/oltapp/subscribers", status_code=500, text="Mock Error", additional_matcher=functools.partial(match_json, expected_conf))
+        m.post("http://onos_voltha_url:4321/onos/olt/oltapp/of:dp_id/uni_port_id", status_code=500, text="Mock Error")
 
         self.onu_device.pon_port.olt_device.dp_id = "of:dp_id"
 
-        with patch.object(ServiceInstance.objects, "get") as service_instance_mock, \
-                patch.object(VOLTService.objects, "get") as olt_service_mock:
-            service_instance_mock.return_value = self.si
+        with patch.object(VOLTService.objects, "get") as olt_service_mock:
             olt_service_mock.return_value = self.volt_service
 
             with self.assertRaises(Exception) as e: