[CORD-2791] Rename Rename VOLTTenant in VOLTServiceInstance
Change-Id: I949f0d5975b6ddde35137dbb8c927b575f3b175f
diff --git a/xos/synchronizer/model_policies/model_policy_volttenant.py b/xos/synchronizer/model_policies/model_policy_voltserviceinstance.py
similarity index 81%
rename from xos/synchronizer/model_policies/model_policy_volttenant.py
rename to xos/synchronizer/model_policies/model_policy_voltserviceinstance.py
index a7da0bd..e807441 100644
--- a/xos/synchronizer/model_policies/model_policy_volttenant.py
+++ b/xos/synchronizer/model_policies/model_policy_voltserviceinstance.py
@@ -14,11 +14,11 @@
# limitations under the License.
-from synchronizers.new_base.modelaccessor import *
+from synchronizers.new_base.modelaccessor import VOLTServiceInstance, ServiceInstanceLink, VSGService, VSGServiceInstance, model_accessor
from synchronizers.new_base.policy import Policy
-class VOLTTenantPolicy(Policy):
- model_name = "VOLTTenant"
+class VOLTServiceInstancePolicy(Policy):
+ model_name = "VOLTServiceInstance"
def handle_create(self, tenant):
return self.handle_update(tenant)
@@ -28,7 +28,7 @@
if (tenant.link_deleted_count > 0) and (not tenant.provided_links.exists()):
# If this instance has no links pointing to it, delete
self.handle_delete(tenant)
- if VOLTTenant.objects.filter(id=tenant.id).exists():
+ if VOLTServiceInstance.objects.filter(id=tenant.id).exists():
tenant.delete()
return
@@ -53,7 +53,7 @@
if not vsgServices:
raise XOSConfigurationError("No VSG Services available")
- self.logger.info("MODEL_POLICY: volttenant %s creating vsg" % tenant)
+ self.logger.info("MODEL_POLICY: VOLTServiceInstance %s creating vsg" % tenant)
cur_vsg = VSGServiceInstance(owner=vsgServices[0])
cur_vsg.creator = tenant.creator
@@ -65,18 +65,18 @@
# Each VOLT object owns exactly one VCPE object
if tenant.deleted:
- self.logger.info("MODEL_POLICY: volttenant %s deleted, deleting vsg" % tenant)
+ self.logger.info("MODEL_POLICY: VOLTServiceInstance %s deleted, deleting vsg" % tenant)
return
cur_vsg = self.get_current_vsg(tenant)
# Check to see if the wrong s-tag is set. This can only happen if the
- # user changed the s-tag after the VoltTenant object was created.
+ # user changed the s-tag after the VOLTServiceInstance object was created.
if cur_vsg and cur_vsg.instance:
s_tags = Tag.objects.filter(content_type=cur_vsg.instance.self_content_type_id,
object_id=cur_vsg.instance.id, name="s_tag")
if s_tags and (s_tags[0].value != str(tenant.s_tag)):
- self.logger.info("MODEL_POLICY: volttenant %s s_tag changed, deleting vsg" % tenant)
+ self.logger.info("MODEL_POLICY: VOLTServiceInstance %s s_tag changed, deleting vsg" % tenant)
cur_vsg.delete()
cur_vsg = None
diff --git a/xos/synchronizer/model_policies/test_model_policy_volttenant.py b/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
similarity index 89%
rename from xos/synchronizer/model_policies/test_model_policy_volttenant.py
rename to xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
index 3e27dee..a8dfaea 100644
--- a/xos/synchronizer/model_policies/test_model_policy_volttenant.py
+++ b/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
@@ -39,9 +39,9 @@
return name
raise Exception("Unable to find service=%s xproto=%s" % (service_name, xproto_name))
-class TestModelPolicyVOLTTenant(unittest.TestCase):
+class TestModelPolicyVOLTServiceInstance(unittest.TestCase):
def setUp(self):
- global VOLTTenantPolicy, MockObjectList
+ global VOLTServiceInstancePolicy, MockObjectList
self.sys_path_save = sys.path
sys.path.append(xos_dir)
@@ -58,8 +58,8 @@
get_models_fn("../profiles/rcord", "rcord.xproto")])
import synchronizers.new_base.modelaccessor
- import model_policy_volttenant
- from model_policy_volttenant import VOLTTenantPolicy, model_accessor
+ import model_policy_voltserviceinstance
+ from model_policy_voltserviceinstance import VOLTServiceInstancePolicy, model_accessor
from mock_modelaccessor import MockObjectList
@@ -71,8 +71,8 @@
# tags. Ideally, this wouldn't happen, but it does. So make sure we reset the world.
model_accessor.reset_all_object_stores()
- self.policy = VOLTTenantPolicy()
- self.tenant = VOLTTenant(s_tag=111, c_tag=222, service_specific_id=1234)
+ self.policy = VOLTServiceInstancePolicy()
+ self.tenant = VOLTServiceInstance(s_tag=111, c_tag=222, service_specific_id=1234)
self.vsg_service = VSGService(name="the vsg service")
@@ -80,15 +80,15 @@
sys.path = self.sys_path_save
def test_handle_create(self):
- with patch.object(VOLTTenantPolicy, "manage_vsg") as manage_vsg, \
- patch.object(VOLTTenantPolicy, "cleanup_orphans") as cleanup_orphans:
+ with patch.object(VOLTServiceInstancePolicy, "manage_vsg") as manage_vsg, \
+ patch.object(VOLTServiceInstancePolicy, "cleanup_orphans") as cleanup_orphans:
self.policy.handle_create(self.tenant)
manage_vsg.assert_called_with(self.tenant)
cleanup_orphans.assert_called_with(self.tenant)
def test_manage_vsg(self):
- with patch.object(VOLTTenantPolicy, "get_current_vsg") as get_current_vsg, \
- patch.object(VOLTTenantPolicy, "create_vsg") as create_vsg, \
+ with patch.object(VOLTServiceInstancePolicy, "get_current_vsg") as get_current_vsg, \
+ patch.object(VOLTServiceInstancePolicy, "create_vsg") as create_vsg, \
patch.object(VSGService.objects, "get_items") as vsg_items:
vsg_items.return_value = [self.vsg_service]
diff --git a/xos/synchronizer/models/volt.xproto b/xos/synchronizer/models/volt.xproto
index f2cb16a..c103016 100644
--- a/xos/synchronizer/models/volt.xproto
+++ b/xos/synchronizer/models/volt.xproto
@@ -5,7 +5,7 @@
option kind = "vOLT";
}
-message VOLTTenant (ServiceInstance){
+message VOLTServiceInstance (ServiceInstance){
option kind = "vOLT";
option owner_class_name = "VOLTService";
option verbose_name = "vOLT Service Instance";
diff --git a/xos/synchronizer/volt_config.yaml b/xos/synchronizer/volt_config.yaml
index d348bb7..0dc7e6f 100644
--- a/xos/synchronizer/volt_config.yaml
+++ b/xos/synchronizer/volt_config.yaml
@@ -20,7 +20,7 @@
password: "@/opt/xos/services/volt/credentials/xosadmin@opencord.org"
required_models:
- VOLTService
- - VOLTTenant
+ - VOLTServiceInstance
- VSGService
- VSGServiceInstance
- ServiceInstanceLink