kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1 | # Testing the basic intent functionality of ONOS |
| 2 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 3 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 4 | class FUNCintent: |
| 5 | |
| 6 | def __init__( self ): |
| 7 | self.default = '' |
| 8 | |
| 9 | def CASE1( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 10 | import imp |
Jon Hall | f632d20 | 2015-07-30 15:45:11 -0700 | [diff] [blame] | 11 | import re |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 12 | """ |
| 13 | - Construct tests variables |
| 14 | - GIT ( optional ) |
| 15 | - Checkout ONOS master branch |
| 16 | - Pull latest ONOS code |
| 17 | - Building ONOS ( optional ) |
| 18 | - Install ONOS package |
| 19 | - Build ONOS package |
| 20 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 21 | |
| 22 | try: |
| 23 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 24 | main.testSetUp = ONOSSetup() |
| 25 | except ImportError: |
| 26 | main.log.error( "ONOSSetup not found. exiting the test" ) |
| 27 | main.exit() |
| 28 | main.testSetUp.envSetupDescription() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 29 | stepResult = main.FALSE |
| 30 | |
| 31 | # Test variables |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 32 | try: |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 33 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 34 | main.dependencyPath = main.testOnDirectory + \ |
| 35 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 36 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 37 | main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 38 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 39 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 40 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 41 | wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ] |
| 42 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 43 | main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] ) |
acsmars | cfa5227 | 2015-08-06 15:21:45 -0700 | [diff] [blame] | 44 | main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 45 | main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] ) |
| 46 | main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] ) |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 47 | main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] ) |
| 48 | main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] ) |
| 49 | main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] ) |
| 50 | main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] ) |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 51 | main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] ) |
Jeremy Songster | 306ed7a | 2016-07-19 10:59:07 -0700 | [diff] [blame] | 52 | main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 53 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
| 54 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 55 | main.hostsData = {} |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 56 | main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' ) |
| 57 | main.scapyHosts = [] # List of scapy hosts for iterating |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 58 | main.assertReturnString = '' # Assembled assert return string |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 59 | main.cycle = 0 # How many times FUNCintent has run through its tests |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 60 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 61 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 62 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 63 | main.intents = imp.load_source( wrapperFile2, |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 64 | main.dependencyPath + |
| 65 | wrapperFile2 + |
| 66 | ".py" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 67 | |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 68 | copyResult1 = main.ONOSbench.scp( main.Mininet1, |
| 69 | main.dependencyPath + |
| 70 | main.topology, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 71 | main.Mininet1.home + "custom/", |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 72 | direction="to" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 73 | |
| 74 | stepResult = main.testSetUp.envSetup( True ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 75 | except Exception as e: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 76 | main.testSetUp.envSetupException( e ) |
| 77 | main.testSetUp.evnSetupConclusion( stepResult ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 78 | |
| 79 | def CASE2( self, main ): |
| 80 | """ |
| 81 | - Set up cell |
| 82 | - Create cell file |
| 83 | - Set cell file |
| 84 | - Verify cell file |
| 85 | - Kill ONOS process |
| 86 | - Uninstall ONOS cluster |
| 87 | - Verify ONOS start up |
| 88 | - Install ONOS cluster |
| 89 | - Connect to cli |
| 90 | """ |
Jeremy Songster | 17147f2 | 2016-05-31 18:30:52 -0700 | [diff] [blame] | 91 | |
Jeremy | cd87222 | 2016-03-29 10:08:34 -0700 | [diff] [blame] | 92 | main.flowCompiler = "Flow Rules" |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 93 | main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, True ) |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 94 | main.intents.report( main ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 95 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 96 | def CASE8( self, main ): |
| 97 | """ |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 98 | Compare ONOS Topology to Mininet Topology |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 99 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 100 | import time |
| 101 | try: |
| 102 | from tests.dependencies.topology import Topology |
| 103 | except ImportError: |
| 104 | main.log.error( "Topology not found exiting the test" ) |
| 105 | main.exit() |
| 106 | try: |
| 107 | main.topoRelated |
| 108 | except ( NameError, AttributeError ): |
| 109 | main.topoRelated = Topology() |
| 110 | main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts ) |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 111 | def CASE10( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 112 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 113 | Start Mininet topology with OF 1.0 switches |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 114 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 115 | if main.initialized == main.FALSE: |
| 116 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 117 | main.skipCase() |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 118 | main.OFProtocol = "1.0" |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 119 | main.log.report( "Start Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 120 | main.case( "Start Mininet topology with OF 1.0 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 121 | main.caseExplanation = "Start mininet topology with OF 1.0 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 122 | "switches to test intents, exits out if " +\ |
| 123 | "topology did not start correctly" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 124 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 125 | main.step( "Starting Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 126 | args = "--switch ovs,protocols=OpenFlow10" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 127 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 128 | main.topology, |
| 129 | args=args ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 130 | stepResult = topoResult |
| 131 | utilities.assert_equals( expect=main.TRUE, |
| 132 | actual=stepResult, |
| 133 | onpass="Successfully loaded topology", |
| 134 | onfail="Failed to load topology" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 135 | |
| 136 | # Set flag to test cases if topology did not load properly |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 137 | if not topoResult: |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 138 | main.initialized = main.FALSE |
| 139 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 140 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 141 | def CASE11( self, main ): |
| 142 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 143 | Start Mininet topology with OF 1.3 switches |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 144 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 145 | if main.initialized == main.FALSE: |
| 146 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 147 | main.skipCase() |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 148 | main.OFProtocol = "1.3" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 149 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 150 | main.case( "Start Mininet topology with OF 1.3 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 151 | main.caseExplanation = "Start mininet topology with OF 1.3 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 152 | "switches to test intents, exits out if " +\ |
| 153 | "topology did not start correctly" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 154 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 155 | main.step( "Starting Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 156 | args = "--switch ovs,protocols=OpenFlow13" |
| 157 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 158 | main.topology, |
| 159 | args=args ) |
| 160 | stepResult = topoResult |
| 161 | utilities.assert_equals( expect=main.TRUE, |
| 162 | actual=stepResult, |
| 163 | onpass="Successfully loaded topology", |
| 164 | onfail="Failed to load topology" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 165 | # Set flag to skip test cases if topology did not load properly |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 166 | if not topoResult: |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 167 | main.initialized = main.FALSE |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 168 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 169 | def CASE12( self, main ): |
| 170 | """ |
| 171 | Assign mastership to controllers |
| 172 | """ |
| 173 | import re |
| 174 | |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 175 | if main.initialized == main.FALSE: |
| 176 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 177 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 178 | main.case( "Assign switches to controllers" ) |
| 179 | main.step( "Assigning switches to controllers" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 180 | main.caseExplanation = "Assign OF " + main.OFProtocol +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 181 | " switches to ONOS nodes" |
| 182 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 183 | switchList = [] |
| 184 | |
| 185 | # Creates a list switch name, use getSwitch() function later... |
| 186 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 187 | switchList.append( 's' + str( i ) ) |
| 188 | |
| 189 | tempONOSip = [] |
| 190 | for i in range( main.numCtrls ): |
| 191 | tempONOSip.append( main.ONOSip[ i ] ) |
| 192 | |
| 193 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 194 | ip=tempONOSip, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 195 | port="6653" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 196 | if not assignResult: |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 197 | main.log.error( "Problem assigning mastership of switches" ) |
| 198 | main.initialized = main.FALSE |
| 199 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 200 | |
| 201 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 202 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
Jon Hall | 860b815 | 2017-05-23 10:35:23 -0700 | [diff] [blame] | 203 | main.log.debug( "Response is " + str( response ) ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 204 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
| 205 | assignResult = assignResult and main.TRUE |
| 206 | else: |
| 207 | assignResult = main.FALSE |
| 208 | stepResult = assignResult |
| 209 | utilities.assert_equals( expect=main.TRUE, |
| 210 | actual=stepResult, |
| 211 | onpass="Successfully assigned switches" + |
| 212 | "to controller", |
| 213 | onfail="Failed to assign switches to " + |
| 214 | "controller" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 215 | if not stepResult: |
| 216 | main.initialized = main.FALSE |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 217 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 218 | def CASE13( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 219 | """ |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 220 | Create Scapy components |
| 221 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 222 | if main.initialized == main.FALSE: |
| 223 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 224 | main.skipCase() |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 225 | main.case( "Create scapy components" ) |
| 226 | main.step( "Create scapy components" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 227 | scapyResult = main.TRUE |
| 228 | for hostName in main.scapyHostNames: |
| 229 | main.Scapy1.createHostComponent( hostName ) |
| 230 | main.scapyHosts.append( getattr( main, hostName ) ) |
| 231 | |
| 232 | main.step( "Start scapy components" ) |
| 233 | for host in main.scapyHosts: |
| 234 | host.startHostCli() |
| 235 | host.startScapy() |
| 236 | host.updateSelf() |
| 237 | main.log.debug( host.name ) |
| 238 | main.log.debug( host.hostIp ) |
| 239 | main.log.debug( host.hostMac ) |
| 240 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 241 | utilities.assert_equals( expect=main.TRUE, |
| 242 | actual=scapyResult, |
| 243 | onpass="Successfully created Scapy Components", |
| 244 | onfail="Failed to discover Scapy Components" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 245 | if not scapyResult: |
| 246 | main.initialized = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 247 | |
| 248 | def CASE14( self, main ): |
| 249 | """ |
| 250 | Discover all hosts with fwd and pingall and store its data in a dictionary |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 251 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 252 | if main.initialized == main.FALSE: |
| 253 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 254 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 255 | main.case( "Discover all hosts" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 256 | main.step( "Pingall hosts and confirm ONOS discovery" ) |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 257 | utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 258 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 259 | stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE, |
| 260 | args=[ main ], attempts=main.checkTopoAttempts, sleep=2 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 261 | utilities.assert_equals( expect=main.TRUE, |
| 262 | actual=stepResult, |
| 263 | onpass="Successfully discovered hosts", |
| 264 | onfail="Failed to discover hosts" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 265 | if not stepResult: |
| 266 | main.initialized = main.FALSE |
| 267 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 268 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 269 | main.step( "Populate hostsData" ) |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 270 | stepResult = main.intents.populateHostData( main ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 271 | utilities.assert_equals( expect=main.TRUE, |
| 272 | actual=stepResult, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 273 | onpass="Successfully populated hostsData", |
| 274 | onfail="Failed to populate hostsData" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 275 | if not stepResult: |
| 276 | main.initialized = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 277 | |
| 278 | def CASE15( self, main ): |
| 279 | """ |
| 280 | Discover all hosts with scapy arp packets and store its data to a dictionary |
| 281 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 282 | if main.initialized == main.FALSE: |
| 283 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 284 | main.skipCase() |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 285 | main.case( "Discover all hosts using scapy" ) |
| 286 | main.step( "Send packets from each host to the first host and confirm onos discovery" ) |
| 287 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 288 | if len( main.scapyHosts ) < 1: |
| 289 | main.log.error( "No scapy hosts have been created" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 290 | main.initialized = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 291 | main.skipCase() |
| 292 | |
| 293 | # Send ARP packets from each scapy host component |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 294 | main.intents.sendDiscoveryArp( main, main.scapyHosts ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 295 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 296 | stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 297 | retValue=main.FALSE, args=[ main ], |
| 298 | attempts=main.checkTopoAttempts, sleep=2 ) |
| 299 | |
| 300 | utilities.assert_equals( expect=main.TRUE, |
| 301 | actual=stepResult, |
| 302 | onpass="ONOS correctly discovered all hosts", |
| 303 | onfail="ONOS incorrectly discovered hosts" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 304 | if not stepResult: |
| 305 | main.initialized = main.FALSE |
| 306 | main.skipCase() |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 307 | |
| 308 | main.step( "Populate hostsData" ) |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 309 | stepResult = main.intents.populateHostData( main ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 310 | utilities.assert_equals( expect=main.TRUE, |
| 311 | actual=stepResult, |
| 312 | onpass="Successfully populated hostsData", |
| 313 | onfail="Failed to populate hostsData" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 314 | if not stepResult: |
| 315 | main.initialized = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 316 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 317 | def CASE16( self, main ): |
| 318 | """ |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 319 | Balance Masters |
| 320 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 321 | if main.initialized == main.FALSE: |
| 322 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 323 | main.stop() |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 324 | main.skipCase() |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 325 | main.case( "Balance mastership of switches" ) |
| 326 | main.step( "Balancing mastership of switches" ) |
| 327 | |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 328 | balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] ) |
| 329 | |
| 330 | utilities.assert_equals( expect=main.TRUE, |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 331 | actual=balanceResult, |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 332 | onpass="Successfully balanced mastership of switches", |
| 333 | onfail="Failed to balance mastership of switches" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 334 | if not balanceResult: |
| 335 | main.initialized = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 336 | |
| 337 | def CASE17( self, main ): |
| 338 | """ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 339 | Use Flow Objectives |
| 340 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 341 | if main.initialized == main.FALSE: |
| 342 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 343 | main.skipCase() |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 344 | main.case( "Enable intent compilation using Flow Objectives" ) |
| 345 | main.step( "Enabling Flow Objectives" ) |
| 346 | |
| 347 | main.flowCompiler = "Flow Objectives" |
| 348 | |
| 349 | cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator" |
| 350 | |
| 351 | stepResult = main.CLIs[ 0 ].setCfg( component=cmd, |
| 352 | propName="useFlowObjectives", value="true" ) |
You Wang | 106d0fa | 2017-05-15 17:22:15 -0700 | [diff] [blame] | 353 | stepResult &= main.CLIs[ 0 ].setCfg( component=cmd, |
| 354 | propName="defaultFlowObjectiveCompiler", |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 355 | value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' ) |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 356 | |
| 357 | utilities.assert_equals( expect=main.TRUE, |
| 358 | actual=stepResult, |
| 359 | onpass="Successfully activated Flow Objectives", |
| 360 | onfail="Failed to activate Flow Objectives" ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 361 | if not balanceResult: |
| 362 | main.initialized = main.FALSE |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 363 | |
| 364 | def CASE18( self, main ): |
| 365 | """ |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 366 | Stop mininet and remove scapy host |
| 367 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 368 | try: |
| 369 | from tests.dependencies.utils import Utils |
| 370 | except ImportError: |
| 371 | main.log.error( "Utils not found exiting the test" ) |
| 372 | main.exit() |
| 373 | try: |
| 374 | main.Utils |
| 375 | except ( NameError, AttributeError ): |
| 376 | main.Utils = Utils() |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 377 | main.log.report( "Stop Mininet and Scapy" ) |
| 378 | main.case( "Stop Mininet and Scapy" ) |
| 379 | main.caseExplanation = "Stopping the current mininet topology " +\ |
| 380 | "to start up fresh" |
| 381 | main.step( "Stopping and Removing Scapy Host Components" ) |
| 382 | scapyResult = main.TRUE |
| 383 | for host in main.scapyHosts: |
| 384 | scapyResult = scapyResult and host.stopScapy() |
| 385 | main.log.info( "Stopped Scapy Host: {0}".format( host.name ) ) |
| 386 | |
| 387 | for host in main.scapyHosts: |
| 388 | scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name ) |
| 389 | main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) ) |
| 390 | |
| 391 | main.scapyHosts = [] |
| 392 | main.scapyHostIPs = [] |
| 393 | |
| 394 | utilities.assert_equals( expect=main.TRUE, |
| 395 | actual=scapyResult, |
| 396 | onpass="Successfully stopped scapy and removed host components", |
| 397 | onfail="Failed to stop mininet and scapy" ) |
| 398 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 399 | mininetResult = main.Utils.mininetCleanup( main.Mininet1 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 400 | # Exit if topology did not load properly |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 401 | if not ( mininetResult and scapyResult ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 402 | main.cleanup() |
| 403 | main.exit() |
| 404 | |
Jeremy Songster | 17147f2 | 2016-05-31 18:30:52 -0700 | [diff] [blame] | 405 | def CASE19( self, main ): |
| 406 | """ |
| 407 | Copy the karaf.log files after each testcase cycle |
| 408 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 409 | try: |
| 410 | from tests.dependencies.utils import Utils |
| 411 | except ImportError: |
| 412 | main.log.error( "Utils not found exiting the test" ) |
| 413 | main.exit() |
| 414 | try: |
| 415 | main.Utils |
| 416 | except ( NameError, AttributeError ): |
| 417 | main.Utils = Utils() |
| 418 | main.Utils.copyKarafLog() |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 419 | def CASE1000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 420 | """ |
| 421 | Add host intents between 2 host: |
| 422 | - Discover hosts |
| 423 | - Add host intents |
| 424 | - Check intents |
| 425 | - Verify flows |
| 426 | - Ping hosts |
| 427 | - Reroute |
| 428 | - Link down |
| 429 | - Verify flows |
| 430 | - Check topology |
| 431 | - Ping hosts |
| 432 | - Link up |
| 433 | - Verify flows |
| 434 | - Check topology |
| 435 | - Ping hosts |
| 436 | - Remove intents |
| 437 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 438 | if main.initialized == main.FALSE: |
| 439 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 440 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 441 | # Assert variables - These variable's name|format must be followed |
| 442 | # if you want to use the wrapper function |
| 443 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 444 | try: |
| 445 | assert main.CLIs |
| 446 | except AssertionError: |
| 447 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 448 | main.initialized = main.FALSE |
| 449 | main.skipCase() |
| 450 | try: |
| 451 | assert main.Mininet1 |
| 452 | except AssertionError: |
| 453 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 454 | main.initialized = main.FALSE |
| 455 | main.skipCase() |
| 456 | try: |
| 457 | assert main.numSwitch |
| 458 | except AssertionError: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 459 | main.log.error( "Place the total number of switch topology in " + |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 460 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 461 | main.initialized = main.FALSE |
| 462 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 463 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 464 | # Save leader candidates |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 465 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 466 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 467 | main.testName = "Host Intents" |
| 468 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 469 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 470 | main.caseExplanation = "This test case tests Host intents using " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 471 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 472 | "Different type of hosts will be tested in " +\ |
| 473 | "each step such as IPV4, Dual stack, VLAN " +\ |
Jeremy | eb51cb1 | 2016-03-28 17:53:35 -0700 | [diff] [blame] | 474 | "etc;\nThe test will use OF " + main.OFProtocol +\ |
| 475 | " OVS running in Mininet and compile intents" +\ |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 476 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 477 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 478 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 479 | main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 480 | host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" } |
| 481 | host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 482 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 483 | installResult = main.intents.installHostIntent( main, |
| 484 | name="IPV4", |
| 485 | onosNode=0, |
| 486 | host1=host1, |
| 487 | host2=host2 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 488 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 489 | testResult = main.intents.testHostIntent( main, |
| 490 | name="IPV4", |
| 491 | intentId=installResult, |
| 492 | onosNode=0, |
| 493 | host1=host1, |
| 494 | host2=host2, |
| 495 | sw1="s5", |
| 496 | sw2="s2", |
| 497 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 498 | else: |
| 499 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 500 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 501 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 502 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 503 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 504 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 505 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 506 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 507 | main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 508 | host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" } |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 509 | host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 510 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 511 | installResult = main.intents.installHostIntent( main, |
| 512 | name="DUALSTACK", |
| 513 | onosNode=0, |
| 514 | host1=host1, |
| 515 | host2=host2 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 516 | |
| 517 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 518 | testResult = main.intents.testHostIntent( main, |
| 519 | name="DUALSTACK", |
| 520 | intentId=installResult, |
| 521 | onosNode=0, |
| 522 | host1=host1, |
| 523 | host2=host2, |
| 524 | sw1="s5", |
| 525 | sw2="s2", |
| 526 | expectedLink=18 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 527 | |
| 528 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 529 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 530 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 531 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 532 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 533 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 534 | main.assertReturnString = "Assertion Result for dualstack2 host intent\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 535 | host1 = { "name": "h1" } |
| 536 | host2 = { "name": "h11" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 537 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 538 | installResult = main.intents.installHostIntent( main, |
| 539 | name="DUALSTACK2", |
| 540 | onosNode=0, |
| 541 | host1=host1, |
| 542 | host2=host2 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 543 | |
| 544 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 545 | testResult = main.intents.testHostIntent( main, |
| 546 | name="DUALSTACK2", |
| 547 | intentId=installResult, |
| 548 | onosNode=0, |
| 549 | host1=host1, |
| 550 | host2=host2, |
| 551 | sw1="s5", |
| 552 | sw2="s2", |
| 553 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 554 | else: |
| 555 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 556 | |
| 557 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 558 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 559 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 560 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 561 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 562 | main.step( "1HOP: Add host intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 563 | main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 564 | host1 = { "name": "h1" } |
| 565 | host2 = { "name": "h3" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 566 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 567 | installResult = main.intents.installHostIntent( main, |
| 568 | name="1HOP", |
| 569 | onosNode=0, |
| 570 | host1=host1, |
| 571 | host2=host2 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 572 | |
| 573 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 574 | testResult = main.intents.testHostIntent( main, |
| 575 | name="1HOP", |
| 576 | intentId=installResult, |
| 577 | onosNode=0, |
| 578 | host1=host1, |
| 579 | host2=host2, |
| 580 | sw1="s5", |
| 581 | sw2="s2", |
| 582 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 583 | else: |
| 584 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 585 | |
| 586 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 587 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 588 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 589 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 590 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 591 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 592 | main.assertReturnString = "Assertion Result vlan IPV4\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 593 | host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" } |
| 594 | host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 595 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 596 | installResult = main.intents.installHostIntent( main, |
| 597 | name="VLAN1", |
| 598 | onosNode=0, |
| 599 | host1=host1, |
| 600 | host2=host2 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 601 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 602 | testResult = main.intents.testHostIntent( main, |
| 603 | name="VLAN1", |
| 604 | intentId=installResult, |
| 605 | onosNode=0, |
| 606 | host1=host1, |
| 607 | host2=host2, |
| 608 | sw1="s5", |
| 609 | sw2="s2", |
| 610 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 611 | else: |
| 612 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 613 | |
| 614 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 615 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 616 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 617 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 618 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 619 | main.step( "VLAN2: Add vlan host intents between h4 and h13" ) |
| 620 | main.assertReturnString = "Assertion Result vlan IPV4\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 621 | host1 = { "name": "h5", "vlan": "200" } |
| 622 | host2 = { "name": "h12", "vlan": "100" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 623 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 624 | installResult = main.intents.installHostIntent( main, |
| 625 | name="VLAN2", |
| 626 | onosNode=0, |
| 627 | host1=host1, |
| 628 | host2=host2 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 629 | |
| 630 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 631 | testResult = main.intents.testHostIntent( main, |
| 632 | name="VLAN2", |
| 633 | intentId=installResult, |
| 634 | onosNode=0, |
| 635 | host1=host1, |
| 636 | host2=host2, |
| 637 | sw1="s5", |
| 638 | sw2="s2", |
| 639 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 640 | else: |
| 641 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 642 | |
| 643 | utilities.assert_equals( expect=main.TRUE, |
| 644 | actual=testResult, |
| 645 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 646 | onfail=main.assertReturnString ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 647 | |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 648 | main.step( "Encapsulation: Add host intents between h1 and h9" ) |
| 649 | main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 650 | host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" } |
| 651 | host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" } |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 652 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 653 | installResult = main.intents.installHostIntent( main, |
| 654 | name="ENCAPSULATION", |
| 655 | onosNode=0, |
| 656 | host1=host1, |
| 657 | host2=host2, |
| 658 | encap="VLAN" ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 659 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 660 | testResult = main.intents.testHostIntent( main, |
| 661 | name="ENCAPSULATION", |
| 662 | intentId=installResult, |
| 663 | onosNode=0, |
| 664 | host1=host1, |
| 665 | host2=host2, |
| 666 | sw1="s5", |
| 667 | sw2="s2", |
| 668 | expectedLink=18 ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 669 | else: |
| 670 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 671 | |
| 672 | utilities.assert_equals( expect=main.TRUE, |
| 673 | actual=testResult, |
| 674 | onpass=main.assertReturnString, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 675 | onfail=main.assertReturnString ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 676 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 677 | # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 678 | # main.step( "Encapsulation: Add host intents between h1 and h9" ) |
| 679 | # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n" |
| 680 | # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" } |
| 681 | # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" } |
| 682 | # testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 683 | # installResult = main.intents.installHostIntent( main, |
| 684 | # name="ENCAPSULATION", |
| 685 | # onosNode=0, |
| 686 | # host1=host1, |
| 687 | # host2=host2, |
| 688 | # encap="MPLS" ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 689 | # if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 690 | # testResult = main.intents.testHostIntent( main, |
| 691 | # name="ENCAPSULATION", |
| 692 | # intentId=installResult, |
| 693 | # onosNode=0, |
| 694 | # host1=host1, |
| 695 | # host2=host2, |
| 696 | # sw1="s5", |
| 697 | # sw2="s2", |
| 698 | # expectedLink=18 ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 699 | # else: |
| 700 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 701 | # |
| 702 | # utilities.assert_equals( expect=main.TRUE, |
| 703 | # actual=testResult, |
| 704 | # onpass=main.assertReturnString, |
| 705 | # onfail=main.assertReturnString ) |
| 706 | |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 707 | main.step( "Confirm that ONOS leadership is unchanged" ) |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 708 | intentLeadersNew = main.CLIs[ 0 ].leaderCandidates() |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 709 | testResult = main.intents.checkLeaderChange( intentLeadersOld, |
| 710 | intentLeadersNew ) |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 711 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 712 | utilities.assert_equals( expect=main.TRUE, |
| 713 | actual=testResult, |
| 714 | onpass="ONOS Leaders Unchanged", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 715 | onfail="ONOS Leader Mismatch" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 716 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 717 | main.intents.report( main ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 718 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 719 | def CASE2000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 720 | """ |
| 721 | Add point intents between 2 hosts: |
| 722 | - Get device ids | ports |
| 723 | - Add point intents |
| 724 | - Check intents |
| 725 | - Verify flows |
| 726 | - Ping hosts |
| 727 | - Reroute |
| 728 | - Link down |
| 729 | - Verify flows |
| 730 | - Check topology |
| 731 | - Ping hosts |
| 732 | - Link up |
| 733 | - Verify flows |
| 734 | - Check topology |
| 735 | - Ping hosts |
| 736 | - Remove intents |
| 737 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 738 | if main.initialized == main.FALSE: |
| 739 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 740 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 741 | # Assert variables - These variable's name|format must be followed |
| 742 | # if you want to use the wrapper function |
| 743 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 744 | try: |
| 745 | assert main.CLIs |
| 746 | except AssertionError: |
| 747 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 748 | main.initialized = main.FALSE |
| 749 | main.skipCase() |
| 750 | try: |
| 751 | assert main.Mininet1 |
| 752 | except AssertionError: |
| 753 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 754 | main.initialized = main.FALSE |
| 755 | main.skipCase() |
| 756 | try: |
| 757 | assert main.numSwitch |
| 758 | except AssertionError: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 759 | main.log.error( "Place the total number of switch topology in " + |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 760 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 761 | main.initialized = main.FALSE |
| 762 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 763 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 764 | main.testName = "Point Intents" |
| 765 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 766 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 767 | main.caseExplanation = "This test case will test point to point" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 768 | " intents using " + str( main.numCtrls ) +\ |
| 769 | " node(s) cluster;\n" +\ |
| 770 | "Different type of hosts will be tested in " +\ |
| 771 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 772 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 773 | " OVS running in Mininet and compile intents" +\ |
| 774 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 775 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 776 | # No option point intents |
| 777 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 778 | main.assertReturnString = "Assertion Result for NOOPTION point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 779 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 780 | { "name": "h1", "device": "of:0000000000000005/1" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 781 | ] |
| 782 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 783 | { "name": "h9", "device": "of:0000000000000006/1" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 784 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 785 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 786 | installResult = main.intents.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 787 | main, |
| 788 | name="NOOPTION", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 789 | senders=senders, |
| 790 | recipients=recipients ) |
| 791 | |
| 792 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 793 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 794 | main, |
| 795 | intentId=installResult, |
| 796 | name="NOOPTION", |
| 797 | senders=senders, |
| 798 | recipients=recipients, |
| 799 | sw1="s5", |
| 800 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 801 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 802 | else: |
| 803 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 804 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 805 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 806 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 807 | onpass=main.assertReturnString, |
| 808 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 809 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 810 | main.step( "IPV4: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 811 | main.assertReturnString = "Assertion Result for IPV4 point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 812 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 813 | { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 814 | ] |
| 815 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 816 | { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 817 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 818 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 819 | installResult = main.intents.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 820 | main, |
| 821 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 822 | senders=senders, |
| 823 | recipients=recipients, |
| 824 | ethType="IPV4" ) |
| 825 | |
| 826 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 827 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 828 | main, |
| 829 | intentId=installResult, |
| 830 | name="IPV4", |
| 831 | senders=senders, |
| 832 | recipients=recipients, |
| 833 | sw1="s5", |
| 834 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 835 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 836 | else: |
| 837 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 838 | |
| 839 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 840 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 841 | onpass=main.assertReturnString, |
| 842 | onfail=main.assertReturnString ) |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 843 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 844 | main.step( "Protected: Add point intents between h1 and h9" ) |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 845 | main.assertReturnString = "Assertion Result for protected point intent\n" |
| 846 | senders = [ |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 847 | { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" } |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 848 | ] |
| 849 | recipients = [ |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 850 | { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" } |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 851 | ] |
| 852 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 853 | installResult = main.intents.installPointIntent( |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 854 | main, |
| 855 | name="Protected", |
| 856 | senders=senders, |
| 857 | recipients=recipients, |
| 858 | protected=True ) |
| 859 | |
| 860 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 861 | testResult = main.intents.testPointIntent( |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame] | 862 | main, |
| 863 | name="Protected", |
| 864 | intentId=installResult, |
| 865 | senders=senders, |
| 866 | recipients=recipients, |
| 867 | sw1="s5", |
| 868 | sw2="s2", |
| 869 | protected=True, |
| 870 | expectedLink=18 ) |
| 871 | else: |
| 872 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 873 | |
| 874 | utilities.assert_equals( expect=main.TRUE, |
| 875 | actual=testResult, |
| 876 | onpass=main.assertReturnString, |
| 877 | onfail=main.assertReturnString ) |
| 878 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 879 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 880 | main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 881 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 882 | { "name": "h1", "device": "of:0000000000000005/1" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 883 | ] |
| 884 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 885 | { "name": "h9", "device": "of:0000000000000006/1" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 886 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 887 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 888 | installResult = main.intents.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 889 | main, |
| 890 | name="IPV4_2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 891 | senders=senders, |
| 892 | recipients=recipients, |
| 893 | ethType="IPV4" ) |
| 894 | |
| 895 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 896 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 897 | main, |
| 898 | intentId=installResult, |
| 899 | name="IPV4_2", |
| 900 | senders=senders, |
| 901 | recipients=recipients, |
| 902 | sw1="s5", |
| 903 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 904 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 905 | else: |
| 906 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 907 | |
| 908 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 909 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 910 | onpass=main.assertReturnString, |
| 911 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 912 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 913 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 914 | main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 915 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 916 | { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 917 | "ip":( main.h1.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 918 | ] |
| 919 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 920 | { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 921 | "ip":( main.h9.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 922 | ] |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 923 | ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ] |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 924 | # Uneccessary, not including this in the selectors |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 925 | tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 926 | tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 927 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 928 | installResult = main.intents.installPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 929 | main, |
| 930 | name="SDNIP-ICMP", |
| 931 | senders=senders, |
| 932 | recipients=recipients, |
| 933 | ethType="IPV4", |
| 934 | ipProto=ipProto, |
| 935 | tcpSrc=tcpSrc, |
| 936 | tcpDst=tcpDst ) |
| 937 | |
| 938 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 939 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 940 | main, |
| 941 | intentId=installResult, |
| 942 | name="SDNIP_ICMP", |
| 943 | senders=senders, |
| 944 | recipients=recipients, |
| 945 | sw1="s5", |
| 946 | sw2="s2", |
Jeremy Songster | e405d3d | 2016-05-17 11:18:57 -0700 | [diff] [blame] | 947 | expectedLink=18, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 948 | useTCP=True ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 949 | else: |
| 950 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 951 | |
| 952 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 953 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 954 | onpass=main.assertReturnString, |
| 955 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 956 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 957 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 958 | main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 959 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 960 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 961 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
| 962 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 963 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 964 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 965 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 966 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 967 | stepResult = main.intents.pointIntentTcp( |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 968 | main, |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 969 | name="SDNIP-TCP", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 970 | host1="h1", |
| 971 | host2="h9", |
| 972 | deviceId1="of:0000000000000005/1", |
| 973 | deviceId2="of:0000000000000006/1", |
| 974 | mac1=mac1, |
| 975 | mac2=mac2, |
| 976 | ethType="IPV4", |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 977 | ipProto=ipProto, |
| 978 | ip1=ip1, |
| 979 | ip2=ip2, |
| 980 | tcp1=tcp1, |
| 981 | tcp2=tcp2 ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 982 | |
| 983 | utilities.assert_equals( expect=main.TRUE, |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 984 | actual=stepResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 985 | onpass=main.assertReturnString, |
| 986 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 987 | |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 988 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
| 989 | main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 990 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 991 | { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 992 | ] |
| 993 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 994 | { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 995 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 996 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 997 | installResult = main.intents.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 998 | main, |
| 999 | name="DUALSTACK1", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1000 | senders=senders, |
| 1001 | recipients=recipients, |
| 1002 | ethType="IPV4" ) |
| 1003 | |
| 1004 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1005 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1006 | main, |
| 1007 | intentId=installResult, |
| 1008 | name="DUALSTACK1", |
| 1009 | senders=senders, |
| 1010 | recipients=recipients, |
| 1011 | sw1="s5", |
| 1012 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1013 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1014 | else: |
| 1015 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1016 | |
| 1017 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1018 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1019 | onpass=main.assertReturnString, |
| 1020 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1021 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1022 | main.step( "VLAN: Add point intents between h5 and h21" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1023 | main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1024 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1025 | { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1026 | ] |
| 1027 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1028 | { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1029 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1030 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1031 | installResult = main.intents.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1032 | main, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1033 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1034 | senders=senders, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1035 | recipients=recipients ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1036 | |
| 1037 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1038 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1039 | main, |
| 1040 | intentId=installResult, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1041 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1042 | senders=senders, |
| 1043 | recipients=recipients, |
| 1044 | sw1="s5", |
| 1045 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1046 | expectedLink=18 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1047 | |
| 1048 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1049 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1050 | onpass=main.assertReturnString, |
| 1051 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1052 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1053 | main.step( "VLAN: Add point intents between h5 and h21" ) |
| 1054 | main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n" |
| 1055 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1056 | { "name": "h4", "vlan": "100" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1057 | ] |
| 1058 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1059 | { "name": "h21", "vlan": "200" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1060 | ] |
| 1061 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1062 | installResult = main.intents.installPointIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1063 | main, |
| 1064 | name="VLAN2", |
| 1065 | senders=senders, |
| 1066 | recipients=recipients, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1067 | setVlan=200 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1068 | |
| 1069 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1070 | testResult = main.intents.testPointIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1071 | main, |
| 1072 | intentId=installResult, |
| 1073 | name="VLAN2", |
| 1074 | senders=senders, |
| 1075 | recipients=recipients, |
| 1076 | sw1="s5", |
| 1077 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1078 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1079 | |
| 1080 | utilities.assert_equals( expect=main.TRUE, |
| 1081 | actual=testResult, |
| 1082 | onpass=main.assertReturnString, |
| 1083 | onfail=main.assertReturnString ) |
| 1084 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1085 | main.step( "1HOP: Add point intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1086 | main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1087 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1088 | { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1089 | ] |
| 1090 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1091 | { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1092 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1093 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1094 | installResult = main.intents.installPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1095 | main, |
| 1096 | name="1HOP IPV4", |
| 1097 | senders=senders, |
| 1098 | recipients=recipients, |
| 1099 | ethType="IPV4" ) |
| 1100 | |
| 1101 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1102 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1103 | main, |
| 1104 | intentId=installResult, |
| 1105 | name="1HOP IPV4", |
| 1106 | senders=senders, |
| 1107 | recipients=recipients, |
| 1108 | sw1="s5", |
| 1109 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1110 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1111 | else: |
| 1112 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1113 | |
| 1114 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1115 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1116 | onpass=main.assertReturnString, |
| 1117 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1118 | |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1119 | main.step( "Add point to point intents using VLAN Encapsulation" ) |
| 1120 | main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent" |
| 1121 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1122 | { "name": "h1", "device": "of:0000000000000005/1" } |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1123 | ] |
| 1124 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1125 | { "name": "h9", "device": "of:0000000000000006/1" } |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1126 | ] |
| 1127 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1128 | installResult = main.intents.installPointIntent( |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1129 | main, |
| 1130 | name="ENCAPSULATION", |
| 1131 | senders=senders, |
| 1132 | recipients=recipients, |
| 1133 | encap="VLAN" ) |
| 1134 | |
| 1135 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1136 | testResult = main.intents.testPointIntent( |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1137 | main, |
| 1138 | intentId=installResult, |
| 1139 | name="ENCAPSULATION", |
| 1140 | senders=senders, |
| 1141 | recipients=recipients, |
| 1142 | sw1="s5", |
| 1143 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1144 | expectedLink=18 ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1145 | else: |
| 1146 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1147 | |
| 1148 | utilities.assert_equals( expect=main.TRUE, |
| 1149 | actual=testResult, |
| 1150 | onpass=main.assertReturnString, |
| 1151 | onfail=main.assertReturnString ) |
| 1152 | |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1153 | main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" ) |
| 1154 | main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n" |
| 1155 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1156 | { "name": "h1", "device": "of:0000000000000005/1" } |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1157 | ] |
| 1158 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1159 | { "name": "h9", "device": "of:0000000000000006/1" } |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1160 | ] |
| 1161 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1162 | installResult = main.intents.installPointIntent( |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1163 | main, |
| 1164 | name="NOOPTION", |
| 1165 | senders=senders, |
| 1166 | recipients=recipients, |
Jon Hall | f539eb9 | 2017-05-22 17:18:42 -0700 | [diff] [blame] | 1167 | bandwidth=100 ) |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1168 | |
| 1169 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1170 | testResult = main.intents.testPointIntent( |
Shreya Chowdhary | 6fbb96c | 2017-05-02 16:20:19 -0700 | [diff] [blame] | 1171 | main, |
| 1172 | intentId=installResult, |
| 1173 | name="NOOPTION", |
| 1174 | senders=senders, |
| 1175 | recipients=recipients, |
| 1176 | sw1="s5", |
| 1177 | sw2="s2", |
| 1178 | expectedLink=18 ) |
| 1179 | else: |
| 1180 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1181 | |
| 1182 | utilities.assert_equals( expect=main.TRUE, |
| 1183 | actual=testResult, |
| 1184 | onpass=main.assertReturnString, |
| 1185 | onfail=main.assertReturnString ) |
| 1186 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1187 | # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1188 | # main.step( "Add point to point intents using MPLS Encapsulation" ) |
| 1189 | # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent" |
| 1190 | # senders = [ |
| 1191 | # { "name": "h1", "device": "of:0000000000000005/1" } |
| 1192 | # ] |
| 1193 | # recipients = [ |
| 1194 | # { "name": "h9", "device": "of:0000000000000006/1" } |
| 1195 | # ] |
| 1196 | # testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1197 | # installResult = main.intents.installPointIntent( |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1198 | # main, |
| 1199 | # name="ENCAPSULATION", |
| 1200 | # senders=senders, |
| 1201 | # recipients=recipients, |
| 1202 | # encap="MPLS" ) |
| 1203 | # |
| 1204 | # if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1205 | # testResult = main.intents.testPointIntent( |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1206 | # main, |
| 1207 | # intentId=installResult, |
| 1208 | # name="ENCAPSULATION", |
| 1209 | # senders=senders, |
| 1210 | # recipients=recipients, |
| 1211 | # sw1="s5", |
| 1212 | # sw2="s2", |
| 1213 | # expectedLink=18 ) |
| 1214 | # else: |
| 1215 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1216 | # |
| 1217 | # utilities.assert_equals( expect=main.TRUE, |
| 1218 | # actual=testResult, |
| 1219 | # onpass=main.assertReturnString, |
| 1220 | # onfail=main.assertReturnString ) |
| 1221 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1222 | main.intents.report( main ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1223 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1224 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1225 | """ |
| 1226 | Add single point to multi point intents |
| 1227 | - Get device ids |
| 1228 | - Add single point to multi point intents |
| 1229 | - Check intents |
| 1230 | - Verify flows |
| 1231 | - Ping hosts |
| 1232 | - Reroute |
| 1233 | - Link down |
| 1234 | - Verify flows |
| 1235 | - Check topology |
| 1236 | - Ping hosts |
| 1237 | - Link up |
| 1238 | - Verify flows |
| 1239 | - Check topology |
| 1240 | - Ping hosts |
| 1241 | - Remove intents |
| 1242 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1243 | if main.initialized == main.FALSE: |
| 1244 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1245 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1246 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1247 | try: |
| 1248 | assert main.CLIs |
| 1249 | except AssertionError: |
| 1250 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1251 | main.initialized = main.FALSE |
| 1252 | main.skipCase() |
| 1253 | try: |
| 1254 | assert main.Mininet1 |
| 1255 | except AssertionError: |
| 1256 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1257 | main.initialized = main.FALSE |
| 1258 | main.skipCase() |
| 1259 | try: |
| 1260 | assert main.numSwitch |
| 1261 | except AssertionError: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1262 | main.log.error( "Place the total number of switch topology in " + |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1263 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1264 | main.initialized = main.FALSE |
| 1265 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1266 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1267 | main.testName = "Single to Multi Point Intents" |
| 1268 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1269 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1270 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1271 | " multi point intents using " +\ |
| 1272 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1273 | "Different type of hosts will be tested in " +\ |
| 1274 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1275 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1276 | " OVS running in Mininet and compile intents" +\ |
| 1277 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1278 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1279 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1280 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n" |
| 1281 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1282 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1283 | ] |
| 1284 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1285 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1286 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1287 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1288 | badSenders = [ { "name": "h9" } ] # Senders that are not in the intent |
| 1289 | badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1290 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1291 | installResult = main.intents.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1292 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1293 | name="NOOPTION", |
| 1294 | senders=senders, |
| 1295 | recipients=recipients, |
| 1296 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1297 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1298 | |
| 1299 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1300 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1301 | main, |
| 1302 | intentId=installResult, |
| 1303 | name="NOOPTION", |
| 1304 | senders=senders, |
| 1305 | recipients=recipients, |
| 1306 | badSenders=badSenders, |
| 1307 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1308 | sw1="s5", |
| 1309 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1310 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1311 | else: |
| 1312 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1313 | |
| 1314 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1315 | actual=testResult, |
| 1316 | onpass=main.assertReturnString, |
| 1317 | onfail=main.assertReturnString ) |
| 1318 | |
| 1319 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1320 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n" |
| 1321 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1322 | { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1323 | ] |
| 1324 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1325 | { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" }, |
| 1326 | { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1327 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1328 | badSenders = [ { "name": "h9" } ] # Senders that are not in the intent |
| 1329 | badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1330 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1331 | installResult = main.intents.installSingleToMultiIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1332 | main, |
| 1333 | name="IPV4", |
| 1334 | senders=senders, |
| 1335 | recipients=recipients, |
| 1336 | ethType="IPV4", |
| 1337 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1338 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1339 | |
| 1340 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1341 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1342 | main, |
| 1343 | intentId=installResult, |
| 1344 | name="IPV4", |
| 1345 | senders=senders, |
| 1346 | recipients=recipients, |
| 1347 | badSenders=badSenders, |
| 1348 | badRecipients=badRecipients, |
| 1349 | sw1="s5", |
| 1350 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1351 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1352 | else: |
| 1353 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1354 | |
| 1355 | utilities.assert_equals( expect=main.TRUE, |
| 1356 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1357 | onpass=main.assertReturnString, |
| 1358 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1359 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1360 | main.step( "IPV4_2: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1361 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and no MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1362 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1363 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1364 | ] |
| 1365 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1366 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1367 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1368 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1369 | badSenders = [ { "name": "h9" } ] # Senders that are not in the intent |
| 1370 | badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1371 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1372 | installResult = main.intents.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1373 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1374 | name="IPV4_2", |
| 1375 | senders=senders, |
| 1376 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1377 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1378 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1379 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1380 | |
| 1381 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1382 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1383 | main, |
| 1384 | intentId=installResult, |
| 1385 | name="IPV4_2", |
| 1386 | senders=senders, |
| 1387 | recipients=recipients, |
| 1388 | badSenders=badSenders, |
| 1389 | badRecipients=badRecipients, |
| 1390 | sw1="s5", |
| 1391 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1392 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1393 | else: |
| 1394 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1395 | |
| 1396 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1397 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1398 | onpass=main.assertReturnString, |
| 1399 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1400 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1401 | main.step( "VLAN: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1402 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1403 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1404 | { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1405 | ] |
| 1406 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1407 | { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" }, |
| 1408 | { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1409 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1410 | badSenders = [ { "name": "h13" } ] # Senders that are not in the intent |
| 1411 | badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1412 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1413 | installResult = main.intents.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1414 | main, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1415 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1416 | senders=senders, |
| 1417 | recipients=recipients, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1418 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1419 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1420 | |
| 1421 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1422 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1423 | main, |
| 1424 | intentId=installResult, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1425 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1426 | senders=senders, |
| 1427 | recipients=recipients, |
| 1428 | badSenders=badSenders, |
| 1429 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1430 | sw1="s5", |
| 1431 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1432 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1433 | else: |
| 1434 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1435 | |
| 1436 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1437 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1438 | onpass=main.assertReturnString, |
| 1439 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1440 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1441 | main.step( "VLAN: Add single point to multi point intents" ) |
| 1442 | main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n" |
| 1443 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1444 | { "name": "h5", "vlan": "200" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1445 | ] |
| 1446 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1447 | { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" }, |
| 1448 | { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1449 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1450 | badSenders = [ { "name": "h13" } ] # Senders that are not in the intent |
| 1451 | badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1452 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1453 | installResult = main.intents.installSingleToMultiIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1454 | main, |
| 1455 | name="VLAN2", |
| 1456 | senders=senders, |
| 1457 | recipients=recipients, |
| 1458 | sw1="s5", |
| 1459 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1460 | setVlan=100 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1461 | |
| 1462 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1463 | testResult = main.intents.testPointIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1464 | main, |
| 1465 | intentId=installResult, |
| 1466 | name="VLAN2", |
| 1467 | senders=senders, |
| 1468 | recipients=recipients, |
| 1469 | badSenders=badSenders, |
| 1470 | badRecipients=badRecipients, |
| 1471 | sw1="s5", |
| 1472 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1473 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1474 | else: |
| 1475 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1476 | |
| 1477 | utilities.assert_equals( expect=main.TRUE, |
| 1478 | actual=testResult, |
| 1479 | onpass=main.assertReturnString, |
| 1480 | onfail=main.assertReturnString ) |
| 1481 | |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1482 | # Does not support Single point to multi point encapsulation |
| 1483 | # main.step( "ENCAPSULATION: Install and test single point to multi point intents" ) |
| 1484 | # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n" |
| 1485 | # senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1486 | # { "name": "h8", "device": "of:0000000000000005/8" } |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1487 | # ] |
| 1488 | # recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1489 | # { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1490 | # { "name": "h24", "device": "of:0000000000000007/8" } |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1491 | # ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1492 | # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent |
| 1493 | # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1494 | # testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1495 | # installResult = main.intents.installSingleToMultiIntent( |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1496 | # main, |
| 1497 | # name="ENCAPSULATION", |
| 1498 | # senders=senders, |
| 1499 | # recipients=recipients, |
| 1500 | # sw1="s5", |
| 1501 | # sw2="s2", |
| 1502 | # encap="VLAN" ) |
| 1503 | # |
| 1504 | # if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1505 | # testResult = main.intents.testPointIntent( |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1506 | # main, |
| 1507 | # intentId=installResult, |
| 1508 | # name="ENCAPSULATION", |
| 1509 | # senders=senders, |
| 1510 | # recipients=recipients, |
| 1511 | # badSenders=badSenders, |
| 1512 | # badRecipients=badRecipients, |
| 1513 | # sw1="s5", |
| 1514 | # sw2="s2", |
| 1515 | # expectedLink=18 ) |
| 1516 | # else: |
| 1517 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1518 | # |
| 1519 | # utilities.assert_equals( expect=main.TRUE, |
| 1520 | # actual=testResult, |
| 1521 | # onpass=main.assertReturnString, |
| 1522 | # onfail=main.assertReturnString ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1523 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1524 | main.intents.report( main ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1525 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1526 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1527 | """ |
| 1528 | Add multi point to single point intents |
| 1529 | - Get device ids |
| 1530 | - Add multi point to single point intents |
| 1531 | - Check intents |
| 1532 | - Verify flows |
| 1533 | - Ping hosts |
| 1534 | - Reroute |
| 1535 | - Link down |
| 1536 | - Verify flows |
| 1537 | - Check topology |
| 1538 | - Ping hosts |
| 1539 | - Link up |
| 1540 | - Verify flows |
| 1541 | - Check topology |
| 1542 | - Ping hosts |
| 1543 | - Remove intents |
| 1544 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1545 | if main.initialized == main.FALSE: |
| 1546 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1547 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1548 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1549 | try: |
| 1550 | assert main.CLIs |
| 1551 | except AssertionError: |
| 1552 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1553 | main.initialized = main.FALSE |
| 1554 | main.skipCase() |
| 1555 | try: |
| 1556 | assert main.Mininet1 |
| 1557 | except AssertionError: |
| 1558 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1559 | main.initialized = main.FALSE |
| 1560 | main.skipCase() |
| 1561 | try: |
| 1562 | assert main.numSwitch |
| 1563 | except AssertionError: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1564 | main.log.error( "Place the total number of switch topology in " + |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1565 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1566 | main.initialized = main.FALSE |
| 1567 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1568 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1569 | main.testName = "Multi To Single Point Intents" |
| 1570 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1571 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1572 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1573 | " multi point intents using " +\ |
| 1574 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1575 | "Different type of hosts will be tested in " +\ |
| 1576 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1577 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1578 | " OVS running in Mininet and compile intents" +\ |
| 1579 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1580 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1581 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 1582 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 1583 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1584 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1585 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1586 | ] |
| 1587 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1588 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1589 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1590 | badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
| 1591 | badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1592 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1593 | installResult = main.intents.installMultiToSingleIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1594 | main, |
| 1595 | name="NOOPTION", |
| 1596 | senders=senders, |
| 1597 | recipients=recipients, |
| 1598 | sw1="s5", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1599 | sw2="s2" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1600 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1601 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1602 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1603 | main, |
| 1604 | intentId=installResult, |
| 1605 | name="NOOPTION", |
| 1606 | senders=senders, |
| 1607 | recipients=recipients, |
| 1608 | badSenders=badSenders, |
| 1609 | badRecipients=badRecipients, |
| 1610 | sw1="s5", |
| 1611 | sw2="s2", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1612 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1613 | else: |
| 1614 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1615 | |
| 1616 | utilities.assert_equals( expect=main.TRUE, |
| 1617 | actual=testResult, |
| 1618 | onpass=main.assertReturnString, |
| 1619 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1620 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1621 | main.step( "IPV4: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1622 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1623 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1624 | { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" }, |
| 1625 | { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1626 | ] |
| 1627 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1628 | { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1629 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1630 | badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
| 1631 | badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1632 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1633 | installResult = main.intents.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1634 | main, |
| 1635 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1636 | senders=senders, |
| 1637 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1638 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1639 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1640 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1641 | |
| 1642 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1643 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1644 | main, |
| 1645 | intentId=installResult, |
| 1646 | name="IPV4", |
| 1647 | senders=senders, |
| 1648 | recipients=recipients, |
| 1649 | badSenders=badSenders, |
| 1650 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1651 | sw1="s5", |
| 1652 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1653 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1654 | else: |
| 1655 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1656 | |
| 1657 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1658 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1659 | onpass=main.assertReturnString, |
| 1660 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1661 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1662 | main.step( "IPV4_2: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1663 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1664 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1665 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1666 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1667 | ] |
| 1668 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1669 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1670 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1671 | badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
| 1672 | badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1673 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1674 | installResult = main.intents.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1675 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1676 | name="IPV4_2", |
| 1677 | senders=senders, |
| 1678 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1679 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1680 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1681 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1682 | |
| 1683 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1684 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1685 | main, |
| 1686 | intentId=installResult, |
| 1687 | name="IPV4_2", |
| 1688 | senders=senders, |
| 1689 | recipients=recipients, |
| 1690 | badSenders=badSenders, |
| 1691 | badRecipients=badRecipients, |
| 1692 | sw1="s5", |
| 1693 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1694 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1695 | else: |
| 1696 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1697 | |
| 1698 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1699 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1700 | onpass=main.assertReturnString, |
| 1701 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1702 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1703 | main.step( "VLAN: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1704 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1705 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1706 | { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" }, |
| 1707 | { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1708 | ] |
| 1709 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1710 | { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1711 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1712 | badSenders = [ { "name": "h12" } ] # Senders that are not in the intent |
| 1713 | badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1714 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1715 | installResult = main.intents.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1716 | main, |
| 1717 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1718 | senders=senders, |
| 1719 | recipients=recipients, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1720 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1721 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1722 | |
| 1723 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1724 | testResult = main.intents.testPointIntent( |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1725 | main, |
| 1726 | intentId=installResult, |
| 1727 | name="VLAN", |
| 1728 | senders=senders, |
| 1729 | recipients=recipients, |
| 1730 | badSenders=badSenders, |
| 1731 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1732 | sw1="s5", |
| 1733 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1734 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1735 | else: |
| 1736 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1737 | |
| 1738 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1739 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1740 | onpass=main.assertReturnString, |
| 1741 | onfail=main.assertReturnString ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1742 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1743 | # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383 |
| 1744 | main.step( "VLAN: Add multi point to single point intents" ) |
| 1745 | main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n" |
| 1746 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1747 | { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" }, |
| 1748 | { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1749 | ] |
| 1750 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1751 | { "name": "h4", "vlan": "100" } |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1752 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1753 | badSenders = [ { "name": "h12" } ] # Senders that are not in the intent |
| 1754 | badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1755 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1756 | installResult = main.intents.installMultiToSingleIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1757 | main, |
| 1758 | name="VLAN2", |
| 1759 | senders=senders, |
| 1760 | recipients=recipients, |
| 1761 | sw1="s5", |
| 1762 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1763 | setVlan=100 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1764 | |
| 1765 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1766 | testResult = main.intents.testPointIntent( |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1767 | main, |
| 1768 | intentId=installResult, |
| 1769 | name="VLAN2", |
| 1770 | senders=senders, |
| 1771 | recipients=recipients, |
| 1772 | badSenders=badSenders, |
| 1773 | badRecipients=badRecipients, |
| 1774 | sw1="s5", |
| 1775 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1776 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1777 | else: |
| 1778 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1779 | |
| 1780 | utilities.assert_equals( expect=main.TRUE, |
| 1781 | actual=testResult, |
| 1782 | onpass=main.assertReturnString, |
| 1783 | onfail=main.assertReturnString ) |
| 1784 | |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1785 | main.step( "ENCAPSULATION: Add multi point to single point intents" ) |
| 1786 | main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n" |
| 1787 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1788 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1789 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1790 | ] |
| 1791 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1792 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1793 | ] |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1794 | badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
| 1795 | badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1796 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1797 | installResult = main.intents.installMultiToSingleIntent( |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1798 | main, |
| 1799 | name="ENCAPSULATION", |
| 1800 | senders=senders, |
| 1801 | recipients=recipients, |
| 1802 | sw1="s5", |
| 1803 | sw2="s2", |
| 1804 | encap="VLAN" ) |
| 1805 | |
| 1806 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1807 | testResult = main.intents.testPointIntent( |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1808 | main, |
| 1809 | intentId=installResult, |
| 1810 | name="ENCAPSULATION", |
| 1811 | senders=senders, |
| 1812 | recipients=recipients, |
| 1813 | badSenders=badSenders, |
| 1814 | badRecipients=badRecipients, |
| 1815 | sw1="s5", |
| 1816 | sw2="s2", |
| 1817 | expectedLink=18 ) |
| 1818 | else: |
| 1819 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1820 | |
| 1821 | utilities.assert_equals( expect=main.TRUE, |
| 1822 | actual=testResult, |
| 1823 | onpass=main.assertReturnString, |
| 1824 | onfail=main.assertReturnString ) |
| 1825 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1826 | #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 ) |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1827 | #main.step( "ENCAPSULATION: Add multi point to single point intents" ) |
| 1828 | #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n" |
| 1829 | #senders = [ |
| 1830 | # { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1831 | # { "name": "h24", "device": "of:0000000000000007/8" } |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1832 | # ] |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1833 | #recipients = [ |
| 1834 | # { "name": "h8", "device": "of:0000000000000005/8" } |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1835 | # ] |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1836 | #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1837 | #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1838 | #testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1839 | #installResult = main.intents.installMultiToSingleIntent( |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1840 | # main, |
| 1841 | # name="ENCAPSULATION", |
| 1842 | # senders=senders, |
| 1843 | # recipients=recipients, |
| 1844 | # sw1="s5", |
| 1845 | # sw2="s2", |
| 1846 | # encap="MPLS" ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1847 | # |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1848 | #if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1849 | # testResult = main.intents.testPointIntent( |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1850 | # main, |
| 1851 | # intentId=installResult, |
| 1852 | # name="ENCAPSULATION", |
| 1853 | # senders=senders, |
| 1854 | # recipients=recipients, |
| 1855 | # badSenders=badSenders, |
| 1856 | # badRecipients=badRecipients, |
| 1857 | # sw1="s5", |
| 1858 | # sw2="s2", |
| 1859 | # expectedLink=18 ) |
| 1860 | #else: |
| 1861 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1862 | # |
Shreya | ca8990f | 2017-03-16 11:43:11 -0700 | [diff] [blame] | 1863 | #utilities.assert_equals( expect=main.TRUE, |
| 1864 | # actual=testResult, |
| 1865 | # onpass=main.assertReturnString, |
| 1866 | # onfail=main.assertReturnString ) |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1867 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1868 | main.intents.report( main ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1869 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1870 | def CASE5000( self, main ): |
| 1871 | """ |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1872 | Tests Host Mobility |
| 1873 | Modifies the topology location of h1 |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1874 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1875 | if main.initialized == main.FALSE: |
| 1876 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1877 | main.skipCase() |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1878 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1879 | try: |
| 1880 | assert main.CLIs |
| 1881 | except AssertionError: |
| 1882 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1883 | main.initialized = main.FALSE |
| 1884 | main.skipCase() |
| 1885 | try: |
| 1886 | assert main.Mininet1 |
| 1887 | except AssertionError: |
| 1888 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1889 | main.initialized = main.FALSE |
| 1890 | main.skipCase() |
| 1891 | try: |
| 1892 | assert main.numSwitch |
| 1893 | except AssertionError: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1894 | main.log.error( "Place the total number of switch topology in " + |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1895 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1896 | main.initialized = main.FALSE |
| 1897 | main.skipCase() |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1898 | main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) + |
| 1899 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1900 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1901 | |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1902 | main.log.info( "Moving h1 from s5 to s6" ) |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1903 | main.Mininet1.moveHost( "h1", "s5", "s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1904 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1905 | # Send discovery ping from moved host |
| 1906 | # Moving the host brings down the default interfaces and creates a new one. |
| 1907 | # Scapy is restarted on this host to detect the new interface |
| 1908 | main.h1.stopScapy() |
| 1909 | main.h1.startScapy() |
| 1910 | |
| 1911 | # Discover new host location in ONOS and populate host data. |
| 1912 | # Host 1 IP and MAC should be unchanged |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1913 | main.intents.sendDiscoveryArp( main, [ main.h1 ] ) |
| 1914 | main.intents.populateHostData( main ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1915 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1916 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1917 | |
| 1918 | utilities.assert_equals( expect="of:0000000000000006", |
| 1919 | actual=h1PostMove, |
| 1920 | onpass="Mobility: Successfully moved h1 to s6", |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1921 | onfail="Mobility: Failed to move h1 to s6" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1922 | " to single point intents" + |
| 1923 | " with IPV4 type and MAC addresses" + |
| 1924 | " in the same VLAN" ) |
| 1925 | |
| 1926 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1927 | main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n" |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1928 | host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" } |
| 1929 | host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" } |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1930 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1931 | installResult = main.intents.installHostIntent( main, |
| 1932 | name="IPV4 Mobility IPV4", |
| 1933 | onosNode=0, |
| 1934 | host1=host1, |
| 1935 | host2=host2 ) |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1936 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1937 | testResult = main.intents.testHostIntent( main, |
| 1938 | name="Host Mobility IPV4", |
| 1939 | intentId=installResult, |
| 1940 | onosNode=0, |
| 1941 | host1=host1, |
| 1942 | host2=host2, |
| 1943 | sw1="s6", |
| 1944 | sw2="s2", |
| 1945 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1946 | else: |
| 1947 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1948 | |
| 1949 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1950 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1951 | onpass=main.assertReturnString, |
| 1952 | onfail=main.assertReturnString ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1953 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 1954 | main.intents.report( main ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1955 | |
| 1956 | def CASE6000( self, main ): |
| 1957 | """ |
| 1958 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 1959 | """ |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 1960 | # At some later point discussion on this behavior in MPSP and SPMP intents |
| 1961 | # will be reoppened and this test case may need to be updated to reflect |
| 1962 | # the outcomes of that discussion |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1963 | if main.initialized == main.FALSE: |
| 1964 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1965 | main.skipCase() |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1966 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1967 | try: |
| 1968 | assert main.CLIs |
| 1969 | except AssertionError: |
| 1970 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1971 | main.initialized = main.FALSE |
| 1972 | main.skipCase() |
| 1973 | try: |
| 1974 | assert main.Mininet1 |
| 1975 | except AssertionError: |
| 1976 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1977 | main.initialized = main.FALSE |
| 1978 | main.skipCase() |
| 1979 | try: |
| 1980 | assert main.numSwitch |
| 1981 | except AssertionError: |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1982 | main.log.error( "Place the total number of switch topology in " + main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1983 | main.initialized = main.FALSE |
| 1984 | main.skipCase() |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1985 | main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) + |
| 1986 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 1987 | main.step( "Installing Multi to Single Point intents with no options set" ) |
| 1988 | main.assertReturnString = "Assertion results for IPV4 multi to single " +\ |
| 1989 | "point intent end point failure with no options set\n" |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1990 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1991 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 1992 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1993 | ] |
| 1994 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1995 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1996 | ] |
| 1997 | isolatedSenders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 1998 | { "name": "h24" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1999 | ] |
| 2000 | isolatedRecipients = [] |
| 2001 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2002 | installResult = main.intents.installMultiToSingleIntent( |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2003 | main, |
| 2004 | name="NOOPTION", |
| 2005 | senders=senders, |
| 2006 | recipients=recipients, |
| 2007 | sw1="s5", |
| 2008 | sw2="s2" ) |
| 2009 | |
| 2010 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2011 | testResult = main.intents.testEndPointFail( |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2012 | main, |
| 2013 | intentId=installResult, |
| 2014 | name="NOOPTION", |
| 2015 | senders=senders, |
| 2016 | recipients=recipients, |
| 2017 | isolatedSenders=isolatedSenders, |
| 2018 | isolatedRecipients=isolatedRecipients, |
| 2019 | sw1="s6", |
| 2020 | sw2="s2", |
| 2021 | sw3="s4", |
| 2022 | sw4="s1", |
| 2023 | sw5="s3", |
| 2024 | expectedLink1=16, |
| 2025 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2026 | else: |
| 2027 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2028 | |
| 2029 | utilities.assert_equals( expect=main.TRUE, |
| 2030 | actual=testResult, |
| 2031 | onpass=main.assertReturnString, |
| 2032 | onfail=main.assertReturnString ) |
| 2033 | |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2034 | main.step( "Installing Multi to Single Point intents with partial failure allowed" ) |
| 2035 | |
| 2036 | main.assertReturnString = "Assertion results for IPV4 multi to single " +\ |
| 2037 | "with partial failures allowed\n" |
| 2038 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2039 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 2040 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2041 | ] |
| 2042 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2043 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2044 | ] |
| 2045 | isolatedSenders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2046 | { "name": "h24" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2047 | ] |
| 2048 | isolatedRecipients = [] |
| 2049 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2050 | installResult = main.intents.installMultiToSingleIntent( |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2051 | main, |
| 2052 | name="NOOPTION", |
| 2053 | senders=senders, |
| 2054 | recipients=recipients, |
| 2055 | sw1="s5", |
| 2056 | sw2="s2", |
| 2057 | partial=True ) |
| 2058 | |
| 2059 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2060 | testResult = main.intents.testEndPointFail( |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2061 | main, |
| 2062 | intentId=installResult, |
| 2063 | name="NOOPTION", |
| 2064 | senders=senders, |
| 2065 | recipients=recipients, |
| 2066 | isolatedSenders=isolatedSenders, |
| 2067 | isolatedRecipients=isolatedRecipients, |
| 2068 | sw1="s6", |
| 2069 | sw2="s2", |
| 2070 | sw3="s4", |
| 2071 | sw4="s1", |
| 2072 | sw5="s3", |
| 2073 | expectedLink1=16, |
| 2074 | expectedLink2=14, |
| 2075 | partial=True ) |
| 2076 | else: |
| 2077 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2078 | |
| 2079 | utilities.assert_equals( expect=main.TRUE, |
| 2080 | actual=testResult, |
| 2081 | onpass=main.assertReturnString, |
| 2082 | onfail=main.assertReturnString ) |
| 2083 | |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2084 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2085 | main.assertReturnString = "Assertion results for IPV4 single to multi " +\ |
| 2086 | "point intent with no options set\n" |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2087 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2088 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2089 | ] |
| 2090 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2091 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 2092 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2093 | ] |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2094 | isolatedSenders = [] |
| 2095 | isolatedRecipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2096 | { "name": "h24" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2097 | ] |
| 2098 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2099 | installResult = main.intents.installSingleToMultiIntent( |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2100 | main, |
| 2101 | name="NOOPTION", |
| 2102 | senders=senders, |
| 2103 | recipients=recipients, |
| 2104 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2105 | sw2="s2" ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2106 | |
| 2107 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2108 | testResult = main.intents.testEndPointFail( |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2109 | main, |
| 2110 | intentId=installResult, |
| 2111 | name="NOOPTION", |
| 2112 | senders=senders, |
| 2113 | recipients=recipients, |
| 2114 | isolatedSenders=isolatedSenders, |
| 2115 | isolatedRecipients=isolatedRecipients, |
| 2116 | sw1="s6", |
| 2117 | sw2="s2", |
| 2118 | sw3="s4", |
| 2119 | sw4="s1", |
| 2120 | sw5="s3", |
| 2121 | expectedLink1=16, |
| 2122 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2123 | else: |
| 2124 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2125 | |
| 2126 | utilities.assert_equals( expect=main.TRUE, |
| 2127 | actual=testResult, |
| 2128 | onpass=main.assertReturnString, |
| 2129 | onfail=main.assertReturnString ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2130 | # Right now this functionality doesn't work properly in SPMP intents |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2131 | main.step( "NOOPTION: Install and test single point to multi point " + |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2132 | "intents with partial failures allowed" ) |
| 2133 | main.assertReturnString = "Assertion results for IPV4 single to multi " +\ |
| 2134 | "point intent with partial failures allowed\n" |
| 2135 | senders = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2136 | { "name": "h8", "device": "of:0000000000000005/8" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2137 | ] |
| 2138 | recipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2139 | { "name": "h16", "device": "of:0000000000000006/8" }, |
| 2140 | { "name": "h24", "device": "of:0000000000000007/8" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2141 | ] |
| 2142 | isolatedSenders = [] |
| 2143 | isolatedRecipients = [ |
Jon Hall | 9c88867 | 2017-05-15 18:03:54 -0700 | [diff] [blame] | 2144 | { "name": "h24" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2145 | ] |
| 2146 | testResult = main.FALSE |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2147 | installResult = main.intents.installSingleToMultiIntent( |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2148 | main, |
| 2149 | name="NOOPTION", |
| 2150 | senders=senders, |
| 2151 | recipients=recipients, |
| 2152 | sw1="s5", |
| 2153 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2154 | partial=True ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2155 | |
| 2156 | if installResult: |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2157 | testResult = main.intents.testEndPointFail( |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2158 | main, |
| 2159 | intentId=installResult, |
| 2160 | name="NOOPTION", |
| 2161 | senders=senders, |
| 2162 | recipients=recipients, |
| 2163 | isolatedSenders=isolatedSenders, |
| 2164 | isolatedRecipients=isolatedRecipients, |
| 2165 | sw1="s6", |
| 2166 | sw2="s2", |
| 2167 | sw3="s4", |
| 2168 | sw4="s1", |
| 2169 | sw5="s3", |
| 2170 | expectedLink1=16, |
| 2171 | expectedLink2=14, |
| 2172 | partial=True ) |
| 2173 | else: |
| 2174 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2175 | |
| 2176 | utilities.assert_equals( expect=main.TRUE, |
| 2177 | actual=testResult, |
| 2178 | onpass=main.assertReturnString, |
| 2179 | onfail=main.assertReturnString ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2180 | |
Jon Hall | 78be496 | 2017-05-23 14:53:53 -0700 | [diff] [blame] | 2181 | main.intents.report( main ) |