blob: d74b23030d4071f55728054e3c41a7c7b1d9b929 [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
36 [Tags] activate
37 #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
Kailash528f7c02019-07-31 10:55:49 -070055 [Tags] onosdevice
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
Kailash1a871bf2019-08-05 14:20:02 -070060 [Tags] eapol 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
Kailash528f7c02019-07-31 10:55:49 -070065 [Tags] aaa
Kailashce305012019-08-05 13:15:52 -070066 Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${num_onus}
Kailash92764922019-07-25 08:21:39 -070067
68Validate DHCP Assignment in ONOS
69 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
Kailashce305012019-08-05 13:15:52 -070070 [Tags] dhcp
71 Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${num_onus}
72
73Delete Device and Verify
74 [Documentation] Disable -> Delete devices via voltctl and verify its removed
75 [Tags] deletedevice
76 #disable/delete onu
77 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
78 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070079 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070080 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
81 Should Be Equal As Integers ${rc} 0
82 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id}
83 #disable/delete olt
84 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
85 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070086 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070087 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
88 Should Be Equal As Integers ${rc} 0
89 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070090
91*** Keywords ***
92Setup
Kailash528f7c02019-07-31 10:55:49 -070093 [Documentation] Setup environment
Kailash0e2465c2019-08-05 09:56:02 -070094 Log Setting up
95 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
96 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
Kailash528f7c02019-07-31 10:55:49 -070097 Check CLI Tools Configured
Kailash92764922019-07-25 08:21:39 -070098 ${onos_auth}= Create List karaf karaf
99 ${HEADERS} Create Dictionary Content-Type=application/json
100 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Kailash92764922019-07-25 08:21:39 -0700101
102Teardown
103 [Documentation] Delete all http sessions
104 Delete All Sessions
105
106BBSIM OLT Device in ONOS
107 [Documentation] Checks if bbsim olt has been connected to ONOS
108 ${resp}= Get Request ONOS onos/v1/devices
109 ${jsondata}= To Json ${resp.content}
110 Should Not Be Empty ${jsondata['devices']}
111 ${length}= Get Length ${jsondata['devices']}
112 @{serial_numbers}= Create List
113 : FOR ${INDEX} IN RANGE 0 ${length}
114 \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
115 \ ${sn}= Get From Dictionary ${value} serial
Kailash92764922019-07-25 08:21:39 -0700116 Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN}
117
118Verify Eapol Flows Added
119 [Arguments] ${expected_onus}
120 [Documentation] Matches for number of eapol flows based on number of onus
121 ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l
122 Should Contain ${eapol_flows_added} ${expected_onus}
123
124Verify Number of AAA-Users
125 [Arguments] ${expected_onus}
126 [Documentation] Matches for number of aaa-users authorized based on number of onus
127 ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l
Kailashce305012019-08-05 13:15:52 -0700128 Should Contain ${aaa_users} ${expected_onus}
129
130Validate DHCP Allocations
131 [Arguments] ${expected_onus}
132 [Documentation] Matches for number of dhcpacks based on number of onus
133 ${allocations}= Execute ONOS Command dhcpl2relay-allocations | grep DHCPACK | wc -l
134 Should Contain ${allocations} ${expected_onus}