aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtestcases/features/sfc/sfc.py16
-rwxr-xr-xtestcases/features/sfc/sfc_colorado1.py63
2 files changed, 64 insertions, 15 deletions
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index 3f46026ad..ec1720003 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -149,6 +149,18 @@ def main():
sg_id = os_utils.create_security_group_full(neutron_client,
SECGROUP_NAME, SECGROUP_DESCR)
+ secgroups = os_utils.get_security_groups(neutron_client)
+
+ for sg in secgroups:
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'ingress', 'tcp',
+ port_range_min=22,
+ port_range_max=22)
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'egress', 'tcp',
+ port_range_min=22,
+ port_range_max=22)
+
# boot INSTANCE
logger.info("Creating instance '%s'..." % INSTANCE_NAME)
logger.debug(
@@ -289,12 +301,12 @@ def main():
time.sleep(3)
r += 1
- logger.info("SSH connectivity to the SFs established")
-
if not all(check):
logger.error("Cannot establish SSH connection to the SFs")
sys.exit(1)
+ logger.info("SSH connectivity to the SFs established")
+
# SSH TO START THE VXLAN_TOOL ON SF1
logger.info("Configuring the SFs")
try:
diff --git a/testcases/features/sfc/sfc_colorado1.py b/testcases/features/sfc/sfc_colorado1.py
index b8f6b9d75..dc13436eb 100755
--- a/testcases/features/sfc/sfc_colorado1.py
+++ b/testcases/features/sfc/sfc_colorado1.py
@@ -51,6 +51,16 @@ TACKER_SCRIPT = 'sfc_tacker.bash'
TEARDOWN_SCRIPT = "sfc_teardown.bash"
TACKER_CHANGECLASSI = "sfc_change_classi.bash"
+ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+
+
+def check_ssh(ip):
+ cmd = "sshpass -p opnfv ssh " + ssh_options + " -q " + ip + " exit"
+ success = subprocess.call(cmd, shell=True) == 0
+ if not success:
+ logger.debug("Wating for SSH connectivity in SF with IP: %s" % ip)
+ return success
+
def main():
@@ -62,7 +72,6 @@ def main():
start_time = time.time()
json_results = {}
- ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
contr_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
" 'fuel node'|grep controller|awk '{print $10}'")
logger.info("Executing script to get ip_server: '%s'" % contr_cmd)
@@ -139,6 +148,18 @@ def main():
sg_id = os_utils.create_security_group_full(neutron_client,
SECGROUP_NAME, SECGROUP_DESCR)
+ secgroups = os_utils.get_security_groups(neutron_client)
+
+ for sg in secgroups:
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'ingress', 'tcp',
+ port_range_min=22,
+ port_range_max=22)
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'egress', 'tcp',
+ port_range_min=22,
+ port_range_max=22)
+
iterator = 0
while(iterator < 6):
# boot INSTANCE
@@ -153,7 +174,7 @@ def main():
if instance is None:
logger.error("Error while booting instance.")
- sys.exit(-1)
+ continue
# Retrieve IP of INSTANCE
instance_ip = instance.networks.get(NET_NAME)[0]
logger.debug("Instance '%s' got private ip '%s'." %
@@ -170,7 +191,7 @@ def main():
if floatip_client is None:
logger.error("Cannot create floating IP.")
- sys.exit(-1)
+ continue
logger.info("Floating IP created: '%s'" % floatip_client)
logger.info("Associating floating ip: '%s' to VM '%s' "
@@ -179,7 +200,7 @@ def main():
instance.id,
floatip_client):
logger.error("Cannot associate floating IP to VM.")
- sys.exit(-1)
+ continue
# STARTING SECOND VM (server) ###
@@ -196,7 +217,7 @@ def main():
if instance_2 is None:
logger.error("Error while booting instance.")
- sys.exit(-1)
+ continue
# Retrieve IP of INSTANCE
instance_ip_2 = instance_2.networks.get(NET_NAME)[0]
logger.debug("Instance '%s' got private ip '%s'." %
@@ -213,7 +234,7 @@ def main():
if floatip_server is None:
logger.error("Cannot create floating IP.")
- sys.exit(-1)
+ continue
logger.info("Floating IP created: '%s'" % floatip_server)
logger.info("Associating floating ip: '%s' to VM '%s' "
@@ -223,7 +244,7 @@ def main():
instance_2.id,
floatip_server):
logger.error("Cannot associate floating IP to VM.")
- sys.exit(-1)
+ continue
# CREATION OF THE 2 SF ####
@@ -268,14 +289,30 @@ def main():
logger.error('Failed to obtain IPs, cant continue, exiting')
return
- logger.info("Waiting 60 seconds for floating IP assignment")
- for j in range(0, 6):
- logger.debug("Test starting in"
- " {0} seconds".format(str((6 - j) * 10)))
- time.sleep(10)
-
logger.debug("Floating IPs for SFs: %s..." % ips)
+ # Check SSH connectivity to VNFs
+ r = 0
+ retries = 100
+ check = [False, False]
+
+ logger.info("Checking SSH connectivity to the SFs with ips {0}"
+ .format(str(ips)))
+ while r < retries and not all(check):
+ try:
+ check = [check_ssh(ips[0]), check_ssh(ips[1])]
+ except Exception:
+ logger.exception("SSH check failed")
+ check = [False, False]
+ time.sleep(3)
+ r += 1
+
+ if not all(check):
+ logger.error("Cannot establish SSH connection to the SFs")
+ continue
+
+ logger.info("SSH connectivity to the SFs established")
+
# SSH TO START THE VXLAN_TOOL ON SF1
logger.info("Configuring the SFs")
try: