CORD-1250 Update to new Service/Tenancy models
Change-Id: I0e7d7de2a2fb41066af14e7ac54d618b1d76dbee
diff --git a/xos/synchronizer/steps/sync_onos_netcfg.py b/xos/synchronizer/steps/sync_onos_netcfg.py
index 10f1c84..8156a20 100644
--- a/xos/synchronizer/steps/sync_onos_netcfg.py
+++ b/xos/synchronizer/steps/sync_onos_netcfg.py
@@ -35,15 +35,15 @@
def get_tenants_who_want_config(self):
tenants = []
# attribute is comma-separated list
- for ta in TenantAttribute.objects.filter(name="autogenerate"):
+ for ta in ServiceInstanceAttribute.objects.filter(name="autogenerate"):
if ta.value:
for config in ta.value.split(','):
if config == "vtn-network-cfg":
- tenants.append(ta.tenant)
+ tenants.append(ta.service_instance)
return tenants
def save_tenant_attribute(self, tenant, name, value):
- tas = TenantAttribute.objects.filter(tenant_id=tenant.id, name=name)
+ tas = ServiceInstanceAttribute.objects.filter(service_instance_id=tenant.id, name=name)
if tas:
ta = tas[0]
if ta.value != value:
@@ -52,7 +52,7 @@
ta.save()
else:
logger.info("saving autogenerated config %s" % name)
- ta = model_accessor.create_obj(TenantAttribute, tenant=tenant, name=name, value=value)
+ ta = model_accessor.create_obj(ServiceInstanceAttribute, service_instance=tenant, name=name, value=value)
ta.save()
# This function currently assumes a single Deployment and Site
diff --git a/xos/synchronizer/vtnnetport.py b/xos/synchronizer/vtnnetport.py
index e1c15bb..bef9b37 100644
--- a/xos/synchronizer/vtnnetport.py
+++ b/xos/synchronizer/vtnnetport.py
@@ -65,10 +65,10 @@
return []
nets=[]
- for tenant in service.subscribed_tenants.all():
- if tenant.provider_service:
- bidirectional = tenant.connect_method!="private-unidirectional"
- for net in tenant.provider_service.get_composable_networks():
+ for dep in service.subscribed_dependencies.all():
+ if dep.provider_service:
+ bidirectional = dep.connect_method!="private-unidirectional"
+ for net in dep.provider_service.get_composable_networks():
if not net.controllernetworks.exists():
continue
@@ -90,10 +90,10 @@
return []
nets=[]
- for tenant in service.provided_tenants.all():
- if tenant.subscriber_service:
- bidirectional = tenant.connect_method!="private-unidirectional"
- for net in tenant.subscriber_service.get_composable_networks():
+ for dep in service.provided_dependencies.all():
+ if dep.subscriber_service:
+ bidirectional = dep.connect_method!="private-unidirectional"
+ for net in dep.subscriber_service.get_composable_networks():
if not net.controllernetworks.exists():
continue