From 60c7f57f814789dfb4bc0c905e34651c4e633a10 Mon Sep 17 00:00:00 2001 From: George Paraskevopoulos Date: Tue, 29 Nov 2016 10:45:22 +0200 Subject: Pythonize sfc_change_classi.bash JIRA: SFC-52 Cleanup sfc_change_classi.bash script from sfc testcase DEPENDS ON: https://gerrit.opnfv.org/gerrit/#/c/25075/ Change-Id: Id55d30925a79cd47181af9958697f67be9dacc8c Signed-off-by: George Paraskevopoulos --- tests/functest/odl-sfc/sfc.py | 24 ++++++++++++++++++++++-- tests/functest/odl-sfc/sfc_change_classi.bash | 7 ------- 2 files changed, 22 insertions(+), 9 deletions(-) delete mode 100755 tests/functest/odl-sfc/sfc_change_classi.bash (limited to 'tests/functest/odl-sfc') diff --git a/tests/functest/odl-sfc/sfc.py b/tests/functest/odl-sfc/sfc.py index 78d11c5a..09c7cca9 100755 --- a/tests/functest/odl-sfc/sfc.py +++ b/tests/functest/odl-sfc/sfc.py @@ -6,6 +6,7 @@ import time import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils +import functest.utils.openstack_tacker as os_tacker import threading import utils as test_utils @@ -42,7 +43,6 @@ SECGROUP_NAME = "example-sg" SECGROUP_DESCR = "Example Security group" SFC_TEST_DIR = os.path.join(REPO_PATH, "tests/functest/odl-sfc/") TACKER_SCRIPT = os.path.join(SFC_TEST_DIR, "sfc_tacker.bash") -TACKER_CHANGECLASSI = os.path.join(SFC_TEST_DIR, "sfc_change_classi.bash") ssh_options = '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' json_results = {"tests": 4, "failures": 0} @@ -89,6 +89,7 @@ def main(): glance_client = os_utils.get_glance_client() neutron_client = os_utils.get_neutron_client() nova_client = os_utils.get_nova_client() + tacker_client = os_tacker.get_tacker_client() controller_clients = test_utils.get_ssh_clients("controller", PROXY) compute_clients = test_utils.get_ssh_clients("compute", PROXY) @@ -170,7 +171,26 @@ def main(): update_json_results("Test 2: HTTP works", "Failed") logger.info("Changing the classification") - subprocess.call(TACKER_CHANGECLASSI, shell=True) + os_tacker.delete_sfc_classifier(tacker_client, sfc_clf_name='red_http') + os_tacker.delete_sfc_classifier(tacker_client, sfc_clf_name='red_ssh') + + os_tacker.create_sfc_classifier( + tacker_client, 'blue_http', sfc_name='blue', + match={ + 'source_port': 0, + 'dest_port': 80, + 'protocol': 6 + }) + + os_tacker.create_sfc_classifier( + tacker_client, 'blue_ssh', sfc_name='blue', + match={ + 'source_port': 0, + 'dest_port': 22, + 'protocol': 6 + }) + + logger.info(test_utils.run_cmd('tacker sfc-classifier-list')) # Start measuring the time it takes to implement the classification rules t2 = threading.Thread(target=test_utils.capture_time_log, diff --git a/tests/functest/odl-sfc/sfc_change_classi.bash b/tests/functest/odl-sfc/sfc_change_classi.bash deleted file mode 100755 index 70375ab3..00000000 --- a/tests/functest/odl-sfc/sfc_change_classi.bash +++ /dev/null @@ -1,7 +0,0 @@ -tacker sfc-classifier-delete red_http -tacker sfc-classifier-delete red_ssh - -tacker sfc-classifier-create --name blue_http --chain blue --match source_port=0,dest_port=80,protocol=6 -tacker sfc-classifier-create --name blue_ssh --chain blue --match source_port=0,dest_port=22,protocol=6 - -tacker sfc-classifier-list -- cgit 1.2.3-korg