Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -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 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} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 38 | ... ELSE Fail Workflow ${workflow} should be one of 'att', 'dt', 'tt' |
| 39 | Return From Keyword ${expectedFlows} |
| 40 | |
| 41 | Calculate Att flows |
| 42 | [Documentation] Calculate the flow for the ATT workflow |
| 43 | ... NOTE we may need to add support for IGMP enabled/disabled |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 44 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} |
| 45 | ... ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 46 | # (1 EAPOL * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning |
| 47 | # (1 EAPOL, 1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) after provisioning |
| 48 | ${eapFlowsCount}= Run Keyword If $withEapol=='true' |
| 49 | ... Evaluate 1 |
| 50 | ... ELSE |
| 51 | ... Evaluate 0 |
| 52 | ${dhcpFlowsCount}= Run Keyword If $withDhcp=='true' |
| 53 | ... Evaluate 1 |
| 54 | ... ELSE |
| 55 | ... Evaluate 0 |
| 56 | ${igmpFlowsCount}= Run Keyword If $withIgmp=='true' |
| 57 | ... Evaluate 2 |
| 58 | ... ELSE |
| 59 | ... Evaluate 0 |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 60 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 61 | ... Evaluate 1 |
| 62 | ... ELSE |
| 63 | ... Evaluate 0 |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 64 | ${flow_count}= Run Keyword If $provisioned=='false' |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 65 | ... Calculate Att Preprovisioned Flows ${olt_count} ${uni_count} |
| 66 | ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 67 | ... ELSE |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 68 | ... Calculate Att Provisioned Flows ${olt_count} ${uni_count} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 69 | ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 70 | Return From Keyword ${flow_count} |
| 71 | |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 72 | Calculate Att Preprovisioned Flows |
| 73 | [Documentation] This calcualtes the flows before subscribers are provisioned in the ATT workflow |
| 74 | [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount} |
| 75 | ... ${igmpFlowsCount} ${lldpFlowsCount} |
| 76 | ${eap}= Evaluate ${uni_count} * ${eapFlowsCount} |
| 77 | ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
| 78 | ${total}= Evaluate ${eap} + ${nni} |
| 79 | Return From Keyword ${total} |
| 80 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 81 | Calculate Att Provisioned Flows |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 82 | [Documentation] This calculates the flows for provisioned subscribers in the ATT workflow |
| 83 | [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount} |
| 84 | ... ${igmpFlowsCount} ${lldpFlowsCount} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 85 | ${eap}= Evaluate ${uni_count} * ${eapFlowsCount} |
| 86 | ${dhcp}= Evaluate ${uni_count} * ${dhcpFlowsCount} |
| 87 | ${igmp}= Evaluate ${uni_count} * ${igmpFlowsCount} |
| 88 | ${dataplane}= Evaluate ${uni_count} * 4 |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 89 | ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 90 | ${total}= Evaluate ${eap} + ${dhcp} + ${igmp} + ${dataplane} + ${nni} |
| 91 | Return From Keyword ${total} |
| 92 | |
| 93 | Calculate Dt flows |
| 94 | [Documentation] Calculate the flow for the DT workflow |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 95 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 96 | # (1 LLDP * OLTS) before provisioning |
| 97 | # (4 DP * ONUs) * (1 LLDP * OLTS) after provisioning |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 98 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 99 | ... Evaluate 1 |
| 100 | ... ELSE |
| 101 | ... Evaluate 0 |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 102 | ${flow_count}= Run Keyword If $provisioned=='false' |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 103 | ... Evaluate (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 104 | ... ELSE |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 105 | ... Evaluate (${uni_count} * 4) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 106 | Return From Keyword ${flow_count} |
| 107 | |
| 108 | Calculate Tt flows |
| 109 | [Documentation] Calculate the flow for the TT workflow |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 110 | [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 111 | # TODO account for withDhcp, withIgmp, see Calculate Att flows for examples |
| 112 | # (1 LLDP + 1 DHCP * OLTS) before provisioning |
| 113 | # (1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) after provisioning |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 114 | ${dhcpFlowsCount}= Run Keyword If $withDhcp=='true' |
| 115 | ... Evaluate 1 |
| 116 | ... ELSE |
| 117 | ... Evaluate 0 |
| 118 | ${lldpFlowsCount}= Run Keyword If $withLldp=='true' |
| 119 | ... Evaluate 1 |
| 120 | ... ELSE |
| 121 | ... Evaluate 0 |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 122 | ${flow_count}= Run Keyword If $provisioned=='false' |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 123 | ... Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 124 | ... ELSE |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 125 | ... Evaluate (${uni_count} * 6) + (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount}) |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 126 | Return From Keyword ${flow_count} |