CORD-1908 VSGTenant renamed to VSGServiceInstance
Change-Id: I9f211a5d411365b8388f8310cdb17d0b454407ba
diff --git a/xos/xos_client/xosapi/convenience/service.py b/xos/xos_client/xosapi/convenience/service.py
index 28cec65..4220f91 100644
--- a/xos/xos_client/xosapi/convenience/service.py
+++ b/xos/xos_client/xosapi/convenience/service.py
@@ -26,7 +26,7 @@
return attrs
def get_composable_networks(self):
- SUPPORTED_VTN_SERVCOMP_KINDS = ['VSG','PRIVATE']
+ SUPPORTED_VTN_SERVCOMP_KINDS = ['VSG','PRIVATE']
nets = []
for slice in self.slices.all():
@@ -39,4 +39,14 @@
nets.append(net)
return nets
+ def get_service_instance_class_name(self):
+ # This assumes that a ServiceInstance is always named after its service. For example
+ # VSGService --> VSGServiceInstance. Services in which this is not the case should override this method.
+ # TODO: Specify via xproto ?
+ return self.leaf_model_name + "Instance"
+
+ def get_service_instance_class(self):
+ return getattr(self.stub, self.get_service_instance_class_name)
+
+
register_convenience_wrapper("Service", ORMWrapperService)
diff --git a/xos/xos_client/xosapi/convenience/volttenant.py b/xos/xos_client/xosapi/convenience/volttenant.py
index 38b1f8e..54b7e12 100644
--- a/xos/xos_client/xosapi/convenience/volttenant.py
+++ b/xos/xos_client/xosapi/convenience/volttenant.py
@@ -18,15 +18,20 @@
class ORMWrapperVOLTTenant(ORMWrapper):
@property
- def vcpe(self):
+ def vsg(self):
links = self.stub.ServiceInstanceLink.objects.filter(subscriber_service_instance_id = self.id)
for link in links:
# cast from ServiceInstance to VSGTenant
- vsgs = self.stub.VSGTenant.objects.filter(id = link.provider_service_instance.id)
+ vsgs = self.stub.VSGServiceInstance.objects.filter(id = link.provider_service_instance.id)
if vsgs:
return vsgs[0]
return None
+ # DEPRECATED
+ @property
+ def vcpe(self):
+ return self.vsg
+
@property
def subscriber(self):
links = self.stub.ServiceInstanceLink.objects.filter(provider_service_instance_id = self.id)
diff --git a/xos/xos_client/xosapi/convenience/vsgtenant.py b/xos/xos_client/xosapi/convenience/vsgserviceinstance.py
similarity index 94%
rename from xos/xos_client/xosapi/convenience/vsgtenant.py
rename to xos/xos_client/xosapi/convenience/vsgserviceinstance.py
index 2f91d14..26bf0bc 100644
--- a/xos/xos_client/xosapi/convenience/vsgtenant.py
+++ b/xos/xos_client/xosapi/convenience/vsgserviceinstance.py
@@ -16,7 +16,7 @@
from xosapi.orm import ORMWrapper, register_convenience_wrapper
-class ORMWrapperVSGTenant(ORMWrapper):
+class ORMWrapperVSGServiceInstance(ORMWrapper):
sync_attributes = ("wan_container_ip", "wan_container_mac", "wan_container_netbits",
"wan_container_gateway_ip", "wan_container_gateway_mac",
"wan_vm_ip", "wan_vm_mac")
@@ -100,4 +100,5 @@
raise Exception("no vm_vrouter_tenant tag for instance %s" % self.instance)
-register_convenience_wrapper("VSGTenant", ORMWrapperVSGTenant)
+register_convenience_wrapper("VSGTenant", ORMWrapperVSGServiceInstance) # DEPRECATED
+register_convenience_wrapper("VSGServiceInstance", ORMWrapperVSGServiceInstance)
diff --git a/xos/xos_client/xosapi/orm.py b/xos/xos_client/xosapi/orm.py
index 84abb3e..ed84f6e 100644
--- a/xos/xos_client/xosapi/orm.py
+++ b/xos/xos_client/xosapi/orm.py
@@ -535,7 +535,7 @@
import convenience.instance
import convenience.cordsubscriberroot
import convenience.volttenant
-import convenience.vsgtenant
+import convenience.vsgserviceinstance
import convenience.vrouterservice
import convenience.vroutertenant
import convenience.vrouterapp