+
+class TestDeployHackfest3Charmed2(TestDeployHackfest3Charmed):
+ description = "Load and deploy Hackfest 3charmed_ns example modified version of descriptors to have dots in " \
+ "ids and member-vnf-index."
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "HACKFEST3v2-"
+ self.qforce = "?FORCE=True"
+ self.descriptor_edit = {
+ "vnfd0": {
+ "vdu": {
+ "$[0]": {
+ "interface": {"$[0]": {"external-connection-point-ref": "pdu-mgmt"}}
+ },
+ "$[1]": None
+ },
+ "vnf-configuration": None,
+ "connection-point": {
+ "$[0]": {
+ "id": "pdu-mgmt",
+ "name": "pdu-mgmt",
+ "short-name": "pdu-mgmt"
+ },
+ "$[1]": None
+ },
+ "mgmt-interface": {"cp": "pdu-mgmt"},
+ "description": "A vnf single vdu to be used as PDU",
+ "id": "vdu-as-pdu",
+ "internal-vld": {
+ "$[0]": {
+ "id": "pdu_internal",
+ "name": "pdu_internal",
+ "internal-connection-point": {"$[1]": None},
+ "short-name": "pdu_internal",
+ "type": "ELAN"
+ }
+ }
+ },
+
+ # Modify NSD accordingly
+ "nsd": {
+ "constituent-vnfd": {
+ "$[0]": {"vnfd-id-ref": "vdu-as-pdu"},
+ "$[1]": None,
+ },
+ "description": "A nsd to deploy the vnf to act as as PDU",
+ "id": "nsd-as-pdu",
+ "name": "nsd-as-pdu",
+ "short-name": "nsd-as-pdu",
+ "vld": {
+ "$[0]": {
+ "id": "mgmt_pdu",
+ "name": "mgmt_pdu",
+ "short-name": "mgmt_pdu",
+ "vnfd-connection-point-ref": {
+ "$[0]": {
+ "vnfd-connection-point-ref": "pdu-mgmt",
+ "vnfd-id-ref": "vdu-as-pdu",
+ },
+ "$[1]": None
+ },
+ "type": "ELAN"
+ },
+ "$[1]": None,
+ }
+ }
+ }
+
+
+class TestDeployHackfest3Charmed3(TestDeployHackfest3Charmed):
+ description = "Load and deploy Hackfest 3charmed_ns example modified version to test scaling and NS parameters"
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "HACKFEST3v3-"
+ self.commands = {'1': ['ls -lrt /home/ubuntu/first-touch-1'], '2': ['ls -lrt /home/ubuntu/first-touch-2']}
+ self.descriptor_edit = {
+ "vnfd0": yaml.load(
+ """
+ scaling-group-descriptor:
+ - name: "scale_dataVM"
+ max-instance-count: 10
+ scaling-policy:
+ - name: "auto_cpu_util_above_threshold"
+ scaling-type: "automatic"
+ threshold-time: 0
+ cooldown-time: 60
+ scaling-criteria:
+ - name: "cpu_util_above_threshold"
+ scale-in-threshold: 15
+ scale-in-relational-operation: "LE"
+ scale-out-threshold: 60
+ scale-out-relational-operation: "GE"
+ vnf-monitoring-param-ref: "monitor1"
+ vdu:
+ - vdu-id-ref: dataVM
+ count: 1
+ scaling-config-action:
+ - trigger: post-scale-out
+ vnf-config-primitive-name-ref: touch
+ - trigger: pre-scale-in
+ vnf-config-primitive-name-ref: touch
+ vdu:
+ "$id: dataVM":
+ monitoring-param:
+ - id: "dataVM_cpu_util"
+ nfvi-metric: "cpu_utilization"
+
+ monitoring-param:
+ - id: "monitor1"
+ name: "monitor1"
+ aggregation-type: AVERAGE
+ vdu-monitoring-param:
+ vdu-ref: "dataVM"
+ vdu-monitoring-param-ref: "dataVM_cpu_util"
+ vnf-configuration:
+ initial-config-primitive:
+ "$[1]":
+ parameter:
+ "$[0]":
+ value: "<touch_filename>" # default-value: /home/ubuntu/first-touch
+ config-primitive:
+ "$[0]":
+ parameter:
+ "$[0]":
+ default-value: "<touch_filename2>"
+ """)
+ }
+ self.ns_params = {
+ "additionalParamsForVnf": [
+ {"member-vnf-index": "1", "additionalParams": {"touch_filename": "/home/ubuntu/first-touch-1",
+ "touch_filename2": "/home/ubuntu/second-touch-1"}},
+ {"member-vnf-index": "2", "additionalParams": {"touch_filename": "/home/ubuntu/first-touch-2",
+ "touch_filename2": "/home/ubuntu/second-touch-2"}},
+ ]
+ }
+
+ def additional_operations(self, engine, test_osm, manual_check):
+ super().additional_operations(engine, test_osm, manual_check)
+ if not test_osm:
+ return
+
+ # 2 perform scale out
+ payload = '{scaleType: SCALE_VNF, scaleVnfData: {scaleVnfType: SCALE_OUT, scaleByStepData: ' \
+ '{scaling-group-descriptor: scale_dataVM, member-vnf-index: "1"}}}'
+ engine.test("Execute scale action over NS", "POST",
+ "/nslcm/v1/ns_instances/{}/scale".format(self.ns_id), headers_yaml, payload,
+ (201, 202), r_headers_yaml_location_nslcmop, "yaml")
+ nslcmop2_scale_out = engine.last_id
+ engine.wait_operation_ready("ns", nslcmop2_scale_out, timeout_deploy)
+ if manual_check:
+ input('NS scale out done. Check that file /home/ubuntu/second-touch-1 is present and new VM is created')
+ if test_osm:
+ commands = {'1': ['ls -lrt /home/ubuntu/second-touch-1', ]}
+ self.test_ns(engine, test_osm, commands=commands)
+ # TODO check automatic connection to scaled VM
+
+ # 2 perform scale in
+ payload = '{scaleType: SCALE_VNF, scaleVnfData: {scaleVnfType: SCALE_IN, scaleByStepData: ' \
+ '{scaling-group-descriptor: scale_dataVM, member-vnf-index: "1"}}}'
+ engine.test("Execute scale action over NS", "POST",
+ "/nslcm/v1/ns_instances/{}/scale".format(self.ns_id), headers_yaml, payload,
+ (201, 202), r_headers_yaml_location_nslcmop, "yaml")
+ nslcmop2_scale_in = engine.last_id
+ engine.wait_operation_ready("ns", nslcmop2_scale_in, timeout_deploy)
+ if manual_check:
+ input('NS scale in done. Check that file /home/ubuntu/second-touch-1 is updated and new VM is deleted')
+ # TODO check automatic
+
+
+class TestDeploySimpleCharm(TestDeploy):
+ description = "Deploy hackfest-4 hackfest_simplecharm example"
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "HACKFEST-SIMPLE"
+ self.descriptor_url = "https://osm-download.etsi.org/ftp/osm-4.0-four/4th-hackfest/packages/"
+ self.vnfd_filenames = ("hackfest_simplecharm_vnf.tar.gz",)
+ self.nsd_filename = "hackfest_simplecharm_ns.tar.gz"
+ self.uses_configuration = True
+ self.commands = {'1': [''], '2': ['ls -lrt /home/ubuntu/first-touch', ]}
+ self.users = {'1': "ubuntu", '2': "ubuntu"}
+ self.passwords = {'1': "osm4u", '2': "osm4u"}
+
+
+class TestDeploySimpleCharm2(TestDeploySimpleCharm):
+ description = "Deploy hackfest-4 hackfest_simplecharm example changing naming to contain dots on ids and " \
+ "vnf-member-index"
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "HACKFEST-SIMPLE2-"
+ self.qforce = "?FORCE=True"
+ self.descriptor_edit = {
+ "vnfd0": {
+ "id": "hackfest.simplecharm.vnf"
+ },
+
+ "nsd": {
+ "id": "hackfest.simplecharm.ns",
+ "constituent-vnfd": {
+ "$[0]": {"vnfd-id-ref": "hackfest.simplecharm.vnf", "member-vnf-index": "$1"},
+ "$[1]": {"vnfd-id-ref": "hackfest.simplecharm.vnf", "member-vnf-index": "$2"},
+ },
+ "vld": {
+ "$[0]": {
+ "vnfd-connection-point-ref": {"$[0]": {"member-vnf-index-ref": "$1",
+ "vnfd-id-ref": "hackfest.simplecharm.vnf"},
+ "$[1]": {"member-vnf-index-ref": "$2",
+ "vnfd-id-ref": "hackfest.simplecharm.vnf"}},
+ },
+ "$[1]": {
+ "vnfd-connection-point-ref": {"$[0]": {"member-vnf-index-ref": "$1",
+ "vnfd-id-ref": "hackfest.simplecharm.vnf"},
+ "$[1]": {"member-vnf-index-ref": "$2",
+ "vnfd-id-ref": "hackfest.simplecharm.vnf"}},
+ },
+ }
+ }
+ }
+
+
+class TestDeploySingleVdu(TestDeployHackfest3Charmed):
+ description = "Generate a single VDU base on editing Hackfest3Charmed descriptors and deploy"
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "SingleVDU"
+ self.qforce = "?FORCE=True"
+ self.descriptor_edit = {
+ # Modify VNFD to remove one VDU
+ "vnfd0": {
+ "vdu": {
+ "$[0]": {
+ "interface": {"$[0]": {"external-connection-point-ref": "pdu-mgmt"}}
+ },
+ "$[1]": None
+ },
+ "vnf-configuration": None,
+ "connection-point": {
+ "$[0]": {
+ "id": "pdu-mgmt",
+ "name": "pdu-mgmt",
+ "short-name": "pdu-mgmt"
+ },
+ "$[1]": None
+ },
+ "mgmt-interface": {"cp": "pdu-mgmt"},
+ "description": "A vnf single vdu to be used as PDU",
+ "id": "vdu-as-pdu",
+ "internal-vld": {
+ "$[0]": {
+ "id": "pdu_internal",
+ "name": "pdu_internal",
+ "internal-connection-point": {"$[1]": None},
+ "short-name": "pdu_internal",
+ "type": "ELAN"
+ }
+ }
+ },
+
+ # Modify NSD accordingly
+ "nsd": {
+ "constituent-vnfd": {
+ "$[0]": {"vnfd-id-ref": "vdu-as-pdu"},
+ "$[1]": None,
+ },
+ "description": "A nsd to deploy the vnf to act as as PDU",
+ "id": "nsd-as-pdu",
+ "name": "nsd-as-pdu",
+ "short-name": "nsd-as-pdu",
+ "vld": {
+ "$[0]": {
+ "id": "mgmt_pdu",
+ "name": "mgmt_pdu",
+ "short-name": "mgmt_pdu",
+ "vnfd-connection-point-ref": {
+ "$[0]": {
+ "vnfd-connection-point-ref": "pdu-mgmt",
+ "vnfd-id-ref": "vdu-as-pdu",
+ },
+ "$[1]": None
+ },
+ "type": "ELAN"
+ },
+ "$[1]": None,
+ }
+ }
+ }
+
+
+class TestDeployHnfd(TestDeployHackfest3Charmed):
+ description = "Generate a HNFD base on editing Hackfest3Charmed descriptors and deploy"
+
+ def __init__(self):
+ super().__init__()
+ self.test_name = "HNFD"
+ self.pduDeploy = TestDeploySingleVdu()
+ self.pdu_interface_0 = {}
+ self.pdu_interface_1 = {}
+
+ self.pdu_id = None
+ # self.vnf_to_pdu = """
+ # vdu:
+ # "$[0]":
+ # pdu-type: PDU-TYPE-1
+ # interface:
+ # "$[0]":
+ # name: mgmt-iface
+ # "$[1]":
+ # name: pdu-iface-internal
+ # id: hfn1
+ # description: HFND, one PDU + One VDU
+ # name: hfn1
+ # short-name: hfn1
+ #
+ # """
+
+ self.pdu_descriptor = {
+ "name": "my-PDU",
+ "type": "PDU-TYPE-1",
+ "vim_accounts": "to-override",
+ "interfaces": [
+ {
+ "name": "mgmt-iface",
+ "mgmt": True,
+ "type": "overlay",
+ "ip-address": "to override",
+ "mac-address": "mac_address",
+ "vim-network-name": "mgmt",
+ },
+ {
+ "name": "pdu-iface-internal",
+ "mgmt": False,
+ "type": "overlay",
+ "ip-address": "to override",
+ "mac-address": "mac_address",
+ "vim-network-name": "pdu_internal", # OSMNBITEST-PDU-pdu_internal
+ },
+ ]
+ }
+ self.vnfd_filenames = ("hackfest_3charmed_vnfd.tar.gz", "hackfest_3charmed_vnfd.tar.gz")
+
+ self.descriptor_edit = {
+ "vnfd0": {
+ "id": "hfnd1",
+ "name": "hfn1",
+ "short-name": "hfn1",
+ "vdu": {
+ "$[0]": {
+ "pdu-type": "PDU-TYPE-1",
+ "interface": {
+ "$[0]": {"name": "mgmt-iface"},
+ "$[1]": {"name": "pdu-iface-internal"},
+ }
+ }
+ }
+ },
+ "nsd": {
+ "constituent-vnfd": {
+ "$[1]": {"vnfd-id-ref": "hfnd1"}
+ },
+ "vld": {
+ "$[0]": {"vnfd-connection-point-ref": {"$[1]": {"vnfd-id-ref": "hfnd1"}}},
+ "$[1]": {"vnfd-connection-point-ref": {"$[1]": {"vnfd-id-ref": "hfnd1"}}}
+ }
+ }
+ }
+
+ def create_descriptors(self, engine):
+ super().create_descriptors(engine)
+
+ # Create PDU
+ self.pdu_descriptor["interfaces"][0].update(self.pdu_interface_0)
+ self.pdu_descriptor["interfaces"][1].update(self.pdu_interface_1)
+ self.pdu_descriptor["vim_accounts"] = [self.vim_id]
+ # TODO get vim-network-name from vnfr.vld.name
+ self.pdu_descriptor["interfaces"][1]["vim-network-name"] = "{}-{}-{}".format(
+ os.environ.get("OSMNBITEST_NS_NAME", "OSMNBITEST"),
+ "PDU", self.pdu_descriptor["interfaces"][1]["vim-network-name"])
+ engine.test("Onboard PDU descriptor", "POST", "/pdu/v1/pdu_descriptors",
+ {"Location": "/pdu/v1/pdu_descriptors/", "Content-Type": "application/yaml"}, self.pdu_descriptor,
+ 201, r_header_yaml, "yaml")
+ self.pdu_id = engine.last_id
+
+ def run(self, engine, test_osm, manual_check, test_params=None):
+ engine.get_autorization()
+ engine.set_test_name(self.test_name)
+ nsname = os.environ.get("OSMNBITEST_NS_NAME", "OSMNBITEST")
+
+ # create real VIM if not exist
+ self.vim_id = engine.get_create_vim(test_osm)
+ # instantiate PDU
+ self.pduDeploy.create_descriptors(engine)
+ self.pduDeploy.instantiate(engine, {"nsDescription": "to be used as PDU", "nsName": nsname + "-PDU",
+ "nsdId": self.pduDeploy.nsd_id, "vimAccountId": self.vim_id})
+ if manual_check:
+ input('VNF to be used as PDU has been deployed. Perform manual check and press enter to resume')
+ if test_osm:
+ self.pduDeploy.test_ns(engine, test_osm)
+
+ if test_osm:
+ r = engine.test("Get VNFR to obtain IP_ADDRESS", "GET",
+ "/nslcm/v1/vnfrs?nsr-id-ref={}".format(self.pduDeploy.ns_id), headers_json, None,
+ 200, r_header_json, "json")
+ if not r:
+ return
+ vnfr_data = r.json()
+ # print(vnfr_data)
+
+ self.pdu_interface_0["ip-address"] = vnfr_data[0]["vdur"][0]["interfaces"][0].get("ip-address")
+ self.pdu_interface_1["ip-address"] = vnfr_data[0]["vdur"][0]["interfaces"][1].get("ip-address")
+ self.pdu_interface_0["mac-address"] = vnfr_data[0]["vdur"][0]["interfaces"][0].get("mac-address")
+ self.pdu_interface_1["mac-address"] = vnfr_data[0]["vdur"][0]["interfaces"][1].get("mac-address")
+ if not self.pdu_interface_0["ip-address"]:
+ raise TestException("Vnfr has not managment ip address")
+ else:
+ self.pdu_interface_0["ip-address"] = "192.168.10.10"
+ self.pdu_interface_1["ip-address"] = "192.168.11.10"
+ self.pdu_interface_0["mac-address"] = "52:33:44:55:66:13"
+ self.pdu_interface_1["mac-address"] = "52:33:44:55:66:14"
+
+ self.create_descriptors(engine)
+
+ ns_data = {"nsDescription": "default description", "nsName": nsname, "nsdId": self.nsd_id,
+ "vimAccountId": self.vim_id}
+ if test_params and test_params.get("ns-config"):
+ if isinstance(test_params["ns-config"], str):
+ ns_data.update(yaml.load(test_params["ns-config"]))
+ else:
+ ns_data.update(test_params["ns-config"])
+
+ self.instantiate(engine, ns_data)
+ if manual_check:
+ input('NS has been deployed. Perform manual check and press enter to resume')
+ if test_osm:
+ self.test_ns(engine, test_osm)
+ self.additional_operations(engine, test_osm, manual_check)
+ self.terminate(engine)
+ self.pduDeploy.terminate(engine)
+ self.delete_descriptors(engine)
+ self.pduDeploy.delete_descriptors(engine)
+
+ def delete_descriptors(self, engine):
+ super().delete_descriptors(engine)
+ # delete pdu
+ engine.test("Delete PDU SOL005", "DELETE",
+ "/pdu/v1/pdu_descriptors/{}".format(self.pdu_id),
+ headers_yaml, None, 204, None, 0)
+
+
+class TestDescriptors:
+ description = "Test VNFD, NSD, PDU descriptors CRUD and dependencies"
+ vnfd_empty = """vnfd:vnfd-catalog:
+ vnfd:
+ - name: prova
+ short-name: prova
+ id: prova
+ """
+ vnfd_prova = """vnfd:vnfd-catalog:
+ vnfd:
+ - connection-point:
+ - name: cp_0h8m
+ type: VPORT
+ id: prova
+ name: prova
+ short-name: prova
+ vdu:
+ - id: vdu_z4bm
+ image: ubuntu
+ interface:
+ - external-connection-point-ref: cp_0h8m
+ name: eth0
+ virtual-interface:
+ type: VIRTIO
+ name: vdu_z4bm
+ version: '1.0'
+ """
+
+ def __init__(self):
+ self.vnfd_filename = "hackfest_3charmed_vnfd.tar.gz"
+ self.nsd_filename = "hackfest_3charmed_nsd.tar.gz"
+ self.descriptor_url = "https://osm-download.etsi.org/ftp/osm-3.0-three/2nd-hackfest/packages/"
+ self.vnfd_id = None
+ self.nsd_id = None
+
+ def run(self, engine, test_osm, manual_check, test_params=None):
+ engine.set_test_name("Descriptors")
+ engine.get_autorization()
+ temp_dir = os.path.dirname(os.path.abspath(__file__)) + "/temp/"
+ if not os.path.exists(temp_dir):
+ os.makedirs(temp_dir)
+
+ # download files
+ for filename in (self.vnfd_filename, self.nsd_filename):
+ filename_path = temp_dir + filename
+ if not os.path.exists(filename_path):
+ with open(filename_path, "wb") as file:
+ response = requests.get(self.descriptor_url + filename)
+ if response.status_code >= 300:
+ raise TestException("Error downloading descriptor from '{}': {}".format(
+ self.descriptor_url + filename, response.status_code))
+ file.write(response.content)
+
+ vnfd_filename_path = temp_dir + self.vnfd_filename
+ nsd_filename_path = temp_dir + self.nsd_filename
+
+ engine.test("Onboard empty VNFD in one step", "POST", "/vnfpkgm/v1/vnf_packages_content", headers_yaml,
+ self.vnfd_empty, 201, r_headers_yaml_location_vnfd, "yaml")
+ self.vnfd_id = engine.last_id
+
+ # test bug 605
+ engine.test("Upload invalid VNFD ", "PUT", "/vnfpkgm/v1/vnf_packages/{}/package_content".format(self.vnfd_id),
+ headers_yaml, self.vnfd_prova, 422, r_header_yaml, "yaml")
+
+ engine.test("Upload VNFD {}".format(self.vnfd_filename), "PUT",
+ "/vnfpkgm/v1/vnf_packages/{}/package_content".format(self.vnfd_id), headers_zip_yaml,
+ "@b" + vnfd_filename_path, 204, None, 0)
+
+ queries = ["mgmt-interface.cp=mgmt", "vdu.0.interface.0.external-connection-point-ref=mgmt",
+ "vdu.0.interface.1.internal-connection-point-ref=internal",
+ "internal-vld.0.internal-connection-point.0.id-ref=internal",
+ # Detection of duplicated VLD names in VNF Descriptors
+ # URL: internal-vld=[
+ # {id: internal1, name: internal, type:ELAN,
+ # internal-connection-point: [{id-ref: mgmtVM-internal}, {id-ref: dataVM-internal}]},
+ # {id: internal2, name: internal, type:ELAN,
+ # internal-connection-point: [{id-ref: mgmtVM-internal}, {id-ref: dataVM-internal}]}
+ # ]
+ "internal-vld=%5B%7Bid%3A%20internal1%2C%20name%3A%20internal%2C%20type%3A%20ELAN%2C%20"
+ "internal-connection-point%3A%20%5B%7Bid-ref%3A%20mgmtVM-internal%7D%2C%20%7Bid-ref%3A%20"
+ "dataVM-internal%7D%5D%7D%2C%20%7Bid%3A%20internal2%2C%20name%3A%20internal%2C%20type%3A%20"
+ "ELAN%2C%20internal-connection-point%3A%20%5B%7Bid-ref%3A%20mgmtVM-internal%7D%2C%20%7B"
+ "id-ref%3A%20dataVM-internal%7D%5D%7D%5D"
+ ]
+ for query in queries:
+ engine.test("Upload invalid VNFD ", "PUT",
+ "/vnfpkgm/v1/vnf_packages/{}/package_content?{}".format(self.vnfd_id, query),
+ headers_zip_yaml, "@b" + vnfd_filename_path, 422, r_header_yaml, "yaml")
+
+ # test bug 605
+ engine.test("Upload invalid VNFD ", "PUT", "/vnfpkgm/v1/vnf_packages/{}/package_content".format(self.vnfd_id),
+ headers_yaml, self.vnfd_prova, 422, r_header_yaml, "yaml")
+
+ # get vnfd descriptor
+ engine.test("Get VNFD descriptor", "GET", "/vnfpkgm/v1/vnf_packages/{}".format(self.vnfd_id),
+ headers_yaml, None, 200, r_header_yaml, "yaml")
+
+ # get vnfd file descriptor
+ engine.test("Get VNFD file descriptor", "GET", "/vnfpkgm/v1/vnf_packages/{}/vnfd".format(self.vnfd_id),
+ headers_text, None, 200, r_header_text, "text", temp_dir+"vnfd-yaml")
+ # TODO compare files: diff vnfd-yaml hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml
+
+ # get vnfd zip file package
+ engine.test("Get VNFD zip package", "GET",
+ "/vnfpkgm/v1/vnf_packages/{}/package_content".format(self.vnfd_id), headers_zip, None, 200,
+ r_header_zip, "zip", temp_dir+"vnfd-zip")
+ # TODO compare files: diff vnfd-zip hackfest_3charmed_vnfd.tar.gz
+
+ # get vnfd artifact
+ engine.test("Get VNFD artifact package", "GET",
+ "/vnfpkgm/v1/vnf_packages/{}/artifacts/icons/osm.png".format(self.vnfd_id), headers_zip, None, 200,
+ r_header_octect, "octet-string", temp_dir+"vnfd-icon")
+ # TODO compare files: diff vnfd-icon hackfest_3charmed_vnfd/icons/osm.png
+
+ # nsd CREATE AND UPLOAD in one step:
+ engine.test("Onboard NSD in one step", "POST", "/nsd/v1/ns_descriptors_content", headers_zip_yaml,
+ "@b" + nsd_filename_path, 201, r_headers_yaml_location_nsd, "yaml")
+ self.nsd_id = engine.last_id
+
+ queries = ["vld.0.vnfd-connection-point-ref.0.vnfd-id-ref=hf"]
+ for query in queries:
+ engine.test("Upload invalid NSD ", "PUT",
+ "/nsd/v1/ns_descriptors/{}/nsd_content?{}".format(self.nsd_id, query),
+ headers_zip_yaml, "@b" + nsd_filename_path, 422, r_header_yaml, "yaml")
+
+ # get nsd descriptor
+ engine.test("Get NSD descriptor", "GET", "/nsd/v1/ns_descriptors/{}".format(self.nsd_id), headers_yaml,
+ None, 200, r_header_yaml, "yaml")
+
+ # get nsd file descriptor
+ engine.test("Get NSD file descriptor", "GET", "/nsd/v1/ns_descriptors/{}/nsd".format(self.nsd_id), headers_text,
+ None, 200, r_header_text, "text", temp_dir+"nsd-yaml")
+ # TODO compare files: diff nsd-yaml hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
+
+ # get nsd zip file package
+ engine.test("Get NSD zip package", "GET", "/nsd/v1/ns_descriptors/{}/nsd_content".format(self.nsd_id),
+ headers_zip, None, 200, r_header_zip, "zip", temp_dir+"nsd-zip")
+ # TODO compare files: diff nsd-zip hackfest_3charmed_nsd.tar.gz
+
+ # get nsd artifact
+ engine.test("Get NSD artifact package", "GET",
+ "/nsd/v1/ns_descriptors/{}/artifacts/icons/osm.png".format(self.nsd_id), headers_zip, None, 200,
+ r_header_octect, "octet-string", temp_dir+"nsd-icon")
+ # TODO compare files: diff nsd-icon hackfest_3charmed_nsd/icons/osm.png
+
+ # vnfd DELETE
+ test_rest.test("Delete VNFD conflict", "DELETE", "/vnfpkgm/v1/vnf_packages/{}".format(self.vnfd_id),
+ headers_yaml, None, 409, None, None)
+
+ test_rest.test("Delete VNFD force", "DELETE", "/vnfpkgm/v1/vnf_packages/{}?FORCE=TRUE".format(self.vnfd_id),
+ headers_yaml, None, 204, None, 0)
+
+ # nsd DELETE
+ test_rest.test("Delete NSD", "DELETE", "/nsd/v1/ns_descriptors/{}".format(self.nsd_id), headers_yaml, None, 204,
+ None, 0)
+
+
+class TestNetSliceTemplates:
+ description = "Upload a NST to OSM"
+
+ def __init__(self):
+ self.vnfd_filename = ("@./slice_shared/vnfd/slice_shared_vnfd.yaml")
+ self.vnfd_filename_middle = ("@./slice_shared/vnfd/slice_shared_middle_vnfd.yaml")
+ self.nsd_filename = ("@./slice_shared/nsd/slice_shared_nsd.yaml")
+ self.nsd_filename_middle = ("@./slice_shared/nsd/slice_shared_middle_nsd.yaml")
+ self.nst_filenames = ("@./slice_shared/slice_shared_nstd.yaml")
+