blob: ce107afafb646345e05f8768443243c886c05d6a [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
30${SADIS_CONFIG} ${CURDIR}/../data/sadis-notp-1.json
Kailash92764922019-07-25 08:21:39 -070031
32*** Test Cases ***
33Activate Device BBSIM OLT/ONU
34 [Documentation] Validate deployment ->
35 ... create and enable bbsim device ->
36 ... re-validate deployment
37 [Tags] activate
38 #create/preprovision device
Kailash0e2465c2019-08-05 09:56:02 -070039 ${rc} ${device_id}= Run and Return Rc and Output ${VOLTCTL_CONFIG} voltctl device create -t openolt -H ${BBSIM_SERVICE}:${BBSIM_PORT}
Kailash92764922019-07-25 08:21:39 -070040 Should Be Equal As Integers ${rc} 0
41 #enable device
Kailash0e2465c2019-08-05 09:56:02 -070042 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG} voltctl device enable ${device_id}
Kailash92764922019-07-25 08:21:39 -070043 Should Be Equal As Integers ${rc} 0
44 #validate olt states
45 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE REACHABLE
46 #validate onu states
47 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE REACHABLE
48
49Validate OLT Connected to ONOS
50 [Documentation] Verifies the BBSIM-OLT device is activated in onos
Kailash528f7c02019-07-31 10:55:49 -070051 [Tags] onosdevice
Kailash92764922019-07-25 08:21:39 -070052 Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS
53
54Check EAPOL Flows in ONOS
55 [Documentation] Validates eapol flows for the onu are pushed from voltha
Kailash528f7c02019-07-31 10:55:49 -070056 [Tags] eapol
Kailash92764922019-07-25 08:21:39 -070057 Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added
58
59Validate ONU Authenticated in ONOS
60 [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate
Kailash528f7c02019-07-31 10:55:49 -070061 [Tags] aaa
Kailash92764922019-07-25 08:21:39 -070062 Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus}
63
64Provision ONU Subscriber in ONOS
65 [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
66 [Tags] notready
67
68Validate DHCP Assignment in ONOS
69 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
70 [Tags] notready
71
72*** Keywords ***
73Setup
Kailash528f7c02019-07-31 10:55:49 -070074 [Documentation] Setup environment
Kailash0e2465c2019-08-05 09:56:02 -070075 Log Setting up
76 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
77 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
Kailash528f7c02019-07-31 10:55:49 -070078 Check CLI Tools Configured
Kailash92764922019-07-25 08:21:39 -070079 ${onos_auth}= Create List karaf karaf
80 ${HEADERS} Create Dictionary Content-Type=application/json
81 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Kailash0e2465c2019-08-05 09:56:02 -070082 ## TODO upload sadis ${sadis_config}
83
Kailash92764922019-07-25 08:21:39 -070084
85Teardown
86 [Documentation] Delete all http sessions
87 Delete All Sessions
88
89BBSIM OLT Device in ONOS
90 [Documentation] Checks if bbsim olt has been connected to ONOS
91 ${resp}= Get Request ONOS onos/v1/devices
92 ${jsondata}= To Json ${resp.content}
93 Should Not Be Empty ${jsondata['devices']}
94 ${length}= Get Length ${jsondata['devices']}
95 @{serial_numbers}= Create List
96 : FOR ${INDEX} IN RANGE 0 ${length}
97 \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
98 \ ${sn}= Get From Dictionary ${value} serial
99 \ ${dpid}= Get From Dictionary ${value} id
100 Should Be Equal As Strings ${dpid} ${BBSIM_DEVICE_ID}
101 Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN}
102
103Verify Eapol Flows Added
104 [Arguments] ${expected_onus}
105 [Documentation] Matches for number of eapol flows based on number of onus
106 ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l
107 Should Contain ${eapol_flows_added} ${expected_onus}
108
109Verify Number of AAA-Users
110 [Arguments] ${expected_onus}
111 [Documentation] Matches for number of aaa-users authorized based on number of onus
112 ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l
113 Should Contain ${aaa_users} ${expected_onus}