fix get_onos_service
Change-Id: Ic4aa3a19fcff2c9372f1042f3be40ee6ae3fa607
diff --git a/xos/synchronizer/steps/sync_tenant.py b/xos/synchronizer/steps/sync_tenant.py
index a0e6cdb..02fa9b9 100644
--- a/xos/synchronizer/steps/sync_tenant.py
+++ b/xos/synchronizer/steps/sync_tenant.py
@@ -29,13 +29,15 @@
SyncStep.__init__(self, **args)
def get_vtn_onos_service(self):
+ from services.onos.models import ONOSService
+
# vtn_tenant = Tenant.objects.filter(name="VTN_ONOS_app") # XXX fixme - hardcoded
# if not vtn_tenant:
# raise "No VTN Onos App found"
# vtn_tenant = vtn_tenant[0]
#
# vtn_service = vtn_tenant.provider_service
- vtn_service = Service.objects.filter(name="service_ONOS_VTN") # XXX fixme - harcoded
+ vtn_service = ONOSService.get_service_objects().filter(name="ONOS_CORD") # XXX fixme - harcoded
if not vtn_service:
raise "No VTN Onos Service"
@@ -44,6 +46,9 @@
def get_vtn_addr(self):
vtn_service = self.get_vtn_onos_service()
+ if vtn_service.rest_hostname:
+ return vtn_service.rest_hostname
+
if not vtn_service.slices.exists():
raise "VTN Service has no slices"