From bdad6faa1fafe7cd20ea96aa70a52178d62add63 Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Mon, 27 Aug 2018 18:11:11 +0200 Subject: Decouple tacker from tests Support n-sfc too and abstract a bit the MANO layer so that other MANO components can be inserted into the test Change-Id: I3fb59fbf40b4207bf1721092cd8ff0559e1d9d90 Signed-off-by: Manuel Buil --- sfc/lib/cleanup.py | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'sfc/lib/cleanup.py') diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py index e614867d..ee3ad689 100644 --- a/sfc/lib/cleanup.py +++ b/sfc/lib/cleanup.py @@ -75,6 +75,7 @@ def delete_vims(): # Creators is a list full of SNAPs objects def delete_openstack_objects(creators): + logger.info("Deleting the openstack objects...") for creator in reversed(creators): try: creator.clean() @@ -97,26 +98,49 @@ def cleanup_odl(odl_ip, odl_port): delete_odl_ietf_access_lists(odl_ip, odl_port) -def cleanup(creators, odl_ip=None, odl_port=None): +def cleanup_nsfc_objects(): + ''' + cleanup the networking-sfc objects created for the test + ''' + # TODO Add n-sfc to snaps so that it can be removed through + # delete_openstack_objects + openstack_sfc = os_sfc_utils.OpenStackSFC() + openstack_sfc.delete_chain() + openstack_sfc.delete_port_groups() + + +def cleanup_tacker_objects(): + ''' + cleanup the tacker objects created for the test + ''' delete_vnffgs() delete_vnffgds() delete_vnfs() time.sleep(20) delete_vnfds() delete_vims() + + +def cleanup_mano_objects(mano): + ''' + Cleanup the mano objects (chains, classifiers, etc) + ''' + if mano == 'tacker': + cleanup_tacker_objects() + elif mano == 'no-mano': + cleanup_nsfc_objects() + + +def cleanup(creators, mano, odl_ip=None, odl_port=None): + cleanup_mano_objects(mano) delete_openstack_objects(creators) delete_untracked_security_groups() if odl_ip is not None and odl_port is not None: cleanup_odl(odl_ip, odl_port) -def cleanup_from_bash(odl_ip=None, odl_port=None): - delete_vnffgs() - delete_vnffgds() - delete_vnfs() - time.sleep(20) - delete_vnfds() - delete_vims() +def cleanup_from_bash(odl_ip=None, odl_port=None, mano='no-mano'): + cleanup_mano_objects(mano=mano) if odl_ip is not None and odl_port is not None: cleanup_odl(odl_ip, odl_port) -- cgit 1.2.3-korg