From 2e259679732ed4e0464992b4cae04a4cf4d88000 Mon Sep 17 00:00:00 2001
From: Martin Klozik <martinx.klozik@intel.com>
Date: Fri, 20 May 2016 13:24:15 +0100
Subject: bugfix: Remove dependency on ifconfig

VSPERF uses ifconfig at several places to bring up
a networking interface. However ifconfig has been
deprecated by iproute2 package and it is not available
in standard installation of many Linux distributions.
Thus all calls of ifconfig have been replaced by
call of 'ip' tool.

Change-Id: I935eaf85b6082e4641d12cffea3e0882c634e5ea
JIRA: VSPERF-299
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
---
 core/vswitch_controller_op2p.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'core')

diff --git a/core/vswitch_controller_op2p.py b/core/vswitch_controller_op2p.py
index 77797b8f..ee8ada8b 100644
--- a/core/vswitch_controller_op2p.py
+++ b/core/vswitch_controller_op2p.py
@@ -77,11 +77,13 @@ class VswitchControllerOP2P(IVswitchController):
             vtep_ip2 = settings.getValue('VTEP_IP2')
             self._vswitch.add_switch(bridge)
 
-            tasks.run_task(['sudo', 'ifconfig', bridge,
-                            settings.getValue('VTEP_IP1')],
+            tasks.run_task(['sudo', 'ip', 'addr', 'add',
+                            settings.getValue('VTEP_IP1'), 'dev', bridge],
                            self._logger, 'Assign ' +
                            settings.getValue('VTEP_IP1') + ' to ' + bridge,
                            False)
+            tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+                           self._logger, 'Bring up ' + bridge, False)
 
             tunnel_type = self._traffic['tunnel_type']
 
@@ -137,10 +139,12 @@ class VswitchControllerOP2P(IVswitchController):
             tgen_ip1 = settings.getValue('TRAFFICGEN_PORT1_IP')
             self._vswitch.add_switch(bridge)
 
-            tasks.run_task(['sudo', 'ifconfig', bridge,
-                            settings.getValue('VTEP_IP1')],
+            tasks.run_task(['sudo', 'ip', 'addr', 'add',
+                            settings.getValue('VTEP_IP1'), 'dev', bridge],
                            self._logger, 'Assign ' +
                            settings.getValue('VTEP_IP1') + ' to ' + bridge, False)
+            tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+                           self._logger, 'Bring up ' + bridge, False)
 
             tunnel_type = self._traffic['tunnel_type']
 
@@ -195,10 +199,12 @@ class VswitchControllerOP2P(IVswitchController):
             tgen_ip1 = settings.getValue('TRAFFICGEN_PORT1_IP')
             self._vswitch.add_switch(bridge)
 
-            tasks.run_task(['sudo', 'ifconfig', bridge,
-                            settings.getValue('TUNNEL_INT_BRIDGE_IP')],
+            tasks.run_task(['sudo', 'ip', 'addr', 'add',
+                            settings.getValue('TUNNEL_INT_BRIDGE_IP'), 'dev', bridge],
                            self._logger, 'Assign ' +
                            settings.getValue('TUNNEL_INT_BRIDGE_IP') + ' to ' + bridge, False)
+            tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+                           self._logger, 'Bring up ' + bridge, False)
 
             tunnel_type = self._traffic['tunnel_type']
 
-- 
cgit