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 *** |
| 27 | ${server_ip} localhost |
| 28 | ${timeout} 90s |
| 29 | ${num_onus} 1 |
| 30 | |
| 31 | *** Test Cases *** |
| 32 | Activate 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 | |
| 48 | Validate OLT Connected to ONOS |
| 49 | [Documentation] Verifies the BBSIM-OLT device is activated in onos |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame^] | 50 | [Tags] onosdevice |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 51 | Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS |
| 52 | |
| 53 | Check EAPOL Flows in ONOS |
| 54 | [Documentation] Validates eapol flows for the onu are pushed from voltha |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame^] | 55 | [Tags] eapol |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 56 | Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added |
| 57 | |
| 58 | Validate ONU Authenticated in ONOS |
| 59 | [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame^] | 60 | [Tags] aaa |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 61 | Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus} |
| 62 | |
| 63 | Provision 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 | |
| 67 | Validate 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 *** |
| 72 | Setup |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame^] | 73 | [Documentation] Setup environment |
| 74 | Check CLI Tools Configured |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 75 | ${onos_auth}= Create List karaf karaf |
| 76 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 77 | Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
| 78 | |
| 79 | Teardown |
| 80 | [Documentation] Delete all http sessions |
| 81 | Delete All Sessions |
| 82 | |
| 83 | BBSIM OLT Device in ONOS |
| 84 | [Documentation] Checks if bbsim olt has been connected to ONOS |
| 85 | ${resp}= Get Request ONOS onos/v1/devices |
| 86 | ${jsondata}= To Json ${resp.content} |
| 87 | Should Not Be Empty ${jsondata['devices']} |
| 88 | ${length}= Get Length ${jsondata['devices']} |
| 89 | @{serial_numbers}= Create List |
| 90 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 91 | \ ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 92 | \ ${sn}= Get From Dictionary ${value} serial |
| 93 | \ ${dpid}= Get From Dictionary ${value} id |
| 94 | Should Be Equal As Strings ${dpid} ${BBSIM_DEVICE_ID} |
| 95 | Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN} |
| 96 | |
| 97 | Verify Eapol Flows Added |
| 98 | [Arguments] ${expected_onus} |
| 99 | [Documentation] Matches for number of eapol flows based on number of onus |
| 100 | ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l |
| 101 | Should Contain ${eapol_flows_added} ${expected_onus} |
| 102 | |
| 103 | Verify Number of AAA-Users |
| 104 | [Arguments] ${expected_onus} |
| 105 | [Documentation] Matches for number of aaa-users authorized based on number of onus |
| 106 | ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l |
| 107 | Should Contain ${aaa_users} ${expected_onus} |