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 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 20 | Suite Setup Setup |
| 21 | Suite Teardown Teardown |
| 22 | Test Teardown Execute ONOS CLI Command ${server_ip} ${ONOS_SSH_PORT} flows -s |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 23 | Library OperatingSystem |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 24 | Resource ${CURDIR}/../../libraries/onos.robot |
| 25 | Resource ${CURDIR}/../../libraries/voltctl.robot |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 26 | Resource ${CURDIR}/../../libraries/utils.robot |
David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame^] | 27 | Resource ${CURDIR}/../../libraries/k8s.robot |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 28 | Resource ${CURDIR}/../../variables/variables.robot |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 29 | |
| 30 | *** Variables *** |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 31 | ${server_ip} localhost |
David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame^] | 32 | ${timeout} 240s |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 33 | ${num_onus} 1 |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 34 | |
| 35 | *** Test Cases *** |
| 36 | Activate Device BBSIM OLT/ONU |
| 37 | [Documentation] Validate deployment -> |
| 38 | ... create and enable bbsim device -> |
| 39 | ... re-validate deployment |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 40 | [Tags] sanity |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 41 | #create/preprovision device |
David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame^] | 42 | ${bbsim_ip}= Lookup Service IP voltha bbsim |
| 43 | ${bbsim_port}= Lookup Service Port voltha bbsim |
| 44 | ${olt_device_id}= Create Device ${bbsim_ip} ${bbsim_port} |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 45 | Set Suite Variable ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 46 | #enable device |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 47 | Enable Device ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 48 | #validate olt states |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 49 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} ENABLED ACTIVE |
| 50 | ... REACHABLE |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 51 | #validate onu states |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 52 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} ENABLED ACTIVE |
| 53 | ... REACHABLE onu=True onu_reason=tech-profile-config-download-success |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 54 | #get onu device id |
| 55 | ${onu_device_id}= Get Device ID From SN ${BBSIM_ONU_SN} |
| 56 | Set Suite Variable ${onu_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 57 | |
| 58 | Validate OLT Connected to ONOS |
| 59 | [Documentation] Verifies the BBSIM-OLT device is activated in onos |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 60 | [Tags] sanity |
Kailash | 57210eb | 2019-08-30 13:27:19 -0700 | [diff] [blame] | 61 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${BBSIM_OLT_SN} |
Kailash | 6bef984 | 2019-09-03 08:27:20 -0700 | [diff] [blame] | 62 | Set Suite Variable ${of_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 63 | |
| 64 | Check EAPOL Flows in ONOS |
| 65 | [Documentation] Validates eapol flows for the onu are pushed from voltha |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 66 | [Tags] sanity |
| 67 | ${num_flows}= Evaluate ${num_onus} * 4 |
| 68 | ${flows_str}= Convert To String ${num_flows} |
| 69 | Wait Until Keyword Succeeds ${timeout} 5s Verify Eapol Flows Added ${server_ip} ${ONOS_SSH_PORT} ${flows_str} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 70 | |
| 71 | Validate ONU Authenticated in ONOS |
| 72 | [Documentation] Validates onu is AUTHORIZED in ONOS as bbsim will attempt to authenticate |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 73 | [Tags] sanity |
Kailash | 2b963f0 | 2019-08-28 22:46:33 -0700 | [diff] [blame] | 74 | Wait Until Keyword Succeeds ${timeout} 1s Verify Number of AAA-Users ${server_ip} ${ONOS_SSH_PORT} ${num_onus} |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 75 | |
| 76 | Add Subscriber-Access in ONOS |
| 77 | [Documentation] Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows |
| 78 | [Tags] sanity |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 79 | ## TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes |
| 80 | ## prior to to dhclient starting. possible start a process after first test case to just attempt |
| 81 | ## "volt-add-subscriber-access" to all onus periodically? |
Kailash | 30c418f | 2019-09-11 13:50:10 -0700 | [diff] [blame] | 82 | ${output}= Execute ONOS CLI Command ${server_ip} ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} 16 |
Kailash | 9b50efc | 2019-08-06 22:01:45 -0700 | [diff] [blame] | 83 | Log ${output} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 84 | |
| 85 | Validate DHCP Assignment in ONOS |
| 86 | [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] | 87 | [Tags] sanity |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 88 | Wait Until Keyword Succeeds 120s 15s Validate DHCP Allocations ${server_ip} ${ONOS_SSH_PORT} ${num_onus} |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 89 | |
| 90 | Delete Device and Verify |
| 91 | [Documentation] Disable -> Delete devices via voltctl and verify its removed |
Andy Bavier | 5026a45 | 2019-09-20 13:09:05 -0700 | [diff] [blame] | 92 | [Tags] sanity |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 93 | #disable/delete onu |
| 94 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id} |
| 95 | Should Be Equal As Integers ${rc} 0 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 96 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_ONU_SN} DISABLED UNKNOWN |
| 97 | ... REACHABLE |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 98 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id} |
| 99 | Should Be Equal As Integers ${rc} 0 |
| 100 | Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${onu_device_id} |
| 101 | #disable/delete olt |
| 102 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 103 | Should Be Equal As Integers ${rc} 0 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 104 | Wait Until Keyword Succeeds 60s 5s Validate Device ${BBSIM_OLT_SN} DISABLED UNKNOWN |
| 105 | ... REACHABLE |
Kailash | ce30501 | 2019-08-05 13:15:52 -0700 | [diff] [blame] | 106 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 107 | Should Be Equal As Integers ${rc} 0 |
| 108 | Wait Until Keyword Succeeds 60s 5s Validate Device Removed ${olt_device_id} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 109 | |
| 110 | *** Keywords *** |
| 111 | Setup |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 112 | [Documentation] Setup environment |
Kailash | 0e2465c | 2019-08-05 09:56:02 -0700 | [diff] [blame] | 113 | Log Setting up |
| 114 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
| 115 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
Kailash | 528f7c0 | 2019-07-31 10:55:49 -0700 | [diff] [blame] | 116 | Check CLI Tools Configured |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 117 | ${onos_auth}= Create List karaf karaf |
| 118 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 119 | Create Session ONOS http://${server_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 120 | |
| 121 | Teardown |
| 122 | [Documentation] Delete all http sessions |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 123 | Delete All Sessions |