summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sfc/lib/utils.py19
-rw-r--r--sfc/tests/functest/setup_scripts/delete.sh3
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py33
3 files changed, 28 insertions, 27 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index 13f534be..a89dc5b5 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -348,7 +348,7 @@ def check_ssh(ips, retries=100):
return False
-def ofctl_time_counter(ovs_logger, ssh_conn):
+def ofctl_time_counter(ovs_logger, ssh_conn, max_duration=None):
try:
# We get the flows from table 11
table = 11
@@ -358,6 +358,17 @@ def ofctl_time_counter(ovs_logger, ssh_conn):
rsps = []
lines = output.split(",")
for line in lines:
+ if max_duration is not None:
+ pattern2 = "duration"
+ is_there2 = re.findall(pattern2, line)
+ if is_there2:
+ value = line.split("=")[1].split(".")[0]
+ value_int = int(value)
+ if value_int < max_duration:
+ # The RSP is new, no need to store the RSP in first_RSP
+ return rsps
+ else:
+ continue
is_there = re.findall(pattern, line)
if is_there:
value = line.split(":")[1].split("-")[0]
@@ -370,7 +381,11 @@ def ofctl_time_counter(ovs_logger, ssh_conn):
@ft_utils.timethis
def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200):
- rsps = ofctl_time_counter(ovs_logger, compute_clients[0])
+ # 10 sec. is the threshold to consider a flow from an old deployment
+ max_duration = 10
+ rsps = ofctl_time_counter(ovs_logger, compute_clients[0], max_duration)
+ # first_RSP saves a potential RSP from an old deployment. ODL may take
+ # quite some time to implement the new flow and an old flow may be there
first_RSP = rsps[0] if len(rsps) > 0 else ''
while not ((len(rsps) > 1) and
(first_RSP != rsps[0]) and
diff --git a/sfc/tests/functest/setup_scripts/delete.sh b/sfc/tests/functest/setup_scripts/delete.sh
index 2c9de04b..908d81fc 100644
--- a/sfc/tests/functest/setup_scripts/delete.sh
+++ b/sfc/tests/functest/setup_scripts/delete.sh
@@ -1,4 +1,4 @@
-source ${repos_dir}/sfc/sfc/tests/functest/tackerc
+# Remember to source the env variables $creds before
tacker sfc-classifier-delete red_http
tacker sfc-classifier-delete blue_ssh
tacker sfc-classifier-delete red_ssh
@@ -14,3 +14,4 @@ openstack stack delete sfc_test1 --y
openstack stack delete sfc_test2 --y
nova delete client
nova delete server
+for line in $(neutron floatingip-list | cut -d" " -f2);do neutron floatingip-delete $line;done
diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
index 2383bb3e..e112e07b 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -8,7 +8,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import argparse
import os
import sys
import threading
@@ -17,19 +16,12 @@ import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_tacker as os_tacker
import functest.utils.openstack_utils as os_utils
import opnfv.utils.ovs_logger as ovs_log
+
import sfc.lib.config as sfc_config
import sfc.lib.utils as test_utils
from sfc.lib.results import Results
-parser = argparse.ArgumentParser()
-
-parser.add_argument("-r", "--report",
- help="Create json result file",
- action="store_true")
-
-args = parser.parse_args()
-
""" logging configuration """
logger = ft_logger.Logger("ODL_SFC").getLogger()
@@ -111,24 +103,17 @@ def main():
srv_prv_ip = srv_instance.networks.get(TESTCASE_CONFIG.net_name)[0]
- tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir,
- COMMON_CONFIG.vnfd_dir,
- TESTCASE_CONFIG.test_vnfd_red)
- os_tacker.create_vnfd(
- tacker_client,
- tosca_file=tosca_file)
+ tosca_red = os.path.join(COMMON_CONFIG.sfc_test_dir,
+ COMMON_CONFIG.vnfd_dir,
+ TESTCASE_CONFIG.test_vnfd_red)
+ os_tacker.create_vnfd(tacker_client, tosca_file=tosca_red)
- tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir,
+ tosca_blue = os.path.join(COMMON_CONFIG.sfc_test_dir,
COMMON_CONFIG.vnfd_dir,
TESTCASE_CONFIG.test_vnfd_blue)
- os_tacker.create_vnfd(
- tacker_client,
- tosca_file=tosca_file)
-
- os_tacker.create_vnf(
- tacker_client, 'testVNF1', vnfd_name='test-vnfd1')
- os_tacker.create_vnf(
- tacker_client, 'testVNF2', vnfd_name='test-vnfd2')
+ os_tacker.create_vnfd(tacker_client, tosca_file=tosca_blue)
+ os_tacker.create_vnf(tacker_client, 'testVNF1', vnfd_name='test-vnfd1')
+ os_tacker.create_vnf(tacker_client, 'testVNF2', vnfd_name='test-vnfd2')
try:
os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1')