aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/requirements.pip1
-rwxr-xr-xtestcases/security_scan/security_scan.py13
-rwxr-xr-xutils/openstack_clean.py11
-rwxr-xr-xutils/openstack_utils.py5
4 files changed, 24 insertions, 6 deletions
diff --git a/docker/requirements.pip b/docker/requirements.pip
index 25ec795f3..7ba1a350c 100644
--- a/docker/requirements.pip
+++ b/docker/requirements.pip
@@ -11,6 +11,7 @@ pyyaml==3.10
gitpython==1.0.1
python-openstackclient==2.3.0
python-ceilometerclient==1.5.1
+python-keystoneclient==2.3.1
virtualenv==1.11.4
pexpect==4.0
requests==2.8.0
diff --git a/testcases/security_scan/security_scan.py b/testcases/security_scan/security_scan.py
index 7b9250215..ac7b78ed6 100755
--- a/testcases/security_scan/security_scan.py
+++ b/testcases/security_scan/security_scan.py
@@ -12,18 +12,19 @@
# nominated node. Post scan a report is downloaded and if '--clean' is passed
# all trace of the scan is removed from the remote system.
+
+import argparse
+import connect
import datetime
import os
import sys
-from ConfigParser import SafeConfigParser
-import argparse
+from ConfigParser import SafeConfigParser
from functest.utils.functest_utils import FUNCTEST_REPO as FUNCTEST_REPO
from keystoneclient import session
from keystoneclient.auth.identity import v2
from novaclient import client
-import connect
__version__ = 0.1
__author__ = 'Luke Hinds (lhinds@redhat.com)'
@@ -80,16 +81,16 @@ def run_tests(host, nodetype):
connect.logger.info("Internet Connection OK.")
connect.logger.info("Creating temp file structure..")
createfiles(host, port, user, localkey)
- connect.logger.info("Installing OpenSCAP...")
+ connect.logger.debug("Installing OpenSCAP...")
install_pkg(host, port, user, localkey)
- connect.logger.info("Running scan...")
+ connect.logger.debug("Running scan...")
run_scanner(host, port, user, localkey, nodetype)
clean = cfgparse.get(nodetype, 'clean')
connect.logger.info("Post installation tasks....")
post_tasks(host, port, user, localkey, nodetype)
if clean:
connect.logger.info("Cleaning down environment....")
- connect.logger.info("Removing OpenSCAP....")
+ connect.logger.debug("Removing OpenSCAP....")
removepkg(host, port, user, localkey, nodetype)
connect.logger.info("Deleting tmp file and reports (remote)...")
cleandir(host, port, user, localkey, nodetype)
diff --git a/utils/openstack_clean.py b/utils/openstack_clean.py
index 8aba763ce..3b937c917 100755
--- a/utils/openstack_clean.py
+++ b/utils/openstack_clean.py
@@ -202,9 +202,20 @@ def remove_networks(neutron_client, default_networks, default_routers):
else:
remove_routers(neutron_client, routers, default_routers)
+ # trozet: wait for Neutron to auto-cleanup HA networks when HA router is
+ # deleted
+ time.sleep(5)
+
# remove networks
if network_ids is not None:
for net_id in network_ids:
+ networks = os_utils.get_network_list(neutron_client)
+ if networks is None:
+ logger.debug("No networks left to remove")
+ break
+ elif not any(network['id'] == net_id for network in networks):
+ logger.debug("Network %s has already been removed" % net_id)
+ continue
logger.debug("Removing network %s ..." % net_id)
if os_utils.delete_neutron_net(neutron_client, net_id):
logger.debug(" > Done!")
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index 21e00d9b9..ff9b54a58 100755
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -705,6 +705,11 @@ def create_network_association(neutron_client, bgpvpn_id, neutron_network_id):
return neutron_client.create_network_association(bgpvpn_id, json_body)
+def create_router_association(neutron_client, bgpvpn_id, router_id):
+ json_body = {"router_association": {"router_id": router_id}}
+ return neutron_client.create_router_association(bgpvpn_id, json_body)
+
+
def update_bgpvpn(neutron_client, bgpvpn_id, **kwargs):
json_body = {"bgpvpn": kwargs}
return neutron_client.update_bgpvpn(bgpvpn_id, json_body)