SRBridgingvlan tagged, untagged and native
Change-Id: I804e4808a7bd22e7662ae06e5d82c2cf03d3efc3
diff --git a/TestON/drivers/common/cli/emulator/scapyclidriver.py b/TestON/drivers/common/cli/emulator/scapyclidriver.py
index 1ff0d6f..db4a721 100644
--- a/TestON/drivers/common/cli/emulator/scapyclidriver.py
+++ b/TestON/drivers/common/cli/emulator/scapyclidriver.py
@@ -344,6 +344,46 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
+ def buildVLAN( self, **kwargs ):
+ """
+ Build a VLAN frame
+ """
+ try:
+ main.log.debug( self.name + ": Building VLAN Frame" )
+ # Set the IP frame
+ cmd = 'vlan = Dot1Q( '
+ options = []
+ for key, value in kwargs.iteritems():
+ if isinstance( value, str ):
+ value = '"' + value + '"'
+ options.append( str( key ) + "=" + str( value ) )
+ cmd += ", ".join( options )
+ cmd += ' )'
+ self.handle.sendline( cmd )
+ self.handle.expect( self.scapyPrompt )
+ response = self.cleanOutput( self.handle.before )
+ if "Traceback" in response:
+ # KeyError, SyntaxError, ...
+ main.log.error( "Error in sending command: " + response )
+ return main.FALSE
+ self.handle.sendline( "packet = ether/ip/vlan" )
+ self.handle.expect( self.scapyPrompt )
+ response = self.cleanOutput( self.handle.before )
+ if "Traceback" in response:
+ # KeyError, SyntaxError, ...
+ main.log.error( "Error in sending command: " + response )
+ return main.FALSE
+ return main.TRUE
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": Command timed out" )
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.exception( self.name + ": connection closed." )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
def buildIPv6( self, **kwargs ):
"""
Build an IPv6 frame
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index 78f6464..6d46c1e 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -538,6 +538,7 @@
hostPair[ 0 ].addRoutes()
hostPair[ 0 ].buildEther( src=srcMac, dst=dstMac )
hostPair[ 0 ].buildIP( src=srcIPs[0], dst=dstIPs[0] )
+ hostPair[ 0 ].buildVLAN( vlan=[102, 103] )
hostPair[ 0 ].buildICMP( )
hostPair[ 0 ].sendPacket( iface=srcIface )