blob: bbbadc1a0dfb9dda48401bf90e97bb5a31af15d3 [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
Kailash6f5acb62019-08-28 14:38:45 -070021Resource ${CURDIR}/../../libraries/onos.robot
22Resource ${CURDIR}/../../libraries/voltctl.robot
Kailash92764922019-07-25 08:21:39 -070023Resource ${CURDIR}/../../libraries/utils.robot
24Resource ${CURDIR}/../../variables/variables.robot
25Suite Setup Setup
26Suite Teardown Teardown
27
28*** Variables ***
Kailash0e2465c2019-08-05 09:56:02 -070029${server_ip} localhost
30${timeout} 90s
31${num_onus} 1
Kailash92764922019-07-25 08:21:39 -070032
33*** Test Cases ***
34Activate Device BBSIM OLT/ONU
35 [Documentation] Validate deployment ->
36 ... create and enable bbsim device ->
37 ... re-validate deployment
Kailash9b50efc2019-08-06 22:01:45 -070038 [Tags] sanity
Kailash92764922019-07-25 08:21:39 -070039 #create/preprovision device
Kailash6f5acb62019-08-28 14:38:45 -070040 ${olt_device_id}= Create Device ${BBSIM_IP} ${BBSIM_PORT}
Kailashce305012019-08-05 13:15:52 -070041 Set Suite Variable ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070042 #enable device
Kailash6f5acb62019-08-28 14:38:45 -070043 Enable Device ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070044 #validate olt states
45 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE REACHABLE
46 #validate onu states
Kailash6f5acb62019-08-28 14:38:45 -070047 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE REACHABLE onu=True onu_reason=tech-profile-config-download-success
Kailashce305012019-08-05 13:15:52 -070048 #get onu device id
49 ${onu_device_id}= Get Device ID From SN ${BBSIM_ONU_SN}
50 Set Suite Variable ${onu_device_id}
Kailash92764922019-07-25 08:21:39 -070051
52Validate OLT Connected to ONOS
53 [Documentation] Verifies the BBSIM-OLT device is activated in onos
Kailash9b50efc2019-08-06 22:01:45 -070054 [Tags] sanity
Kailash57210eb2019-08-30 13:27:19 -070055 ${of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${BBSIM_OLT_SN}
Kailash6bef9842019-09-03 08:27:20 -070056 Set Suite Variable ${of_id}
Kailash92764922019-07-25 08:21:39 -070057
58Check EAPOL Flows in ONOS
59 [Documentation] Validates eapol flows for the onu are pushed from voltha
Andy Bavierb0c06232019-08-29 12:58:53 -070060 [Tags] sanity
61 ${num_flows}= Evaluate ${num_onus} * 4
62 ${flows_str}= Convert To String ${num_flows}
63 Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added ${server_ip} ${ONOS_SSH_PORT} ${flows_str}
Kailash92764922019-07-25 08:21:39 -070064
65Validate ONU Authenticated in ONOS
66 [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate
Kailash9b50efc2019-08-06 22:01:45 -070067 [Tags] sanity
Kailash2b963f02019-08-28 22:46:33 -070068 Wait Until Keyword Succeeds ${timeout} 1s Verify Number of AAA-Users ${server_ip} ${ONOS_SSH_PORT} ${num_onus}
Kailash9b50efc2019-08-06 22:01:45 -070069
70Add Subscriber-Access in ONOS
71 [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
72 [Tags] sanity
73 ## TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes
74 ... prior to to dhclient starting. possible start a process after first test case to just attempt
75 ... "volt-add-subscriber-access" to all onus periodically?
Kailash6f5acb62019-08-28 14:38:45 -070076 ${output}= Execute ONOS Command ${server_ip} ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} 16
Kailash9b50efc2019-08-06 22:01:45 -070077 Log ${output}
Kailash92764922019-07-25 08:21:39 -070078
79Validate DHCP Assignment in ONOS
80 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
Kailash9b50efc2019-08-06 22:01:45 -070081 [Tags] sanity
Kailash2b963f02019-08-28 22:46:33 -070082 Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${server_ip} ${ONOS_SSH_PORT} ${num_onus}
Kailashce305012019-08-05 13:15:52 -070083
84Delete Device and Verify
85 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Kailash9b50efc2019-08-06 22:01:45 -070086 [Tags] VOL-1705
Kailashce305012019-08-05 13:15:52 -070087 #disable/delete onu
88 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
89 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070090 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070091 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
92 Should Be Equal As Integers ${rc} 0
93 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id}
94 #disable/delete olt
95 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
96 Should Be Equal As Integers ${rc} 0
Kailash1a871bf2019-08-05 14:20:02 -070097 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN REACHABLE
Kailashce305012019-08-05 13:15:52 -070098 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
99 Should Be Equal As Integers ${rc} 0
100 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -0700101
102*** Keywords ***
103Setup
Kailash528f7c02019-07-31 10:55:49 -0700104 [Documentation] Setup environment
Kailash0e2465c2019-08-05 09:56:02 -0700105 Log Setting up
106 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
107 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
Kailash528f7c02019-07-31 10:55:49 -0700108 Check CLI Tools Configured
Kailash92764922019-07-25 08:21:39 -0700109 ${onos_auth}= Create List karaf karaf
110 ${HEADERS} Create Dictionary Content-Type=application/json
111 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Kailash92764922019-07-25 08:21:39 -0700112
113Teardown
114 [Documentation] Delete all http sessions
Andy Bavierb0c06232019-08-29 12:58:53 -0700115 Delete All Sessions