summaryrefslogtreecommitdiffstats
path: root/tests/functest/odl-sfc/sfc.py
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2016-11-29 10:05:04 +0200
committerGeorge Paraskevopoulos <geopar@intracom-telecom.com>2016-11-30 16:05:02 +0200
commit34ac334f68ad52feb34b5503a16d4f1eccffdc14 (patch)
tree411b790f38984bf8e6d5c1b2027aee36a483ee4b /tests/functest/odl-sfc/sfc.py
parent60c7f57f814789dfb4bc0c905e34651c4e633a10 (diff)
Pythonize tacker script calls
JIRA: SFC-52 Clean up the repo from bash scripts using the python modules we have in place. DEPENDS ON: https://gerrit.opnfv.org/gerrit/#/c/25075/ Change-Id: I785c6df58391eab215e8e8918714f85bfadef747 Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'tests/functest/odl-sfc/sfc.py')
-rwxr-xr-xtests/functest/odl-sfc/sfc.py43
1 files changed, 40 insertions, 3 deletions
diff --git a/tests/functest/odl-sfc/sfc.py b/tests/functest/odl-sfc/sfc.py
index 09c7cca9..edc1aaaa 100755
--- a/tests/functest/odl-sfc/sfc.py
+++ b/tests/functest/odl-sfc/sfc.py
@@ -1,6 +1,5 @@
import argparse
import os
-import subprocess
import sys
import time
import functest.utils.functest_logger as ft_logger
@@ -42,7 +41,6 @@ ROUTER_NAME = "example-router"
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")
ssh_options = '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
json_results = {"tests": 4, "failures": 0}
@@ -119,7 +117,46 @@ def main():
srv_prv_ip = srv_instance.networks.get(NET_NAME)[0]
- subprocess.call(TACKER_SCRIPT, shell=True)
+ os_tacker.create_vnfd(
+ tacker_client,
+ tosca_file=os.path.join(SFC_TEST_DIR, 'test-vnfd1.yaml'))
+ os_tacker.create_vnfd(
+ tacker_client,
+ tosca_file=os.path.join(SFC_TEST_DIR, 'test-vnfd2.yaml'))
+
+ 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')
+ os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF2')
+ except:
+ logger.error('ERROR while booting vnfs')
+ sys.exit(1)
+
+ os_tacker.create_sfc(tacker_client, 'red', chain_vnf_names=['testVNF1'])
+ os_tacker.create_sfc(tacker_client, 'blue', chain_vnf_names=['testVNF2'])
+
+ os_tacker.create_sfc_classifier(
+ tacker_client, 'red_http', sfc_name='red',
+ match={
+ 'source_port': 0,
+ 'dest_port': 80,
+ 'protocol': 6
+ })
+
+ os_tacker.create_sfc_classifier(
+ tacker_client, 'red_ssh', sfc_name='red',
+ match={
+ 'source_port': 0,
+ 'dest_port': 22,
+ 'protocol': 6
+ })
+
+ logger.info(test_utils.run_cmd('tacker sfc-list'))
+ logger.info(test_utils.run_cmd('tacker sfc-classifier-list'))
# Start measuring the time it takes to implement the classification rules
t1 = threading.Thread(target=test_utils.capture_time_log,