blob: 6c59c5bcf938bab5a2c9e66f6051f21c18ac2f85 [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-onlabeaa2eb32015-01-16 15:58:18 -080032 cell_name = main.params[ 'ENV' ][ 'cellName' ]
andrewonlab8d29f122014-10-22 17:15:04 -040033
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080034 ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
35 ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
andrewonlab8d29f122014-10-22 17:15:04 -040036
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080037 git_pull_trigger = main.params[ 'GIT' ][ 'autoPull' ]
38 git_checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
39
40 main.case( "Setting up test environment" )
41
42 main.step( "Creating cell file" )
43 # params: ( bench ip, cell name, mininet ip, *onos ips )
andrewonlab8d29f122014-10-22 17:15:04 -040044 cell_file_result = main.ONOSbench.create_cell_file(
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080045 "10.128.20.10", cell_name, "10.128.10.90",
46 "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" )
50 #cell_result = main.ONOSbench.set_cell( cell_name )
51 cell_result = main.ONOSbench.set_cell( "temp_cell_2" )
andrewonlab8d29f122014-10-22 17:15:04 -040052 verify_result = main.ONOSbench.verify_cell()
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080053
andrewonlab8d29f122014-10-22 17:15:04 -040054 if git_pull_trigger == 'on':
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080055 main.step( "Git checkout and pull master" )
56 main.ONOSbench.git_checkout( git_checkout_branch )
andrewonlab8d29f122014-10-22 17:15:04 -040057 git_pull_result = main.ONOSbench.git_pull()
58 else:
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080059 main.log.info( "Git checkout and pull skipped by config" )
andrewonlab8d29f122014-10-22 17:15:04 -040060 git_pull_result = main.TRUE
61
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080062 main.step( "Using mvn clean & install" )
andrewonlab8d29f122014-10-22 17:15:04 -040063 #clean_install_result = main.ONOSbench.clean_install()
64 clean_install_result = main.TRUE
65
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080066 main.step( "Creating ONOS package" )
andrewonlab8d29f122014-10-22 17:15:04 -040067 package_result = main.ONOSbench.onos_package()
68
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080069 main.step( "Installing ONOS package" )
andrewonlab8d29f122014-10-22 17:15:04 -040070 onos_install_result = main.ONOSbench.onos_install()
71 onos1_isup = main.ONOSbench.isup()
andrewonlab8d29f122014-10-22 17:15:04 -040072
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080073 main.step( "Starting ONOS service" )
74 start_result = main.ONOSbench.onos_start( ONOS1_ip )
andrewonlaba85a7762014-10-22 18:05:52 -040075
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080076 main.step( "Setting cell for ONOScli" )
77 main.ONOScli.set_cell( cell_name )
andrewonlaba85a7762014-10-22 18:05:52 -040078
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080079 main.step( "Starting ONOScli" )
80 main.ONOScli.start_onos_cli( ONOS1_ip )
andrewonlab8d29f122014-10-22 17:15:04 -040081
kelvin-onlabeaa2eb32015-01-16 15:58:18 -080082 case1_result = ( clean_install_result and package_result and
83 cell_result and verify_result and onos_install_result and
84 onos1_isup and start_result )
85 utilities.assert_equals( expect=main.TRUE, actual=case1_result,
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-onlabeaa2eb32015-01-16 15:58:18 -080097 ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
98 default_sw_port = 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
101 main.Mininet1.assign_sw_controller(
102 sw="1",
103 ip1=ONOS1_ip,
104 port1=default_sw_port )
105 main.Mininet1.assign_sw_controller(
106 sw="2",
107 ip1=ONOS1_ip,
108 port1=default_sw_port )
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 """