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