Replace % operator with format method 37/62037/1
authorStamatis Katsaounis <mokats@intracom-telecom.com>
Mon, 10 Sep 2018 08:34:17 +0000 (11:34 +0300)
committerStamatis Katsaounis <mokats@intracom-telecom.com>
Mon, 10 Sep 2018 08:36:51 +0000 (11:36 +0300)
JIRA: SDNVPN-223

Running the testcase 3 with the % operator was causing an error
on formating the string. This patch replace % operator with
format method.

Change-Id: I33d3a4539bd7e1914f8c52ea8e91ae15083ce0b1
Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
sdnvpn/artifacts/quagga_setup.sh
sdnvpn/lib/quagga.py

index fbd229f..b3bf786 100644 (file)
@@ -9,22 +9,22 @@ echo 'ubuntu:opnfv' | chpasswd
 sleep 100
 
 # Variables to be filled in with python
-NEIGHBOR_IP=$1
-OWN_IP=$2
+NEIGHBOR_IP={0}
+OWN_IP={1}
 # directly access the instance from the external net without NAT
-EXT_NET_MASK=$3
-IP_PREFIX=$4
-RD=$5
-IRT=$6
-ERT=$7
+EXT_NET_MASK={2}
+IP_PREFIX={3}
+RD={4}
+IRT={5}
+ERT={6}
 
-if [[ $(getent hosts | awk '{print $2}') != *"$(cat /etc/hostname | awk '{print $1}')"* ]]
+if [[ $(getent hosts | awk '{{print $2}}') != *"$(cat /etc/hostname | awk '{{print $1}}')"* ]]
 then
-echo "127.0.1.1 $(cat /etc/hostname | awk '{print $1}')" | tee -a /etc/hosts
+echo "127.0.1.1 $(cat /etc/hostname | awk '{{print $1}}')" | tee -a /etc/hosts
 fi
 
 quagga_int=''
-for net_int in $(netstat -ia | awk 'NR>2{print $1}');
+for net_int in $(netstat -ia | awk 'NR>2{{print $1}}');
 do
 if [ -z "$(ifconfig | grep $net_int)" ]
 then
index 0ea206e..f11e188 100644 (file)
@@ -48,10 +48,10 @@ def gen_quagga_setup_script(controller_ip,
                             ip_prefix, rd, irt, ert):
     with open(COMMON_CONFIG.quagga_setup_script_path) as f:
         template = f.read()
-    script = template % (controller_ip,
-                         fake_floating_ip,
-                         ext_net_mask,
-                         ip_prefix, rd, irt, ert)
+    script = template.format(controller_ip,
+                             fake_floating_ip,
+                             ext_net_mask,
+                             ip_prefix, rd, irt, ert)
     return script