Changing the way the mac addrs is extracted from OVS switches. 91/22291/11
authorKailash Khalasi <kkhalasi@iix.net>
Wed, 10 Jun 2015 17:45:43 +0000 (17:45 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jun 2015 23:00:55 +0000 (23:00 +0000)
Since the "s1" interface and "s1" is hard-coded, this is a safer approach.

On Fedora, I found that the mac addr wasnt being extracted(but worked for Ubuntu).

This command will work for both platforms, and others as it uses
regular expression.

Change-Id: I008b1a3681eabdace6fbe26346750fb3b1169f7d
Signed-off-by: Kailash Khalasi <kkhalasi@iix.net>
test/csit/libraries/SwitchClasses/Ovs.py

index 0b47d3f32461515dffa6d3d8f104b85f6b012caa..58b13c4282fc0dac0edaf9d3afa1f907717517a0 100644 (file)
@@ -1,5 +1,5 @@
 """
-Provision 3800 Object Definition
+Open vSwitch Object Definition
 Authors: james.luhrsen@hp.com
 Created: 2014-10-02
 """
@@ -86,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 = ''