diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2019-04-24 09:42:36 +0800 |
---|---|---|
committer | maopengzhang <zhang.maopeng1@zte.com.cn> | 2019-04-24 09:42:36 +0800 |
commit | 5481ebacbbd2e37a8f1524e6f196aaaccec4f460 (patch) | |
tree | 229255aa2cbf6ed8dbdae56591556b266cfafadb | |
parent | 275df924b7dcd5d2ee8a3fca100bd1e55cd573c6 (diff) |
move scale aspect test json
move scale aspect test json files to independant files
Change-Id: If34db0fbe032f881752e264232ea75ae7b89777f
Issue-ID: VFC-1241
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r-- | lcm/ns/tests/test_scaleaspect.py | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/lcm/ns/tests/test_scaleaspect.py b/lcm/ns/tests/test_scaleaspect.py index a235c9d3..a1f9dda9 100644 --- a/lcm/ns/tests/test_scaleaspect.py +++ b/lcm/ns/tests/test_scaleaspect.py @@ -12,20 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import os - from django.test import TestCase - -from lcm.ns.biz.scaleaspect import get_json_data from lcm.pub.database.models import NSInstModel from lcm.pub.database.models import NfInstModel from lcm.pub.utils.timeutil import now_time +from lcm.pub.utils import fileutil class TestScaleAspect(TestCase): def setUp(self): - self.init_scaling_map_json() + self.cur_path = os.path.dirname(os.path.abspath(__file__)) + self.scaling_map_json = fileutil.read_json_file(self.cur_path + '/data/scalemapping.json') + self.vnfd_model_json = fileutil.read_json_file(self.cur_path + '/data/vnfd_model.json') self.initInstModel() self.init_scale_ns_data() @@ -69,14 +70,6 @@ class TestScaleAspect(TestCase): ] }] - def init_scaling_map_json(self): - curdir_path = os.path.dirname( - os.path.dirname( - os.path.dirname( - os.path.abspath(__file__)))) - filename = curdir_path + "/ns/data/scalemapping.json" - self.scaling_map_json = get_json_data(filename) - def initInstModel(self): self.nsd_id = "23" self.ns_inst_id = "1" @@ -118,11 +111,7 @@ class TestScaleAspect(TestCase): status='active', mnfinstid=self.nf_uuid, package_id=self.package_id, - vnfd_model='{"metadata": {"vnfdId": "1","vnfdName": "PGW001",' - '"vnfProvider": "zte","vnfdVersion": "V00001","vnfVersion": "V5.10.20",' - '"productType": "CN","vnfType": "PGW",' - '"description": "PGW VNFD description",' - '"isShared":true,"vnfExtendType":"driver"}}') + vnfd_model=json.dumps(self.vnfd_model_json)) # Create a second vnf instance self.nf_inst_id = "232" @@ -143,11 +132,7 @@ class TestScaleAspect(TestCase): status='active', mnfinstid=self.nf_uuid, package_id=self.package_id, - vnfd_model='{"metadata": {"vnfdId": "1","vnfdName": "PGW001",' - '"vnfProvider": "zte","vnfdVersion": "V00001","vnfVersion": "V5.10.20",' - '"productType": "CN","vnfType": "PGW",' - '"description": "PGW VNFD description",' - '"isShared":true,"vnfExtendType":"driver"}}') + vnfd_model=json.dumps(self.vnfd_model_json)) def add_another_nf_instance(self): # Create a third vnf instance @@ -169,11 +154,7 @@ class TestScaleAspect(TestCase): status='active', mnfinstid=nf_uuid, package_id=package_id, - vnfd_model='{"metadata": {"vnfdId": "1","vnfdName": "PGW001",' - '"vnfProvider": "zte","vnfdVersion": "V00001","vnfVersion": "V5.10.20",' - '"productType": "CN","vnfType": "PGW",' - '"description": "PGW VNFD description",' - '"isShared":true,"vnfExtendType":"driver"}}') + vnfd_model=json.dumps(self.vnfd_model_json)) def add_new_vnf_instance(self): # Create a third vnf instance @@ -195,11 +176,7 @@ class TestScaleAspect(TestCase): status='active', mnfinstid=nf_uuid, package_id=package_id, - vnfd_model='{"metadata": {"vnfdId": "1","vnfdName": "PGW001",' - '"vnfProvider": "zte","vnfdVersion": "V00001","vnfVersion": "V5.10.20",' - '"productType": "CN","vnfType": "PGW",' - '"description": "PGW VNFD description",' - '"isShared":true,"vnfExtendType":"driver"}}') + vnfd_model=json.dumps(self.vnfd_model_json)) # Create a third vnf instance nf_inst_id = "242" @@ -220,11 +197,7 @@ class TestScaleAspect(TestCase): status='active', mnfinstid=nf_uuid, package_id=package_id, - vnfd_model='{"metadata": {"vnfdId": "1","vnfdName": "PGW001",' - '"vnfProvider": "zte","vnfdVersion": "V00001","vnfVersion": "V5.10.20",' - '"productType": "CN","vnfType": "PGW",' - '"description": "PGW VNFD description",' - '"isShared":true,"vnfExtendType":"driver"}}') + vnfd_model=json.dumps(self.vnfd_model_json)) def tearDown(self): NSInstModel().clean() |