Storing backend handle to delete object
Change-Id: I0781e20796836e347514a0623f6315c42b378854
diff --git a/xos/synchronizer/steps/sync_volt_service_instance.py b/xos/synchronizer/steps/sync_volt_service_instance.py
index 11675a4..5ec0328 100644
--- a/xos/synchronizer/steps/sync_volt_service_instance.py
+++ b/xos/synchronizer/steps/sync_volt_service_instance.py
@@ -61,7 +61,9 @@
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/%s/%s" % (onos_voltha['url'], onos_voltha['port'], olt_device.dp_id, uni_port_id)
+ handle = "%s/%s" % (olt_device.dp_id, uni_port_id)
+
+ full_url = "%s:%d/onos/olt/oltapp/%s" % (onos_voltha['url'], onos_voltha['port'], handle)
log.info("Sending request to onos-voltha", url=full_url)
@@ -70,6 +72,9 @@
if request.status_code != 200:
raise Exception("Failed to add subscriber in onos-voltha: %s" % request.text)
+ o.backend_handle = handle
+ o.save(update_fields=["backend_handle"])
+
log.info("Added Subscriber in onos voltha", response=request.text)
def delete_record(self, o):
@@ -80,11 +85,7 @@
onos_voltha = Helpers.get_onos_voltha_info(volt_service)
onos_voltha_basic_auth = HTTPBasicAuth(onos_voltha['user'], onos_voltha['pass'])
- olt_device = o.onu_device.pon_port.olt_device
- # NOTE each ONU has only one UNI port!
- uni_port_id = o.onu_device.uni_ports.first().port_no
-
- full_url = "%s:%d/onos/olt/oltapp/%s/%s" % (onos_voltha['url'], onos_voltha['port'], olt_device.dp_id, uni_port_id)
+ full_url = "%s:%d/onos/olt/oltapp/%s" % (onos_voltha['url'], onos_voltha['port'], o.backend_handle)
request = requests.delete(full_url, auth=onos_voltha_basic_auth)