[ONOS-7736] Add vlan tagged host movement tests
Change-Id: I5948a8536286bf1d31ce2f8f1a6f58f5329edbe0
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
index ca1ff80..150d7fd 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -1306,11 +1306,13 @@
verify( main )
h1v6cfg = '{"of:0000000000000001/8" : { "interfaces" : [ { "ips" : [ "1000::3ff/120" ], "vlan-untagged": 21 } ] } }'
- lib.moveHost( main, "h1v6", "leaf1", "leaf1", "1000::3fe", prefixLen=128, cfg=h1v6cfg, ipv6=True )
+ lib.moveHost( main, "h1v6", "leaf1", "leaf1", "1000::3ff", prefixLen=128, cfg=h1v6cfg, ipv6=True )
hostLocations = { "h1v6": "of:0000000000000001/8" }
lib.verifyHostLocations( main, hostLocations )
verify( main )
+ # FIXME: We don't have any tagged hosts on DAAS-1
+
h13v4cfg = '{"of:0000000000000006/7" : { "interfaces" : [ { "ips" : [ "10.5.20.254/24" ], "vlan-untagged": 20 } ] } }'
lib.moveHost( main, "h13v4", "leaf6", "leaf6", "10.5.20.254", prefixLen=24, cfg=h13v4cfg )
hostLocations = { "h13v4": "of:0000000000000006/7" }
@@ -1318,12 +1320,26 @@
verify( main )
h13v6cfg = '{"of:0000000000000006/8" : { "interfaces" : [ { "ips" : [ "1012::3ff/120" ], "vlan-untagged": 26 } ] } }'
- lib.moveHost( main, "h13v6", "leaf6", "leaf6", "1012::3fe", prefixLen=128, cfg=h13v6cfg, ipv6=True )
+ lib.moveHost( main, "h13v6", "leaf6", "leaf6", "1012::3ff", prefixLen=128, cfg=h13v6cfg, ipv6=True )
hostLocations = { "h13v6": "of:0000000000000006/8" }
lib.verifyHostLocations( main, hostLocations )
verify( main )
- # TODO: test vlan tagged hosts
+ h12v4cfg = '{"of:0000000000000006/9" : { "interfaces" : [ { "ips" : [ "10.5.10.254/24" ], "vlan-tagged": [80] } ] } }'
+ lib.moveHost( main, "h12v4", "leaf6", "leaf6", "10.5.10.254", prefixLen=24, cfg=h12v4cfg, vlan=80 )
+ hostLocations = { "h12v4": "of:0000000000000006/9" }
+ lib.verifyHostLocations( main, hostLocations )
+ verify( main )
+
+ # FIXME: Due to CORD-3079, we are not able to test movement of tagged IPv6 hosts at the moment
+ '''
+ h12v6cfg = '{"of:0000000000000006/10" : { "interfaces" : [ { "ips" : [ "1011::3ff/120" ], "vlan-tagged": [127] } ] } }'
+ lib.moveHost( main, "h12v6", "leaf6", "leaf6", "1011::3ff", prefixLen=128, cfg=h12v6cfg, ipv6=True, vlan=127 )
+ hostLocations = { "h12v6": "of:0000000000000006/10" }
+ lib.verifyHostLocations( main, hostLocations )
+ verify( main )
+ '''
+
lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE652( self, main ):
@@ -1355,8 +1371,14 @@
lib.verifyHostLocations( main, hostLocations )
verify( main )
+ h5v4cfg = '''{"of:0000000000000002/14" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] },
+ "of:0000000000000003/16" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] } }'''
+ lib.moveDualHomedHost( main, "h5v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.20.254", prefixLen=24, cfg=h5v4cfg, vlan=30 )
+ hostLocations = { "h5v4": [ "of:0000000000000002/14", "of:0000000000000003/16" ] }
+ lib.verifyHostLocations( main, hostLocations )
+ verify( main )
+
# TODO: test static routes that point to the moved host
- # TODO: test vlan tagged hosts
lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE653( self, main ):
@@ -1388,6 +1410,12 @@
lib.verifyHostLocations( main, hostLocations )
verify( main )
+ h5v4cfg = '''{"of:0000000000000002/14" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] },
+ "of:0000000000000003/16" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] } }'''
+ lib.moveDualHomedHost( main, "h5v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.20.254", macAddr="00:aa:01:00:00:04", prefixLen=24, cfg=h5v4cfg, vlan=30 )
+ hostLocations = { "h5v4": [ "of:0000000000000002/14", "of:0000000000000003/16" ] }
+ lib.verifyHostLocations( main, hostLocations )
+ verify( main )
+
# TODO: test static routes that point to the moved host
- # TODO: test vlan tagged hosts
lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 1838fc3..8c6e22a 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -1235,7 +1235,7 @@
onfail="Location verification failed" )
@staticmethod
- def moveHost( main, hostName, srcSw, dstSw, gw, macAddr=None, prefixLen=None, cfg='', ipv6=False ):
+ def moveHost( main, hostName, srcSw, dstSw, gw, macAddr=None, prefixLen=None, cfg='', ipv6=False, vlan=None ):
"""
Move specified host from srcSw to dstSw.
If srcSw and dstSw are same, the host will be moved from current port to
@@ -1250,16 +1250,15 @@
prefixLen: prefix length
cfg: port configuration as JSON string
ipv6: Use True to move IPv6 host
+ vlan: vlan number of the host
"""
if not hasattr( main, 'Mininet1' ):
main.log.warn( "moveHost is supposed to be used only in Mininet." )
return
- main.step( "Moving host {} from {} to {}".format( hostName, srcSw, dstSw ) )
- if ipv6:
- main.Mininet1.moveHostv6( hostName, srcSw, dstSw, macAddr, prefixLen )
- else:
- main.Mininet1.moveHost( hostName, srcSw, dstSw, macAddr, prefixLen )
+ main.step( "Moving {} host {} from {} to {}".format( 'tagged' if vlan else 'untagged', hostName, srcSw, dstSw ) )
+ main.Mininet1.moveHost( hostName, srcSw, dstSw, macAddr, prefixLen, ipv6, vlan=vlan )
+ if not ipv6:
main.Mininet1.changeDefaultGateway( hostName, gw )
if cfg:
main.Cluster.active( 0 ).REST.setNetCfg( json.loads( cfg ),
@@ -1282,7 +1281,7 @@
@staticmethod
def moveDualHomedHost( main, hostName, srcSw, srcPairSw, dstSw, dstPairSw, gw,
- macAddr=None, prefixLen=24, cfg='', ipv6=False ):
+ macAddr=None, prefixLen=24, cfg='', ipv6=False, vlan=None ):
"""
Move specified dual-homed host from srcSw-srcPairSw to dstSw-dstPairSw.
If srcSw-srcPairSw and dstSw-dstPairSw are same, the host will be moved from current port
@@ -1299,20 +1298,17 @@
prefixLen: prefix length
cfg: port configurations as JSON string
ipv6: Use True to move IPv6 host
+ vlan: vlan number of the host
"""
- # TODO: support vlan-tagged hosts.
if not hasattr( main, 'Mininet1' ):
main.log.warn( "moveDualHomedHost is supposed to be used only in Mininet." )
return
- main.step( "Moving host {} from {} and {} to {} and {}".format( hostName, srcSw, srcPairSw,
- dstSw, dstPairSw ) )
- if ipv6:
- main.Mininet1.moveDualHomedHostv6( hostName, srcSw, srcPairSw, dstSw, dstPairSw,
- macAddr=macAddr, prefixLen=prefixLen )
- else:
- main.Mininet1.moveDualHomedHost( hostName, srcSw, srcPairSw, dstSw, dstPairSw,
- macAddr=macAddr, prefixLen=prefixLen )
+ main.step( "Moving {} host {} from {} and {} to {} and {}".format( 'tagged' if vlan else 'untagged', hostName,
+ srcSw, srcPairSw, dstSw, dstPairSw ) )
+ main.Mininet1.moveDualHomedHost( hostName, srcSw, srcPairSw, dstSw, dstPairSw,
+ macAddr=macAddr, prefixLen=prefixLen, ipv6=ipv6, vlan=vlan )
+ if not ipv6:
main.Mininet1.changeDefaultGateway( hostName, gw )
if cfg:
main.Cluster.active( 0 ).REST.setNetCfg( json.loads( cfg ),