Merge "Move functional tests from commonservices directory"
This commit is contained in:
commit
ff5b90fdac
|
@ -138,6 +138,32 @@ class BaseTackerTest(base.BaseTestCase):
|
|||
mesg = ("%s - state transition expected." % state)
|
||||
self.assertIsNotNone(vnf_evt_list, mesg)
|
||||
|
||||
def verify_vnf_crud_events(self, vnf_id, evt_type, tstamp=None, cnt=1):
|
||||
params = {'resource_id': vnf_id,
|
||||
'resource_type': evt_constants.RES_TYPE_VNF,
|
||||
'event_type': evt_type}
|
||||
if tstamp:
|
||||
params['timestamp'] = tstamp
|
||||
|
||||
vnf_evt_list = self.client.list_vnf_events(params)
|
||||
|
||||
self.assertIsNotNone(vnf_evt_list,
|
||||
"List of VNF events are Empty")
|
||||
self.assertEqual(cnt, len(vnf_evt_list))
|
||||
|
||||
def verify_vnfd_events(self, vnfd_id, evt_type, tstamp=None, cnt=1):
|
||||
params = {'resource_id': vnfd_id,
|
||||
'resource_type': evt_constants.RES_TYPE_VNFD,
|
||||
'event_type': evt_type}
|
||||
if tstamp:
|
||||
params['timestamp'] = tstamp
|
||||
|
||||
vnfd_evt_list = self.client.list_vnfd_events(params)
|
||||
|
||||
self.assertIsNotNone(vnfd_evt_list,
|
||||
"List of VNFD events are Empty")
|
||||
self.assertEqual(cnt, len(vnfd_evt_list))
|
||||
|
||||
def get_vim(self, vim_list, vim_name):
|
||||
if len(vim_list.values()) == 0:
|
||||
assert False, "vim_list is Empty: Default VIM is missing"
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
# Copyright 2016 Brocade Communications System, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import yaml
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
SECRET_PASSWORD = '***'
|
||||
|
||||
|
||||
class VimTestCreate(base.BaseTackerTest):
|
||||
def _test_create_delete_vim(self, vim_file, name, description, vim_type,
|
||||
version=None):
|
||||
data = yaml.load(read_file(vim_file))
|
||||
|
||||
password = data['password']
|
||||
username = data['username']
|
||||
project_name = data['project_name']
|
||||
auth_url = data['auth_url']
|
||||
domain_name = data.get('domain_name', None)
|
||||
vim_arg = {'vim': {'name': name, 'description': description,
|
||||
'type': vim_type,
|
||||
'auth_url': auth_url,
|
||||
'auth_cred': {'username': username,
|
||||
'password': password,
|
||||
'user_domain_name': domain_name},
|
||||
'vim_project': {'name': project_name,
|
||||
'project_domain_name':
|
||||
domain_name},
|
||||
'is_default': False}}
|
||||
|
||||
# Register vim
|
||||
vim_res = self.client.create_vim(vim_arg)
|
||||
vim_obj = vim_res['vim']
|
||||
vim_id = vim_obj['id']
|
||||
self.verify_vim(vim_obj, data, name, description, version)
|
||||
|
||||
params = {'resource_id': vim_id,
|
||||
'event_type': evt_constants.RES_EVT_CREATE,
|
||||
'timestamp': vim_res['vim'][
|
||||
evt_constants.RES_EVT_CREATED_FLD]}
|
||||
vim_evt_list = self.client.list_vim_events(params)
|
||||
|
||||
self.assertIsNotNone(vim_evt_list,
|
||||
"List of VIM events are Empty after Creation")
|
||||
self.assertEqual(1, len(vim_evt_list))
|
||||
|
||||
# Read vim
|
||||
vim_show_res = self.client.show_vim(vim_id)
|
||||
self.verify_vim(vim_show_res['vim'], data, name, description, version)
|
||||
|
||||
# Delete vim
|
||||
try:
|
||||
self.client.delete_vim(vim_id)
|
||||
except Exception:
|
||||
self.assertFalse(True, "Failed to delete vim %s" % vim_id)
|
||||
|
||||
params = {'resource_id': vim_id,
|
||||
'event_type': evt_constants.RES_EVT_DELETE}
|
||||
vim_evt_list = self.client.list_vim_events(params)
|
||||
|
||||
self.assertIsNotNone(vim_evt_list,
|
||||
"List of vnf events are Empty after Deletion")
|
||||
self.assertEqual(1, len(vim_evt_list))
|
||||
|
||||
def verify_vim(self, vim_instance, config_data, name, description,
|
||||
version):
|
||||
expected_regions = ['RegionOne']
|
||||
self.assertIsNotNone(vim_instance)
|
||||
self.assertEqual(description, vim_instance['description'])
|
||||
self.assertEqual(name, vim_instance['name'])
|
||||
self.assertIsNotNone(vim_instance['tenant_id'])
|
||||
self.assertIsNotNone(vim_instance['id'])
|
||||
self.assertEqual(config_data['username'],
|
||||
vim_instance['auth_cred']['username'])
|
||||
self.assertEqual(SECRET_PASSWORD,
|
||||
vim_instance['auth_cred']['password'])
|
||||
self.assertEqual(expected_regions,
|
||||
vim_instance['placement_attr']['regions'])
|
||||
if version:
|
||||
method_name = 'verify_vim_' + version
|
||||
getattr(self, method_name)(vim_instance, config_data)
|
||||
|
||||
def verify_vim_v2(self, vim_instance, config_data):
|
||||
self.assertEqual(config_data['project_name'],
|
||||
vim_instance['auth_cred']['tenant_name'])
|
||||
|
||||
def verify_vim_v3(self, vim_instance, config_data):
|
||||
self.assertEqual(config_data['project_name'],
|
||||
vim_instance['auth_cred']['project_name'])
|
||||
|
||||
def test_create_delete_local_vim(self):
|
||||
name = 'Default vim'
|
||||
description = 'Local vim description'
|
||||
vim_type = 'openstack'
|
||||
ks_version = 'v3'
|
||||
self._test_create_delete_vim('local-vim.yaml', name, description,
|
||||
vim_type, ks_version)
|
||||
|
||||
def test_create_delete_local_vim_keystone_v2(self):
|
||||
name = 'Openstack'
|
||||
description = 'OpenStack VIM with keystone v2'
|
||||
vim_type = 'openstack'
|
||||
ks_version = 'v2'
|
||||
self._test_create_delete_vim('vim-config-ks-v2.yaml', name,
|
||||
description, vim_type, ks_version)
|
|
@ -1,95 +0,0 @@
|
|||
# Copyright 2016 Brocade Communications System, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
CONF = cfg.CONF
|
||||
VNF_CIRROS_CREATE_TIMEOUT = 120
|
||||
|
||||
|
||||
class VnfTestEvent(base.BaseTackerTest):
|
||||
def _test_create_delete_vnf_events(self, vnf_name, vim_id=None):
|
||||
data = dict()
|
||||
data['tosca'] = read_file(
|
||||
'sample_cirros_vnf_no_monitoring.yaml')
|
||||
vnfd_name = 'sample_cirros_vnf_no_monitoring'
|
||||
toscal = data['tosca']
|
||||
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': vnf_name}}
|
||||
if vim_id:
|
||||
vnf_arg['vnf']['vim_id'] = vim_id
|
||||
vnf_instance = self.client.create_vnf(body=vnf_arg)
|
||||
self.validate_vnf_instance(vnfd_instance, vnf_instance)
|
||||
|
||||
vnf_id = vnf_instance['vnf']['id']
|
||||
self.wait_until_vnf_active(
|
||||
vnf_id,
|
||||
constants.VNF_CIRROS_CREATE_TIMEOUT,
|
||||
constants.ACTIVE_SLEEP_TIME)
|
||||
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
|
||||
if vim_id:
|
||||
self.assertEqual(vim_id, vnf_instance['vnf']['vim_id'])
|
||||
|
||||
vnf_id = vnf_instance['vnf']['id']
|
||||
params = {'resource_id': vnf_id,
|
||||
'event_type': evt_constants.RES_EVT_CREATE,
|
||||
'timestamp': vnf_instance['vnf'][
|
||||
evt_constants.RES_EVT_CREATED_FLD]}
|
||||
vnf_evt_list = self.client.list_vnf_events(params)
|
||||
|
||||
self.assertIsNotNone(vnf_evt_list,
|
||||
"List of vnfd events are Empty after Creation")
|
||||
|
||||
# Delete vnf_instance with vnf_id
|
||||
try:
|
||||
self.client.delete_vnf(vnf_id)
|
||||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
|
||||
params = {'resource_id': vnf_id,
|
||||
'event_type': evt_constants.RES_EVT_DELETE}
|
||||
vnf_evt_list = self.client.list_vnf_events(params)
|
||||
|
||||
self.assertIsNotNone(vnf_evt_list,
|
||||
"List of vnf events are Empty after Deletion")
|
||||
self.assertEqual(1, len(vnf_evt_list))
|
||||
|
||||
# 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_vnf_with_default_vim(self):
|
||||
self._test_create_delete_vnf_events(
|
||||
vnf_name='test_vnf_with_cirros_no_monitoring')
|
||||
|
||||
def test_create_delete_vnf_with_vim_id(self):
|
||||
vim_list = self.client.list_vims()
|
||||
vim0_id = self.get_vim(vim_list, 'VIM0')['id']
|
||||
self._test_create_delete_vnf_events(
|
||||
vim_id=vim0_id,
|
||||
vnf_name='test_vnf_with_cirros_with_default_vim_id')
|
|
@ -1,60 +0,0 @@
|
|||
# Copyright 2016 Brocade Communications System, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.plugins.common import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class VnfdTestEvent(base.BaseTackerTest):
|
||||
def _test_create_delete_vnfd_events(self, vnfd_file):
|
||||
data = dict()
|
||||
data['tosca'] = read_file(vnfd_file)
|
||||
toscal = data['tosca']
|
||||
vnfd_name = 'sample_cirros_vnf'
|
||||
tosca_arg = {'vnfd': {'name': vnfd_name,
|
||||
'attributes': {'vnfd': toscal}}}
|
||||
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
|
||||
self.assertIsNotNone(vnfd_instance)
|
||||
|
||||
vnfd_id = vnfd_instance['vnfd']['id']
|
||||
params = {'resource_id': vnfd_id,
|
||||
'event_type': constants.RES_EVT_CREATE,
|
||||
'timestamp': vnfd_instance['vnfd'][
|
||||
constants.RES_EVT_CREATED_FLD]}
|
||||
vnfd_evt_list = self.client.list_vnfd_events(params)
|
||||
|
||||
self.assertIsNotNone(vnfd_evt_list,
|
||||
"List of vnfds events are Empty after Creation")
|
||||
self.assertEqual(1, len(vnfd_evt_list))
|
||||
|
||||
try:
|
||||
self.client.delete_vnfd(vnfd_id)
|
||||
except Exception:
|
||||
assert False, "vnfd Delete failed"
|
||||
|
||||
params = {'resource_id': vnfd_id,
|
||||
'event_type': constants.RES_EVT_DELETE}
|
||||
vnfd_evt_list = self.client.list_vnfd_events(params)
|
||||
|
||||
self.assertIsNotNone(vnfd_evt_list,
|
||||
"List of vnfds events are Empty after Deletion")
|
||||
self.assertEqual(1, len(vnfd_evt_list))
|
||||
|
||||
def test_vnfd_events(self):
|
||||
self._test_create_delete_vnfd_events('sample_cirros_vnf.yaml')
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
import yaml
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
@ -47,6 +48,8 @@ class VimTestCreate(base.BaseTackerTest):
|
|||
vim_obj = vim_res['vim']
|
||||
vim_id = vim_obj['id']
|
||||
self.verify_vim(vim_obj, data, name, description, version)
|
||||
self.verify_vim_events(vim_id, evt_constants.RES_EVT_CREATE,
|
||||
vim_obj[evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Read vim
|
||||
vim_show_res = self.client.show_vim(vim_id)
|
||||
|
@ -57,6 +60,7 @@ class VimTestCreate(base.BaseTackerTest):
|
|||
self.client.delete_vim(vim_id)
|
||||
except Exception:
|
||||
self.assertFalse(True, "Failed to delete vim %s" % vim_id)
|
||||
self.verify_vim_events(vim_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
def verify_vim(self, vim_instance, config_data, name, description,
|
||||
version):
|
||||
|
@ -76,6 +80,19 @@ class VimTestCreate(base.BaseTackerTest):
|
|||
method_name = 'verify_vim_' + version
|
||||
getattr(self, method_name)(vim_instance, config_data)
|
||||
|
||||
def verify_vim_events(self, vim_id, evt_type, tstamp=None, cnt=1):
|
||||
params = {'resource_id': vim_id,
|
||||
'resource_type': evt_constants.RES_TYPE_VIM,
|
||||
'event_type': evt_type}
|
||||
if tstamp:
|
||||
params['timestamp'] = tstamp
|
||||
|
||||
vim_evt_list = self.client.list_vim_events(params)
|
||||
|
||||
self.assertIsNotNone(vim_evt_list,
|
||||
"List of VIM events are Empty")
|
||||
self.assertEqual(cnt, len(vim_evt_list))
|
||||
|
||||
def verify_vim_v2(self, vim_instance, config_data):
|
||||
self.assertEqual(config_data['project_name'],
|
||||
vim_instance['auth_cred']['tenant_name'])
|
||||
|
|
|
@ -16,6 +16,7 @@ from novaclient import exceptions
|
|||
from oslo_config import cfg
|
||||
import yaml
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
@ -52,12 +53,18 @@ class VnfTestToscaCreate(base.BaseTackerTest):
|
|||
constants.ACTIVE_SLEEP_TIME)
|
||||
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
|
||||
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Delete vnf_instance with vnf_id
|
||||
try:
|
||||
self.client.delete_vnf(vnf_id)
|
||||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
@ -91,6 +98,10 @@ class VnfTestToscaCreateFlavorCreation(base.BaseTackerTest):
|
|||
constants.ACTIVE_SLEEP_TIME)
|
||||
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
|
||||
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
servers = self.novaclient().servers.list()
|
||||
vdu_server = None
|
||||
for server in servers:
|
||||
|
@ -109,6 +120,8 @@ class VnfTestToscaCreateFlavorCreation(base.BaseTackerTest):
|
|||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
@ -144,6 +157,10 @@ class VnfTestToscaCreateImageCreation(base.BaseTackerTest):
|
|||
constants.ACTIVE_SLEEP_TIME)
|
||||
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
|
||||
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
servers = self.novaclient().servers.list()
|
||||
vdu_server = None
|
||||
for server in servers:
|
||||
|
@ -162,6 +179,8 @@ class VnfTestToscaCreateImageCreation(base.BaseTackerTest):
|
|||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
|
|
@ -16,6 +16,7 @@ from toscaparser import tosca_template
|
|||
import yaml
|
||||
|
||||
from tacker.common import utils
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
@ -50,6 +51,10 @@ class VnfTestToscaMultipleVDU(base.BaseTackerTest):
|
|||
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,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Validate mgmt_url with input yaml file
|
||||
mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
|
||||
self.assertIsNotNone(mgmt_url)
|
||||
|
@ -74,6 +79,8 @@ class VnfTestToscaMultipleVDU(base.BaseTackerTest):
|
|||
except Exception:
|
||||
assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
from oslo_config import cfg
|
||||
import yaml
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
@ -35,10 +36,15 @@ class VnfdTestCreate(base.BaseTackerTest):
|
|||
self.assertIsNotNone(vnfds, "List of vnfds are Empty after Creation")
|
||||
|
||||
vnfd_id = vnfd_instance['vnfd']['id']
|
||||
self.verify_vnfd_events(
|
||||
vnfd_id, evt_constants.RES_EVT_CREATE,
|
||||
vnfd_instance['vnfd'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
try:
|
||||
self.client.delete_vnfd(vnfd_id)
|
||||
except Exception:
|
||||
assert False, "vnfd Delete failed"
|
||||
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
def test_tosca_vnfd(self):
|
||||
self._test_create_list_delete_tosca_vnfd('sample-tosca-vnfd.yaml')
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
@ -58,12 +59,18 @@ class VnfTestCreate(base.BaseTackerTest):
|
|||
self.assertIn('id', vnf_details)
|
||||
self.assertIn('type', vnf_details)
|
||||
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Delete vnf_instance with vnf_id
|
||||
try:
|
||||
self.client.delete_vnf(vnf_id)
|
||||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
|
|
@ -15,6 +15,7 @@ from oslo_config import cfg
|
|||
import yaml
|
||||
|
||||
from tacker.common import utils
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
@ -50,6 +51,10 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
|
|||
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,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Validate mgmt_url with input yaml file
|
||||
mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
|
||||
self.assertIsNotNone(mgmt_url)
|
||||
|
@ -67,6 +72,8 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
|
|||
except Exception:
|
||||
assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"
|
||||
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
# Delete vnfd_instance
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
@ -35,10 +36,15 @@ class VnfdTestCreate(base.BaseTackerTest):
|
|||
self.assertIsNotNone(vnfds, "List of vnfds are Empty after Creation")
|
||||
|
||||
vnfd_id = vnfd_instance['vnfd']['id']
|
||||
|
||||
self.verify_vnfd_events(
|
||||
vnfd_id, evt_constants.RES_EVT_CREATE,
|
||||
vnfd_instance['vnfd'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
try:
|
||||
self.client.delete_vnfd(vnfd_id)
|
||||
except Exception:
|
||||
assert False, "vnfd Delete failed"
|
||||
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
def test_vnfd(self):
|
||||
self._test_create_list_delete_vnfd('sample_cirros_vnf.yaml')
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import yaml
|
||||
|
||||
from tacker.plugins.common import constants as evt_constants
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
@ -35,6 +36,9 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.assertIsNotNone(vnfd_instance)
|
||||
vnfd_id = vnfd_instance['vnfd']['id']
|
||||
self.assertIsNotNone(vnfd_id)
|
||||
self.verify_vnfd_events(
|
||||
vnfd_id, evt_constants.RES_EVT_CREATE,
|
||||
vnfd_instance['vnfd'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
return vnfd_instance
|
||||
|
||||
def _test_vnfd_delete(self, vnfd_instance):
|
||||
|
@ -45,6 +49,7 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.client.delete_vnfd(vnfd_id)
|
||||
except Exception:
|
||||
assert False, "vnfd Delete failed"
|
||||
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE)
|
||||
try:
|
||||
vfnd_d = self.client.show_vnfd(vnfd_id)
|
||||
except Exception:
|
||||
|
@ -68,6 +73,10 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
|
||||
vnf_instance = self.client.show_vnf(vnf_id)
|
||||
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
# Verify values dictionary is same as param values from vnf_show
|
||||
|
||||
param_values = vnf_instance['vnf']['attributes']['param_values']
|
||||
|
@ -82,6 +91,7 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.client.delete_vnf(vnf_id)
|
||||
except Exception:
|
||||
assert False, "vnf Delete failed"
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
|
||||
try:
|
||||
vfn_d = self.client.show_vnf(vnf_id)
|
||||
|
@ -100,6 +110,10 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.assertEqual(input_dict, param_values_dict)
|
||||
self._test_vnf_delete(vnf_instance)
|
||||
vnf_id = vnf_instance['vnf']['id']
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_instance['vnfd']['id'])
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
constants.VNF_CIRROS_DELETE_TIMEOUT)
|
||||
|
@ -120,6 +134,10 @@ class VnfmTestParam(base.BaseTackerTest):
|
|||
self.assertEqual(values_dict, param_values_dict)
|
||||
self._test_vnf_delete(vnf_instance)
|
||||
vnf_id = vnf_instance['vnf']['id']
|
||||
self.verify_vnf_crud_events(
|
||||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
self.verify_vnf_crud_events(vnf_id, evt_constants.RES_EVT_DELETE)
|
||||
self.addCleanup(self.client.delete_vnfd, vnfd_instance['vnfd']['id'])
|
||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||
constants.VNF_CIRROS_DELETE_TIMEOUT)
|
||||
|
|
Loading…
Reference in New Issue