blob: f6e6a4a89ae6e9146d507beffebb1020a164510f [file] [log] [blame]
Matteo Scandoloeb26a842020-05-08 10:06:24 -07001# 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 ***
17Documentation Library for various utilities
18Library SSHLibrary
19Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
25
26*** Keywords ***
27Calculate 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 Campanella70cf0a72020-05-27 10:55:15 +020031 ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070032 ${expectedFlows}= Run Keyword If $workflow=="att" Calculate Att flows
Andrea Campanella70cf0a72020-05-27 10:55:15 +020033 ... ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070034 ... ELSE IF $workflow=="dt" Calculate Dt Flows
Andrea Campanella70cf0a72020-05-27 10:55:15 +020035 ... ${uni_count} ${olt_count} ${provisioned} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070036 ... ELSE IF $workflow=="tt" Calculate Tt Flows
Andrea Campanella70cf0a72020-05-27 10:55:15 +020037 ... ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp}
Andrea Speranzaa8cf80b2022-05-26 10:09:59 +020038 ... 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 Scandoloeb26a842020-05-08 10:06:24 -070041 Return From Keyword ${expectedFlows}
42
43Calculate Att flows
44 [Documentation] Calculate the flow for the ATT workflow
45 ... NOTE we may need to add support for IGMP enabled/disabled
Andrea Campanella70cf0a72020-05-27 10:55:15 +020046 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp}
47 ... ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070048 # (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 Campanella70cf0a72020-05-27 10:55:15 +020062 ${lldpFlowsCount}= Run Keyword If $withLldp=='true'
63 ... Evaluate 1
64 ... ELSE
65 ... Evaluate 0
Matteo Scandoloeb26a842020-05-08 10:06:24 -070066 ${flow_count}= Run Keyword If $provisioned=='false'
Andrea Campanella70cf0a72020-05-27 10:55:15 +020067 ... Calculate Att Preprovisioned Flows ${olt_count} ${uni_count}
68 ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070069 ... ELSE
Matteo Scandolo616daab2020-05-13 11:49:24 -070070 ... Calculate Att Provisioned Flows ${olt_count} ${uni_count}
Andrea Campanella70cf0a72020-05-27 10:55:15 +020071 ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070072 Return From Keyword ${flow_count}
73
Andrea Campanella70cf0a72020-05-27 10:55:15 +020074Calculate 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 Scandolo616daab2020-05-13 11:49:24 -070083Calculate Att Provisioned Flows
Andrea Campanella70cf0a72020-05-27 10:55:15 +020084 [Documentation] This calculates the flows for provisioned subscribers in the ATT workflow
85 [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount}
86 ... ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070087 ${eap}= Evaluate ${uni_count} * ${eapFlowsCount}
88 ${dhcp}= Evaluate ${uni_count} * ${dhcpFlowsCount}
89 ${igmp}= Evaluate ${uni_count} * ${igmpFlowsCount}
90 ${dataplane}= Evaluate ${uni_count} * 4
Andrea Campanella70cf0a72020-05-27 10:55:15 +020091 ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -070092 ${total}= Evaluate ${eap} + ${dhcp} + ${igmp} + ${dataplane} + ${nni}
93 Return From Keyword ${total}
94
95Calculate Dt flows
96 [Documentation] Calculate the flow for the DT workflow
Andrea Campanella70cf0a72020-05-27 10:55:15 +020097 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070098 # (1 LLDP * OLTS) before provisioning
99 # (4 DP * ONUs) * (1 LLDP * OLTS) after provisioning
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200100 ${lldpFlowsCount}= Run Keyword If $withLldp=='true'
101 ... Evaluate 1
102 ... ELSE
103 ... Evaluate 0
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700104 ${flow_count}= Run Keyword If $provisioned=='false'
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200105 ... Evaluate (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700106 ... ELSE
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200107 ... Evaluate (${uni_count} * 4) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700108 Return From Keyword ${flow_count}
109
110Calculate Tt flows
111 [Documentation] Calculate the flow for the TT workflow
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200112 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700113 # TODO account for withDhcp, withIgmp, see Calculate Att flows for examples
Andrea Campanella13cd0b92020-09-07 11:46:08 +0200114 # (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 Campanella70cf0a72020-05-27 10:55:15 +0200116 ${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 Campanella13cd0b92020-09-07 11:46:08 +0200124 ${igmpFlowsCount}= Run Keyword If $withIgmp=='true'
125 ... Evaluate 1
Matteo Scandoloda854b02020-09-01 16:20:51 -0700126 ... ELSE
Andrea Campanella13cd0b92020-09-07 11:46:08 +0200127 ... 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 Speranzaa8cf80b2022-05-26 10:09:59 +0200135 Return From Keyword ${flow_count}
136
137Calculate Tim flows
138 [Documentation] Calculate the flow for the Tim workflow
139 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withPppoe} ${withIgmp} ${withLldp}
140 # (1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs before provisioning
141 # 1 Any VLAN + (4 * UNIs) * (1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs after provisioning
142 ${anyVlanFlowsCount}= Evaluate 1
143 ${pppoeFlowsCount}= Run Keyword If $withPppoe=='true'
144 ... Evaluate 1
145 ... ELSE
146 ... Evaluate 0
147 ${lldpFlowsCount}= Run Keyword If $withLldp=='true'
148 ... Evaluate 1
149 ... ELSE
150 ... Evaluate 0
151 ${igmpFlowsCount}= Run Keyword If $withIgmp=='true'
152 ... Evaluate 1
153 ... ELSE
154 ... Evaluate 0
155 ${pppoeFlowsCount}= Evaluate ${olt_count} * ${pppoeFlowsCount}
156 ${totalLldpFlows}= Evaluate ${olt_count} * ${lldpFlowsCount}
157 ${totalIgmpFlows}= Evaluate ${olt_count} * ${igmpFlowsCount}
158 ${flow_count}= Run Keyword If $provisioned=='false'
159 ... Evaluate ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows}
160 ... ELSE
161 ... Evaluate ${anyVlanFlowsCount} + (${uni_count} * 4) + ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows}
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700162 Return From Keyword ${flow_count}