Andreas Pantelopoulos | 90f0b10 | 2018-02-01 13:21:45 -0800 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2017 Open Networking Foundation ( ONF ) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or 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 | |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 22 | def setupTest( main, test_idx, onosNodes=-1, ipv4=True, ipv6=True, |
| 23 | external=True, static=False, countFlowsGroups=False ): |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 24 | """ |
| 25 | SRRouting test setup |
| 26 | """ |
| 27 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
You Wang | 68568b1 | 2019-03-04 11:49:57 -0800 | [diff] [blame] | 28 | import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 29 | import time |
| 30 | |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 31 | try: |
| 32 | skipPackage = False |
| 33 | init = False |
| 34 | if not hasattr( main, 'apps' ): |
| 35 | init = True |
| 36 | lib.initTest( main ) |
| 37 | if onosNodes < 0: |
| 38 | onosNodes = main.Cluster.numCtrls |
| 39 | # Skip onos packaging if the cluster size stays the same |
| 40 | if not init and onosNodes == main.Cluster.numCtrls: |
| 41 | skipPackage = True |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 42 | |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 43 | main.internalIpv4Hosts = main.params[ 'TOPO' ][ 'internalIpv4Hosts' ].split( ',' ) |
| 44 | main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' ) |
| 45 | main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv4Hosts') else [] |
| 46 | main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv6Hosts') else [] |
| 47 | main.staticIpv4Hosts = main.params[ 'TOPO' ][ 'staticIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv4Hosts') else [] |
| 48 | main.staticIpv6Hosts = main.params[ 'TOPO' ][ 'staticIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv6Hosts') else [] |
| 49 | main.disconnectedIpv4Hosts = [] |
| 50 | main.disconnectedIpv6Hosts = [] |
| 51 | main.disconnectedExternalIpv4Hosts = [] |
| 52 | main.disconnectedExternalIpv6Hosts = [] |
| 53 | main.disconnectedStaticIpv4Hosts = [] |
| 54 | main.disconnectedStaticIpv6Hosts = [] |
| 55 | main.resultFileName = 'CASE%03d' % test_idx |
| 56 | main.Cluster.setRunningNode( onosNodes ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 57 | |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 58 | lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 59 | |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 60 | # Load configuration files |
| 61 | if hasattr( main, "Mininet1" ): |
| 62 | main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}'.format( 1 if ipv4 else 0, |
| 63 | 1 if ipv6 else 0) |
| 64 | else: |
| 65 | main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ] |
You Wang | 68568b1 | 2019-03-04 11:49:57 -0800 | [diff] [blame] | 66 | if main.useBmv2: |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 67 | # Translate configuration file from OVS-OFDPA to BMv2 driver |
| 68 | translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types |
| 69 | switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" ) |
| 70 | translator.ofdpaToBmv2( main, switchPrefix=switchPrefix ) |
| 71 | else: |
| 72 | translator.bmv2ToOfdpa( main ) |
| 73 | lib.loadJson( main ) |
| 74 | main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) ) |
| 75 | time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) ) |
| 76 | lib.loadHost( main ) |
You Wang | 0fc2170 | 2018-11-02 17:49:18 -0700 | [diff] [blame] | 77 | |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 78 | # if static route flag add routes |
| 79 | # these routes are topology specific |
| 80 | if static: |
| 81 | if ipv4: |
| 82 | lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1") |
| 83 | lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.5.1") |
| 84 | if ipv6: |
| 85 | lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101") |
| 86 | lib.addStaticOnosRoute( main, "2000::8700/120", "2000::501") |
| 87 | if countFlowsGroups: |
| 88 | lib.loadCount( main ) |
| 89 | |
| 90 | if hasattr( main, 'Mininet1' ): |
| 91 | lib.mnDockerSetup( main ) |
| 92 | # Run the test with Mininet |
| 93 | mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0, |
| 94 | 1 if ipv4 else 0 ) |
| 95 | if main.useBmv2: |
| 96 | mininet_args += ' --switch %s' % main.switchType |
| 97 | main.log.info( "Using %s switch" % main.switchType ) |
| 98 | lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args ) |
| 99 | main.log.debug( "Waiting %i seconds for ONOS to discover dataplane" % float( main.params[ "timers" ][ "startMininetSleep" ] )) |
| 100 | time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) ) |
| 101 | else: |
| 102 | # Run the test with physical devices |
| 103 | lib.connectToPhysicalNetwork( main ) |
| 104 | |
| 105 | lib.saveOnosDiagnostics( main ) |
| 106 | # wait some time for onos to install the rules! |
| 107 | main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] )) |
| 108 | time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) ) |
| 109 | except Exception as e: |
| 110 | main.log.exception( "Error in setupTest" ) |
| 111 | main.skipCase( result="FAIL", msg=e ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 112 | |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 113 | def verifyPingInternal( main, ipv4=True, ipv6=True, disconnected=True ): |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 114 | """ |
| 115 | Verify all connected internal hosts are able to reach each other, |
| 116 | and disconnected internal hosts cannot reach any other internal host |
| 117 | """ |
| 118 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 119 | # Verify connected hosts |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 120 | if ipv4: |
| 121 | lib.verifyPing( main, |
| 122 | [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ], |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 123 | [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ], |
| 124 | stepMsg="Verify reachability of connected internal IPv4 hosts" ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 125 | if ipv6: |
| 126 | lib.verifyPing( main, |
| 127 | [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ], |
| 128 | [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ], |
You Wang | 42f9e8a | 2018-07-11 13:25:11 -0700 | [diff] [blame] | 129 | ipv6=True, |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 130 | stepMsg="Verify reachability of connected internal IPv6 hosts" ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 131 | # Verify disconnected hosts |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 132 | if disconnected: |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 133 | if main.disconnectedIpv4Hosts: |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 134 | lib.verifyPing( main, main.internalIpv4Hosts, main.disconnectedIpv4Hosts, expect=False, |
| 135 | stepMsg="Verify unreachability of disconnected internal IPv4 hosts" ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 136 | if main.disconnectedIpv6Hosts: |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 137 | lib.verifyPing( main, main.internalIpv6Hosts, main.disconnectedIpv6Hosts, ipv6=True, expect=False, |
| 138 | stepMsg="Verify unreachability of disconnected internal IPv6 hosts" ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 139 | |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 140 | def verifyPingExternal( main, ipv4=True, ipv6=True, disconnected=True ): |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 141 | """ |
| 142 | Verify all connected internal hosts are able to reach external hosts, |
| 143 | and disconnected internal hosts cannot reach any external host |
| 144 | """ |
| 145 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 146 | # Verify connected hosts |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 147 | if ipv4: |
| 148 | lib.verifyPing( main, |
| 149 | [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ], |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 150 | [ h for h in main.externalIpv4Hosts if h not in main.disconnectedExternalIpv4Hosts ], |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 151 | stepMsg="Verify reachability from connected internal IPv4 hosts to external IPv4 hosts", |
| 152 | t3Simple=False ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 153 | if ipv6: |
| 154 | lib.verifyPing( main, |
| 155 | [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ], |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 156 | [ h for h in main.externalIpv6Hosts if h not in main.disconnectedExternalIpv6Hosts ], |
You Wang | 42f9e8a | 2018-07-11 13:25:11 -0700 | [diff] [blame] | 157 | ipv6=True, |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 158 | stepMsg="Verify reachability from connected internal IPv6 hosts to external IPv6 hosts", |
| 159 | t3Simple=False ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 160 | # Verify disconnected hosts |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 161 | if disconnected: |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 162 | # Disconnected internal to connected external |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 163 | if main.disconnectedIpv4Hosts: |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 164 | lib.verifyPing( main, main.disconnectedIpv4Hosts, |
| 165 | [ h for h in main.externalIpv4Hosts if h not in main.disconnectedExternalIpv4Hosts ], |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 166 | expect=False, |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 167 | stepMsg="Verify unreachability of disconnected internal IPv4 hosts to connected external IPv4 hosts", |
| 168 | t3Simple=False ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 169 | if main.disconnectedIpv6Hosts: |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 170 | lib.verifyPing( main, main.disconnectedIpv6Hosts, |
| 171 | [ h for h in main.externalIpv6Hosts if h not in main.disconnectedExternalIpv6Hosts ], |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 172 | ipv6=True, expect=False, |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 173 | stepMsg="Verify unreachability of disconnected internal IPv6 hosts to connected external IPv6 hosts", |
| 174 | t3Simple=False ) |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 175 | # Connected internal to disconnected external |
| 176 | if main.disconnectedExternalIpv4Hosts: |
| 177 | lib.verifyPing( main, |
| 178 | [ h for h in main.internalIpv4Hosts if h not in main.disconnectedIpv4Hosts ], |
| 179 | main.disconnectedExternalIpv4Hosts, |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 180 | expect=False, |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 181 | stepMsg="Verify unreachability of connected internal IPv4 hosts to disconnected external IPv4 hosts", |
| 182 | t3Simple=False ) |
Jonghwan Hyun | 3759e47 | 2018-05-01 15:40:08 -0700 | [diff] [blame] | 183 | if main.disconnectedExternalIpv6Hosts: |
| 184 | lib.verifyPing( main, |
| 185 | [ h for h in main.internalIpv6Hosts if h not in main.disconnectedIpv6Hosts ], |
| 186 | main.disconnectedExternalIpv6Hosts, |
You Wang | 8574776 | 2018-05-11 15:51:50 -0700 | [diff] [blame] | 187 | ipv6=True, expect=False, |
You Wang | 54b1d67 | 2018-06-11 16:44:13 -0700 | [diff] [blame] | 188 | stepMsg="Verify unreachability of connected internal IPv6 hosts to disconnected external IPv6 hosts", |
| 189 | t3Simple=False ) |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 190 | |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 191 | def verifyPing( main, ipv4=True, ipv6=True, disconnected=False, internal=True, external=True ): |
You Wang | 5da39c8 | 2018-04-26 22:55:08 -0700 | [diff] [blame] | 192 | """ |
| 193 | Verify reachability and unreachability of connected/disconnected hosts |
| 194 | """ |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 195 | if internal: |
| 196 | verifyPingInternal( main, ipv4, ipv6, disconnected ) |
| 197 | if external: |
| 198 | verifyPingExternal( main, ipv4, ipv6, disconnected ) |
| 199 | |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 200 | def verifyLinkFailure( main, ipv4=True, ipv6=True, disconnected=False, |
| 201 | internal=True, external=True, countFlowsGroups=False ): |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 202 | """ |
| 203 | Kill and recover all links to spine101 and 102 sequencially and run verifications |
| 204 | """ |
| 205 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 206 | linksToRemove = [ ["spine103", "spine101"], |
| 207 | ["leaf2", "spine101"], |
| 208 | ["leaf3", "spine101"], |
| 209 | ["leaf4", "spine101"], |
| 210 | ["leaf5", "spine101"] ] |
| 211 | lib.killLinkBatch( main, linksToRemove, 30, 10 ) |
| 212 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 213 | lib.restoreLinkBatch( main, linksToRemove, 48, 10 ) |
| 214 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 215 | linksToRemove = [ ["spine104", "spine102"], |
| 216 | ["leaf2", "spine102"], |
| 217 | ["leaf3", "spine102"], |
| 218 | ["leaf4", "spine102"], |
| 219 | ["leaf5", "spine102"] ] |
| 220 | lib.killLinkBatch( main, linksToRemove, 30, 10 ) |
| 221 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 222 | lib.restoreLinkBatch( main, linksToRemove, 48, 10 ) |
| 223 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 224 | |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 225 | def verifySwitchFailure( main, ipv4=True, ipv6=True, disconnected=False, |
| 226 | internal=True, external=True, countFlowsGroups=False ): |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 227 | """ |
| 228 | Kill and recover spine101 and 102 sequencially and run verifications |
| 229 | """ |
| 230 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 231 | for switchToKill in [ "spine101", "spine102" ]: |
| 232 | lib.killSwitch( main, switchToKill, 9, 30 ) |
| 233 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 234 | lib.recoverSwitch( main, switchToKill, 10, 48 ) |
| 235 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 236 | |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 237 | def verifyOnosFailure( main, ipv4=True, ipv6=True, disconnected=False, |
| 238 | internal=True, external=True, countFlowsGroups=False ): |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 239 | """ |
| 240 | Kill and recover onos nodes sequencially and run verifications |
| 241 | """ |
| 242 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 243 | import json |
| 244 | import time |
| 245 | |
| 246 | numCtrls = len( main.Cluster.runningNodes ) |
| 247 | links = len( json.loads( main.Cluster.next().links() ) ) |
| 248 | switches = len( json.loads( main.Cluster.next().devices() ) ) |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 249 | mastershipSleep = float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 250 | for ctrl in xrange( numCtrls ): |
| 251 | # Kill node |
| 252 | lib.killOnos( main, [ ctrl ], switches, links, ( numCtrls - 1 ) ) |
| 253 | main.Cluster.active(0).CLI.balanceMasters() |
Jon Hall | 43060f6 | 2020-06-23 13:13:33 -0700 | [diff] [blame] | 254 | main.log.debug( "sleeping %i seconds" % mastershipSleep ) |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 255 | time.sleep( mastershipSleep ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 256 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 257 | # Recover node |
| 258 | lib.recoverOnos( main, [ ctrl ], switches, links, numCtrls ) |
| 259 | main.Cluster.active(0).CLI.balanceMasters() |
Jon Hall | 43060f6 | 2020-06-23 13:13:33 -0700 | [diff] [blame] | 260 | main.log.debug( "sleeping %i seconds" % mastershipSleep ) |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 261 | time.sleep( mastershipSleep ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 262 | verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups ) |
| 263 | |
| 264 | def verify( main, ipv4=True, ipv6=True, disconnected=True, internal=True, external=True, countFlowsGroups=False ): |
| 265 | """ |
| 266 | Verify host IP assignment, flow/group number and pings |
| 267 | """ |
| 268 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 269 | # Verify host IP assignment |
| 270 | lib.verifyOnosHostIp( main ) |
| 271 | lib.verifyNetworkHostIp( main ) |
| 272 | # check flows / groups numbers |
| 273 | if countFlowsGroups: |
Jon Hall | a604fd4 | 2018-05-04 14:27:27 -0700 | [diff] [blame] | 274 | lib.checkFlowsGroupsFromFile( main ) |
You Wang | d66de19 | 2018-04-30 17:30:12 -0700 | [diff] [blame] | 275 | # ping hosts |
| 276 | verifyPing( main, ipv4, ipv6, disconnected, internal, external ) |
You Wang | 0f745de | 2018-07-27 15:49:22 -0700 | [diff] [blame] | 277 | |
| 278 | def verifyRouterFailure( main, routerToKill, affectedIpv4Hosts=[], affectedIpv6Hosts=[], |
| 279 | ipv4=True, ipv6=True, countFlowsGroups=False ): |
| 280 | """ |
| 281 | Kill and recover a quagga router and verify connectivities to external hosts |
| 282 | """ |
| 283 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib |
| 284 | lib.killRouter( main, routerToKill, 5 ) |
| 285 | main.disconnectedExternalIpv4Hosts = affectedIpv4Hosts |
| 286 | main.disconnectedExternalIpv6Hosts = affectedIpv6Hosts |
| 287 | verify( main, ipv4, ipv6, True if (affectedIpv4Hosts or affectedIpv6Hosts) else False, False, True, countFlowsGroups ) |
| 288 | lib.recoverRouter( main, routerToKill, 5 ) |
| 289 | main.disconnectedExternalIpv4Hosts = [] |
| 290 | main.disconnectedExternalIpv6Hosts = [] |
| 291 | verify( main, ipv4, ipv6, False, False, True, countFlowsGroups ) |