[VOL-3007] Moving the scale pipeline in robot

Change-Id: I729685325f6b05e9f9f17f14e96d597c885ebe68
diff --git a/libraries/utils.robot b/libraries/utils.robot
index b0e5548..258b465 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -483,3 +483,50 @@
     ${rc}    ${output}=    Run and Return Rc and Output     date --date="${dateStr}" "+%s"
     Should Be Equal As Numbers    ${rc}    0
     [return]    ${output}
+
+Calculate flows by workflow
+    [Documentation]  Calculate how many flows should be created based on the workflow, the number of UNIs
+    ...     and whether the subscribers have been provisioned
+    [Arguments]  ${workflow}    ${uni_count}    ${olt_count}    ${provisioned}
+    ${expectedFlows}=   Run Keyword If  $workflow=="att"  Calculate Att flows
+    ...     ${uni_count}    ${olt_count}    ${provisioned}
+    ...     ELSE IF     $workflow=="dt"     Calculate Dt Flows
+    ...     ${uni_count}    ${olt_count}    ${provisioned}
+    ...     ELSE IF     $workflow=="tt"     Calculate Tt Flows
+    ...     ${uni_count}    ${olt_count}    ${provisioned}
+    ...     ELSE    Fail    Workflow ${workflow} should be one of 'att', 'dt', 'tt'
+    Return From Keyword     ${expectedFlows}
+
+Calculate Att flows
+    [Documentation]  Calculate the flow for the ATT workflow
+    ...     NOTE we may need to add support for IGMP enabled/disabled
+    [Arguments]  ${uni_count}    ${olt_count}   ${provisioned}
+    # (1 EAPOL * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning
+    # (1 EAPOL, 1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning
+    ${flow_count}=  Run Keyword If  $provisioned=='false'
+    ...     Evaluate    (${uni_count} * 1) + (${olt_count} * 2)
+    ...     ELSE
+    ...     Evaluate    (${uni_count} * 7) + (${olt_count} * 2)
+    Return From Keyword     ${flow_count}
+
+Calculate Dt flows
+    [Documentation]  Calculate the flow for the DT workflow
+    [Arguments]  ${uni_count}    ${olt_count}   ${provisioned}
+    # (1 LLDP * OLTS) before provisioning
+    # (4 DP * ONUs) * (1 LLDP * OLTS) before provisioning
+    ${flow_count}=  Run Keyword If  $provisioned=='false'
+        ...     Evaluate    (${olt_count} * 1)
+        ...     ELSE
+        ...     Evaluate    (${uni_count} * 4) + (${olt_count} * 1)
+    Return From Keyword     ${flow_count}
+
+Calculate Tt flows
+    [Documentation]  Calculate the flow for the TT workflow
+    [Arguments]  ${uni_count}    ${olt_count}   ${provisioned}
+    # (1 LLDP + 1 DHCP * OLTS) before provisioning
+    # (1 DHCP, 1 IGMP, 4 DP * ONUs) * (1 LLDP + 1 DHCP * OLTS) before provisioning
+    ${flow_count}=  Run Keyword If  $provisioned=='false'
+        ...     Evaluate    (${olt_count} * 2)
+        ...     ELSE
+        ...     Evaluate    (${uni_count} * 6) + (${olt_count} * 1)
+    Return From Keyword     ${flow_count}
\ No newline at end of file