Migrate existing SRRouting tests to use the new functions
Change-Id: I5d1fd5c3e0555126873f94109bd2af1e1c3b9fb5
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
index 5f4157f..de05514 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -7,112 +7,67 @@
"""
Ping between all ipv4 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=1,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- countFlowsGroups=False,
- linkFailure=False,
- description="Ping between all ipv4 hosts in the topology" )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv4 hosts in the topology" )
+ setupTest( main, test_idx=1, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, disconnected=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE2( self, main ):
"""
Ping between all ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=2,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=False,
- description="Ping between all ipv6 hosts in the topology" )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv6 hosts in the topology" )
+ setupTest( main, test_idx=2, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, disconnected=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE3( self, main ):
"""
Ping between all ipv4 and ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=3,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=False,
- description="Ping between all ipv4 and ipv6 hosts in the topology" )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv4 and ipv6 hosts in the topology" )
+ setupTest( main, test_idx=3, onosNodes=3, external=False )
+ verify( main, disconnected=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE4( self, main ):
"""
Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=4,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Ping between all ipv4 hosts in the topology and check connectivity to external hosts",
- checkExternalHost=True,
- linkFailure=False,
- countFlowsGroups=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts" )
+ setupTest( main, test_idx=4, onosNodes=3, ipv6=False )
+ verify( main, ipv6=False, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE5( self, main ):
"""
Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=5,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Ping between all ipv6 hosts in the topology and check connectivity to external hosts",
- checkExternalHost=True,
- linkFailure=False,
- countFlowsGroups=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts" )
+ setupTest( main, test_idx=5, onosNodes=3, ipv4=False )
+ verify( main, ipv4=False, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE6( self, main ):
"""
Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=6,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external hosts",
- checkExternalHost=True,
- linkFailure=False,
- countFlowsGroups=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external hosts" )
+ setupTest( main, test_idx=6, onosNodes=3 )
+ verify( main, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE7( self, main ):
"""
@@ -120,21 +75,12 @@
external router config, but reachable through the use of route-add
command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=7,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Ping between from ipv4 hosts to external host configured with route-add command.",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between from ipv4 hosts to external host configured with route-add command" )
+ setupTest( main, test_idx=7, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, internal=False, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE8( self, main ):
"""
@@ -142,21 +88,12 @@
external router config, but reachable through the use of route-add
command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=8,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Ping between from ipv6 hosts to external host configured with route-add command.",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between from ipv6 hosts to external host configured with route-add command" )
+ setupTest( main, test_idx=8, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv6=False, internal=False, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE9( self, main ):
"""
@@ -164,141 +101,90 @@
external router config, but reachable through the use of route-add
command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=9,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Ping between from ipv4 and ipv6 hosts to external hosts configured with route-add command.",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Ping between from ipv4 and ipv6 hosts to external host configured with route-add command" )
+ setupTest( main, test_idx=9, onosNodes=3, external=False )
+ verify( main, internal=False, disconnected=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE101( self, main ):
"""
Kill and recover links
Ping between all ipv4 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=101,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- countFlowsGroups=False,
- linkFailure=True,
- description="Test link failures with IPv4 hosts",
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 hosts" )
+ setupTest( main, test_idx=101, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, external=False, disconnected=False )
+ verifyLinkFailure( main, ipv6=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE102( self, main ):
"""
Kill and recover links
Ping between all ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=102,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=True,
- description="Test link failures with IPv6 hosts",
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv6 hosts" )
+ setupTest( main, test_idx=102, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, external=False, disconnected=False )
+ verifyLinkFailure( main, ipv4=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE103( self, main ):
"""
Kill and recover links
Ping between all ipv4 and ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=103,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=True,
- description="Test link failures with IPv4 and IPv6 hosts",
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 and IPv6 hosts" )
+ setupTest( main, test_idx=103, onosNodes=3, external=False )
+ verify( main, external=False, disconnected=False )
+ verifyLinkFailure( main, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE104( self, main ):
"""
Kill and recover links
Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=104,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test link failures with IPv4 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 hosts including external hosts" )
+ setupTest( main, test_idx=104, onosNodes=3, ipv6=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifyLinkFailure( main, ipv6=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE105( self, main ):
"""
Kill and recover links
Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=105,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test link failures with IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=105, onosNodes=3, ipv4=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifyLinkFailure( main, ipv4=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE106( self, main ):
"""
Kill and recover links
Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=106,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test link failures with IPv4 and IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 and IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=106, onosNodes=3 )
+ verify( main, disconnected=False )
+ verifyLinkFailure( main )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE107( self, main ):
"""
@@ -306,22 +192,13 @@
Ping between ipv4 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=107,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test link failures with IPv4 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=True,
- staticRouteConfigure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=107, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifyLinkFailure( main, ipv6=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE108( self, main ):
"""
@@ -329,22 +206,13 @@
Ping between ipv6 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=108,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test link failures with IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=True,
- staticRouteConfigure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=108, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifyLinkFailure( main, ipv4=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE109( self, main ):
"""
@@ -352,142 +220,91 @@
Ping between ipv4 and pv6 hosts and external hosts that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=109,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test link failures with IPv4 and IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=True,
- staticRouteConfigure=True,
- switchFailure=False )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test link failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=109, onosNodes=3, external=False )
+ verify( main, disconnected=False )
+ verifyLinkFailure( main, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE201( self, main ):
"""
Kill and recover spine switches
Ping between all ipv4 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=201,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- countFlowsGroups=False,
- linkFailure=False,
- description="Test switch failures with IPv4 hosts",
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 hosts" )
+ setupTest( main, test_idx=201, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, external=False, disconnected=False )
+ verifySwitchFailure( main, ipv6=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE202( self, main ):
"""
Kill and recover spine switches
Ping between all ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=202,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=False,
- description="Test switch failures with IPv6 hosts",
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv6 hosts" )
+ setupTest( main, test_idx=202, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, external=False, disconnected=False )
+ verifySwitchFailure( main, ipv4=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE203( self, main ):
"""
Kill and recover spine switches
Ping between all ipv4 and ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=203,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- countFlowsGroups=False,
- linkFailure=False,
- description="Test switch failures with IPv4 and IPv6 hosts",
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 and IPv6 hosts" )
+ setupTest( main, test_idx=203, onosNodes=3, external=False )
+ verify( main, external=False, disconnected=False )
+ verifySwitchFailure( main, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE204( self, main ):
"""
Kill and recover spine switches
Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=204,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test switch failures with IPv4 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=False,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 hosts including external hosts" )
+ setupTest( main, test_idx=204, onosNodes=3, ipv6=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifySwitchFailure( main, ipv6=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE205( self, main ):
"""
Kill and recover spine switches
Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=205,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test switch failures with IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=False,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=205, onosNodes=3, ipv4=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifySwitchFailure( main, ipv4=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE206( self, main ):
"""
Kill and recover spine switches
Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=206,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test switch failures with IPv4 and IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- linkFailure=False,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 and IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=206, onosNodes=3 )
+ verify( main, disconnected=False )
+ verifySwitchFailure( main )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE207( self, main ):
"""
@@ -495,22 +312,13 @@
Ping between ipv4 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=207,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test switch failures with IPv4 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=207, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifySwitchFailure( main, ipv6=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE208( self, main ):
"""
@@ -518,22 +326,13 @@
Ping between ipv6 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=208,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test switch failures with IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=208, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifySwitchFailure( main, ipv4=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE209( self, main ):
"""
@@ -541,202 +340,133 @@
Ping between ipv4 and pv6 hosts and external hosts that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=209,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test switch failures with IPv4 and IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- linkFailure=False,
- staticRouteConfigure=True,
- switchFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test switch failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=209, onosNodes=3, external=False )
+ verify( main, disconnected=False )
+ verifySwitchFailure( main, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE301( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv4 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=301,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- countFlowsGroups=False,
- description="Test node failures with IPv4 hosts",
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 hosts" )
+ setupTest( main, test_idx=301, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, external=False, disconnected=False )
+ verifyOnosFailure( main, ipv6=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE302( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=302,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- countFlowsGroups=False,
- description="Test node failures with IPv6 hosts",
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv6 hosts" )
+ setupTest( main, test_idx=302, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, external=False, disconnected=False )
+ verifyOnosFailure( main, ipv4=False, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE303( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv4 and ipv6 hosts in the topology.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=303,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- countFlowsGroups=False,
- description="Test node failures with IPv4 and IPv6 hosts",
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 and IPv6 hosts" )
+ setupTest( main, test_idx=303, onosNodes=3, external=False )
+ verify( main, external=False, disconnected=False )
+ verifyOnosFailure( main, external=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE304( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=304,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test node failures with IPv4 hosts (including external hosts)",
- checkExternalHost=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 hosts including external hosts" )
+ setupTest( main, test_idx=304, onosNodes=3, ipv6=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifyOnosFailure( main, ipv6=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE305( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=305,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test node failures with IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=305, onosNodes=3, ipv4=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifyOnosFailure( main, ipv4=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE306( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=306,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test node failures with IPv4 and IPv6 hosts (including external hosts)",
- checkExternalHost=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 and IPv6 hosts including external hosts" )
+ setupTest( main, test_idx=306, onosNodes=3 )
+ verify( main, disconnected=False )
+ verifyOnosFailure( main )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE307( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between ipv4 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=307,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=0,
- description="Test node failures with IPv4 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- staticRouteConfigure=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=307, onosNodes=3, ipv6=False, external=False )
+ verify( main, ipv6=False, disconnected=False )
+ verifyOnosFailure( main, ipv6=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE308( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between ipv6 hosts and an external host that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=308,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=0,
- ipv6=1,
- description="Test node failures with IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- staticRouteConfigure=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=308, onosNodes=3, ipv4=False, external=False )
+ verify( main, ipv4=False, disconnected=False )
+ verifyOnosFailure( main, ipv4=False, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE309( self, main ):
"""
- Kill and recover ONOS nodes
+ Kill and recover onos nodes
Ping between ipv4 and pv6 hosts and external hosts that is not configured in
external router config, but reachable through the use of route-add command.
"""
-
- from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
-
- SRRoutingTest.runTest( main,
- test_idx=309,
- onosNodes=3,
- dhcp=1,
- routers=1,
- ipv4=1,
- ipv6=1,
- description="Test node failures with IPv4 and IPv6 hosts (including external host configured with route-add command)",
- checkExternalHost=False,
- countFlowsGroups=False,
- staticRouteConfigure=True,
- nodeFailure=True )
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ main.case( "Test onos failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
+ setupTest( main, test_idx=309, onosNodes=3, external=False )
+ verify( main, disconnected=False )
+ verifyOnosFailure( main, internal=False )
+ lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
def CASE606( self, main ):
"""
@@ -751,21 +481,19 @@
from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
main.case( "Drop spine and paired leaf" )
setupTest( main, test_idx=606, onosNodes=3 )
- main.disconnectedIpv4Hosts = []
- main.disconnectedIpv6Hosts = []
- verifyPing( main )
- lib.killSwitch( main, "spine101", int( main.params[ "TOPO" ][ "switchNum" ] ) - 1, int( main.params[ "TOPO" ][ "linkNum" ] ) - 18 )
- verifyPing( main )
- lib.killSwitch( main, "leaf2", int( main.params[ "TOPO" ][ "switchNum" ] ) - 2, int( main.params[ "TOPO" ][ "linkNum" ] ) - 24 )
- lib.killSwitch( main, "leaf3", int( main.params[ "TOPO" ][ "switchNum" ] ) - 3, int( main.params[ "TOPO" ][ "linkNum" ] ) - 28 )
+ verify( main, disconnected=False )
+ lib.killSwitch( main, "spine101", 9, 30 )
+ verify( main, disconnected=False )
+ lib.killSwitch( main, "leaf2", 8, 24 )
+ lib.killSwitch( main, "leaf3", 7, 20 )
main.disconnectedIpv4Hosts = [ "h3v4", "h4v4", "h5v4", "h6v4", "h7v4" ]
main.disconnectedIpv6Hosts = [ "h3v6", "h4v6", "h5v6", "h6v6", "h7v6" ]
- verifyPing( main )
- lib.recoverSwitch( main, "spine101", int( main.params[ "TOPO" ][ "switchNum" ] ) - 2, int( main.params[ "TOPO" ][ "linkNum" ] ) - 18 )
- verifyPing( main )
- lib.recoverSwitch( main, "leaf3", int( main.params[ "TOPO" ][ "switchNum" ] ) - 1, int( main.params[ "TOPO" ][ "linkNum" ] ) - 10 )
- lib.recoverSwitch( main, "leaf2", int( main.params[ "TOPO" ][ "switchNum" ] ), int( main.params[ "TOPO" ][ "linkNum" ] ) )
+ verify( main )
+ lib.recoverSwitch( main, "spine101", 8, 30 )
+ verify( main )
+ lib.recoverSwitch( main, "leaf3", 9, 38 )
+ lib.recoverSwitch( main, "leaf2", 10, 48 )
main.disconnectedIpv4Hosts = []
main.disconnectedIpv6Hosts = []
- verifyPing( main )
+ verify( main )
lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index a9a24bb..bfeb4e7 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -19,153 +19,18 @@
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
-import time
-import json
-
-class SRRoutingTest ():
-
- topo = {}
-
- def __init__( self ):
- self.default = ''
-
- @staticmethod
- def runTest( main, test_idx, onosNodes, dhcp, routers, ipv4, ipv6,
- description, countFlowsGroups=False, checkExternalHost=False,
- staticRouteConfigure=False, switchFailure=False, linkFailure=False,
- nodeFailure=False ):
-
- skipPackage = False
- init = False
- if not hasattr( main, 'apps' ):
- init = True
- run.initTest( main )
-
- # Skip onos packaging if the cluster size stays the same
- if not init and onosNodes == main.Cluster.numCtrls:
- skipPackage = True
-
- main.case( '%s, ONOS cluster size: %s' % ( description, onosNodes ) )
-
- main.cfgName = 'TEST_CONFIG_ipv4=%d_ipv6=%d_dhcp=%d_routers=%d' % \
- ( ipv4, ipv6, dhcp, routers )
- if checkExternalHost:
- main.cfgName += '_external=1'
- if staticRouteConfigure:
- main.cfgName += '_static=1'
-
- main.resultFileName = 'CASE%03d' % test_idx
- main.Cluster.setRunningNode( onosNodes )
-
- run.installOnos( main, skipPackage=skipPackage, cliSleep=5,
- parallel=False )
-
- # Load configuration files
- run.loadJson( main )
- run.loadChart( main )
- run.loadHost( main )
-
- # if static route flag add routes
- # these routes are topology specific
- if (staticRouteConfigure):
- if (ipv4):
- run.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
- if (ipv6):
- run.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
-
- if countFlowsGroups:
- run.loadCount( main )
- if switchFailure:
- run.loadSwitchFailureChart( main )
- if linkFailure:
- run.loadLinkFailureChart( main )
-
- # wait some time
- time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
-
- if hasattr( main, 'Mininet1' ):
- # Run the test with Mininet
- mininet_args = ' --dhcp=%s --routers=%s --ipv6=%s --ipv4=%s' % ( dhcp, routers, ipv6, ipv4 )
- run.startMininet( main, main.params['DEPENDENCY']['topology'], args=mininet_args )
- else:
- # Run the test with physical devices
- # TODO: connect TestON to the physical network
- pass
-
- # wait some time for onos to install the rules!
- time.sleep( float( main.params[ 'timers' ][ 'startMininetSleep' ] ) )
- if ( dhcp ):
- time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
-
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- # Test switch failures
- if switchFailure:
- for switch, expected in main.switchFailureChart.items():
- run.killSwitch( main, switch, expected['switches_after_failure'], expected['links_after_failure'] )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- run.recoverSwitch( main, switch, expected['switches_before_failure'], expected['links_before_failure'] )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- # Test link failures
- if linkFailure:
- for link_batch_name, info in main.linkFailureChart.items():
-
- linksToRemove = info['links'].values()
- linksBefore = info['links_before']
- linksAfter = info['links_after']
-
- run.killLinkBatch( main, linksToRemove, linksAfter, 10 )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- run.restoreLinkBatch( main, linksToRemove, linksBefore, 10 )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- # Test node failures
- if nodeFailure:
- numCtrls = len( main.Cluster.runningNodes )
- links = len( json.loads( main.Cluster.next().links() ) )
- switches = len( json.loads( main.Cluster.next().devices() ) )
- for ctrl in xrange( numCtrls ):
- # Kill node
- run.killOnos( main, [ ctrl ], switches, links, ( numCtrls - 1 ) )
- main.Cluster.active(0).CLI.balanceMasters()
- time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- # Recover node
- run.recoverOnos( main, [ ctrl ], switches, links, numCtrls )
- main.Cluster.active(0).CLI.balanceMasters()
- time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
- SRRoutingTest.runChecks( main, test_idx, countFlowsGroups )
-
- # Cleanup
- run.cleanup( main, copyKarafLog=False )
-
- @staticmethod
- def runChecks( main, test_idx, countFlowsGroups ):
- # Verify host IP assignment
- run.verifyOnosHostIp( main )
- run.verifyNetworkHostIp( main )
- # check flows / groups numbers
- if countFlowsGroups:
- run.checkFlowsGroupsFromFile( main )
- # ping hosts
- run.pingAll( main, 'CASE%03d' % test_idx, False, acceptableFailed=5, basedOnIp=True, skipOnFail=True )
-
-
-def setupTest( main, test_idx, onosNodes ):
+def setupTest( main, test_idx, onosNodes, ipv4=True, ipv6=True, external=True, static=False, countFlowsGroups=False ):
"""
SRRouting test setup
"""
from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ import time
+
skipPackage = False
init = False
if not hasattr( main, 'apps' ):
init = True
- run.initTest( main )
+ lib.initTest( main )
# Skip onos packaging if the cluster size stays the same
if not init and onosNodes == main.Cluster.numCtrls:
skipPackage = True
@@ -174,31 +39,47 @@
main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' )
main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' )
main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' )
- main.resultFileName = "CASE%03d" % test_idx
+ main.disconnectedIpv4Hosts = []
+ main.disconnectedIpv6Hosts = []
+ main.resultFileName = 'CASE%03d' % test_idx
main.Cluster.setRunningNode( onosNodes )
- lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
- # Load configuration files
- main.step( "Load configurations" )
- main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1_dhcp=1_routers=1_external=1"
- lib.loadJson( main )
- time.sleep( float( main.params[ "timers" ][ "loadNetcfgSleep" ] ) )
- if hasattr( main, "Mininet1" ):
+ lib.installOnos( main, skipPackage=skipPackage, cliSleep=5, parallel=False )
+
+ # Load configuration files
+ main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}_dhcp=1_routers=1{}{}'.format( 1 if ipv4 else 0,
+ 1 if ipv6 else 0,
+ "_external=1" if external else "",
+ "_static=1" if static else "" )
+ lib.loadJson( main )
+ time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
+ lib.loadHost( main )
+
+ # if static route flag add routes
+ # these routes are topology specific
+ if static:
+ if ipv4:
+ lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
+ if ipv6:
+ lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
+ if countFlowsGroups:
+ lib.loadCount( main )
+
+ if hasattr( main, 'Mininet1' ):
# Run the test with Mininet
- mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
- lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
+ mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
+ 1 if ipv4 else 0 )
+ lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
else:
# Run the test with physical devices
lib.connectToPhysicalNetwork( main, self.switchNames )
# Check if the devices are up
lib.checkDevices( main, switches=len( self.switchNames ) )
-
# wait some time for onos to install the rules!
- time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
- time.sleep( float( main.params[ "timers" ][ "dhcpSleep" ] ) )
+ time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
-def verifyPingInternal( main, verifyDisconnected=True ):
+def verifyPingInternal( main, ipv4=True, ipv6=True, disconnected=True ):
"""
Verify all connected internal hosts are able to reach each other,
and disconnected internal hosts cannot reach any other internal host
@@ -206,20 +87,24 @@
from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
# Verify connected hosts
main.step("Verify reachability of connected internal hosts")
- lib.verifyPing( main,
- [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ],
- [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ] )
- lib.verifyPing( main,
- [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
- [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
- ipv6=True, acceptableFailed=7 )
+ if ipv4:
+ lib.verifyPing( main,
+ [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ],
+ [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ] )
+ if ipv6:
+ lib.verifyPing( main,
+ [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
+ [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
+ ipv6=True, acceptableFailed=7 )
# Verify disconnected hosts
- if verifyDisconnected and ( main.disconnectedIpv4Hosts or main.disconnectedIpv6Hosts ):
+ if disconnected:
main.step("Verify unreachability of disconnected internal hosts")
- lib.verifyPing( main, main.internalIpv4Hosts, main.disconnectedIpv4Hosts, expect=False )
- lib.verifyPing( main, main.internalIpv6Hosts, main.disconnectedIpv6Hosts, ipv6=True, expect=False )
+ if main.disconnectedIpv4Hosts:
+ lib.verifyPing( main, main.internalIpv4Hosts, main.disconnectedIpv4Hosts, expect=False )
+ if main.disconnectedIpv6Hosts:
+ lib.verifyPing( main, main.internalIpv6Hosts, main.disconnectedIpv6Hosts, ipv6=True, expect=False )
-def verifyPingExternal( main, verifyDisconnected=True ):
+def verifyPingExternal( main, ipv4=True, ipv6=True, disconnected=True ):
"""
Verify all connected internal hosts are able to reach external hosts,
and disconnected internal hosts cannot reach any external host
@@ -227,24 +112,100 @@
from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
# Verify connected hosts
main.step("Verify reachability of from connected internal hosts to external hosts")
- lib.verifyPing( main,
- [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ],
- main.externalIpv4Hosts )
- lib.verifyPing( main,
- [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
- main.externalIpv6Hosts,
- ipv6=True, acceptableFailed=7 )
+ if ipv4:
+ lib.verifyPing( main,
+ [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ],
+ main.externalIpv4Hosts )
+ if ipv6:
+ lib.verifyPing( main,
+ [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ],
+ main.externalIpv6Hosts,
+ ipv6=True, acceptableFailed=7 )
# Verify disconnected hosts
- '''
- if verifyDisconnected and ( main.disconnectedIpv4Hosts or main.disconnectedIpv6Hosts ):
+ if disconnected:
main.step("Verify unreachability of disconnected internal hosts to external hosts")
- lib.verifyPing( main, main.disconnectedIpv4Hosts, main.externalIpv4Hosts, expect=False )
- lib.verifyPing( main, main.disconnectedIpv6Hosts, main.externalIpv6Hosts, ipv6=True, expect=False )
- '''
+ if main.disconnectedIpv4Hosts:
+ lib.verifyPing( main, main.disconnectedIpv4Hosts, main.externalIpv4Hosts, expect=False )
+ if main.disconnectedIpv6Hosts:
+ lib.verifyPing( main, main.disconnectedIpv6Hosts, main.externalIpv6Hosts, ipv6=True, expect=False )
-def verifyPing( main ):
+def verifyPing( main, ipv4=True, ipv6=True, disconnected=False, internal=True, external=True ):
"""
Verify reachability and unreachability of connected/disconnected hosts
"""
- verifyPingInternal( main )
- verifyPingExternal( main )
+ if internal:
+ verifyPingInternal( main, ipv4, ipv6, disconnected )
+ if external:
+ verifyPingExternal( main, ipv4, ipv6, disconnected )
+
+def verifyLinkFailure( main, ipv4=True, ipv6=True, disconnected=False, internal=True, external=True, countFlowsGroups=False ):
+ """
+ Kill and recover all links to spine101 and 102 sequencially and run verifications
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ linksToRemove = [ ["spine103", "spine101"],
+ ["leaf2", "spine101"],
+ ["leaf3", "spine101"],
+ ["leaf4", "spine101"],
+ ["leaf5", "spine101"] ]
+ lib.killLinkBatch( main, linksToRemove, 30, 10 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+ lib.restoreLinkBatch( main, linksToRemove, 48, 10 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+ linksToRemove = [ ["spine104", "spine102"],
+ ["leaf2", "spine102"],
+ ["leaf3", "spine102"],
+ ["leaf4", "spine102"],
+ ["leaf5", "spine102"] ]
+ lib.killLinkBatch( main, linksToRemove, 30, 10 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+ lib.restoreLinkBatch( main, linksToRemove, 48, 10 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+
+def verifySwitchFailure( main, ipv4=True, ipv6=True, disconnected=False, internal=True, external=True, countFlowsGroups=False ):
+ """
+ Kill and recover spine101 and 102 sequencially and run verifications
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ for switchToKill in [ "spine101", "spine102" ]:
+ lib.killSwitch( main, switchToKill, 9, 30 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+ lib.recoverSwitch( main, switchToKill, 10, 48 )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+
+def verifyOnosFailure( main, ipv4=True, ipv6=True, disconnected=False, internal=True, external=True, countFlowsGroups=False ):
+ """
+ Kill and recover onos nodes sequencially and run verifications
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ import json
+ import time
+
+ numCtrls = len( main.Cluster.runningNodes )
+ links = len( json.loads( main.Cluster.next().links() ) )
+ switches = len( json.loads( main.Cluster.next().devices() ) )
+ for ctrl in xrange( numCtrls ):
+ # Kill node
+ lib.killOnos( main, [ ctrl ], switches, links, ( numCtrls - 1 ) )
+ main.Cluster.active(0).CLI.balanceMasters()
+ time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+ # Recover node
+ lib.recoverOnos( main, [ ctrl ], switches, links, numCtrls )
+ main.Cluster.active(0).CLI.balanceMasters()
+ time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
+ verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
+
+def verify( main, ipv4=True, ipv6=True, disconnected=True, internal=True, external=True, countFlowsGroups=False ):
+ """
+ Verify host IP assignment, flow/group number and pings
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+ # Verify host IP assignment
+ lib.verifyOnosHostIp( main )
+ lib.verifyNetworkHostIp( main )
+ # check flows / groups numbers
+ if countFlowsGroups:
+ run.checkFlowsGroupsFromFile( main )
+ # ping hosts
+ verifyPing( main, ipv4, ipv6, disconnected, internal, external )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 96ad077..5ebe5dc 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -925,11 +925,13 @@
"""
main.step( "Verify IP address assignment from hosts" )
ipResult = main.TRUE
+ main.Network.update()
for hostName, ip in main.expectedHosts[ "network" ].items():
ipResult = ipResult and utilities.retry( main.Network.verifyHostIp,
main.FALSE,
kwargs={ 'hostList': [ hostName ],
- 'prefix': ip },
+ 'prefix': ip,
+ 'update': False },
attempts=attempts,
sleep=sleep )
utilities.assert_equals( expect=main.TRUE, actual=ipResult,