blob: 6452be6fda7270e45737813f6f010bf3d75c9a70 [file] [log] [blame]
Kailash92764922019-07-25 08:21:39 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16*** Settings ***
17Documentation Creates bbsim olt/onu and validates activataion
18... Assumes voltha-go, go-based onu/olt adapters, and bbsim are installed
19... voltctl and kubectl should be configured prior to running these tests
20Library OperatingSystem
21Resource ${CURDIR}/../../libraries/utils.robot
22Resource ${CURDIR}/../../variables/variables.robot
23Suite Setup Setup
24Suite Teardown Teardown
25
26*** Variables ***
Kailash0e2465c2019-08-05 09:56:02 -070027${server_ip} localhost
28${timeout} 90s
29${num_onus} 1
Kailash92764922019-07-25 08:21:39 -070030
31*** Test Cases ***
32Activate Device BBSIM OLT/ONU
33 [Documentation] Validate deployment ->
34 ... create and enable bbsim device ->
35 ... re-validate deployment
Kailash9b50efc2019-08-06 22:01:45 -070036 [Tags] sanity
Kailash92764922019-07-25 08:21:39 -070037 #create/preprovision device
Kailashce305012019-08-05 13:15:52 -070038 ${rc} ${olt_device_id}= Run and Return Rc and Output
39 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${BBSIM_IP}:${BBSIM_PORT}
Kailash92764922019-07-25 08:21:39 -070040 Should Be Equal As Integers ${rc} 0
Kailashce305012019-08-05 13:15:52 -070041 Set Suite Variable ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070042 #enable device
Kailash1a871bf2019-08-05 14:20:02 -070043 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070044 Should Be Equal As Integers ${rc} 0
45 #validate olt states
46 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE REACHABLE
47 #validate onu states
48 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE REACHABLE
Kailashce305012019-08-05 13:15:52 -070049 #get onu device id
50 ${onu_device_id}= Get Device ID From SN ${BBSIM_ONU_SN}
51 Set Suite Variable ${onu_device_id}
Kailash92764922019-07-25 08:21:39 -070052
53Validate OLT Connected to ONOS
54 [Documentation] Verifies the BBSIM-OLT device is activated in onos
Kailash9b50efc2019-08-06 22:01:45 -070055 [Tags] sanity
Kailash92764922019-07-25 08:21:39 -070056 Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS
57
58Check EAPOL Flows in ONOS
59 [Documentation] Validates eapol flows for the onu are pushed from voltha
Kailash9b50efc2019-08-06 22:01:45 -070060 [Tags] sanity notready
Kailashce305012019-08-05 13:15:52 -070061 Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added ${num_onus}
Kailash92764922019-07-25 08:21:39 -070062
63Validate ONU Authenticated in ONOS
64 [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate
Kailash9b50efc2019-08-06 22:01:45 -070065 [Tags] sanity
66 Wait Until Keyword Succeeds ${timeout} 1s Verify Number of AAA-Users ${num_onus}
67
68Add Subscriber-Access in ONOS
69 [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
70 [Tags] sanity
71 ## TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes
72 ... prior to to dhclient starting. possible start a process after first test case to just attempt
73 ... "volt-add-subscriber-access" to all onus periodically?
74 ${output}= Execute ONOS Command volt-add-subscriber-access ${of_id} 16
75 Log ${output}
Kailash92764922019-07-25 08:21:39 -070076
77Validate DHCP Assignment in ONOS
78 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
Kailash9b50efc2019-08-06 22:01:45 -070079 [Tags] sanity
Kailashce305012019-08-05 13:15:52 -070080 Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${num_onus}
81
82Delete Device and Verify
83 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Kailash9b50efc2019-08-06 22:01:45 -070084 [Tags] VOL-1705
Kailashce305012019-08-05 13:15:52 -070085 #disable/delete onu
86 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
87 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070088 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070089 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
90 Should Be Equal As Integers ${rc} 0
91 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id}
92 #disable/delete olt
93 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
94 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070095 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070096 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
97 Should Be Equal As Integers ${rc} 0
98 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070099
100*** Keywords ***
101Setup
Kailash528f7c02019-07-31 10:55:49 -0700102 [Documentation] Setup environment
Kailash0e2465c2019-08-05 09:56:02 -0700103 Log Setting up
104 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
105 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
Kailash528f7c02019-07-31 10:55:49 -0700106 Check CLI Tools Configured
Kailash92764922019-07-25 08:21:39 -0700107 ${onos_auth}= Create List karaf karaf
108 ${HEADERS} Create Dictionary Content-Type=application/json
109 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Kailash92764922019-07-25 08:21:39 -0700110
111Teardown
112 [Documentation] Delete all http sessions
113 Delete All Sessions
114
115BBSIM OLT Device in ONOS
116 [Documentation] Checks if bbsim olt has been connected to ONOS
117 ${resp}= Get Request ONOS onos/v1/devices
118 ${jsondata}= To Json ${resp.content}
119 Should Not Be Empty ${jsondata['devices']}
120 ${length}= Get Length ${jsondata['devices']}
121 @{serial_numbers}= Create List
122 : FOR ${INDEX} IN RANGE 0 ${length}
123 \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
124 \ ${sn}= Get From Dictionary ${value} serial
Kailash9b50efc2019-08-06 22:01:45 -0700125 \ ${of_id}= Get From Dictionary ${value} id
Kailash92764922019-07-25 08:21:39 -0700126 Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN}
Kailash9b50efc2019-08-06 22:01:45 -0700127 Set Suite Variable ${of_id}
Kailash92764922019-07-25 08:21:39 -0700128
129Verify Eapol Flows Added
130 [Arguments] ${expected_onus}
131 [Documentation] Matches for number of eapol flows based on number of onus
132 ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l
133 Should Contain ${eapol_flows_added} ${expected_onus}
134
135Verify Number of AAA-Users
136 [Arguments] ${expected_onus}
137 [Documentation] Matches for number of aaa-users authorized based on number of onus
138 ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l
Kailashce305012019-08-05 13:15:52 -0700139 Should Contain ${aaa_users} ${expected_onus}
140
141Validate DHCP Allocations
142 [Arguments] ${expected_onus}
143 [Documentation] Matches for number of dhcpacks based on number of onus
144 ${allocations}= Execute ONOS Command dhcpl2relay-allocations | grep DHCPACK | wc -l
145 Should Contain ${allocations} ${expected_onus}