Browse Source

Fix dsvm failure caused by devstack plugin and event/auditing func.

This patch will fix dsvm failure:
1. The new changes in devstack [1]. Whereby, plugin was not enabled
to use multiple times. Currently, almost functions like fixup_quota,
add_key and add_secgrp enable plugin which runs multiple times.
2. Some functional tests were not working with event/auditing function.
[1]https://review.openstack.org/#/c/396794/

Change-Id: I1846c0df1d59557919a4caa612f2a4c60fbf7ce8
Closes-Bug: #1646807
tags/0.6.0
doantungbk 3 years ago
parent
commit
17e28c9d90
12 changed files with 38 additions and 37 deletions
  1. +1
    -1
      tacker/tests/contrib/post_test_hook.sh
  2. +0
    -5
      tacker/tests/contrib/post_test_hook_lib.sh
  3. +3
    -1
      tacker/tests/functional/base.py
  4. +1
    -2
      tacker/tests/functional/nfvo/test_vim.py
  5. +6
    -6
      tacker/tests/functional/vnfm/test_tosca_vnf.py
  6. +2
    -2
      tacker/tests/functional/vnfm/test_tosca_vnf_multiple_vdu.py
  7. +8
    -6
      tacker/tests/functional/vnfm/test_tosca_vnfd.py
  8. +2
    -2
      tacker/tests/functional/vnfm/test_vnf.py
  9. +2
    -2
      tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py
  10. +3
    -2
      tacker/tests/functional/vnfm/test_vnfd.py
  11. +9
    -8
      tacker/tests/functional/vnfm/test_vnfm_param.py
  12. +1
    -0
      tools/prepare_functional_test.sh

+ 1
- 1
tacker/tests/contrib/post_test_hook.sh View File

@@ -60,7 +60,7 @@ then
owner=stack
sudo_env=
log_dir="/tmp/${venv}-logs"
source $DEVSTACK_DIR/openrc admin admin
fixup_quota
add_key
add_secgrp

+ 0
- 5
tacker/tests/contrib/post_test_hook_lib.sh View File

@@ -15,7 +15,6 @@
PRIVATE_KEY_FILE=${PRIVATE_KEY_FILE:-"keypair.priv"}

function fixup_quota {
source $DEVSTACK_DIR/openrc admin admin
echo "Disable nova compute instance & core quota"
nova quota-class-update --instances -1 --cores -1 default
projectId=$(openstack project list | awk '/\ nfv\ / {print $2}')
@@ -26,7 +25,6 @@ function fixup_quota {
# Adding nova keypair if not exist to support key_name (#1578785).
function add_key_if_not_exist {
echo "Adding nova key if not exist"
source $DEVSTACK_DIR/openrc admin admin
userId=$(openstack user list | awk '/\ nfv_user\ / {print $2}')
nova keypair-show userKey --user $userId >/dev/null
if [[ "$?" != "0" ]]; then
@@ -40,7 +38,6 @@ function add_key_if_not_exist {
# used by OpenStack CI since it will fail if $? is not 0
function add_key {
echo "Adding nova key"
source $DEVSTACK_DIR/openrc admin admin
userId=$(openstack user list | awk '/\ nfv_user\ / {print $2}')
nova keypair-add userKey --user $userId > ${PRIVATE_KEY_FILE}
}
@@ -61,7 +58,6 @@ function _check_secgrps {

function add_secgrp_if_not_exist {
echo "Adding nova security group"
source $DEVSTACK_DIR/openrc admin admin
openstack security group show test_secgrp
if [[ "$?" != "0" ]]; then
_create_secgrps
@@ -74,7 +70,6 @@ function add_secgrp_if_not_exist {
# Adding nova security groups (#1591372).
function add_secgrp {
echo "Adding nova security group"
source $DEVSTACK_DIR/openrc admin admin
_create_secgrps
_check_secgrps
}

+ 3
- 1
tacker/tests/functional/base.py View File

@@ -171,8 +171,10 @@ class BaseTackerTest(base.BaseTestCase):
"List of VNF events are Empty")
self.assertEqual(cnt, len(vnf_evt_list['vnf_events']))

def verify_vnfd_events(self, vnfd_id, evt_type, tstamp=None, cnt=1):
def verify_vnfd_events(self, vnfd_id, evt_type, res_state,
tstamp=None, cnt=1):
params = {'resource_id': vnfd_id,
'resource_state': res_state,
'resource_type': evt_constants.RES_TYPE_VNFD,
'event_type': evt_type}
if tstamp:

+ 1
- 2
tacker/tests/functional/nfvo/test_vim.py View File

@@ -48,8 +48,7 @@ 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])
self.verify_vim_events(vim_id, evt_constants.RES_EVT_CREATE)

# Read vim
vim_show_res = self.client.show_vim(vim_id)

+ 6
- 6
tacker/tests/functional/vnfm/test_tosca_vnf.py View File

@@ -76,8 +76,8 @@ class VnfTestToscaCreate(base.BaseTackerTest):
resource_name=field)

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])
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)
return vnfd_id, vnf_id
@@ -154,8 +154,8 @@ class VnfTestToscaCreateFlavorCreation(base.BaseTackerTest):
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])

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])
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)

@@ -216,8 +216,8 @@ class VnfTestToscaCreateImageCreation(base.BaseTackerTest):
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])

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])
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)


+ 2
- 2
tacker/tests/functional/vnfm/test_tosca_vnf_multiple_vdu.py View File

@@ -52,8 +52,8 @@ class VnfTestToscaMultipleVDU(base.BaseTackerTest):
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])
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)


+ 8
- 6
tacker/tests/functional/vnfm/test_tosca_vnfd.py View File

@@ -23,10 +23,9 @@ CONF = cfg.CONF


class VnfdTestCreate(base.BaseTackerTest):
def _test_create_list_delete_tosca_vnfd(self, tosca_vnfd_file):
def _test_create_list_delete_tosca_vnfd(self, tosca_vnfd_file, vnfd_name):
input_yaml = read_file(tosca_vnfd_file)
tosca_dict = yaml.safe_load(input_yaml)
vnfd_name = 'sample-tosca-vnfd'
tosca_arg = {'vnfd': {'name': vnfd_name,
'attributes': {'vnfd': tosca_dict}}}
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
@@ -38,17 +37,20 @@ class VnfdTestCreate(base.BaseTackerTest):
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])
evt_constants.RES_EVT_VNFD_ONBOARDED)

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)
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE,
evt_constants.RES_EVT_VNFD_NA_STATE)

def test_tosca_vnfd(self):
self._test_create_list_delete_tosca_vnfd('sample-tosca-vnfd.yaml')
self._test_create_list_delete_tosca_vnfd('sample-tosca-vnfd.yaml',
'sample-tosca-vnfd-template')

def test_tosca_large_vnfd(self):
self._test_create_list_delete_tosca_vnfd(
'sample-tosca-vnfd-large-template.yaml')
'sample-tosca-vnfd-large-template.yaml',
'sample-tosca-vnfd-large-template')

+ 2
- 2
tacker/tests/functional/vnfm/test_vnf.py View File

@@ -59,8 +59,8 @@ class VnfTestCreate(base.BaseTackerTest):
self.assertIn('type', vnf_details)

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])
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)


+ 2
- 2
tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py View File

@@ -52,8 +52,8 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
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])
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)


+ 3
- 2
tacker/tests/functional/vnfm/test_vnfd.py View File

@@ -39,12 +39,13 @@ class VnfdTestCreate(base.BaseTackerTest):

self.verify_vnfd_events(
vnfd_id, evt_constants.RES_EVT_CREATE,
vnfd_instance['vnfd'][evt_constants.RES_EVT_CREATED_FLD])
evt_constants.RES_EVT_VNFD_ONBOARDED)
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)
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE,
evt_constants.RES_EVT_VNFD_NA_STATE)

def test_vnfd(self):
self._test_create_list_delete_vnfd('sample_cirros_vnf.yaml')

+ 9
- 8
tacker/tests/functional/vnfm/test_vnfm_param.py View File

@@ -37,7 +37,7 @@ class VnfmTestParam(base.BaseTackerTest):
self.assertIsNotNone(vnfd_id)
self.verify_vnfd_events(
vnfd_id, evt_constants.RES_EVT_CREATE,
vnfd_instance['vnfd'][evt_constants.RES_EVT_CREATED_FLD])
evt_constants.RES_EVT_VNFD_ONBOARDED)
return vnfd_instance

def _test_vnfd_delete(self, vnfd_instance):
@@ -48,7 +48,8 @@ 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)
self.verify_vnfd_events(vnfd_id, evt_constants.RES_EVT_DELETE,
evt_constants.RES_EVT_VNFD_NA_STATE)
try:
vnfd_d = self.client.show_vnfd(vnfd_id)
except Exception:
@@ -73,8 +74,8 @@ class VnfmTestParam(base.BaseTackerTest):
vnf_instance = self.client.show_vnf(vnf_id)

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])
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)

@@ -116,8 +117,8 @@ class VnfmTestParam(base.BaseTackerTest):
self._test_vnf_delete(vnf_instance)
vnf_id = vnf_instance['vnf']['id']
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])
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)
self.wait_until_vnf_delete(vnf_id,
@@ -145,8 +146,8 @@ class VnfmTestParam(base.BaseTackerTest):
self._test_vnf_delete(vnf_instance)
vnf_id = vnf_instance['vnf']['id']
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])
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)
self.wait_until_vnf_delete(vnf_id,

+ 1
- 0
tools/prepare_functional_test.sh View File

@@ -12,6 +12,7 @@ if [ ! -f ${DEVSTACK_DIR}/openrc ]; then
exit 1
fi

source $DEVSTACK_DIR/openrc admin admin
source ${TACKER_DIR}/tacker/tests/contrib/post_test_hook_lib.sh

fixup_quota

Loading…
Cancel
Save