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 |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 30 | |
| 31 | *** Test Cases *** |
| 32 | Activate Device BBSIM OLT/ONU |
| 33 | [Documentation] Validate deployment -> |
| 34 | ... create and enable bbsim device -> |
| 35 | ... re-validate deployment |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 36 | [Tags] sanity |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 37 | #create/preprovision device |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 38 | ${rc} ${olt_device_id}= Run and Return Rc and Output |
| 39 | ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${BBSIM_IP}:${BBSIM_PORT} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 40 | Should Be Equal As Integers ${rc} 0 |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 41 | Set Suite Variable ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 42 | #enable device |
Kailash | 1a871bf | 2019-08-05 14:20:02 -0700 | [diff] [blame] | 43 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 44 | Should Be Equal As Integers ${rc} 0 |
| 45 | #validate olt states |
| 46 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE REACHABLE |
| 47 | #validate onu states |
| 48 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE REACHABLE |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 49 | #get onu device id |
| 50 | ${onu_device_id}= Get Device ID From SN ${BBSIM_ONU_SN} |
| 51 | Set Suite Variable ${onu_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 52 | |
| 53 | Validate OLT Connected to ONOS |
| 54 | [Documentation] Verifies the BBSIM-OLT device is activated in onos |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 55 | [Tags] sanity |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 56 | Wait Until Keyword Succeeds ${timeout} 5s BBSIM OLT Device in ONOS |
| 57 | |
| 58 | Check EAPOL Flows in ONOS |
| 59 | [Documentation] Validates eapol flows for the onu are pushed from voltha |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 60 | [Tags] sanity notready |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 61 | Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added ${num_onus} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 62 | |
| 63 | Validate ONU Authenticated in ONOS |
| 64 | [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 65 | [Tags] sanity |
| 66 | Wait Until Keyword Succeeds ${timeout} 1s Verify Number of AAA-Users ${num_onus} |
| 67 | |
| 68 | Add Subscriber-Access in ONOS |
| 69 | [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows |
| 70 | [Tags] sanity |
| 71 | ## TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes |
| 72 | ... prior to to dhclient starting. possible start a process after first test case to just attempt |
| 73 | ... "volt-add-subscriber-access" to all onus periodically? |
| 74 | ${output}= Execute ONOS Command volt-add-subscriber-access ${of_id} 16 |
| 75 | Log ${output} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 76 | |
| 77 | Validate DHCP Assignment in ONOS |
| 78 | [Documentation] After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU. |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 79 | [Tags] sanity |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 80 | Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${num_onus} |
| 81 | |
| 82 | Delete Device and Verify |
| 83 | [Documentation] Disable -> Delete devices via voltctl and verify its removed |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 84 | [Tags] VOL-1705 |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 85 | #disable/delete onu |
| 86 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id} |
| 87 | Should Be Equal As Integers ${rc} 0 |
Kailash | 1a871bf | 2019-08-05 14:20:02 -0700 | [diff] [blame] | 88 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN REACHABLE |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 89 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id} |
| 90 | Should Be Equal As Integers ${rc} 0 |
| 91 | Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id} |
| 92 | #disable/delete olt |
| 93 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 94 | Should Be Equal As Integers ${rc} 0 |
Kailash | 1a871bf | 2019-08-05 14:20:02 -0700 | [diff] [blame] | 95 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN REACHABLE |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 96 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 97 | Should Be Equal As Integers ${rc} 0 |
| 98 | Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 99 | |
| 100 | *** Keywords *** |
| 101 | Setup |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 102 | [Documentation] Setup environment |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame] | 103 | Log Setting up |
| 104 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
| 105 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 106 | Check CLI Tools Configured |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 107 | ${onos_auth}= Create List karaf karaf |
| 108 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 109 | Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 110 | |
| 111 | Teardown |
| 112 | [Documentation] Delete all http sessions |
| 113 | Delete All Sessions |
| 114 | |
| 115 | BBSIM OLT Device in ONOS |
| 116 | [Documentation] Checks if bbsim olt has been connected to ONOS |
| 117 | ${resp}= Get Request ONOS onos/v1/devices |
| 118 | ${jsondata}= To Json ${resp.content} |
| 119 | Should Not Be Empty ${jsondata['devices']} |
| 120 | ${length}= Get Length ${jsondata['devices']} |
| 121 | @{serial_numbers}= Create List |
| 122 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 123 | \ ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 124 | \ ${sn}= Get From Dictionary ${value} serial |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 125 | \ ${of_id}= Get From Dictionary ${value} id |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 126 | Should Be Equal As Strings ${sn} ${BBSIM_OLT_SN} |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 127 | Set Suite Variable ${of_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 128 | |
| 129 | Verify Eapol Flows Added |
| 130 | [Arguments] ${expected_onus} |
| 131 | [Documentation] Matches for number of eapol flows based on number of onus |
| 132 | ${eapol_flows_added}= Execute ONOS Command flows -s -f ADDED | grep eapol | wc -l |
| 133 | Should Contain ${eapol_flows_added} ${expected_onus} |
| 134 | |
| 135 | Verify Number of AAA-Users |
| 136 | [Arguments] ${expected_onus} |
| 137 | [Documentation] Matches for number of aaa-users authorized based on number of onus |
| 138 | ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 139 | Should Contain ${aaa_users} ${expected_onus} |
| 140 | |
| 141 | Validate DHCP Allocations |
| 142 | [Arguments] ${expected_onus} |
| 143 | [Documentation] Matches for number of dhcpacks based on number of onus |
| 144 | ${allocations}= Execute ONOS Command dhcpl2relay-allocations | grep DHCPACK | wc -l |
| 145 | Should Contain ${allocations} ${expected_onus} |