blob: fefca297a091b49955107ffe5a3a43c49095a2aa [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2016 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
Flavio Castro5608a392016-06-22 17:02:35 -070022# In this test we perform a switch failure and then test for connectivity
23# CASE1: 2x2 topo + swtich failure + IP connectivity test
24# CASE2: 4x4 topo + switch failure + IP connectivity test
25# CASE4: 2x2 topo + 3-node ONOS CLUSTER + switch failure + IP connectivity test
26# CASE5: 4x4 topo + 3-node ONOS CLUSTER + switch failure + IP connectivity test
27
28class SRSwitchFailure:
29 def __init__( self ):
30 self.default = ''
31
32 def CASE1( self, main ):
33 """
34 Sets up 1-node Onos-cluster
35 Start 2x2 Leaf-Spine topology
36 Pingall
37 Cause switch failure
38 Pingall
39 """
40 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
41 Testcaselib as run
42 if not hasattr( main, 'apps' ):
43 run.initTest( main )
44
45 description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
46 main.case( description )
47
48 main.cfgName = '2x2'
49 main.numCtrls = 1
50 run.installOnos( main )
51 run.startMininet( main, 'cord_fabric.py' )
52 # pre-configured routing and bridging test
53 run.checkFlows( main, minFlowCount=116 )
54 run.pingAll( main )
55 # switch failure\
56 switch = main.params[ 'kill' ][ 'switch' ]
57 run.killSwitch( main, switch, switches='3', links='4' )
58 run.pingAll( main, "CASE1_Failure" )
59 run.recoverSwitch( main, switch, switches='4', links='8' )
60 run.checkFlows( main, minFlowCount=116 )
61 run.pingAll( main, "CASE1_Recovery" )
62 # TODO Dynamic config of hosts in subnet
63 # TODO Dynamic config of host not in subnet
64 # TODO Dynamic config of vlan xconnect
65 # TODO Vrouter integration
66 # TODO Mcast integration
67 run.cleanup( main )
68
69 def CASE2( self, main ):
70 """
71 Sets up 1-node Onos-cluster
72 Start 4x4 Leaf-Spine topology
73 Pingall
74 Cause switch failure
75 Pingall
76 """
77 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
78 Testcaselib as run
Flavio Castroc0a2c5e2016-07-13 17:19:21 -070079 import time
Flavio Castro5608a392016-06-22 17:02:35 -070080 if not hasattr( main, 'apps' ):
81 run.initTest( main )
82 description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
83 main.case( description )
84 main.cfgName = '4x4'
85 main.numCtrls = 1
86 run.installOnos( main )
87 run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
88 # pre-configured routing and bridging test
89 run.checkFlows( main, minFlowCount=350 )
90 run.pingAll( main )
91 # switch failure
92 switch = main.params[ 'kill' ][ 'switch' ]
93 run.killSwitch( main, switch, switches='7', links='24' )
Flavio Castroc0a2c5e2016-07-13 17:19:21 -070094 time.sleep( main.switchSleep )
Flavio Castro5608a392016-06-22 17:02:35 -070095 run.pingAll( main, "CASE2_Failure" )
96 run.recoverSwitch( main, switch, switches='8', links='32' )
97 run.checkFlows( main, minFlowCount=350 )
98 run.pingAll( main, "CASE2_Recovery" )
99 # TODO Dynamic config of hosts in subnet
100 # TODO Dynamic config of host not in subnet
101 # TODO preconfigured xconnect
102 # TODO Vrouter integration
103 # TODO Mcast integration
104 run.cleanup( main )
105
106 def CASE4( self, main ):
107 """
108 Sets up 3-node Onos-cluster
109 Start 2x2 Leaf-Spine topology
110 Pingall
111 Cause link failure
112 Pingall
113 """
114 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
115 Testcaselib as run
116 if not hasattr( main, 'apps' ):
117 run.initTest( main )
118 description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
119 main.case( description )
120 main.cfgName = '2x2'
121 main.numCtrls = 3
122 run.installOnos( main )
123 run.startMininet( main, 'cord_fabric.py' )
124 # pre-configured routing and bridging test
125 run.checkFlows( main, minFlowCount=116 )
126 run.pingAll( main )
127 # switch failure
128 switch = main.params[ 'kill' ][ 'switch' ]
129 run.killSwitch( main, switch, switches='3', links='4' )
130 run.pingAll( main, "CASE3_Failure" )
131 run.recoverSwitch( main, switch, switches='4', links='8' )
132 run.checkFlows( main, minFlowCount=116 )
133 run.pingAll( main, "CASE3_Recovery" )
134 # TODO Dynamic config of hosts in subnet
135 # TODO Dynamic config of host not in subnet
136 # TODO Dynamic config of vlan xconnect
137 # TODO Vrouter integration
138 # TODO Mcast integration
139 run.cleanup( main )
140
141 def CASE5( self, main ):
142 """
143 Sets up 1-node Onos-cluster
144 Start 4x4 Leaf-Spine topology
145 Pingall
146 Cause link failure
147 Pingall
148 """
149 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
150 Testcaselib as run
Flavio Castroc0a2c5e2016-07-13 17:19:21 -0700151 import time
Flavio Castro5608a392016-06-22 17:02:35 -0700152 if not hasattr( main, 'apps' ):
153 run.initTest( main )
154 description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
155 main.case( description )
156 main.cfgName = '4x4'
157 main.numCtrls = 3
158 run.installOnos( main )
159 run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
160 # pre-configured routing and bridging test
161 run.checkFlows( main, minFlowCount=350 )
162 run.pingAll( main )
163 # switch failure
164 switch = main.params[ 'kill' ][ 'switch' ]
165 run.killSwitch( main, switch, switches='7', links='24' )
Flavio Castroc0a2c5e2016-07-13 17:19:21 -0700166 time.sleep( main.switchSleep )
Flavio Castro5608a392016-06-22 17:02:35 -0700167 run.pingAll( main, "CASE4_Failure" )
168 run.recoverSwitch( main, switch, switches='8', links='32' )
169 run.checkFlows( main, minFlowCount=350 )
170 run.pingAll( main, "CASE4_Recovery" )
171 # TODO Dynamic config of hosts in subnet
172 # TODO Dynamic config of host not in subnet
173 # TODO preconfigured xconnect
174 # TODO Vrouter integration
175 # TODO Mcast integration
176 run.cleanup( main )