Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 1 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 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 various utilities |
| 18 | Library SSHLibrary |
| 19 | Library String |
| 20 | Library DateTime |
| 21 | Library Process |
| 22 | Library Collections |
| 23 | Library RequestsLibrary |
| 24 | Library OperatingSystem |
| 25 | |
| 26 | *** Keywords *** |
| 27 | Calculate flows by workflow |
| 28 | [Documentation] Calculate how many flows should be created based on the workflow, the number of UNIs |
| 29 | ... and whether the subscribers have been provisioned |
| 30 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 31 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 32 | ${expectedFlows}= Run Keyword If $workflow=="att" Calculate Att flows |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 33 | ... ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 34 | ... ELSE IF $workflow=="dt" Calculate Dt Flows |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 35 | ... ${uni_count} ${olt_count} ${provisioned} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 36 | ... ELSE IF $workflow=="tt" Calculate Tt Flows |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 37 | ... ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp} |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 38 | ... ELSE IF $workflow=="tim" Calculate Tim Flows |
| 39 | ... ${uni_count} ${olt_count} ${provisioned} ${withPppoe} ${withIgmp} ${withLldp} |
| 40 | ... ELSE Fail Workflow ${workflow} should be one of 'att', 'dt', 'tt' , 'tim' |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 41 | Return From Keyword ${expectedFlows} |
| 42 | |
| 43 | Calculate Att flows |
| 44 | [Documentation] Calculate the flow for the ATT workflow |
| 45 | ... NOTE we may need to add support for IGMP enabled/disabled |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 46 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} |
| 47 | ... ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 48 | # (1 EAPOL * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning |
| 49 | # (1 EAPOL, 1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) after provisioning |
| 50 | ${eapFlowsCount}= Run Keyword If $withEapol=='true' |
| 51 | ... Evaluate 1 |
| 52 | ... ELSE |
| 53 | ... Evaluate 0 |
| 54 | ${dhcpFlowsCount}= Run Keyword If $withDhcp=='true' |
| 55 | ... Evaluate 1 |
| 56 | ... ELSE |
| 57 | ... Evaluate 0 |
| 58 | ${igmpFlowsCount}= Run Keyword If $withIgmp=='true' |
| 59 | ... Evaluate 2 |
| 60 | ... ELSE |
| 61 | ... Evaluate 0 |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 62 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 63 | ... Evaluate 1 |
| 64 | ... ELSE |
| 65 | ... Evaluate 0 |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 66 | ${flow_count}= Run Keyword If $provisioned=='false' |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 67 | ... Calculate Att Preprovisioned Flows ${olt_count} ${uni_count} |
| 68 | ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 69 | ... ELSE |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 70 | ... Calculate Att Provisioned Flows ${olt_count} ${uni_count} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 71 | ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 72 | Return From Keyword ${flow_count} |
| 73 | |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 74 | Calculate Att Preprovisioned Flows |
| 75 | [Documentation] This calcualtes the flows before subscribers are provisioned in the ATT workflow |
| 76 | [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount} |
| 77 | ... ${igmpFlowsCount} ${lldpFlowsCount} |
| 78 | ${eap}= Evaluate ${uni_count} * ${eapFlowsCount} |
| 79 | ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
| 80 | ${total}= Evaluate ${eap} + ${nni} |
| 81 | Return From Keyword ${total} |
| 82 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 83 | Calculate Att Provisioned Flows |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 84 | [Documentation] This calculates the flows for provisioned subscribers in the ATT workflow |
| 85 | [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount} |
| 86 | ... ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 87 | ${eap}= Evaluate ${uni_count} * ${eapFlowsCount} |
| 88 | ${dhcp}= Evaluate ${uni_count} * ${dhcpFlowsCount} |
| 89 | ${igmp}= Evaluate ${uni_count} * ${igmpFlowsCount} |
| 90 | ${dataplane}= Evaluate ${uni_count} * 4 |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 91 | ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 92 | ${total}= Evaluate ${eap} + ${dhcp} + ${igmp} + ${dataplane} + ${nni} |
| 93 | Return From Keyword ${total} |
| 94 | |
| 95 | Calculate Dt flows |
| 96 | [Documentation] Calculate the flow for the DT workflow |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 97 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 98 | # (1 LLDP * OLTS) before provisioning |
| 99 | # (4 DP * ONUs) * (1 LLDP * OLTS) after provisioning |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 100 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 101 | ... Evaluate 1 |
| 102 | ... ELSE |
| 103 | ... Evaluate 0 |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 104 | ${flow_count}= Run Keyword If $provisioned=='false' |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 105 | ... Evaluate (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 106 | ... ELSE |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 107 | ... Evaluate (${uni_count} * 4) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 108 | Return From Keyword ${flow_count} |
| 109 | |
| 110 | Calculate Tt flows |
| 111 | [Documentation] Calculate the flow for the TT workflow |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 112 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 113 | # TODO account for withDhcp, withIgmp, see Calculate Att flows for examples |
Andrea Campanella | 13cd0b9 | 2020-09-07 11:46:08 +0200 | [diff] [blame] | 114 | # (1 LLDP + 1 DHCP + 1 IGMP * OLTS) before provisioning |
| 115 | # (1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP + 1 IGMP * OLTS) after provisioning |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 116 | ${dhcpFlowsCount}= Run Keyword If $withDhcp=='true' |
| 117 | ... Evaluate 1 |
| 118 | ... ELSE |
| 119 | ... Evaluate 0 |
| 120 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 121 | ... Evaluate 1 |
| 122 | ... ELSE |
| 123 | ... Evaluate 0 |
Andrea Campanella | 13cd0b9 | 2020-09-07 11:46:08 +0200 | [diff] [blame] | 124 | ${igmpFlowsCount}= Run Keyword If $withIgmp=='true' |
| 125 | ... Evaluate 1 |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 126 | ... ELSE |
Andrea Campanella | 13cd0b9 | 2020-09-07 11:46:08 +0200 | [diff] [blame] | 127 | ... Evaluate 0 |
| 128 | ${totalDhcpFlows}= Evaluate ${olt_count} * ${dhcpFlowsCount} |
| 129 | ${totalLldpFlows}= Evaluate ${olt_count} * ${lldpFlowsCount} |
| 130 | ${totalIgmpFlows}= Evaluate ${olt_count} * ${igmpFlowsCount} |
| 131 | ${flow_count}= Run Keyword If $provisioned=='false' |
| 132 | ... Evaluate ${totalDhcpFlows} + ${totalLldpFlows} + ${totalIgmpFlows} |
| 133 | ... ELSE |
| 134 | ... Evaluate (${uni_count} * 15) + ${totalDhcpFlows} + ${totalLldpFlows} + ${totalIgmpFlows} |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 135 | Return From Keyword ${flow_count} |
| 136 | |
| 137 | Calculate Tim flows |
LupoAndreaSperanza | 0f3fbc2 | 2023-05-16 21:02:40 +0200 | [diff] [blame] | 138 | [Documentation] Calculate the number of flow rules for the Tim workflow in a single OLT, |
| 139 | ... at the variation of the number of ONis provisioned |
| 140 | ... Case 1: ( 1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs before provisioning |
| 141 | ... Case 2: ( 2 Any VLAN) + ( UNIs * 8 ) + (1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs after provisioning |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 142 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withPppoe} ${withIgmp} ${withLldp} |
LupoAndreaSperanza | 0f3fbc2 | 2023-05-16 21:02:40 +0200 | [diff] [blame] | 143 | |
| 144 | #Define the any Vlan Number Flows in a OLT after the subscription of almost one subscriber |
| 145 | #One Any Vlan roule for each service ( HSIA , VoD ) |
| 146 | ${anyVlanFlowsCount}= Evaluate 2 |
| 147 | |
| 148 | #Define the number of flows for single UNIs where there are a subscriber |
| 149 | # 4 Flow Rules for HSIA Service and 4 Flow Rules for VoD Service |
| 150 | ${uniUpDownFlowsCount}= Evaluate 8 |
| 151 | |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 152 | ${pppoeFlowsCount}= Run Keyword If $withPppoe=='true' |
| 153 | ... Evaluate 1 |
| 154 | ... ELSE |
| 155 | ... Evaluate 0 |
| 156 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 157 | ... Evaluate 1 |
| 158 | ... ELSE |
| 159 | ... Evaluate 0 |
| 160 | ${igmpFlowsCount}= Run Keyword If $withIgmp=='true' |
| 161 | ... Evaluate 1 |
| 162 | ... ELSE |
| 163 | ... Evaluate 0 |
| 164 | ${pppoeFlowsCount}= Evaluate ${olt_count} * ${pppoeFlowsCount} |
| 165 | ${totalLldpFlows}= Evaluate ${olt_count} * ${lldpFlowsCount} |
| 166 | ${totalIgmpFlows}= Evaluate ${olt_count} * ${igmpFlowsCount} |
LupoAndreaSperanza | 0f3fbc2 | 2023-05-16 21:02:40 +0200 | [diff] [blame] | 167 | ${totalPppoeLlldpIgmpFlows}= Evaluate ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows} |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 168 | ${flow_count}= Run Keyword If $provisioned=='false' |
LupoAndreaSperanza | 0f3fbc2 | 2023-05-16 21:02:40 +0200 | [diff] [blame] | 169 | ... Set Variable ${totalPppoeLlldpIgmpFlows} |
Andrea Speranza | a8cf80b | 2022-05-26 10:09:59 +0200 | [diff] [blame] | 170 | ... ELSE |
LupoAndreaSperanza | 0f3fbc2 | 2023-05-16 21:02:40 +0200 | [diff] [blame] | 171 | ... Evaluate ${anyVlanFlowsCount} + (${uniUpDownFlowsCount} * ${uni_count}) + ${totalPppoeLlldpIgmpFlows} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 172 | Return From Keyword ${flow_count} |