Conform SFC test case to FeatureBase 57/24757/10
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 23 Nov 2016 10:24:49 +0000 (11:24 +0100)
committerjose.lausuch <jose.lausuch@ericsson.com>
Tue, 13 Dec 2016 18:28:00 +0000 (19:28 +0100)
JIRA: FUNCTEST-550

Change-Id: I46853d1ba943a54b39b760c34c29c2b4c3b43d63
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
functest/ci/exec_test.sh
functest/ci/testcases.yaml
functest/opnfv_tests/features/odl_sfc.py [new file with mode: 0644]

index 913ce08..3a7d8b0 100755 (executable)
@@ -61,17 +61,7 @@ function odl_tests(){
     fi
 }
 
-function sfc_prepare(){
-    ids=($(neutron security-group-list|grep default|awk '{print $2}'))
-    for id in ${ids[@]}; do
-        if ! neutron security-group-show $id|grep "22/tcp" &>/dev/null; then
-            neutron security-group-rule-create --protocol tcp \
-                --port-range-min 22 --port-range-max 22 --direction ingress $id
-            neutron security-group-rule-create --protocol tcp \
-                --port-range-min 22 --port-range-max 22 --direction egress $id
-        fi
-    done
-}
+
 
 function run_test(){
     test_name=$1
@@ -146,13 +136,6 @@ function run_test(){
                 $clean_flag -s -m feature_multisite $report \
                 -c ${FUNCTEST_TEST_DIR}/openstack/tempest/tempest_multisite.conf
         ;;
-        "odl-sfc")
-            ODL_SFC_DIR=${REPOS_DIR}/sfc/tests/functest/odl-sfc
-            # pass FUNCTEST_REPO_DIR inside prepare_odl_sfc.bash
-            FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} python ${ODL_SFC_DIR}/prepare_odl_sfc.py || exit $?
-            source ${ODL_SFC_DIR}/tackerc
-            python ${ODL_SFC_DIR}/sfc.py $report
-        ;;
         *)
             echo "The test case '${test_name}' does not exist."
             exit 1
@@ -197,10 +180,6 @@ done
 echo "Sourcing Credentials ${creds} to run the test.."
 source ${creds}
 
-# ODL Boron workaround to create additional flow rules to allow port 22 TCP
-if [[ $DEPLOY_SCENARIO == *"odl_l2-sfc"* ]]; then
-    sfc_prepare
-fi
 
 # Run test
 run_test $TEST
index 56ca401..0696a5a 100755 (executable)
@@ -103,7 +103,6 @@ tiers:
                 dependencies:
                     installer: ''
                     scenario: ''
-
             -
                 name: rally_sanity
                 criteria: 'success_rate == 100%'
@@ -249,6 +248,9 @@ tiers:
                 dependencies:
                     installer: '(apex)|(fuel)'
                     scenario: 'odl_l2-sfc'
+                run:
+                    module: 'functest.opnfv_tests.features.odl_sfc'
+                    class: 'OpenDaylightSFC'
             -
                 name: onos_sfc
                 criteria: 'status == "PASS"'
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
new file mode 100644 (file)
index 0000000..b194b28
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+import functest.core.feature_base as base
+
+
+class OpenDaylightSFC(base.FeatureBase):
+
+    def __init__(self):
+        super(OpenDaylightSFC, self).__init__(project='sfc',
+                                              case='functest-odl-sfc"',
+                                              repo='dir_repo_sfc')
+        self.cmd = 'cd %s/tests/functest && python ./run_tests.py' % self.repo