blob: 678270a8754ca0ba305b517dac6dd8d8bb2975a8 [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}
31 ... ${withEapol} ${withDhcp} ${withIgmp}
32 ${expectedFlows}= Run Keyword If $workflow=="att" Calculate Att flows
33 ... ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} ${withIgmp}
34 ... ELSE IF $workflow=="dt" Calculate Dt Flows
35 ... ${uni_count} ${olt_count} ${provisioned}
36 ... ELSE IF $workflow=="tt" Calculate Tt Flows
37 ... ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp}
38 ... 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
44 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withEapol} ${withDhcp} ${withIgmp}
45 # (1 EAPOL * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning
46 # (1 EAPOL, 1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) after provisioning
47 ${eapFlowsCount}= Run Keyword If $withEapol=='true'
48 ... Evaluate 1
49 ... ELSE
50 ... Evaluate 0
51 ${dhcpFlowsCount}= Run Keyword If $withDhcp=='true'
52 ... Evaluate 1
53 ... ELSE
54 ... Evaluate 0
55 ${igmpFlowsCount}= Run Keyword If $withIgmp=='true'
56 ... Evaluate 2
57 ... ELSE
58 ... Evaluate 0
59 ${flow_count}= Run Keyword If $provisioned=='false'
60 ... Evaluate (${uni_count} * ${eapFlowsCount}) + (${olt_count} * 2)
61 ... ELSE
62 ... Calculate Att Provisione Flows ${olt_count} ${uni_count}
63 ... ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount}
64 Return From Keyword ${flow_count}
65
66Calculate Att Provisione Flows
67 [Documentation] This calculate the flows for provisioned subscribers in the ATT workflow
68 [Arguments] ${olt_count} ${uni_count} ${eapFlowsCount} ${dhcpFlowsCount} ${igmpFlowsCount}
69 ${eap}= Evaluate ${uni_count} * ${eapFlowsCount}
70 ${dhcp}= Evaluate ${uni_count} * ${dhcpFlowsCount}
71 ${igmp}= Evaluate ${uni_count} * ${igmpFlowsCount}
72 ${dataplane}= Evaluate ${uni_count} * 4
73 ${nni}= Evaluate ${olt_count} * 2
74 ${total}= Evaluate ${eap} + ${dhcp} + ${igmp} + ${dataplane} + ${nni}
75 Return From Keyword ${total}
76
77Calculate Dt flows
78 [Documentation] Calculate the flow for the DT workflow
79 [Arguments] ${uni_count} ${olt_count} ${provisioned}
80 # (1 LLDP * OLTS) before provisioning
81 # (4 DP * ONUs) * (1 LLDP * OLTS) after provisioning
82 ${flow_count}= Run Keyword If $provisioned=='false'
83 ... Evaluate (${olt_count} * 1)
84 ... ELSE
85 ... Evaluate (${uni_count} * 4) + (${olt_count} * 1)
86 Return From Keyword ${flow_count}
87
88Calculate Tt flows
89 [Documentation] Calculate the flow for the TT workflow
90 [Arguments] ${uni_count} ${olt_count} ${provisioned} ${withDhcp} ${withIgmp}
91 # TODO account for withDhcp, withIgmp, see Calculate Att flows for examples
92 # (1 LLDP + 1 DHCP * OLTS) before provisioning
93 # (1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) after provisioning
94 ${flow_count}= Run Keyword If $provisioned=='false'
95 ... Evaluate (${olt_count} * 2)
96 ... ELSE
97 ... Evaluate (${uni_count} * 6) + (${olt_count} * 1)
98 Return From Keyword ${flow_count}