Merge "VNF monitoring event capture: Functional test"

This commit is contained in:
Jenkins 2016-09-08 18:53:48 +00:00 committed by Gerrit Code Review
commit 38167f2ccc
2 changed files with 15 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from oslo_config import cfg
from tempest.lib import base
import yaml
from tacker.plugins.common import constants as evt_constants
from tacker.tests import constants
from tacker.tests.utils import read_file
from tacker import version
@ -129,6 +130,14 @@ class BaseTackerTest(base.BaseTestCase):
constants.ACTIVE_SLEEP_TIME)
self.validate_vnf_instance(vnfd_instance, vnf_instance)
def verify_vnf_monitor_events(self, vnf_id, vnf_state_list):
for state in vnf_state_list:
params = {'resource_id': vnf_id, 'resource_state': state,
'event_type': evt_constants.RES_EVT_MONITOR}
vnf_evt_list = self.client.list_vnf_events(params)
mesg = ("%s - state transition expected." % state)
self.assertIsNotNone(vnf_evt_list, mesg)
def get_vim(self, vim_list, vim_name):
if len(vim_list.values()) == 0:
assert False, "vim_list is Empty: Default VIM is missing"

View File

@ -11,6 +11,8 @@
# 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 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
@ -45,6 +47,10 @@ class VnfTestPingMonitor(base.BaseTackerTest):
assert False, ("Failed to delete vnf %s after the monitor test" %
vnf_id)
# Verify VNF monitor events captured for states, ACTIVE and DEAD
vnf_state_list = [evt_constants.ACTIVE, evt_constants.DEAD]
self.verify_vnf_monitor_events(vnf_id, vnf_state_list)
# Delete vnfd_instance
self.addCleanup(self.client.delete_vnfd, vnfd_id)
self.addCleanup(self.wait_until_vnf_delete, vnf_id,