zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 1 | """ |
| 2 | Description: This test is to check onos set configuration and flows with ovsdb connection. |
| 3 | |
| 4 | List of test cases: |
| 5 | CASE1: Compile ONOS and push it to the test machines |
| 6 | CASE2: Test ovsdb connection and tearDown |
| 7 | CASE3: Test default br-int configuration and vxlan port |
| 8 | CASE4: Test default openflow configuration |
| 9 | CASE5: Test default flows |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 10 | CASE6: Configure Network Subnet Port |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 11 | CASE7: Test host go online and ping each other |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 12 | CASE8: Clear ovs configuration and host configuration |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 13 | zhanghaoyu7@huawei.com |
| 14 | """ |
| 15 | import os |
| 16 | |
| 17 | class FUNCovsdbtest: |
| 18 | |
| 19 | def __init__( self ): |
| 20 | self.default = '' |
| 21 | |
| 22 | def CASE1( self, main ): |
| 23 | """ |
| 24 | CASE1 is to compile ONOS and push it to the test machines |
| 25 | |
| 26 | Startup sequence: |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 27 | Construct test variables |
| 28 | Safety check, kill all ONOS processes before setup |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 29 | NOTE: temporary - onos-remove-raft-logs |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 30 | Create ONOS package |
| 31 | Install ONOS package |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 32 | start cli sessions |
| 33 | start ovsdb |
| 34 | start vtn apps |
| 35 | """ |
| 36 | import os |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 37 | import time |
| 38 | main.log.info( "ONOS Single node start ovsdb test - initialization" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 39 | main.case( "Setting up test environment" ) |
| 40 | main.caseExplanation = "Setup the test environment including " +\ |
| 41 | "installing ONOS, start ONOS." |
| 42 | |
| 43 | # load some variables from the params file |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 44 | main.step( "Constructing test variables" ) |
| 45 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 46 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 47 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 48 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 49 | main.startUpSleep = int( main.params['SLEEP']['startup'] ) |
| 50 | cellAppString = main.params['ENV']['cellApps'] |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 51 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 52 | if gitPull == 'True': |
| 53 | main.step( "Building ONOS in " + gitBranch + "branch" ) |
| 54 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 55 | stepResult = onosBuildResult |
| 56 | utilities.assert_equals( expect=main.TRUE, |
| 57 | actual=stepResult, |
| 58 | onpass="Successfully compiled latest ONOS", |
| 59 | onfail="Failed to compile latest ONOS") |
| 60 | else: |
| 61 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 62 | "clean install" ) |
| 63 | main.ONOSbench.getVersion( report=True ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 64 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 65 | main.log.info( "Safety check, killing all ONOS processes" + |
| 66 | " before initiating environment setup" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 67 | |
| 68 | main.log.info( "Removing raft logs" ) |
| 69 | main.ONOSbench.onosRemoveRaftLogs() |
| 70 | |
| 71 | main.CLIs = [] |
| 72 | main.nodes = [] |
| 73 | main.numCtrls= 1 |
| 74 | |
| 75 | for i in range( 1, main.numCtrls + 1 ): |
| 76 | try: |
| 77 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 78 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 79 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 80 | except AttributeError: |
| 81 | break |
| 82 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 83 | main.step( "Uninstalling ONOS package" ) |
| 84 | onosUninstallResult = main.TRUE |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 85 | for node in main.nodes: |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 86 | onosUninstallResult = onosUninstallResult and main.ONOSbench.onosUninstall( node.ip_address ) |
| 87 | utilities.assert_equals( expect=main.TRUE, |
| 88 | actual=onosUninstallResult, |
| 89 | onpass="Successfully uninstalled ONOS package", |
| 90 | onfail="Failed to uninstall ONOS package" ) |
| 91 | time.sleep( main.startUpSleep ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 92 | |
| 93 | # Make sure ONOS process is not running |
| 94 | main.log.info( "Killing any ONOS processes" ) |
| 95 | killResults = main.TRUE |
| 96 | for node in main.nodes: |
| 97 | killed = main.ONOSbench.onosKill( node.ip_address ) |
| 98 | killResults = killResults and killed |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 99 | utilities.assert_equals( expect=main.TRUE, |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 100 | actual=onosUninstallResult, |
| 101 | onpass="Successfully kill all ONOS processes", |
| 102 | onfail="Failed to kill all ONOS processes" ) |
| 103 | |
| 104 | main.step( "Create cell file" ) |
| 105 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName, |
| 106 | main.OVSDB1.ip_address, |
| 107 | cellAppString, ipList ) |
| 108 | |
| 109 | main.step( "Apply cell to environment" ) |
| 110 | cellResult = main.ONOSbench.setCell( cellName ) |
| 111 | verifyResult = main.ONOSbench.verifyCell() |
| 112 | stepResult = cellResult and verifyResult |
| 113 | utilities.assert_equals( expect=main.TRUE, |
| 114 | actual=stepResult, |
| 115 | onpass="Successfully applied cell to environment", |
| 116 | onfail="Failed to apply cell to environment" ) |
| 117 | |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 118 | |
| 119 | main.step( "Creating ONOS package" ) |
Jon Hall | bd60ea0 | 2016-08-23 10:03:59 -0700 | [diff] [blame] | 120 | packageResult = main.ONOSbench.buckBuild() |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 121 | utilities.assert_equals( expect=main.TRUE, |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 122 | actual=packageResult, |
| 123 | onpass="Successfully created ONOS package", |
| 124 | onfail="Failed to create ONOS package" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 125 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 126 | time.sleep( main.startUpSleep ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 127 | main.step( "Installing ONOS package" ) |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 128 | onosInstallResult = main.ONOSbench.onosInstall( options="-f", node=main.nodes[0].ip_address ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 129 | utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult, |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 130 | onpass="Successfully installed ONOS package", |
| 131 | onfail="Failed to install ONOS package" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 132 | |
You Wang | f5de25b | 2017-01-06 15:13:01 -0800 | [diff] [blame] | 133 | main.step( "Set up ONOS secure SSH" ) |
| 134 | secureSshResult = main.TRUE |
| 135 | for i in range( int( main.numCtrls ) ): |
| 136 | secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.nodes[ i ].ip_address ) |
| 137 | utilities.assert_equals( expect=main.TRUE, actual=secureSshResult, |
| 138 | onpass="Test step PASS", |
| 139 | onfail="Test step FAIL" ) |
| 140 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 141 | time.sleep( main.startUpSleep ) |
| 142 | main.step("Starting ONOS service") |
| 143 | stopResult = main.TRUE |
| 144 | startResult = main.TRUE |
| 145 | onos1Isup = main.TRUE |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 146 | for i in range( 2 ): |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 147 | Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address ) |
| 148 | onos1Isup = onos1Isup and Isup |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 149 | if onos1Isup: |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 150 | main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) ) |
| 151 | else: |
| 152 | main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) + |
| 153 | "start ONOS again" ) |
| 154 | stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 155 | startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 156 | if not startResult or stopResult: |
| 157 | main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) ) |
| 158 | stepResult = onos1Isup and stopResult and startResult |
| 159 | utilities.assert_equals( expect=main.TRUE, actual=stepResult, |
| 160 | onpass="ONOS service is ready on all nodes", |
| 161 | onfail="ONOS service did not start properly on all nodes" ) |
| 162 | |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 163 | main.step( "Starting ONOS CLI sessions" ) |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 164 | cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 165 | utilities.assert_equals( expect=main.TRUE, actual=cliResults, |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 166 | onpass="Successfully start ONOS cli", |
| 167 | onfail="Failed to start ONOS cli" ) |
| 168 | |
| 169 | if cliResults == main.FALSE: |
| 170 | main.log.error( "Failed to start ONOS, stopping test" ) |
| 171 | main.cleanup() |
| 172 | main.exit() |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 173 | |
| 174 | main.step( "App Ids check" ) |
| 175 | appCheck = main.ONOScli1.appToIDCheck() |
| 176 | |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 177 | if appCheck != main.TRUE: |
| 178 | main.log.warn( main.CLIs[ 0 ].apps() ) |
| 179 | main.log.warn( main.CLIs[ 0 ].appIDs() ) |
| 180 | |
| 181 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 182 | onpass="App Ids seem to be correct", |
| 183 | onfail="Something is wrong with app Ids" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 184 | |
alison | d9915ea | 2016-08-12 10:16:26 -0700 | [diff] [blame] | 185 | main.step( "Install onos-ovsdb" ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 186 | installResults = main.ONOScli1.activateApp( "org.onosproject.ovsdb" ) |
| 187 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 188 | onpass="Install onos-ovsdatabase successful", |
| 189 | onfail="Install onos-ovsdatabase failed" ) |
| 190 | |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 191 | main.step( "Install onos-app-vtn" ) |
| 192 | installResults = main.ONOScli1.activateApp( "org.onosproject.vtn" ) |
| 193 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 194 | onpass="Install onos-app-vtn successful", |
| 195 | onfail="Install onos-app-vtn failed" ) |
| 196 | |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 197 | def CASE2( self, main ): |
| 198 | |
| 199 | """ |
| 200 | Test ovsdb connection and teardown |
| 201 | """ |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 202 | import os |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 203 | import re |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 204 | |
| 205 | main.case( "Test ovsdb connection and teardown" ) |
| 206 | main.caseExplanation = "Test ovsdb connection create and delete" +\ |
| 207 | " over ovsdb node and onos node " |
| 208 | |
| 209 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 210 | ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] |
| 211 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
| 212 | |
| 213 | main.step( "Set ovsdb node manager" ) |
| 214 | assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 215 | stepResult = assignResult |
| 216 | utilities.assert_equals( expect=main.TRUE, |
| 217 | actual=stepResult, |
| 218 | onpass="Set ovsdb node manager sucess", |
| 219 | onfail="Set ovsdb node manager failed" ) |
| 220 | |
| 221 | main.step( "Check ovsdb node manager is " + str( ctrlip ) ) |
| 222 | response = main.OVSDB1.getManager() |
| 223 | if re.search( ctrlip, response ): |
| 224 | stepResult = main.TRUE |
| 225 | else: |
| 226 | stepResult = main.FALSE |
| 227 | utilities.assert_equals( expect=main.TRUE, |
| 228 | actual=stepResult, |
| 229 | onpass="Check ovsdb node manager is " + str( response ) , |
| 230 | onfail="Check ovsdb node manager failed" ) |
| 231 | |
| 232 | main.step( "Delete ovsdb node manager" ) |
| 233 | deleteResult = main.OVSDB1.delManager( delaytime=delaytime ) |
| 234 | stepResult = deleteResult |
| 235 | utilities.assert_equals( expect=main.TRUE, |
| 236 | actual=stepResult, |
| 237 | onpass="ovsdb node delete manager sucess", |
| 238 | onfail="ovsdb node delete manager failed" ) |
| 239 | |
| 240 | main.step( "Check ovsdb node delete manager " + str( ctrlip ) ) |
| 241 | response = main.OVSDB1.getManager() |
| 242 | if not re.search( ctrlip, response ): |
| 243 | stepResult = main.TRUE |
| 244 | else: |
| 245 | stepResult = main.FALSE |
| 246 | utilities.assert_equals( expect=main.TRUE, |
| 247 | actual=stepResult, |
| 248 | onpass="Check ovsdb node delete manager sucess", |
| 249 | onfail="Check ovsdb node delete manager failed" ) |
| 250 | |
| 251 | def CASE3( self, main ): |
| 252 | |
| 253 | """ |
| 254 | Test default br-int configuration and vxlan port |
| 255 | """ |
| 256 | import re |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 257 | import os |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 258 | |
| 259 | main.case( "Test default br-int configuration and vxlan port" ) |
| 260 | main.caseExplanation = "onos create default br-int bridge and" +\ |
| 261 | " vxlan port on the ovsdb node" |
| 262 | |
| 263 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 264 | ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] |
| 265 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 266 | OVSDB1Ip = os.getenv( main.params['OVSDB']['ip1'] ) |
| 267 | OVSDB2Ip = os.getenv( main.params['OVSDB']['ip2'] ) |
zhanghaoyu | 451c139 | 2015-08-07 19:21:16 +0800 | [diff] [blame] | 268 | |
| 269 | main.step( "ovsdb node 1 set ovs manager to " + str( ctrlip ) ) |
| 270 | assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 271 | stepResult = assignResult |
| 272 | utilities.assert_equals( expect=main.TRUE, |
| 273 | actual=stepResult, |
| 274 | onpass="ovsdb node 1 set ovs manager to to " +\ |
| 275 | str( ctrlip ) + " sucess", |
| 276 | onfail="ovsdb node 1 set ovs manager to to " +\ |
| 277 | str( ctrlip ) + " failed" ) |
| 278 | |
| 279 | main.step( "ovsdb node 2 set ovs manager to " + str( ctrlip ) ) |
| 280 | assignResult = main.OVSDB2.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 281 | stepResult = assignResult |
| 282 | utilities.assert_equals( expect=main.TRUE, |
| 283 | actual=stepResult, |
| 284 | onpass="ovsdb node 2 set ovs manager to to " +\ |
| 285 | str( ctrlip ) + " sucess", |
| 286 | onfail="ovsdb node 2 set ovs manager to to " +\ |
| 287 | str( ctrlip ) + " failed" ) |
| 288 | |
| 289 | main.step( "Check ovsdb node 1 manager is " + str( ctrlip ) ) |
| 290 | response = main.OVSDB1.getManager() |
| 291 | if re.search( ctrlip, response ): |
| 292 | stepResult = main.TRUE |
| 293 | else: |
| 294 | stepResult = main.FALSE |
| 295 | utilities.assert_equals( expect=main.TRUE, |
| 296 | actual=stepResult, |
| 297 | onpass="ovsdb node 1 manager is " + str( response ) , |
| 298 | onfail="ovsdb node 1 manager check failed" ) |
| 299 | |
| 300 | main.step( "Check ovsdb node 2 manager is " + str( ctrlip ) ) |
| 301 | response = main.OVSDB2.getManager() |
| 302 | if re.search( ctrlip, response ): |
| 303 | stepResult = main.TRUE |
| 304 | else: |
| 305 | stepResult = main.FALSE |
| 306 | utilities.assert_equals( expect=main.TRUE, |
| 307 | actual=stepResult, |
| 308 | onpass="ovsdb node 2 manager is " + str( response ) , |
| 309 | onfail="ovsdb node 2 manager check failed" ) |
| 310 | |
| 311 | main.step( "Check default br-int bridge on ovsdb node " + str( OVSDB1Ip ) ) |
| 312 | response = main.OVSDB1.listBr() |
| 313 | if re.search( "br-int", response ): |
| 314 | stepResult = main.TRUE |
| 315 | else: |
| 316 | stepResult = main.FALSE |
| 317 | utilities.assert_equals( expect=main.TRUE, |
| 318 | actual=stepResult, |
| 319 | onpass="onos add default bridge on the node 1 sucess", |
| 320 | onfail="onos add default bridge on the node 1 failed" ) |
| 321 | |
| 322 | main.step( "Check default br-int bridge on ovsdb node " + str( OVSDB2Ip ) ) |
| 323 | response = main.OVSDB2.listBr() |
| 324 | if re.search( "br-int", response ): |
| 325 | stepResult = main.TRUE |
| 326 | else: |
| 327 | stepResult = main.FALSE |
| 328 | utilities.assert_equals( expect=main.TRUE, |
| 329 | actual=stepResult, |
| 330 | onpass="onos add default bridge on the node 2 sucess", |
| 331 | onfail="onos add default bridge on the node 2 failed" ) |
| 332 | |
| 333 | main.step( "Check default vxlan port on ovsdb node " + str( OVSDB1Ip ) ) |
| 334 | response = main.OVSDB1.listPorts( "br-int" ) |
| 335 | if re.search( "vxlan", response ) and re.search( str( OVSDB2Ip ), response ): |
| 336 | stepResult = main.TRUE |
| 337 | else: |
| 338 | stepResult = main.FALSE |
| 339 | utilities.assert_equals( expect=main.TRUE, |
| 340 | actual=stepResult, |
| 341 | onpass="onos add default vxlan port on the node 1 sucess", |
| 342 | onfail="onos add default vxlan port on the node 1 failed" ) |
| 343 | |
| 344 | main.step( "Check default vxlan port on ovsdb node " + str( OVSDB2Ip ) ) |
| 345 | response = main.OVSDB2.listPorts( "br-int" ) |
| 346 | if re.search( "vxlan", response ) and re.search( str( OVSDB1Ip ), response ): |
| 347 | stepResult = main.TRUE |
| 348 | else: |
| 349 | stepResult = main.FALSE |
| 350 | utilities.assert_equals( expect=main.TRUE, |
| 351 | actual=stepResult, |
| 352 | onpass="onos add default vxlan port on the node 2 sucess", |
| 353 | onfail="onos add default vxlan port on the node 2 failed" ) |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 354 | |
| 355 | def CASE4( self, main ): |
| 356 | |
| 357 | """ |
| 358 | Test default openflow configuration |
| 359 | """ |
| 360 | import re |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 361 | import os |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 362 | |
| 363 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 364 | ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] |
| 365 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
| 366 | |
| 367 | main.step( "ovsdb node 1 set ovs manager to " + str( ctrlip ) ) |
| 368 | assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 369 | stepResult = assignResult |
| 370 | utilities.assert_equals( expect=main.TRUE, |
| 371 | actual=stepResult, |
| 372 | onpass="ovsdb node 1 set ovs manager to to " +\ |
| 373 | str( ctrlip ) + " sucess", |
| 374 | onfail="ovsdb node 1 set ovs manager to to " +\ |
| 375 | str( ctrlip ) + " failed" ) |
| 376 | |
| 377 | main.step( "ovsdb node 2 set ovs manager to " + str( ctrlip ) ) |
| 378 | assignResult = main.OVSDB2.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 379 | stepResult = assignResult |
| 380 | utilities.assert_equals( expect=main.TRUE, |
| 381 | actual=stepResult, |
| 382 | onpass="ovsdb node 2 set ovs manager to to " +\ |
| 383 | str( ctrlip ) + " sucess", |
| 384 | onfail="ovsdb node 2 set ovs manager to to " +\ |
| 385 | str( ctrlip ) + " failed" ) |
| 386 | |
| 387 | main.step( "Check ovsdb node 1 manager is " + str( ctrlip ) ) |
| 388 | response = main.OVSDB1.getManager() |
| 389 | if re.search( ctrlip, response ): |
| 390 | stepResult = main.TRUE |
| 391 | else: |
| 392 | stepResult = main.FALSE |
| 393 | utilities.assert_equals( expect=main.TRUE, |
| 394 | actual=stepResult, |
| 395 | onpass="ovsdb node 1 manager is " + str( response ) , |
sunyulin | 916e13e | 2015-10-15 20:27:23 +0800 | [diff] [blame] | 396 | onfail="ovsdb node 1 manager check failed\n" +\ |
| 397 | str( main.OVSDB1.show() ) ) |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 398 | |
| 399 | main.step( "Check ovsdb node 2 manager is " + str( ctrlip ) ) |
| 400 | response = main.OVSDB2.getManager() |
| 401 | if re.search( ctrlip, response ): |
| 402 | stepResult = main.TRUE |
| 403 | else: |
| 404 | stepResult = main.FALSE |
| 405 | utilities.assert_equals( expect=main.TRUE, |
| 406 | actual=stepResult, |
| 407 | onpass="ovsdb node 2 manager is " + str( response ) , |
sunyulin | 916e13e | 2015-10-15 20:27:23 +0800 | [diff] [blame] | 408 | onfail="ovsdb node 2 manager check failed\n" +\ |
| 409 | str( main.OVSDB2.show() ) ) |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 410 | |
| 411 | main.step( "Check ovsdb node 1 bridge br-int controller set to " + str( ctrlip ) ) |
| 412 | response = main.OVSDB1.getController( "br-int" ) |
| 413 | if re.search( ctrlip, response ): |
| 414 | stepResult = main.TRUE |
| 415 | else: |
| 416 | stepResult = main.FALSE |
| 417 | utilities.assert_equals( expect=main.TRUE, |
| 418 | actual=stepResult, |
| 419 | onpass="Check ovsdb node 1 bridge br-int controller set to " +\ |
| 420 | str( ctrlip ) + " sucess", |
| 421 | onfail="Check ovsdb node 1 bridge br-int controller set to " +\ |
sunyulin | 916e13e | 2015-10-15 20:27:23 +0800 | [diff] [blame] | 422 | str( ctrlip ) + " failed\n" + str( main.OVSDB1.show() ) ) |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 423 | |
| 424 | main.step( "Check ovsdb node 2 bridge br-int controller set to " + str( ctrlip ) ) |
| 425 | response = main.OVSDB2.getController( "br-int" ) |
| 426 | if re.search( ctrlip, response ): |
| 427 | stepResult = main.TRUE |
| 428 | else: |
| 429 | stepResult = main.FALSE |
| 430 | utilities.assert_equals( expect=main.TRUE, |
| 431 | actual=stepResult, |
| 432 | onpass="Check ovsdb node 2 bridge br-int controller set to " +\ |
| 433 | str( ctrlip ) + " sucess", |
| 434 | onfail="Check ovsdb node 2 bridge br-int controller set to " +\ |
sunyulin | 916e13e | 2015-10-15 20:27:23 +0800 | [diff] [blame] | 435 | str( ctrlip ) + " failed\n" + str( main.OVSDB2.show()) ) |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 436 | |
| 437 | main.step( "Check onoscli devices have ovs " + str( OVSDB1Ip ) ) |
| 438 | response = main.ONOScli1.devices() |
| 439 | if re.search( OVSDB1Ip, response ) and not re.search( "false", response ): |
| 440 | stepResult = main.TRUE |
| 441 | else: |
| 442 | stepResult = main.FALSE |
| 443 | utilities.assert_equals( expect=main.TRUE, |
| 444 | actual=stepResult, |
| 445 | onpass="Check onoscli devices have ovs " + str( OVSDB1Ip ) + " sucess", |
| 446 | onfail="Check onoscli devices have ovs " + str( OVSDB1Ip ) + " failed" ) |
| 447 | |
| 448 | main.step( "Check onoscli devices have ovs " + str( OVSDB2Ip ) ) |
| 449 | response = main.ONOScli1.devices() |
| 450 | if re.search( OVSDB2Ip, response ) and not re.search( "false", response ): |
| 451 | stepResult = main.TRUE |
| 452 | else: |
| 453 | stepResult = main.FALSE |
| 454 | utilities.assert_equals( expect=main.TRUE, |
| 455 | actual=stepResult, |
| 456 | onpass="Check onoscli devices have ovs " + str( OVSDB2Ip ) + " sucess", |
| 457 | onfail="Check onoscli devices have ovs " + str( OVSDB2Ip ) + " failed" ) |
| 458 | |
| 459 | def CASE5( self, main ): |
| 460 | |
| 461 | """ |
| 462 | Test default flows |
| 463 | """ |
| 464 | import re |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 465 | import os |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 466 | |
| 467 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 468 | ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] |
| 469 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
| 470 | |
| 471 | main.step( "ovsdb node 1 set ovs manager to onos" ) |
| 472 | assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 473 | stepResult = assignResult |
| 474 | utilities.assert_equals( expect=main.TRUE, |
| 475 | actual=stepResult, |
| 476 | onpass="ovsdb node 1 set ovs manager to to " +\ |
| 477 | str( ctrlip ) + " sucess", |
| 478 | onfail="ovsdb node 1 set ovs manager to to " +\ |
| 479 | str( ctrlip ) + " failed" ) |
| 480 | |
| 481 | main.step( "Check ovsdb node 1 manager is " + str( ctrlip ) ) |
| 482 | response = main.OVSDB1.getManager() |
| 483 | if re.search( ctrlip, response ): |
| 484 | stepResult = main.TRUE |
| 485 | else: |
| 486 | stepResult = main.FALSE |
| 487 | utilities.assert_equals( expect=main.TRUE, |
| 488 | actual=stepResult, |
| 489 | onpass="ovsdb node 1 manager is " + str( response ) , |
| 490 | onfail="ovsdb node 1 manager check failed" ) |
| 491 | |
| 492 | main.step( "Check ovsdb node 1 bridge br-int default flows on " + str( OVSDB1Ip ) ) |
| 493 | response = main.OVSDB1.dumpFlows( sw="br-int", protocols="OpenFlow13" ) |
| 494 | if re.search( "actions=CONTROLLER", response ): |
| 495 | stepResult = main.TRUE |
| 496 | else: |
| 497 | stepResult = main.FALSE |
| 498 | utilities.assert_equals( expect=main.TRUE, |
| 499 | actual=stepResult, |
| 500 | onpass="Successfully set default flows " + str( ctrlip ) , |
| 501 | onfail="Failed to set default flows " + str( ctrlip ) ) |
| 502 | |
| 503 | def CASE6( self, main ): |
| 504 | """ |
| 505 | Configure Network Subnet Port |
| 506 | """ |
| 507 | import os |
| 508 | |
| 509 | try: |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 510 | from tests.FUNC.FUNCovsdbtest.dependencies.Nbdata import NetworkData |
| 511 | from tests.FUNC.FUNCovsdbtest.dependencies.Nbdata import SubnetData |
| 512 | from tests.FUNC.FUNCovsdbtest.dependencies.Nbdata import VirtualPortData |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 513 | except ImportError: |
| 514 | main.log.exception( "Something wrong with import file or code error." ) |
| 515 | main.log.info( "Import Error, please check!" ) |
| 516 | main.cleanup() |
| 517 | main.exit() |
| 518 | |
| 519 | main.log.info( "Configure Network Subnet Port Start" ) |
| 520 | main.case( "Configure Network Subnet Port" ) |
| 521 | main.caseExplanation = "Configure Network Subnet Port " +\ |
| 522 | "Verify post is OK" |
| 523 | |
| 524 | ctrlip = os.getenv( main.params['CTRL']['ip1'] ) |
| 525 | httpport = main.params['HTTP']['port'] |
| 526 | path = main.params['HTTP']['path'] |
| 527 | |
| 528 | main.step( "Generate Post Data" ) |
| 529 | network = NetworkData() |
| 530 | network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' |
| 531 | network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' |
| 532 | subnet = SubnetData() |
| 533 | subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178" |
| 534 | subnet.tenant_id = network.tenant_id |
| 535 | subnet.network_id = network.id |
| 536 | subnet.start = "10.0.0.1" |
| 537 | subnet.end = "10.0.0.254" |
| 538 | subnet.cidr = "10.0.0.0/24" |
| 539 | port1 = VirtualPortData() |
| 540 | port1.id = "00000000-0000-0000-0000-000000000001" |
| 541 | port1.subnet_id = subnet.id |
| 542 | port1.tenant_id = network.tenant_id |
| 543 | port1.network_id = network.id |
| 544 | port1.macAddress = "00:00:00:00:00:01" |
| 545 | port1.ip_address = "10.0.0.1" |
| 546 | port2 = VirtualPortData() |
| 547 | port2.id = "00000000-0000-0000-0000-000000000002" |
| 548 | port2.subnet_id = subnet.id |
| 549 | port2.tenant_id = network.tenant_id |
| 550 | port2.network_id = network.id |
| 551 | port2.macAddress = "00:00:00:00:00:02" |
| 552 | port2.ip_address = "10.0.0.2" |
| 553 | |
| 554 | networkpostdata = network.DictoJson() |
| 555 | subnetpostdata = subnet.DictoJson() |
| 556 | port1postdata = port1.DictoJson() |
| 557 | port2postdata = port2.DictoJson() |
| 558 | |
| 559 | main.step( "Post Network Data via HTTP(Post port need post network)" ) |
| 560 | Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/', |
| 561 | 'POST', None, networkpostdata ) |
| 562 | utilities.assert_equals( |
| 563 | expect='200', |
| 564 | actual=Poststatus, |
| 565 | onpass="Post Network Success", |
| 566 | onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) ) |
| 567 | |
| 568 | main.step( "Post Subnet Data via HTTP(Post port need post subnet)" ) |
| 569 | Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/', |
| 570 | 'POST', None, subnetpostdata ) |
| 571 | utilities.assert_equals( |
| 572 | expect='202', |
| 573 | actual=Poststatus, |
| 574 | onpass="Post Subnet Success", |
| 575 | onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) ) |
| 576 | |
| 577 | main.step( "Post Port1 Data via HTTP" ) |
| 578 | Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/', |
| 579 | 'POST', None, port1postdata ) |
| 580 | utilities.assert_equals( |
| 581 | expect='200', |
| 582 | actual=Poststatus, |
| 583 | onpass="Post Port Success", |
| 584 | onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) ) |
| 585 | |
| 586 | main.step( "Post Port2 Data via HTTP" ) |
| 587 | Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/', |
| 588 | 'POST', None, port2postdata ) |
| 589 | utilities.assert_equals( |
| 590 | expect='200', |
| 591 | actual=Poststatus, |
| 592 | onpass="Post Port Success", |
| 593 | onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) ) |
| 594 | |
| 595 | def CASE7( self, main ): |
| 596 | |
| 597 | """ |
| 598 | Test host go online and ping each other |
| 599 | """ |
| 600 | import re |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 601 | import os |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 602 | |
| 603 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 604 | ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] |
| 605 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
| 606 | |
| 607 | main.step( "ovsdb node 1 set ovs manager to " + str( ctrlip ) ) |
| 608 | assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 609 | stepResult = assignResult |
| 610 | utilities.assert_equals( expect=main.TRUE, |
| 611 | actual=stepResult, |
| 612 | onpass="ovsdb node 1 set ovs manager to to " +\ |
| 613 | str( ctrlip ) + " sucess", |
| 614 | onfail="ovsdb node 1 set ovs manager to to " +\ |
| 615 | str( ctrlip ) + " failed" ) |
| 616 | |
| 617 | main.step( "ovsdb node 2 set ovs manager to " + str( ctrlip ) ) |
| 618 | assignResult = main.OVSDB2.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) |
| 619 | stepResult = assignResult |
| 620 | utilities.assert_equals( expect=main.TRUE, |
| 621 | actual=stepResult, |
| 622 | onpass="ovsdb node 2 set ovs manager to " +\ |
| 623 | str( ctrlip ) + " sucess", |
| 624 | onfail="ovsdb node 2 set ovs manager to " +\ |
| 625 | str( ctrlip ) + " failed" ) |
| 626 | |
| 627 | main.step( "Create host1 on node 1 " + str( OVSDB1Ip ) ) |
| 628 | stepResult = main.OVSDB1.createHost( hostname="host1" ) |
| 629 | utilities.assert_equals( expect=main.TRUE, |
| 630 | actual=stepResult, |
| 631 | onpass="Create host1 on node 1 " + str( OVSDB1Ip ) + " sucess", |
| 632 | onfail="Create host1 on node 1 " + str( OVSDB1Ip ) + " failed" ) |
| 633 | |
| 634 | main.step( "Create host2 on node 2 " + str( OVSDB2Ip ) ) |
| 635 | stepResult = main.OVSDB2.createHost( hostname="host2" ) |
| 636 | utilities.assert_equals( expect=main.TRUE, |
| 637 | actual=stepResult, |
| 638 | onpass="Create host2 on node 2 " + str( OVSDB2Ip ) + " sucess", |
| 639 | onfail="Create host2 on node 2 " + str( OVSDB2Ip ) + " failed" ) |
| 640 | |
| 641 | main.step( "Create port on host1 on the node " + str ( OVSDB1Ip ) ) |
| 642 | stepResult = main.OVSDB1.createHostport( hostname="host1", hostport="host1-eth0", hostportmac="000000000001" ) |
| 643 | utilities.assert_equals( expect=main.TRUE, |
| 644 | actual=stepResult, |
| 645 | onpass="Create port on host1 on the node " + str( OVSDB1Ip ) + " sucess", |
| 646 | onfail="Create port on host1 on the node " + str( OVSDB1Ip ) + " failed" ) |
| 647 | |
| 648 | main.step( "Create port on host2 on the node " + str ( OVSDB2Ip ) ) |
| 649 | stepResult = main.OVSDB2.createHostport( hostname="host2", hostport="host2-eth0", hostportmac="000000000002" ) |
| 650 | utilities.assert_equals( expect=main.TRUE, |
| 651 | actual=stepResult, |
| 652 | onpass="Create port on host1 on the node " + str( OVSDB2Ip ) + " sucess", |
| 653 | onfail="Create port on host1 on the node " + str( OVSDB2Ip ) + " failed" ) |
| 654 | |
| 655 | main.step( "Add port to ovs br-int and host go-online on the node " + str ( OVSDB1Ip ) ) |
| 656 | stepResult = main.OVSDB1.addPortToOvs( ovsname="br-int", ifaceId="00000000-0000-0000-0000-000000000001", |
| 657 | attachedMac="00:00:00:00:00:01", vmuuid="10000000-0000-0000-0000-000000000001" ) |
| 658 | utilities.assert_equals( expect=main.TRUE, |
| 659 | actual=stepResult, |
| 660 | onpass="Add port to ovs br-int and host go-online on the node " +\ |
| 661 | str( OVSDB1Ip ) + " sucess", |
| 662 | onfail="Add port to ovs br-int and host go-online on the node " +\ |
| 663 | str( OVSDB1Ip ) + " failed" ) |
| 664 | |
| 665 | main.step( "Add port to ovs br-int and host go-online on the node " + str ( OVSDB2Ip ) ) |
| 666 | stepResult = main.OVSDB2.addPortToOvs( ovsname="br-int", ifaceId="00000000-0000-0000-0000-000000000002", |
| 667 | attachedMac="00:00:00:00:00:02", vmuuid="10000000-0000-0000-0000-000000000001" ) |
| 668 | utilities.assert_equals( expect=main.TRUE, |
| 669 | actual=stepResult, |
| 670 | onpass="Add port to ovs br-int and host go-online on the node " +\ |
| 671 | str( OVSDB2Ip ) + " sucess", |
| 672 | onfail="Add port to ovs br-int and host go-online on the node " +\ |
| 673 | str( OVSDB2Ip ) + " failed" ) |
| 674 | |
| 675 | main.step( "Check onos set host flows on the node " + str( OVSDB1Ip ) ) |
| 676 | response = main.OVSDB1.dumpFlows( sw="br-int", protocols="OpenFlow13" ) |
| 677 | if re.search( "00:00:00:00:00:01", response ): |
| 678 | stepResult = main.TRUE |
| 679 | else: |
| 680 | stepResult = main.FALSE |
| 681 | utilities.assert_equals( expect=main.TRUE, |
| 682 | actual=stepResult, |
| 683 | onpass="Check onos set host flows on the node " +\ |
| 684 | str( OVSDB1Ip ) + " sucess", |
| 685 | onfail="Check onos set host flows on the node " +\ |
| 686 | str( OVSDB1Ip ) + " failed" ) |
| 687 | |
| 688 | main.step( "Check onos set host flows on the node " + str( OVSDB2Ip ) ) |
| 689 | response = main.OVSDB2.dumpFlows( sw="br-int", protocols="OpenFlow13" ) |
| 690 | if re.search( "00:00:00:00:00:02", response ): |
| 691 | stepResult = main.TRUE |
| 692 | else: |
| 693 | stepResult = main.FALSE |
| 694 | utilities.assert_equals( expect=main.TRUE, |
| 695 | actual=stepResult, |
| 696 | onpass="Check onos set host flows on the node " +\ |
| 697 | str( OVSDB2Ip ) + " sucess", |
| 698 | onfail="Check onos set host flows on the node " +\ |
| 699 | str( OVSDB2Ip ) + " failed" ) |
| 700 | |
| 701 | main.step( "Check hosts can ping each other" ) |
| 702 | main.OVSDB1.setHostportIp( hostname="host1", hostport1="host1-eth0", ip="10.0.0.1" ) |
| 703 | main.OVSDB2.setHostportIp( hostname="host2", hostport1="host2-eth0", ip="10.0.0.2" ) |
| 704 | pingResult1 = main.OVSDB1.hostPing( src="10.0.0.1", hostname="host1", target="10.0.0.2" ) |
| 705 | pingResult2 = main.OVSDB2.hostPing( src="10.0.0.2", hostname="host2", target="10.0.0.1" ) |
| 706 | stepResult = pingResult1 and pingResult2 |
| 707 | utilities.assert_equals( expect=main.TRUE, |
| 708 | actual=stepResult, |
| 709 | onpass="Successfully host go online and ping each other,controller is " +\ |
| 710 | str( ctrlip ), |
| 711 | onfail="Failed to host go online and ping each other,controller is " +\ |
| 712 | str( ctrlip ) ) |
| 713 | |
| 714 | def CASE8( self, main ): |
| 715 | |
| 716 | """ |
| 717 | Clear ovs configuration and host configuration |
| 718 | """ |
| 719 | import re |
alison | 6acef9f | 2016-09-28 12:29:08 -0700 | [diff] [blame] | 720 | import os |
zhanghaoyu7 | 474d8c6 | 2015-08-26 14:53:28 +0800 | [diff] [blame] | 721 | |
| 722 | ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 723 | OVSDB1Ip = os.getenv( main.params[ 'OVSDB' ][ 'ip1' ] ) |
| 724 | OVSDB2Ip = os.getenv( main.params[ 'OVSDB' ][ 'ip2' ] ) |
| 725 | delaytime = main.params[ 'TIMER' ][ 'delaytime' ] |
| 726 | |
| 727 | main.step( "Delete ovsdb node 1 manager" ) |
| 728 | deleteResult = main.OVSDB1.delManager( delaytime=delaytime ) |
| 729 | stepResult = deleteResult |
| 730 | utilities.assert_equals( expect=main.TRUE, |
| 731 | actual=stepResult, |
| 732 | onpass="ovsdb node 1 delete manager sucess", |
| 733 | onfail="ovsdb node 1 delete manager failed" ) |
| 734 | |
| 735 | main.step( "Delete ovsdb node 2 manager" ) |
| 736 | deleteResult = main.OVSDB2.delManager( delaytime=delaytime ) |
| 737 | stepResult = deleteResult |
| 738 | utilities.assert_equals( expect=main.TRUE, |
| 739 | actual=stepResult, |
| 740 | onpass="ovsdb node 2 delete manager sucess", |
| 741 | onfail="ovsdb node 2 delete manager failed" ) |
| 742 | |
| 743 | main.step( "Delete ovsdb node 1 bridge br-int" ) |
| 744 | deleteResult = main.OVSDB1.delBr( sw="br-int" ) |
| 745 | stepResult = deleteResult |
| 746 | utilities.assert_equals( expect=main.TRUE, |
| 747 | actual=stepResult, |
| 748 | onpass="Delete ovsdb node 1 bridge br-int sucess", |
| 749 | onfail="Delete ovsdb node 1 bridge br-int failed" ) |
| 750 | |
| 751 | main.step( "Delete ovsdb node 2 bridge br-int" ) |
| 752 | deleteResult = main.OVSDB2.delBr( sw="br-int" ) |
| 753 | stepResult = deleteResult |
| 754 | utilities.assert_equals( expect=main.TRUE, |
| 755 | actual=stepResult, |
| 756 | onpass="Delete ovsdb node 2 bridge br-int sucess", |
| 757 | onfail="Delete ovsdb node 2 bridge br-int failed" ) |
| 758 | |
| 759 | main.step( "Delete ip netns host on the ovsdb node 1" ) |
| 760 | deleteResult = main.OVSDB1.delHost( hostname="host1" ) |
| 761 | stepResult = deleteResult |
| 762 | utilities.assert_equals( expect=main.TRUE, |
| 763 | actual=stepResult, |
| 764 | onpass="Delete ip netns host on the ovsdb node 1 sucess", |
| 765 | onfail="Delete ip netns host on the ovsdb node 1 failed" ) |
| 766 | |
| 767 | main.step( "Delete ip netns host on the ovsdb node 2" ) |
| 768 | deleteResult = main.OVSDB2.delHost( hostname="host2" ) |
| 769 | stepResult = deleteResult |
| 770 | utilities.assert_equals( expect=main.TRUE, |
| 771 | actual=stepResult, |
| 772 | onpass="Delete ip netns host on the ovsdb node 2 sucess", |
| 773 | onfail="Delete ip netns host on the ovsdb node 2 failed" ) |
| 774 | |
| 775 | main.step( "Check onoscli devices openflow session is false " + str( OVSDB1Ip ) ) |
| 776 | response = main.ONOScli1.devices() |
| 777 | if re.search( OVSDB1Ip, response ) and not re.search( "true", response ): |
| 778 | stepResult = main.TRUE |
| 779 | else: |
| 780 | stepResult = main.FALSE |
| 781 | utilities.assert_equals( expect=main.TRUE, |
| 782 | actual=stepResult, |
| 783 | onpass="Check openflow session is false " + str( OVSDB1Ip ) + " sucess", |
| 784 | onfail="Check openflow session is false " + str( OVSDB1Ip ) + " failed" ) |
| 785 | |
| 786 | main.step( "Check onoscli devices have ovs " + str( OVSDB2Ip ) ) |
| 787 | response = main.ONOScli1.devices() |
| 788 | if re.search( OVSDB2Ip, response ) and not re.search( "true", response ): |
| 789 | stepResult = main.TRUE |
| 790 | else: |
| 791 | stepResult = main.FALSE |
| 792 | utilities.assert_equals( expect=main.TRUE, |
| 793 | actual=stepResult, |
| 794 | onpass="Check openflow session is false " + str( OVSDB2Ip ) + " sucess", |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 795 | onfail="Check openflow session is false " + str( OVSDB2Ip ) + " failed" ) |