blob: 7f6295f4246031414af8c365afc6ddbc7df8cb1a [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 ***
27${server_ip} localhost
28${timeout} 90s
29${num_onus} 1
30
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
38 ${rc} ${device_id}= Run and Return Rc and Output voltctl device create -t openolt -H ${BBSIM_SERVICE}:${BBSIM_PORT}
39 Should Be Equal As Integers ${rc} 0
40 #enable device
41 ${rc} ${output}= Run and Return Rc and Output voltctl device enable ${device_id}
42 Should Be Equal As Integers ${rc} 0
43 #validate olt states
44 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE REACHABLE
45 #validate onu states
46 Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE REACHABLE
47
48Validate OLT Connected to ONOS
49 [Documentation] Verifies the BBSIM-OLT device is activated in onos
50 [Tags] notready
51 Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS
52
53Check EAPOL Flows in ONOS
54 [Documentation] Validates eapol flows for the onu are pushed from voltha
55 [Tags] notready
56 Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added
57
58Validate ONU Authenticated in ONOS
59 [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate
60 [Tags] notready
61 Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus}
62
63Provision ONU Subscriber in ONOS
64 [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
65 [Tags] notready
66
67Validate DHCP Assignment in ONOS
68 [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
69 [Tags] notready
70
71*** Keywords ***
72Setup
73 [Documentation] Create HTTP Session with the ONOS Controller
74 ${onos_auth}= Create List karaf karaf
75 ${HEADERS} Create Dictionary Content-Type=application/json
76 Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
77
78Teardown
79 [Documentation] Delete all http sessions
80 Delete All Sessions
81
82BBSIM OLT Device in ONOS
83 [Documentation] Checks if bbsim olt has been connected to ONOS
84 ${resp}= Get Request ONOS onos/v1/devices
85 ${jsondata}= To Json ${resp.content}
86 Should Not Be Empty ${jsondata['devices']}
87 ${length}= Get Length ${jsondata['devices']}
88 @{serial_numbers}= Create List
89 : FOR ${INDEX} IN RANGE 0 ${length}
90 \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
91 \ ${sn}= Get From Dictionary ${value} serial
92 \ ${dpid}= Get From Dictionary ${value} id
93 Should Be Equal As Strings ${dpid} ${BBSIM_DEVICE_ID}
94 Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN}
95
96Verify Eapol Flows Added
97 [Arguments] ${expected_onus}
98 [Documentation] Matches for number of eapol flows based on number of onus
99 ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l
100 Should Contain ${eapol_flows_added} ${expected_onus}
101
102Verify Number of AAA-Users
103 [Arguments] ${expected_onus}
104 [Documentation] Matches for number of aaa-users authorized based on number of onus
105 ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l
106 Should Contain ${aaa_users} ${expected_onus}