Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 1 | # 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 *** |
| 17 | Documentation 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 |
| 20 | Library OperatingSystem |
| 21 | Resource ${CURDIR}/../../libraries/utils.robot |
| 22 | Resource ${CURDIR}/../../variables/variables.robot |
| 23 | Suite Setup Setup |
| 24 | Suite Teardown Teardown |
| 25 | |
| 26 | *** Variables *** |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame^] | 27 | ${server_ip} localhost |
| 28 | ${timeout} 90s |
| 29 | ${num_onus} 1 |
| 30 | ${SADIS_CONFIG} ${CURDIR}/../data/sadis-notp-1.json |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 31 | |
| 32 | *** Test Cases *** |
| 33 | Activate 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 |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame^] | 39 | ${rc} ${device_id}= Run and Return Rc and Output ${VOLTCTL_CONFIG} voltctl device create -t openolt -H ${BBSIM_SERVICE}:${BBSIM_PORT} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 40 | Should Be Equal As Integers ${rc} 0 |
| 41 | #enable device |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame^] | 42 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG} voltctl device enable ${device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 43 | 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 | |
| 49 | Validate OLT Connected to ONOS |
| 50 | [Documentation] Verifies the BBSIM-OLT device is activated in onos |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 51 | [Tags] onosdevice |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 52 | Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS |
| 53 | |
| 54 | Check EAPOL Flows in ONOS |
| 55 | [Documentation] Validates eapol flows for the onu are pushed from voltha |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 56 | [Tags] eapol |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 57 | Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added |
| 58 | |
| 59 | Validate ONU Authenticated in ONOS |
| 60 | [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 61 | [Tags] aaa |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 62 | Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus} |
| 63 | |
| 64 | Provision 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 | |
| 68 | Validate 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 *** |
| 73 | Setup |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 74 | [Documentation] Setup environment |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame^] | 75 | Log Setting up |
| 76 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
| 77 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 78 | Check CLI Tools Configured |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 79 | ${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} |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame^] | 82 | ## TODO upload sadis ${sadis_config} |
| 83 | |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 84 | |
| 85 | Teardown |
| 86 | [Documentation] Delete all http sessions |
| 87 | Delete All Sessions |
| 88 | |
| 89 | BBSIM 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 | |
| 103 | Verify 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 | |
| 109 | Verify 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} |