blob: 8772e63aee611d1145fa518c987b5bdc3064f9ee [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}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070038 ... ELSE Fail Workflow ${workflow} should be one of 'att', 'dt', 'tt'
39 Return From Keyword ${expectedFlows}
40
41Calculate Att flows
42 [Documentation] Calculate the flow for the ATT workflow
43 ... NOTE we may need to add support for IGMP enabled/disabled
Andrea Campanella70cf0a72020-05-27 10:55:15 +020044 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp}
45 ... ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070046 # (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 Campanella70cf0a72020-05-27 10:55:15 +020060 ${lldpFlowsCount}= Run Keyword If $withLldp=='true'
61 ... Evaluate 1
62 ... ELSE
63 ... Evaluate 0
Matteo Scandoloeb26a842020-05-08 10:06:24 -070064 ${flow_count}= Run Keyword If $provisioned=='false'
Andrea Campanella70cf0a72020-05-27 10:55:15 +020065 ... Calculate Att Preprovisioned Flows ${olt_count} ${uni_count}
66 ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070067 ... ELSE
Matteo Scandolo616daab2020-05-13 11:49:24 -070068 ... Calculate Att Provisioned Flows ${olt_count} ${uni_count}
Andrea Campanella70cf0a72020-05-27 10:55:15 +020069 ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070070 Return From Keyword ${flow_count}
71
Andrea Campanella70cf0a72020-05-27 10:55:15 +020072Calculate 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 Scandolo616daab2020-05-13 11:49:24 -070081Calculate Att Provisioned Flows
Andrea Campanella70cf0a72020-05-27 10:55:15 +020082 [Documentation] This calculates the flows for provisioned subscribers in the ATT workflow
83 [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount}
84 ... ${igmpFlowsCount} ${lldpFlowsCount}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070085 ${eap}= Evaluate ${uni_count} * ${eapFlowsCount}
86 ${dhcp}= Evaluate ${uni_count} * ${dhcpFlowsCount}
87 ${igmp}= Evaluate ${uni_count} * ${igmpFlowsCount}
88 ${dataplane}= Evaluate ${uni_count} * 4
Andrea Campanella70cf0a72020-05-27 10:55:15 +020089 ${nni}= Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -070090 ${total}= Evaluate ${eap} + ${dhcp} + ${igmp} + ${dataplane} + ${nni}
91 Return From Keyword ${total}
92
93Calculate Dt flows
94 [Documentation] Calculate the flow for the DT workflow
Andrea Campanella70cf0a72020-05-27 10:55:15 +020095 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -070096 # (1 LLDP * OLTS) before provisioning
97 # (4 DP * ONUs) * (1 LLDP * OLTS) after provisioning
Andrea Campanella70cf0a72020-05-27 10:55:15 +020098 ${lldpFlowsCount}= Run Keyword If $withLldp=='true'
99 ... Evaluate 1
100 ... ELSE
101 ... Evaluate 0
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700102 ${flow_count}= Run Keyword If $provisioned=='false'
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200103 ... Evaluate (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700104 ... ELSE
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200105 ... Evaluate (${uni_count} * 4) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700106 Return From Keyword ${flow_count}
107
108Calculate Tt flows
109 [Documentation] Calculate the flow for the TT workflow
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200110 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700111 # 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 Campanella70cf0a72020-05-27 10:55:15 +0200114 ${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 Scandoloeb26a842020-05-08 10:06:24 -0700122 ${flow_count}= Run Keyword If $provisioned=='false'
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200123 ... Evaluate (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700124 ... ELSE
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200125 ... Evaluate (${uni_count} * 6) + (${olt_count} * ${dhcpFlowsCount}) + (${olt_count} * ${lldpFlowsCount})
Matteo Scandoloeb26a842020-05-08 10:06:24 -0700126 Return From Keyword ${flow_count}