Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -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 | # onos common functions |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Library for BBSimCtl interactions |
| 18 | Resource ./k8s.robot |
| 19 | |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 20 | *** Variables *** |
| 21 | &{IGMP_TASK_DICT} join=0 leave=1 joinv3=2 |
| 22 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 23 | *** Keywords *** |
| 24 | List ONUs |
| 25 | [Documentation] Lists ONUs via BBSimctl |
| 26 | [Arguments] ${namespace} ${bbsim_pod_name} |
| 27 | ${onus} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 28 | ... bbsimctl onu list |
| 29 | Log ${onus} |
| 30 | Should Be Equal as Integers ${rc} 0 |
| 31 | |
| 32 | Restart Auth |
| 33 | [Documentation] Restart Authentication on a BBSim ONU |
| 34 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} |
| 35 | ${res} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 36 | ... bbsimctl onu auth_restart ${onu} |
| 37 | Log ${res} |
| 38 | Should Be Equal as Integers ${rc} 0 |
| 39 | |
| 40 | Restart DHCP |
| 41 | [Documentation] Restart Dhcp on a BBSim ONU |
| 42 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} |
| 43 | ${res} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 44 | ... bbsimctl onu dhcp_restart ${onu} |
| 45 | Log ${res} |
| 46 | Should Be Equal as Integers ${rc} 0 |
| 47 | |
| 48 | List Service |
| 49 | [Documentation] Lists Service via BBSimctl |
| 50 | [Arguments] ${namespace} ${bbsim_pod_name} |
| 51 | ${service} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 52 | ... bbsimctl service list |
| 53 | Log ${service} |
| 54 | Should Be Equal as Integers ${rc} 0 |
| 55 | |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 56 | JoinOrLeave Igmp Rest Based |
| 57 | [Documentation] Joins or Leaves Igmp on a BBSim ONU (based on Rest Endpoint) |
| 58 | [Arguments] ${bbsim_rel_session} ${onu} ${task} ${group_address} |
| 59 | ${resp}= Post Request ${bbsim_rel_session} |
| 60 | ... /v1/olt/onus/${onu}/igmp/${IGMP_TASK_DICT}[${task}]/${group_address} |
| 61 | Log ${resp} |
| 62 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 63 | JoinOrLeave Igmp |
| 64 | [Documentation] Joins or Leaves Igmp on a BBSim ONU |
| 65 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} ${task} ${group_address}=224.0.0.22 |
| 66 | ${res} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 67 | ... bbsimctl onu igmp ${onu} ${task} ${group_address} |
| 68 | Log ${res} |
| 69 | Should Be Equal as Integers ${rc} 0 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 70 | |
| 71 | Power On ONU |
| 72 | [Documentation] This keyword turns on the power for onu device. |
| 73 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} |
| 74 | ${result} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 75 | ... bbsimctl onu poweron ${onu} |
| 76 | Should Contain ${result} successfully msg=Can not poweron ${onu} values=False |
| 77 | |
| 78 | Power Off ONU |
| 79 | [Documentation] This keyword turns off the power for onu device. |
| 80 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} |
| 81 | ${result} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 82 | ... bbsimctl onu shutdown ${onu} |
| 83 | Should Contain ${result} successfully msg=Can not shutdown ${onu} values=False |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 84 | |
| 85 | Get ONUs List |
| 86 | [Documentation] Fetches ONUs via BBSimctl |
| 87 | [Arguments] ${namespace} ${bbsim_pod_name} |
| 88 | ${onus} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 89 | ... bbsimctl onu list | awk 'NR>1 {print $4}' |
| 90 | @{onuList}= Split To Lines ${onus} |
| 91 | Should Be Equal as Integers ${rc} 0 |
| 92 | [Return] ${onuList} |
Hardik Windlass | c082c42 | 2021-03-16 15:44:10 +0000 | [diff] [blame] | 93 | |
| 94 | Restart Grpc Server |
| 95 | [Documentation] Restart Grpc Server on a BBSim OLT |
| 96 | [Arguments] ${namespace} ${bbsim_pod_name} ${delay} |
| 97 | ${res} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 98 | ... bbsimctl olt restartServer ${delay} |
| 99 | Log ${res} |
| 100 | Should Be Equal as Integers ${rc} 0 |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 101 | |
| 102 | Verify ONU Device Image On BBSim |
| 103 | [Documentation] Validates the state of ONU in case of Image Upgrade |
| 104 | [Arguments] ${namespace} ${bbsim_pod_name} ${onu} ${internal_state} |
| 105 | ${res} ${rc}= Exec Pod And Return Output And RC ${namespace} ${bbsim_pod_name} |
| 106 | ... bbsimctl onu list | grep ${onu} | awk '{print $6}' |
| 107 | Should Be Equal as Integers ${rc} 0 |
| 108 | Should Be Equal ${res} ${internal_state} |