CORD-2865 get creator from subscriber object
Change-Id: I51bc8841ff1802949336849c79366cf10993ca4b
diff --git a/xos/synchronizer/model_policies/model_policy_vsgserviceinstance.py b/xos/synchronizer/model_policies/model_policy_vsgserviceinstance.py
index 050093f..6800e81 100644
--- a/xos/synchronizer/model_policies/model_policy_vsgserviceinstance.py
+++ b/xos/synchronizer/model_policies/model_policy_vsgserviceinstance.py
@@ -106,14 +106,17 @@
assert (slice is not None)
assert (node is not None)
assert (desired_image is not None)
- assert (service_instance.creator is not None)
assert (node.site_deployment.deployment is not None)
assert (desired_image is not None)
+ assert(service_instance.volt)
+ assert(service_instance.volt.subscriber)
+ assert(service_instance.volt.subscriber.creator)
+
instance = Instance(slice=slice,
node=node,
image=desired_image,
- creator=service_instance.creator,
+ creator=service_instance.volt.subscriber.creator,
deployment=node.site_deployment.deployment,
flavor=flavors[0],
isolation=slice.default_isolation,
diff --git a/xos/synchronizer/model_policies/test_model_policy_vsgserviceinstance.py b/xos/synchronizer/model_policies/test_model_policy_vsgserviceinstance.py
index 99cdd94..5dd860d 100644
--- a/xos/synchronizer/model_policies/test_model_policy_vsgserviceinstance.py
+++ b/xos/synchronizer/model_policies/test_model_policy_vsgserviceinstance.py
@@ -79,7 +79,7 @@
self.policy = VSGServiceInstancePolicy()
self.tenant = VSGServiceInstance()
self.user = User(email="testadmin@test.org")
- self.tenant = VSGServiceInstance(creator=self.user, id=1)
+ self.tenant = VSGServiceInstance(id=1)
self.flavor = Flavor(name="m1.small")
self.npt_ctag = NetworkParameterType(name="c_tag", id=1)
self.npt_stag = NetworkParameterType(name="s_tag", id=2)
@@ -378,7 +378,6 @@
# make sure Instance was created
self.assertNotEqual(instance, None)
- self.assertEqual(instance.creator.email, "testadmin@test.org")
self.assertEqual(instance.image.name, "trusty-server-multi-nic")
self.assertEqual(instance.flavor.name, "m1.small")
self.assertEqual(instance.isolation, "vm")
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
deleted file mode 100644
index 108de2f..0000000
--- a/xos/synchronizer/models/models.py
+++ /dev/null
@@ -1,41 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from xos.exceptions import *
-from models_decl import *
-
-class VSGServiceInstance(VSGServiceInstance_decl):
- class Meta:
- proxy = True
-
- def __init__(self, *args, **kwargs):
- super(VSGServiceInstance, self).__init__(*args, **kwargs)
-
- def save(self, *args, **kwargs):
- if not self.creator:
- if not getattr(self, "caller", None):
- # caller must be set when creating a vCPE since it creates a slice
- raise XOSProgrammingError("VSGServiceInstance's self.caller was not set")
- self.creator = self.caller
- if not self.creator:
- raise XOSProgrammingError("VSGServiceInstance's self.creator was not set")
-
- super(VSGServiceInstance, self).save(*args, **kwargs)
-
-class VSGService(VSGService_decl):
- class Meta:
- proxy = True
-
- pass
diff --git a/xos/synchronizer/models/vsg.xproto b/xos/synchronizer/models/vsg.xproto
index 06584b0..4540f78 100644
--- a/xos/synchronizer/models/vsg.xproto
+++ b/xos/synchronizer/models/vsg.xproto
@@ -1,7 +1,6 @@
option name = "vsg";
option app_label = "vsg";
option kind = "vCPE";
-option legacy="True";
message VSGService (Service){
option verbose_name = "vSG Service";
diff --git a/xos/synchronizer/steps/test_sync_vsgserviceinstance.py b/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
index 31f3674..36f8307 100644
--- a/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
+++ b/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
@@ -99,8 +99,7 @@
"url_filter_level", "cdn_enable", "uplink_speed",
"downlink_speed", "enable_uverse", "status"])
self.volt = MagicMock(s_tag=111, c_tag=222, subscriber=self.subscriber)
- self.tenant = VSGServiceInstance(creator=self.user,
- id=401,
+ self.tenant = VSGServiceInstance(id=401,
volt=self.volt,
owner=self.service,
wan_container_ip="10.7.1.3",