+class TestDeployHackfest1(TestDeploy):
+ description = "Load and deploy Hackfest_1_vnfd example"
+
+ def __init__(self):
+ super().__init__()
+ self.vnfd_filenames = ("hackfest_1_vnfd.tar.gz",)
+ self.nsd_filename = "hackfest_1_nsd.tar.gz"
+ # self.cmds = {'1': ['ls -lrt', ], '2': ['ls -lrt', ]}
+ # self.uss = {'1': "cirros", '2': "cirros"}
+ # self.pss = {'1': "cubswin:)", '2': "cubswin:)"}
+
+
+class TestDeployHackfestCirrosScaling(TestDeploy):
+ description = "Load and deploy Hackfest cirros_2vnf_ns example with scaling modifications"
+
+ def __init__(self):
+ super().__init__()
+ self.vnfd_filenames = ("cirros_vnf.tar.gz",)
+ self.nsd_filename = "cirros_2vnf_ns.tar.gz"
+
+ def create_descriptors(self, engine):
+ super().create_descriptors(engine)
+ # Modify VNFD to add scaling and count=2
+ payload = """
+ vdu:
+ "$id: 'cirros_vnfd-VM'":
+ count: 2
+ scaling-group-descriptor:
+ - name: "scale_cirros"
+ max-instance-count: 2
+ vdu:
+ - vdu-id-ref: cirros_vnfd-VM
+ count: 2
+ """
+ engine.test("DEPLOY{}".format(self.step), "Edit VNFD ", "PATCH",
+ "/vnfpkgm/v1/vnf_packages/{}".format(self.vnfds_id[0]),
+ headers_yaml, payload, 204, None, None)
+ self.step += 1
+
+ def aditional_operations(self, engine, test_osm, manual_check):
+ if not test_osm:
+ return
+ # 2 perform scale out twice
+ payload = '{scaleType: SCALE_VNF, scaleVnfData: {scaleVnfType: SCALE_OUT, scaleByStepData: ' \
+ '{scaling-group-descriptor: scale_cirros, member-vnf-index: "1"}}}'
+ for i in range(0, 2):
+ engine.test("DEPLOY{}".format(self.step), "Execute scale action over NS", "POST",
+ "/nslcm/v1/ns_instances/<{}>/scale".format(self.ns_test), headers_yaml, payload,
+ 201, {"Location": "nslcm/v1/ns_lcm_op_occs/", "Content-Type": "application/yaml"}, "yaml")
+ nslcmop2_scale_out = "DEPLOY{}".format(self.step)
+ self._wait_nslcmop_ready(engine, nslcmop2_scale_out, timeout_deploy)
+ if manual_check:
+ input('NS scale out done. Check that two more vdus are there')
+ # TODO check automatic
+
+ # 2 perform scale in
+ payload = '{scaleType: SCALE_VNF, scaleVnfData: {scaleVnfType: SCALE_IN, scaleByStepData: ' \
+ '{scaling-group-descriptor: scale_cirros, member-vnf-index: "1"}}}'
+ for i in range(0, 2):
+ engine.test("DEPLOY{}".format(self.step), "Execute scale IN action over NS", "POST",
+ "/nslcm/v1/ns_instances/<{}>/scale".format(self.ns_test), headers_yaml, payload,
+ 201, {"Location": "nslcm/v1/ns_lcm_op_occs/", "Content-Type": "application/yaml"}, "yaml")
+ nslcmop2_scale_in = "DEPLOY{}".format(self.step)
+ self._wait_nslcmop_ready(engine, nslcmop2_scale_in, timeout_deploy)
+ if manual_check:
+ input('NS scale in done. Check that two less vdus are there')
+ # TODO check automatic
+
+ # perform scale in that must fail as reached limit
+ engine.test("DEPLOY{}".format(self.step), "Execute scale IN out of limit action over NS", "POST",
+ "/nslcm/v1/ns_instances/<{}>/scale".format(self.ns_test), headers_yaml, payload,
+ 201, {"Location": "nslcm/v1/ns_lcm_op_occs/", "Content-Type": "application/yaml"}, "yaml")
+ nslcmop2_scale_in = "DEPLOY{}".format(self.step)
+ self._wait_nslcmop_ready(engine, nslcmop2_scale_in, timeout_deploy, expected_fail=True)
+
+