From 86d848eacff225a89f2e80acd33e32e56b855553 Mon Sep 17 00:00:00 2001 From: OpenStack Proposal Bot Date: Mon, 18 Jul 2016 18:16:36 +0000 Subject: [PATCH] Adding Tacker functional tests with parameterization using tosca template Closes-bug: #1594599 Depends-On: I8f7c36333ae26a88f52fe06883a9bfe8efdcf731 Change-Id: I16339b9107bb45bca6afb933b8d74963a32e8510 --- requirements.txt | 4 +- .../etc/samples/sample-tosca-vnf-values.yaml | 10 ++ .../etc/samples/sample-tosca-vnfd-param.yaml | 101 ++++++++++++++++++ .../tests/functional/vnfm/test_vnfm_param.py | 19 +++- 4 files changed, 128 insertions(+), 6 deletions(-) create mode 100644 tacker/tests/etc/samples/sample-tosca-vnf-values.yaml create mode 100644 tacker/tests/etc/samples/sample-tosca-vnfd-param.yaml diff --git a/requirements.txt b/requirements.txt index 7824a9836..ae953657a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,10 +23,10 @@ python-heatclient>=1.1.0 # Apache-2.0 python-keystoneclient!=1.8.0,!=2.1.0,>=1.7.0 # Apache-2.0 alembic>=0.8.4 # MIT six>=1.9.0 # MIT -stevedore>=1.10.0 # Apache-2.0 +stevedore>=1.16.0 # Apache-2.0 oslo.concurrency>=3.8.0 # Apache-2.0 oslo.config>=3.12.0 # Apache-2.0 -oslo.context>=2.4.0 # Apache-2.0 +oslo.context!=2.6.0,>=2.4.0 # Apache-2.0 oslo.db>=4.1.0 # Apache-2.0 oslo.log>=1.14.0 # Apache-2.0 oslo.messaging>=5.2.0 # Apache-2.0 diff --git a/tacker/tests/etc/samples/sample-tosca-vnf-values.yaml b/tacker/tests/etc/samples/sample-tosca-vnf-values.yaml new file mode 100644 index 000000000..d3b621d96 --- /dev/null +++ b/tacker/tests/etc/samples/sample-tosca-vnf-values.yaml @@ -0,0 +1,10 @@ +{ + image_name: 'cirros-0.3.4-x86_64-uec', + flavor: 'm1.tiny', + zone: 'nova', + network: 'net_mgmt', + management: 'true', + pkt_in_network: 'net0', + pkt_out_network: 'net1', + vendor: 'tacker' +} diff --git a/tacker/tests/etc/samples/sample-tosca-vnfd-param.yaml b/tacker/tests/etc/samples/sample-tosca-vnfd-param.yaml new file mode 100644 index 000000000..4f3a8ef0e --- /dev/null +++ b/tacker/tests/etc/samples/sample-tosca-vnfd-param.yaml @@ -0,0 +1,101 @@ +tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 + +description: VNF TOSCA template with input parameters + +metadata: + template_name: sample-tosca-vnfd + +topology_template: + inputs: + image_name: + type: string + description: Image Name + + flavor: + type: string + description: Flavor Information + + zone: + type: string + description: Zone Information + + network: + type: string + description: mgmt network + + management: + type: string + description: management network + + pkt_in_network: + type: string + description: In network + + pkt_out_network: + type: string + description: Out network + + vendor: + type: string + description: Vendor information + + node_templates: + VDU1: + type: tosca.nodes.nfv.VDU.Tacker + properties: + image: { get_input: image_name} + flavor: {get_input: flavor} + availability_zone: { get_input: zone } + mgmt_driver: noop + config: | + param0: key1 + param1: key2 + + CP1: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: { get_input: management } + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU1 + + CP2: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL2 + - virtualBinding: + node: VDU1 + + CP3: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL3 + - virtualBinding: + node: VDU1 + + VL1: + type: tosca.nodes.nfv.VL + properties: + network_name: { get_input: network } + vendor: {get_input: vendor} + + VL2: + type: tosca.nodes.nfv.VL + properties: + network_name: { get_input: pkt_in_network } + vendor: {get_input: vendor} + + VL3: + type: tosca.nodes.nfv.VL + properties: + network_name: { get_input: pkt_out_network } + vendor: {get_input: vendor} diff --git a/tacker/tests/functional/vnfm/test_vnfm_param.py b/tacker/tests/functional/vnfm/test_vnfm_param.py index d3d00ef71..3d51d7ee1 100644 --- a/tacker/tests/functional/vnfm/test_vnfm_param.py +++ b/tacker/tests/functional/vnfm/test_vnfm_param.py @@ -89,10 +89,6 @@ class VnfmTestParam(base.BaseTackerTest): except Exception: assert True, "Vnf Delete success" + str(vfn_d) + str(Exception) - def test_vnfd_param(self): - vnfd_instance = self._test_vnfd_create('sample_cirros_vnf_param.yaml') - self._test_vnfd_delete(vnfd_instance) - def test_vnf_param(self): vnfd_instance = self._test_vnfd_create('sample_cirros_vnf_param.yaml') vnf_instance = self._test_vnf_create(vnfd_instance, @@ -103,3 +99,18 @@ class VnfmTestParam(base.BaseTackerTest): self.addCleanup(self.client.delete_vnfd, vnfd_instance['vnfd']['id']) self.addCleanup(self.wait_until_vnf_delete, vnf_id, constants.VNF_CIRROS_DELETE_TIMEOUT) + + def test_vnfd_param_tosca_template(self): + vnfd_instance = self._test_vnfd_create('sample-tosca-vnfd-param.yaml') + self._test_vnfd_delete(vnfd_instance) + + def test_vnf_param_tosca_template(self): + vnfd_instance = self._test_vnfd_create('sample-tosca-vnfd-param.yaml') + vnf_instance = self._test_vnf_create(vnfd_instance, + 'test_vnf_with_parameters_tosca_template', + 'sample-tosca-vnf-values.yaml') + self._test_vnf_delete(vnf_instance) + vnf_id = vnf_instance['vnf']['id'] + self.addCleanup(self.client.delete_vnfd, vnfd_instance['vnfd']['id']) + self.addCleanup(self.wait_until_vnf_delete, vnf_id, + constants.VNF_CIRROS_DELETE_TIMEOUT)