From e9713403a50f6a71aeaa49c07145795e15d2b45f Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Wed, 3 Aug 2016 17:59:07 +0200 Subject: Bug fixes odl-sfc + new features * Doing the test with private IPs as floating are currently not working in ODL * New SF takes more time to start the service. A while loop is added. * Configuration of the compute set-up due to ODL limitations added Change-Id: I5449af940caee456262dac66bc47b66fd05c2a70 Signed-off-by: Manuel Buil --- testcases/features/sfc/compute_presetup_CI.bash | 21 +++++++++ testcases/features/sfc/correct_classifier.bash | 37 ++++++++++++++++ testcases/features/sfc/sfc.py | 59 +++++++++++++++++-------- 3 files changed, 99 insertions(+), 18 deletions(-) create mode 100755 testcases/features/sfc/compute_presetup_CI.bash create mode 100755 testcases/features/sfc/correct_classifier.bash (limited to 'testcases') diff --git a/testcases/features/sfc/compute_presetup_CI.bash b/testcases/features/sfc/compute_presetup_CI.bash new file mode 100755 index 000000000..57d3d8278 --- /dev/null +++ b/testcases/features/sfc/compute_presetup_CI.bash @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script must be use with vxlan-gpe + nsh. Once we have eth + nsh support +# in ODL, we will not need it anymore + +set -e +ssh_options='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' +BASEDIR=`dirname $0` +INSTALLER_IP=${INSTALLER_IP:-10.20.0.2} + +pushd $BASEDIR +ip=`sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'fuel node'|grep compute|\ +awk '{print $10}' | head -1` + +echo $ip +sshpass -p r00tme scp $ssh_options correct_classifier.bash ${INSTALLER_IP}:/root +sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'scp correct_classifier.bash '"$ip"':/root' + +sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'ssh root@'"$ip"' ifconfig br-int up' +sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'ssh root@'"$ip"' ip route add 11.0.0.0/24 \ +dev br-int' diff --git a/testcases/features/sfc/correct_classifier.bash b/testcases/features/sfc/correct_classifier.bash new file mode 100755 index 000000000..ba34d7fe9 --- /dev/null +++ b/testcases/features/sfc/correct_classifier.bash @@ -0,0 +1,37 @@ +#!/bin/bash + +#This scripts correct the current ODL bug which does not detect +#when SFF and classifier are in the same swtich + +nsp=`ovs-ofctl -O Openflow13 dump-flows br-int table=11 | \ +grep "nsp=" | awk '{print $6}' | awk -F ',' '{print $2}' | \ +awk -F '=' '{print $2}'` + +ip=`ovs-ofctl -O Openflow13 dump-flows br-int table=11 | \ +grep NXM_NX_NSH_C1 | head -1 | cut -d':' -f5 | cut -d'-' -f1` + +output_port=`ovs-ofctl -O Openflow13 show br-int | \ +grep vxgpe | cut -d'(' -f1` + +output_port2=`echo $output_port` + +echo "This is the nsp =$(($nsp))" +echo "This is the ip=$ip" +echo "This is the vxlan-gpe port=$output_port2" + +ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=80" +ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=22" + +ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=80 \ +actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],push_nsh,\ +load:0x1->NXM_NX_NSH_MDTYPE[],load:0x3->NXM_NX_NSH_NP[],\ +load:$ip->NXM_NX_NSH_C1[],load:$nsp->NXM_NX_NSP[0..23],\ +load:0xff->NXM_NX_NSI[],load:$ip->NXM_NX_TUN_IPV4_DST[],\ +load:$nsp->NXM_NX_TUN_ID[0..31],resubmit($output_port,0)" + +ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=22\ + actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],push_nsh,\ +load:0x1->NXM_NX_NSH_MDTYPE[],load:0x3->NXM_NX_NSH_NP[],\ +load:$ip->NXM_NX_NSH_C1[],load:$nsp->NXM_NX_NSP[0..23],\ +load:0xff->NXM_NX_NSI[],load:$ip->NXM_NX_TUN_IPV4_DST[],\ +load:$nsp->NXM_NX_TUN_ID[0..31],resubmit($output_port,0)" diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py index 511b5936b..c4d7fd785 100755 --- a/testcases/features/sfc/sfc.py +++ b/testcases/features/sfc/sfc.py @@ -59,16 +59,24 @@ def main(): ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' contr_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" " 'fuel node'|grep controller|awk '{print $10}'") - logger.info("Executing tacker script: '%s'" % contr_cmd) + logger.info("Executing script to get ip_server: '%s'" % contr_cmd) process = subprocess.Popen(contr_cmd, shell=True, stdout=subprocess.PIPE) - ip = process.stdout.readline().rstrip() + ip_server = process.stdout.readline().rstrip() + + contr_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" + " 'fuel node'|grep compute|awk '{print $10}'") + logger.info("Executing script to get ip_compute: '%s'" % contr_cmd2) + process = subprocess.Popen(contr_cmd2, + shell=True, + stdout=subprocess.PIPE) + ip_compute = process.stdout.readline().rstrip() iptable_cmd1 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" - " ssh " + ip + " iptables -P INPUT ACCEPT ") + " ssh " + ip_server + " iptables -P INPUT ACCEPT ") iptable_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" - " ssh " + ip + " iptables -t nat -P INPUT ACCEPT ") + " ssh " + ip_server + " iptables -t nat -P INPUT ACCEPT ") subprocess.call(iptable_cmd1, shell=True) subprocess.call(iptable_cmd2, shell=True) @@ -247,11 +255,14 @@ def main(): # timeout -= 1 try: - (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python") - if "vxlan_tool.py" in stdout.readlines()[0]: - logger.debug("HTTP firewall started") - else: - logger.error("HTTP firewall not started") + while 1: + (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python") + if "vxlan_tool.py" in stdout.readlines()[0]: + logger.debug("HTTP firewall started") + break + else: + logger.debug("HTTP firewall not started") + time.sleep(3) except: logger.error("vxlan_tool not started in SF1") @@ -268,21 +279,33 @@ def main(): # timeout -= 1 try: - (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python") - if "vxlan_tool.py" in stdout.readlines()[0]: - logger.debug("SSH firewall started") - else: - logger.error("SSH firewall not started") + while 1: + (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python") + if "vxlan_tool.py" in stdout.readlines()[0]: + logger.debug("SSH firewall started") + break + else: + logger.debug("SSH firewall not started") + time.sleep(3) except: logger.error("vxlan_tool not started in SF2") + # SSH to modify the classification flows in compute + + contr_cmd3 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" + " 'ssh " + ip_compute + " 'bash correct_classifier.bash''") + logger.info("Executing script to modify the classi: '%s'" % contr_cmd3) + process = subprocess.Popen(contr_cmd3, + shell=True, + stdout=subprocess.PIPE) + # SSH TO EXECUTE cmd_client logger.info("TEST STARTED") try: ssh.connect(floatip_client, username="root", password="opnfv", timeout=2) - command = "nc -w 5 -zv " + floatip_server + " 22 2>&1" + command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1" (stdin, stdout, stderr) = ssh.exec_command(command) except: logger.debug("Waiting for %s..." % floatip_client) @@ -305,7 +328,7 @@ def main(): try: ssh.connect(floatip_client, username="root", password="opnfv", timeout=2) - command = "nc -w 5 -zv " + floatip_server + " 80 2>&1" + command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1" (stdin, stdout, stderr) = ssh.exec_command(command) except: logger.debug("Waiting for %s..." % floatip_client) @@ -332,7 +355,7 @@ def main(): try: ssh.connect(floatip_client, username="root", password="opnfv", timeout=2) - command = "nc -w 5 -zv " + floatip_server + " 80 2>&1" + command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1" (stdin, stdout, stderr) = ssh.exec_command(command) except: logger.debug("Waiting for %s..." % floatip_client) @@ -353,7 +376,7 @@ def main(): try: ssh.connect(floatip_client, username="root", password="opnfv", timeout=2) - command = "nc -w 5 -zv " + floatip_server + " 22 2>&1" + command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1" (stdin, stdout, stderr) = ssh.exec_command(command) except: logger.debug("Waiting for %s..." % floatip_client) -- cgit 1.2.3-korg