Making OVS Switch Prompts configurable.
[integration.git] / test / csit / libraries / SwitchClasses / Ovs.py
index c5c69dbd59be860c6bf59ff9d120000f3062d5c2..58b13c4282fc0dac0edaf9d3afa1f907717517a0 100644 (file)
@@ -1,5 +1,5 @@
 """
-Provision 3800 Object Definition
+Open vSwitch Object Definition
 Authors: james.luhrsen@hp.com
 Created: 2014-10-02
 """
@@ -31,7 +31,7 @@ class Ovs(BaseSwitch):
 
     @property
     def cleanup_cmds(self):
-        return ['/sbin/ifconfig | egrep \'^s\' | awk \'{print \"sudo ovs-vsctl del-br\",$1}\' | sh']
+        return ['/sbin/ifconfig -a | egrep \'^s\' | awk \'{print \"sudo ovs-vsctl del-br\",$1}\' | sh']
 
     @property
     def initialization_cmds(self):
@@ -41,7 +41,8 @@ class Ovs(BaseSwitch):
     def base_openflow_config(self):
         return ['sudo ovs-vsctl add-br s1',
                 'sudo ovs-vsctl set bridge s1 protocols=OpenFlow13',
-                'sudo ovs-vsctl set-controller s1 tcp:' + self.of_controller_ip]
+                'sudo ovs-vsctl set-controller s1 tcp:' + self.of_controller_ip,
+                'sudo ifconfig s1 up']
 
     @property
     def openflow_validation_cmd(self):
@@ -85,7 +86,8 @@ class Ovs(BaseSwitch):
 
     @property
     def datapath_id_output_command(self):
-        return '/sbin/ifconfig | egrep \'^s1\' | awk \'{print $5}\''
+        '''This regex will extract the macaddr of the ovs switch'''
+        return '/sbin/ifconfig s1 | grep -o -E "([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}"'
 
     datapath_id_output_string = ''
     datapath_id = ''