blob: 78364d65b7e046d62c0d63bbb02c53642f06b3a2 [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
Zack Williamsec53a1b2019-09-16 15:50:52 -070020Suite Setup Setup
21Suite Teardown Teardown
22Test Teardown Execute ONOS CLI Command ${server_ip} ${ONOS_SSH_PORT} flows -s
Kailash92764922019-07-25 08:21:39 -070023Library OperatingSystem
David Bainbridge152bf5a2019-10-07 18:38:32 +000024Library ${CURDIR}/../../libraries/DependencyLibrary.py
Kailash6f5acb62019-08-28 14:38:45 -070025Resource ${CURDIR}/../../libraries/onos.robot
26Resource ${CURDIR}/../../libraries/voltctl.robot
Kailash92764922019-07-25 08:21:39 -070027Resource ${CURDIR}/../../libraries/utils.robot
David Bainbridge117d23e2019-09-30 20:37:51 +000028Resource ${CURDIR}/../../libraries/k8s.robot
Kailash92764922019-07-25 08:21:39 -070029Resource ${CURDIR}/../../variables/variables.robot
Kailash92764922019-07-25 08:21:39 -070030
31*** Variables ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070032${server_ip} localhost
David Bainbridge117d23e2019-09-30 20:37:51 +000033${timeout} 240s
Zack Williamsec53a1b2019-09-16 15:50:52 -070034${num_onus} 1
Kailash92764922019-07-25 08:21:39 -070035
36*** Test Cases ***
37Activate Device BBSIM OLT/ONU
38 [Documentation] Validate deployment ->
39 ... create and enable bbsim device ->
40 ... re-validate deployment
Kailash9b50efc2019-08-06 22:01:45 -070041 [Tags] sanity
Kailash92764922019-07-25 08:21:39 -070042 #create/preprovision device
David Bainbridge117d23e2019-09-30 20:37:51 +000043 ${bbsim_ip}= Lookup Service IP voltha bbsim
44 ${bbsim_port}= Lookup Service Port voltha bbsim
45 ${olt_device_id}= Create Device ${bbsim_ip} ${bbsim_port}
Kailashce305012019-08-05 13:15:52 -070046 Set Suite Variable ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070047 #enable device
Kailash6f5acb62019-08-28 14:38:45 -070048 Enable Device ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -070049 #validate olt states
Zack Williamsec53a1b2019-09-16 15:50:52 -070050 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE
51 ... REACHABLE
Kailash92764922019-07-25 08:21:39 -070052 #validate onu states
Zack Williamsec53a1b2019-09-16 15:50:52 -070053 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE
54 ... REACHABLE onu=True onu_reason=tech-profile-config-download-success
Kailashce305012019-08-05 13:15:52 -070055 #get onu device id
56 ${onu_device_id}= Get Device ID From SN ${BBSIM_ONU_SN}
57 Set Suite Variable ${onu_device_id}
Kailash92764922019-07-25 08:21:39 -070058
59Validate OLT Connected to ONOS
60 [Documentation] Verifies the BBSIM-OLT device is activated in onos
Kailash9b50efc2019-08-06 22:01:45 -070061 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000062 [Setup] Require test case Activate Device BBSIM OLT/ONU
Kailash57210eb2019-08-30 13:27:19 -070063 ${of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${BBSIM_OLT_SN}
Kailash6bef9842019-09-03 08:27:20 -070064 Set Suite Variable ${of_id}
Kailash92764922019-07-25 08:21:39 -070065
66Check EAPOL Flows in ONOS
67 [Documentation] Validates eapol flows for the onu are pushed from voltha
Andy Bavierb0c06232019-08-29 12:58:53 -070068 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000069 [Setup] Require test case Validate OLT Connected to ONOS
Andy Bavierb0c06232019-08-29 12:58:53 -070070 ${num_flows}= Evaluate ${num_onus} * 4
71 ${flows_str}= Convert To String ${num_flows}
72 Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added ${server_ip} ${ONOS_SSH_PORT} ${flows_str}
Kailash92764922019-07-25 08:21:39 -070073
74Validate ONU Authenticated in ONOS
75 [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate
Kailash9b50efc2019-08-06 22:01:45 -070076 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000077 [Setup] Require test case Check EAPOL Flows in ONOS
Kailash2b963f02019-08-28 22:46:33 -070078 Wait Until Keyword Succeeds ${timeout} 1s Verify Number of AAA-Users ${server_ip} ${ONOS_SSH_PORT} ${num_onus}
Kailash9b50efc2019-08-06 22:01:45 -070079
80Add Subscriber-Access in ONOS
81 [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
82 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000083 [Setup] Require test case Validate ONU Authenticated in ONOS
Zack Williamsec53a1b2019-09-16 15:50:52 -070084 ## TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes
85 ## prior to to dhclient starting. possible start a process after first test case to just attempt
86 ## "volt-add-subscriber-access" to all onus periodically?
Kailash30c418f2019-09-11 13:50:10 -070087 ${output}= Execute ONOS CLI Command ${server_ip} ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} 16
Kailash9b50efc2019-08-06 22:01:45 -070088 Log ${output}
Kailash92764922019-07-25 08:21:39 -070089
90Validate DHCP Assignment in ONOS
91 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
Kailash9b50efc2019-08-06 22:01:45 -070092 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000093 [Setup] Require test case Add Subscriber-Access in ONOS
Zack Williamsec53a1b2019-09-16 15:50:52 -070094 Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${server_ip} ${ONOS_SSH_PORT} ${num_onus}
Kailashce305012019-08-05 13:15:52 -070095
96Delete Device and Verify
97 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Andy Bavier5026a452019-09-20 13:09:05 -070098 [Tags] sanity
David Bainbridge152bf5a2019-10-07 18:38:32 +000099 [Setup] Require test case Activate Device BBSIM OLT/ONU
Kailashce305012019-08-05 13:15:52 -0700100 #disable/delete onu
101 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
102 Should Be Equal As Integers ${rc} 0
Zack Williamsec53a1b2019-09-16 15:50:52 -0700103 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN
104 ... REACHABLE
Kailashce305012019-08-05 13:15:52 -0700105 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
106 Should Be Equal As Integers ${rc} 0
107 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id}
108 #disable/delete olt
109 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
110 Should Be Equal As Integers ${rc} 0
Zack Williamsec53a1b2019-09-16 15:50:52 -0700111 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN
112 ... REACHABLE
Kailashce305012019-08-05 13:15:52 -0700113 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
114 Should Be Equal As Integers ${rc} 0
115 Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id}
Kailash92764922019-07-25 08:21:39 -0700116
117*** Keywords ***
118Setup
Kailash528f7c02019-07-31 10:55:49 -0700119 [Documentation] Setup environment
Kailash0e2465c2019-08-05 09:56:02 -0700120 Log Setting up
121 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
122 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
Kailash528f7c02019-07-31 10:55:49 -0700123 Check CLI Tools Configured
Kailash92764922019-07-25 08:21:39 -0700124 ${onos_auth}= Create List karaf karaf
125 ${HEADERS} Create Dictionary Content-Type=application/json
126 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Kailash92764922019-07-25 08:21:39 -0700127
128Teardown
129 [Documentation] Delete all http sessions
Andy Bavierb0c06232019-08-29 12:58:53 -0700130 Delete All Sessions