aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ONOS/Teston/onosfunctest.py
diff options
context:
space:
mode:
authorwuwenbin2 <wuwenbin2@huawei.com>2016-07-13 12:36:08 +0800
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-13 08:12:48 +0000
commit4dedc11a04e334acb8db2a54083613264325c90c (patch)
tree3f59d2c477d5bfc5dfbd771d2fed5e7dde435223 /testcases/Controllers/ONOS/Teston/onosfunctest.py
parent048931191340429c2df2858db6d11035ae66325b (diff)
Add sfc support for all installers.
JIRA:FUNCTEST-366 Verified in fuel and joid locally. Change-Id: Ife0fd55361e22b9f2003e592b42558860431747a Signed-off-by: wuwenbin2 <wuwenbin2@huawei.com>
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/onosfunctest.py')
-rwxr-xr-xtestcases/Controllers/ONOS/Teston/onosfunctest.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/testcases/Controllers/ONOS/Teston/onosfunctest.py b/testcases/Controllers/ONOS/Teston/onosfunctest.py
index b215b08ad..23fb62d47 100755
--- a/testcases/Controllers/ONOS/Teston/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/onosfunctest.py
@@ -19,6 +19,8 @@ import os
import re
import time
+from neutronclient.v2_0 import client as neutronclient
+
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as functest_utils
import functest.utils.openstack_utils as openstack_utils
@@ -186,16 +188,31 @@ def SfcTest():
os.system(cmd)
-def SetSfcIp():
- cmd = "openstack catalog show network | grep publicURL"
+def GetIp(type):
+ cmd = "openstack catalog show " + type + " | grep publicURL"
cmd_output = os.popen(cmd).read()
ip = re.search(r"\d+\.\d+\.\d+\.\d+", cmd_output).group()
- cmd_onos_ip = "sed -i 's/onos_ip/" + ip + "/g' " + SFC_PATH + "Sfc_fun.py"
- cmd_openstack_ip = "sed -i 's/openstack_ip/" + ip\
- + "/g' " + SFC_PATH + "Sfc_fun.py"
- logger.info("Modify ip for SFC")
- os.system(cmd_onos_ip)
- os.system(cmd_openstack_ip)
+ return ip
+
+
+def Replace(before, after):
+ file = "Sfc_fun.py"
+ cmd = "sed -i 's/" + before + "/" + after + "/g' " + SFC_PATH + file
+ os.system(cmd)
+
+
+def SetSfcConf():
+ Replace("keystone_ip", GetIp("keystone"))
+ Replace("neutron_ip", GetIp("neutron"))
+ Replace("nova_ip", GetIp("nova"))
+ Replace("glance_ip", GetIp("glance"))
+ pwd = os.environ['OS_PASSWORD']
+ Replace("console", pwd)
+ creds_neutron = openstack_utils.get_credentials("neutron")
+ neutron_client = neutronclient.Client(**creds_neutron)
+ ext_net = openstack_utils.get_external_net(neutron_client)
+ Replace("admin_floating_net", ext_net)
+ logger.info("Modify configuration for SFC")
def main():
@@ -212,7 +229,7 @@ def main():
RunScript("FUNCvirNetNBL3")
if DEPLOY_SCENARIO == "os-onos-sfc-ha":
CreateImage()
- SetSfcIp()
+ SetSfcConf()
SfcTest()
try:
logger.debug("Push ONOS results into DB")