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>
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
from django.test import TestCase
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.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):
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()
self.initInstModel()
self.init_scale_ns_data()
- 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"
def initInstModel(self):
self.nsd_id = "23"
self.ns_inst_id = "1"
status='active',
mnfinstid=self.nf_uuid,
package_id=self.package_id,
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"
# Create a second vnf instance
self.nf_inst_id = "232"
status='active',
mnfinstid=self.nf_uuid,
package_id=self.package_id,
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
def add_another_nf_instance(self):
# Create a third vnf instance
status='active',
mnfinstid=nf_uuid,
package_id=package_id,
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
def add_new_vnf_instance(self):
# Create a third vnf instance
status='active',
mnfinstid=nf_uuid,
package_id=package_id,
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"
# Create a third vnf instance
nf_inst_id = "242"
status='active',
mnfinstid=nf_uuid,
package_id=package_id,
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()
def tearDown(self):
NSInstModel().clean()