Merge "integration_doc: Update integration document"
[vswitchperf.git] / vswitches / ovs_vanilla.py
index f5fecc2..89023a7 100644 (file)
@@ -18,7 +18,7 @@
 import logging
 from conf import settings
 from vswitches.ovs import IVSwitchOvs
-from src.ovs import VSwitchd, DPCtl
+from src.ovs import DPCtl
 from tools.module_manager import ModuleManager
 from tools import tasks
 
@@ -39,11 +39,9 @@ class OvsVanilla(IVSwitchOvs):
         super(OvsVanilla, self).__init__()
         self._ports = list(nic['device'] for nic in settings.getValue('NICS'))
         self._logger = logging.getLogger(__name__)
-        self._vswitchd_args = ["unix:%s" % VSwitchd.get_db_sock_path()]
+        self._vswitchd_args += ["unix:%s" % self.get_db_sock_path()]
         self._vswitchd_args += settings.getValue('VSWITCHD_VANILLA_ARGS')
-        self._vswitchd = VSwitchd(vswitchd_args=self._vswitchd_args,
-                                  expected_cmd="db.sock: connected")
-        self._bridges = {}
+        self._expect = "db.sock: connected"
         self._module_manager = ModuleManager()
 
     def start(self):
@@ -96,8 +94,10 @@ class OvsVanilla(IVSwitchOvs):
         params = []
 
         # For PVP only
-        tasks.run_task(['sudo', 'ifconfig', port_name, '0'],
+        tasks.run_task(['sudo', 'ip', 'addr', 'flush', 'dev', port_name],
                        self._logger, 'Remove IP', False)
+        tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', port_name, 'up'],
+                       self._logger, 'Bring up ' + port_name, False)
 
         of_port = bridge.add_port(port_name, params)
         self._current_id += 1
@@ -121,7 +121,9 @@ class OvsVanilla(IVSwitchOvs):
                         tap_name, 'mode', 'tap'],
                        self._logger, 'Creating tap device...', False)
 
-        tasks.run_task(['sudo', 'ifconfig', tap_name, '0'],
+        tasks.run_task(['sudo', 'ip', 'addr', 'flush', 'dev', tap_name],
+                       self._logger, 'Remove IP', False)
+        tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', tap_name, 'up'],
                        self._logger, 'Bring up ' + tap_name, False)
 
         bridge = self._bridges[switch_name]