blob: b693138b016dd70746da82b6b1081ea6b291854c [file] [log] [blame]
kelvin-onlabeaa2eb32015-01-16 15:58:18 -08001# LincOETest
andrewonlab8d29f122014-10-22 17:15:04 -04002#
kelvin-onlabeaa2eb32015-01-16 15:58:18 -08003# Packet-Optical Intent Testing
andrewonlab8d29f122014-10-22 17:15:04 -04004#
kelvin-onlabeaa2eb32015-01-16 15:58:18 -08005# andrew@onlab.us
andrewonlab8d29f122014-10-22 17:15:04 -04006
7
8import time
9import sys
10import os
11import re
12
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080013
andrewonlab8d29f122014-10-22 17:15:04 -040014class LincOETest:
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080015
16 def __init__( self ):
andrewonlab8d29f122014-10-22 17:15:04 -040017 self.default = ''
18
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080019 def CASE1( self, main ):
20 """
andrewonlab8d29f122014-10-22 17:15:04 -040021 Startup sequence:
22 git pull
23 mvn clean install
24 onos-package
25 cell <name>
26 onos-verify-cell
27 onos-install -f
28 onos-wait-for-start
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080029 """
andrewonlab8d29f122014-10-22 17:15:04 -040030 import time
31
kelvin-onlab7bbb5612015-01-26 10:54:50 -080032 cellName = main.params[ 'ENV' ][ 'cellName' ]
andrewonlab8d29f122014-10-22 17:15:04 -040033
kelvin-onlab7bbb5612015-01-26 10:54:50 -080034 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
35 ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
andrewonlab8d29f122014-10-22 17:15:04 -040036
kelvin-onlab7bbb5612015-01-26 10:54:50 -080037 gitPullTrigger = main.params[ 'GIT' ][ 'autoPull' ]
38 gitCheckoutBranch = main.params[ 'GIT' ][ 'checkout' ]
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080039
40 main.case( "Setting up test environment" )
41
42 main.step( "Creating cell file" )
43 # params: ( bench ip, cell name, mininet ip, *onos ips )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080044 cellFileResult = main.ONOSbench.createCellFile(
45 "10.128.20.10", cellName, "10.128.10.90",
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080046 "onos-core-trivial,onos-app-fwd",
47 "10.128.174.1" )
andrewonlab8d29f122014-10-22 17:15:04 -040048
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080049 main.step( "Applying cell variable to environment" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080050 # cellResult = main.ONOSbench.setCell( cellName )
51 cellResult = main.ONOSbench.setCell( "temp_cell_2" )
52 verifyResult = main.ONOSbench.verifyCell()
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080053
kelvin-onlab7bbb5612015-01-26 10:54:50 -080054 if gitPullTrigger == 'on':
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080055 main.step( "Git checkout and pull master" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080056 main.ONOSbench.gitCheckout( gitCheckoutBranch )
57 gitPullResult = main.ONOSbench.gitPull()
andrewonlab8d29f122014-10-22 17:15:04 -040058 else:
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080059 main.log.info( "Git checkout and pull skipped by config" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080060 gitPullResult = main.TRUE
andrewonlab8d29f122014-10-22 17:15:04 -040061
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080062 main.step( "Using mvn clean & install" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080063 # cleanInstallResult = main.ONOSbench.cleanInstall()
64 cleanInstallResult = main.TRUE
andrewonlab8d29f122014-10-22 17:15:04 -040065
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080066 main.step( "Creating ONOS package" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080067 packageResult = main.ONOSbench.onosPackage()
andrewonlab8d29f122014-10-22 17:15:04 -040068
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080069 main.step( "Installing ONOS package" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080070 onosInstallResult = main.ONOSbench.onosInstall()
71 onos1Isup = main.ONOSbench.isup()
andrewonlab8d29f122014-10-22 17:15:04 -040072
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080073 main.step( "Starting ONOS service" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080074 startResult = main.ONOSbench.onosStart( ONOS1Ip )
andrewonlaba85a7762014-10-22 18:05:52 -040075
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080076 main.step( "Setting cell for ONOScli" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080077 main.ONOScli.setCell( cellName )
andrewonlaba85a7762014-10-22 18:05:52 -040078
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080079 main.step( "Starting ONOScli" )
kelvin-onlab7bbb5612015-01-26 10:54:50 -080080 main.ONOScli.startOnosCli( ONOS1Ip )
andrewonlab8d29f122014-10-22 17:15:04 -040081
kelvin-onlab7bbb5612015-01-26 10:54:50 -080082 case1Result = ( cleanInstallResult and packageResult and
83 cellResult and verifyResult and onosInstallResult and
84 onos1Isup and startResult )
85 utilities.assertEquals( expect=main.TRUE, actual=case1Result,
86 onpass="Test startup successful",
87 onfail="Test startup NOT successful" )
andrewonlab8d29f122014-10-22 17:15:04 -040088
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080089 time.sleep( 10 )
90
91 def CASE2( self, main ):
92 """
andrewonlaba85a7762014-10-22 18:05:52 -040093 Configure topology
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080094 """
andrewonlaba85a7762014-10-22 18:05:52 -040095 import time
96
kelvin-onlab7bbb5612015-01-26 10:54:50 -080097 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
98 defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
andrewonlaba85a7762014-10-22 18:05:52 -040099
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800100 # Assign packet level switches to controller
kelvin-onlab7bbb5612015-01-26 10:54:50 -0800101 main.Mininet1.assignSwController(
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800102 sw="1",
kelvin-onlab7bbb5612015-01-26 10:54:50 -0800103 ip1=ONOS1Ip,
104 port1=defaultSwPort )
105 main.Mininet1.assignSwController(
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800106 sw="2",
kelvin-onlab7bbb5612015-01-26 10:54:50 -0800107 ip1=ONOS1Ip,
108 port1=defaultSwPort )
andrewonlaba85a7762014-10-22 18:05:52 -0400109
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800110 # Check devices in controller
111 # This should include Linc-OE devices as well
andrewonlaba85a7762014-10-22 18:05:52 -0400112 devices = main.ONOScli.devices()
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800113 main.log.info( devices )
andrewonlaba85a7762014-10-22 18:05:52 -0400114
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800115 def CASE3( self, main ):
116 """
andrewonlaba85a7762014-10-22 18:05:52 -0400117 Install multi-layer intents
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800118 """