blob: bb52ca82f2b844f7e5ddf1e71e28512b45c551d8 [file] [log] [blame]
andrewonlab8d29f122014-10-22 17:15:04 -04001#LincOETest
2#
3#Packet-Optical Intent Testing
4#
5#andrew@onlab.us
6
7
8import time
9import sys
10import os
11import re
12
13class LincOETest:
14 def __init__(self):
15 self.default = ''
16
17 def CASE1(self, main):
18 '''
19 Startup sequence:
20 git pull
21 mvn clean install
22 onos-package
23 cell <name>
24 onos-verify-cell
25 onos-install -f
26 onos-wait-for-start
27 '''
28 import time
29
30 cell_name = main.params['ENV']['cellName']
31
32 ONOS1_ip = main.params['CTRL']['ip1']
33 ONOS1_port = main.params['CTRL']['port1']
34
35 git_pull_trigger = main.params['GIT']['autoPull']
36 git_checkout_branch = main.params['GIT']['checkout']
37
38 main.case("Setting up test environment")
39
40 main.step("Creating cell file")
41 #params: (bench ip, cell name, mininet ip, *onos ips)
42 cell_file_result = main.ONOSbench.create_cell_file(
43 "10.128.20.10", cell_name, "10.128.10.90",
44 "onos-core-trivial,onos-app-fwd",
45 "10.128.174.1")
46
47 main.step("Applying cell variable to environment")
48 #cell_result = main.ONOSbench.set_cell(cell_name)
49 cell_result = main.ONOSbench.set_cell("temp_cell_2")
50 verify_result = main.ONOSbench.verify_cell()
51
52 if git_pull_trigger == 'on':
53 main.step("Git checkout and pull master")
54 main.ONOSbench.git_checkout(git_checkout_branch)
55 git_pull_result = main.ONOSbench.git_pull()
56 else:
57 main.log.info("Git checkout and pull skipped by config")
58 git_pull_result = main.TRUE
59
60 main.step("Using mvn clean & install")
61 #clean_install_result = main.ONOSbench.clean_install()
62 clean_install_result = main.TRUE
63
64 main.step("Creating ONOS package")
65 package_result = main.ONOSbench.onos_package()
66
67 main.step("Installing ONOS package")
68 onos_install_result = main.ONOSbench.onos_install()
69 onos1_isup = main.ONOSbench.isup()
70
71 main.step("Starting ONOS service")
72 start_result = main.ONOSbench.onos_start(ONOS1_ip)
73
andrewonlaba85a7762014-10-22 18:05:52 -040074 main.step("Setting cell for ONOScli")
75 main.ONOScli.set_cell(cell_name)
76
77 main.step("Starting ONOScli")
78 main.ONOScli.start_onos_cli(ONOS1_ip)
79
andrewonlab8d29f122014-10-22 17:15:04 -040080 case1_result = (clean_install_result and package_result and\
81 cell_result and verify_result and onos_install_result and\
82 onos1_isup and start_result )
83 utilities.assert_equals(expect=main.TRUE, actual=case1_result,
84 onpass="Test startup successful",
85 onfail="Test startup NOT successful")
86
87 time.sleep(10)
88
andrewonlaba85a7762014-10-22 18:05:52 -040089 def CASE2(self, main):
90 '''
91 Configure topology
92 '''
93 import time
94
95 ONOS1_ip = main.params['CTRL']['ip1']
96 default_sw_port = main.params['CTRL']['port1']
97
98 #Assign packet level switches to controller
99 main.Mininet1.assign_sw_controller(sw="1",
100 ip1=ONOS1_ip, port1=default_sw_port)
101 main.Mininet1.assign_sw_controller(sw="2",
102 ip1=ONOS1_ip, port1=default_sw_port)
103
104 #Check devices in controller
105 #This should include Linc-OE devices as well
106 devices = main.ONOScli.devices()
107 main.log.info(devices)
108
109 def CASE3(self, main):
110 '''
111 Install multi-layer intents
112 '''
113
andrewonlab8d29f122014-10-22 17:15:04 -0400114