blob: b053506b0eab503871b5d8044101177d9ad7270e [file] [log] [blame]
Joey Armstrong888f1ee2023-01-11 17:14:30 -05001# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandoloeb26a842020-05-08 10:06:24 -07002#
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
LupoAndreaSperanza0f3fbc22023-05-16 21:02:40 +0200138 [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 Speranzaa8cf80b2022-05-26 10:09:59 +0200142 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withPppoe} ${withIgmp} ${withLldp}
LupoAndreaSperanza0f3fbc22023-05-16 21:02:40 +0200143
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 Speranzaa8cf80b2022-05-26 10:09:59 +0200152 ${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}
LupoAndreaSperanza0f3fbc22023-05-16 21:02:40 +0200167 ${totalPppoeLlldpIgmpFlows}= Evaluate ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows}
Andrea Speranzaa8cf80b2022-05-26 10:09:59 +0200168 ${flow_count}= Run Keyword If $provisioned=='false'
LupoAndreaSperanza0f3fbc22023-05-16 21:02:40 +0200169 ... Set Variable ${totalPppoeLlldpIgmpFlows}
Andrea Speranzaa8cf80b2022-05-26 10:09:59 +0200170 ... ELSE
LupoAndreaSperanza0f3fbc22023-05-16 21:02:40 +0200171 ... Evaluate ${anyVlanFlowsCount} + (${uniUpDownFlowsCount} * ${uni_count}) + ${totalPppoeLlldpIgmpFlows}
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700172 Return From Keyword ${flow_count}