def test_create_delete_vnf_with_multiple_vdus(self):
        data = dict()
        input_yaml = read_file('sample-vnfd-multi-vdu.yaml')
        data['tosca'] = input_yaml
        toscal = data['tosca']
        vnfd_name = 'sample-vnfd-multi-vdu'
        tosca_arg = {'vnfd': {'name': vnfd_name,
                     'attributes': {'vnfd': toscal}}}

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
                           "test_vnf_with_multiple_vdus"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id,
                                   constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(
            vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.PENDING_CREATE,
            vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
        self.verify_vnf_crud_events(
            vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.ACTIVE)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        self.assertEqual(len(input_dict['vdus'].keys()), len(mgmt_dict.keys()))
        for vdu in input_dict['vdus'].keys():
            self.assertIsNotNone(mgmt_dict[vdu])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id,
                                   constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE,
                                    evt_constants.PENDING_DELETE, cnt=2)

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
예제 #2
0
    def test_create_delete_vnf_with_multiple_vdus(self):
        data = dict()
        input_yaml = read_file('sample-vnfd-multi-vdu.yaml')
        data['tosca'] = input_yaml
        toscal = data['tosca']
        vnfd_name = 'sample-vnfd-multi-vdu'
        tosca_arg = {
            'vnfd': {
                'name': vnfd_name,
                'attributes': {
                    'vnfd': toscal
                }
            }
        }

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {
            'vnf': {
                'vnfd_id': vnfd_id,
                'name': "test_vnf_with_multiple_vdus"
            }
        }
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id, constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual(
            self.client.show_vnf(vnf_id)['vnf']['status'], 'ACTIVE')
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        self.assertEqual(len(mgmt_dict.keys()), len(input_dict['vdus'].keys()))
        for vdu in input_dict['vdus'].keys():
            self.assertIsNotNone(mgmt_dict[vdu])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
        self.addCleanup(self.wait_until_vnf_delete, vnf_id,
                        constants.VNF_CIRROS_DELETE_TIMEOUT)
    def test_create_delete_tosca_vnf_with_multiple_vdus(self):
        input_yaml = read_file("sample-tosca-vnfd-multi-vdu.yaml")
        tosca_dict = yaml.safe_load(input_yaml)
        vnfd_name = "sample-tosca-vnfd-multi-vdu"
        tosca_arg = {"vnfd": {"name": vnfd_name, "attributes": {"vnfd": tosca_dict}}}

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance["vnfd"]["id"]
        vnf_arg = {"vnf": {"vnfd_id": vnfd_id, "name": "test_tosca_vnf_with_multiple_vdus"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance["vnf"]["id"]
        self.wait_until_vnf_active(vnf_id, constants.VNF_CIRROS_CREATE_TIMEOUT, constants.ACTIVE_SLEEP_TIME)
        self.assertEqual("ACTIVE", self.client.show_vnf(vnf_id)["vnf"]["status"])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(
            vnf_id,
            evt_constants.RES_EVT_CREATE,
            evt_constants.PENDING_CREATE,
            vnf_instance["vnf"][evt_constants.RES_EVT_CREATED_FLD],
        )
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.ACTIVE)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)["vnf"]["mgmt_url"]
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = tosca_template.ToscaTemplate(parsed_params={}, a_file=False, yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id, constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE, evt_constants.PENDING_DELETE, cnt=2)

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
    def test_create_delete_tosca_vnf_with_multiple_vdus(self):
        data = dict()
        input_yaml = read_file('sample-tosca-vnfd-multi-vdu.yaml')
        data['tosca'] = input_yaml
        toscal = data['tosca']
        vnfd_name = 'sample-tosca-vnfd-multi-vdu'
        tosca_arg = {'vnfd': {'name': vnfd_name,
                              'attributes': {'vnfd': toscal}}}

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
                           "test_tosca_vnf_with_multiple_vdus"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id,
                                   constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = ToscaTemplate(parsed_params={}, a_file=False,
                          yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
        self.addCleanup(self.wait_until_vnf_delete, vnf_id,
            constants.VNF_CIRROS_DELETE_TIMEOUT)
    def test_create_delete_tosca_vnf_with_multiple_vdus(self):
        data = dict()
        input_yaml = read_file('sample-tosca-vnfd-multi-vdu.yaml')
        data['tosca'] = input_yaml
        toscal = data['tosca']
        tosca_arg = {'vnfd': {'attributes': {'vnfd': toscal}}}

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
                           "test_tosca_vnf_with_multiple_vdus"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id,
                                   constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual(self.client.show_vnf(vnf_id)['vnf']['status'],
                         'ACTIVE')
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = ToscaTemplate(parsed_params={}, a_file=False,
                          yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(mgmt_dict.keys()), len(vdus))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        # Delete vnfd_instance
        try:
            self.client.delete_vnfd(vnfd_id)
        except Exception:
            assert False, "vnfd Delete of sample-vnfd-multiple-vdus failed"
예제 #6
0
    def test_create_delete_tosca_vnf_with_multiple_vdus(self):
        vnf_name = 'test_tosca_vnf_with_multiple_vdus'
        vnfd_file = 'sample-tosca-vnfd-multi-vdu.yaml'
        vnfd_instance, vnf_instance, tosca_dict = self.vnfd_and_vnf_create(
            vnfd_file, vnf_name)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id, constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_CREATE,
                                    evt_constants.PENDING_CREATE,
                                    cnt=2)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_CREATE,
                                    evt_constants.ACTIVE)

        # Validate mgmt_ip_address with input yaml file
        mgmt_ip_address = self.client.show_vnf(
            vnf_id)['vnf']['mgmt_ip_address']
        self.assertIsNotNone(mgmt_ip_address)
        mgmt_dict = yaml.safe_load(str(mgmt_ip_address))

        toscautils.updateimports(tosca_dict)

        tosca = tosca_template.ToscaTemplate(parsed_params={},
                                             a_file=False,
                                             yaml_dict_tpl=tosca_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id, constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_DELETE,
                                    evt_constants.PENDING_DELETE,
                                    cnt=2)
예제 #7
0
    def test_create_delete_vnf_with_multiple_vdus(self):
        data = dict()
        input_yaml = read_file('sample-vnfd-multi-vdu.yaml')
        data['tosca'] = input_yaml
        toscal = data['tosca']
        tosca_arg = {'vnfd': {'attributes': {'vnfd': toscal}}}

        ##Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        ##Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
            "test_vnf_with_multiple_vdus"}}
        vnf_instance = self.client.create_vnf(body = vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id,
                                   constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual(self.client.show_vnf(vnf_id)['vnf']['status'],
                         'ACTIVE')
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        ##Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        self.assertEqual(len(mgmt_dict.keys()), len(input_dict['vdus'].keys()))
        for vdu in input_dict['vdus'].keys():
            self.assertIsNotNone(mgmt_dict[vdu])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu]))

        ##Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        ##Delete vnfd_instance
        try:
            self.client.delete_vnfd(vnfd_id)
        except Exception:
            assert False, "vnfd Delete of sample-vnfd-multiple-vdus failed"
예제 #8
0
    def test_create_delete_tosca_vnfc(self):
        input_yaml = read_file('sample_tosca_vnfc.yaml')
        tosca_dict = yaml.safe_load(input_yaml)
        path = os.path.abspath(
            os.path.join(os.path.dirname(__file__), "../../etc/samples"))
        vnfd_name = 'sample-tosca-vnfc'
        tosca_dict['topology_template']['node_templates'
                                        ]['firewall_vnfc'
                                          ]['interfaces'
                                            ]['Standard']['create'] = path \
            + '/install_vnfc.sh'
        tosca_arg = {
            'vnfd': {
                'name': vnfd_name,
                'attributes': {
                    'vnfd': tosca_dict
                }
            }
        }

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name': "test_tosca_vnfc"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id, constants.VNFC_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_CREATE,
                                    evt_constants.PENDING_CREATE,
                                    cnt=2)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_CREATE,
                                    evt_constants.ACTIVE)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = tosca_template.ToscaTemplate(parsed_params={},
                                             a_file=False,
                                             yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Check the status of SoftwareDeployment
        heat_stack_id = self.client.show_vnf(vnf_id)['vnf']['instance_id']
        resource_types = self.h_client.resources
        resources = resource_types.list(stack_id=heat_stack_id)
        for resource in resources:
            resource = resource.to_dict()
            if resource['resource_type'] == \
                    SOFTWARE_DEPLOYMENT:
                self.assertEqual('CREATE_COMPLETE',
                                 resource['resource_status'])
                break

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id, constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_DELETE,
                                    evt_constants.PENDING_DELETE,
                                    cnt=2)

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
    def test_create_delete_tosca_vnf_with_multiple_vdus(self):
        input_yaml = read_file('sample-tosca-vnfd-multi-vdu.yaml')
        tosca_dict = yaml.safe_load(input_yaml)
        vnfd_name = 'sample-tosca-vnfd-multi-vdu'
        tosca_arg = {
            'vnfd': {
                'name': vnfd_name,
                'attributes': {
                    'vnfd': tosca_dict
                }
            }
        }

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {
            'vnf': {
                'vnfd_id': vnfd_id,
                'name': "test_tosca_vnf_with_multiple_vdus"
            }
        }
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id, constants.VNF_CIRROS_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_CREATE,
                                    evt_constants.PENDING_CREATE,
                                    cnt=2)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_CREATE,
                                    evt_constants.ACTIVE)

        # Validate mgmt_url with input yaml file
        mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
        self.assertIsNotNone(mgmt_url)
        mgmt_dict = yaml.load(str(mgmt_url))

        input_dict = yaml.load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = tosca_template.ToscaTemplate(parsed_params={},
                                             a_file=False,
                                             yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id, constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id,
                                    evt_constants.RES_EVT_DELETE,
                                    evt_constants.PENDING_DELETE,
                                    cnt=2)

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)
예제 #10
0
    def test_create_delete_tosca_vnfc(self):
        input_yaml = read_file('sample_tosca_vnfc.yaml')
        tosca_dict = yaml.safe_load(input_yaml)
        path = os.path.abspath(os.path.join(
            os.path.dirname(__file__), "../../etc/samples"))
        vnfd_name = 'sample-tosca-vnfc'
        tosca_dict['topology_template']['node_templates'
                                        ]['firewall_vnfc'
                                          ]['interfaces'
                                            ]['Standard']['create'] = path \
            + '/install_vnfc.sh'
        tosca_arg = {'vnfd': {'name': vnfd_name,
                              'attributes': {'vnfd': tosca_dict}}}

        # Create vnfd with tosca template
        vnfd_instance = self.client.create_vnfd(body=tosca_arg)
        self.assertIsNotNone(vnfd_instance)

        # Create vnf with vnfd_id
        vnfd_id = vnfd_instance['vnfd']['id']
        vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
                           "test_tosca_vnfc"}}
        vnf_instance = self.client.create_vnf(body=vnf_arg)

        vnf_id = vnf_instance['vnf']['id']
        self.wait_until_vnf_active(vnf_id,
                                   constants.VNFC_CREATE_TIMEOUT,
                                   constants.ACTIVE_SLEEP_TIME)
        self.assertEqual('ACTIVE',
                         self.client.show_vnf(vnf_id)['vnf']['status'])
        self.validate_vnf_instance(vnfd_instance, vnf_instance)

        self.verify_vnf_crud_events(
            vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.PENDING_CREATE,
            cnt=2)
        self.verify_vnf_crud_events(
            vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.ACTIVE)

        # Validate mgmt_ip_address with input yaml file
        mgmt_ip_address = self.client.show_vnf(vnf_id)['vnf'][
            'mgmt_ip_address']
        self.assertIsNotNone(mgmt_ip_address)
        mgmt_dict = yaml.safe_load(str(mgmt_ip_address))

        input_dict = yaml.safe_load(input_yaml)
        toscautils.updateimports(input_dict)

        tosca = tosca_template.ToscaTemplate(parsed_params={}, a_file=False,
                          yaml_dict_tpl=input_dict)

        vdus = toscautils.findvdus(tosca)

        self.assertEqual(len(vdus), len(mgmt_dict.keys()))
        for vdu in vdus:
            self.assertIsNotNone(mgmt_dict[vdu.name])
            self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu.name]))

        # Check the status of SoftwareDeployment
        heat_stack_id = self.client.show_vnf(vnf_id)['vnf']['instance_id']
        resource_types = self.h_client.resources
        resources = resource_types.list(stack_id=heat_stack_id)
        for resource in resources:
            resource = resource.to_dict()
            if resource['resource_type'] == \
                    SOFTWARE_DEPLOYMENT:
                self.assertEqual('CREATE_COMPLETE',
                    resource['resource_status'])
                break

        # Delete vnf_instance with vnf_id
        try:
            self.client.delete_vnf(vnf_id)
        except Exception:
            assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"

        self.wait_until_vnf_delete(vnf_id,
                                   constants.VNF_CIRROS_DELETE_TIMEOUT)
        self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE,
                                    evt_constants.PENDING_DELETE, cnt=2)

        # Delete vnfd_instance
        self.addCleanup(self.client.delete_vnfd, vnfd_id)