[VOL-3641] Testing ONU flow count per OLT

Change-Id: Idc95c77b6fd456c30111599146148469275b5876
diff --git a/libraries/utils.robot b/libraries/utils.robot
index a141cf4..7f161d2 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -587,6 +587,17 @@
     END
     [Return]    ${olt_device_id}
 
+Get Num of Onus From OLT SN
+    [Documentation]    Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
+    [Arguments]      ${serial_number}
+    ${num_of_olt_onus}=    Set Variable    0
+    FOR    ${I}    IN RANGE    0    ${olt_count}
+        ${sn}=    Get From Dictionary    ${olt_ids}[${I}]    sn
+        ${num_of_olt_onus}=    Run Keyword IF    "${serial_number}"=="${sn}"
+        ...    Get From Dictionary    ${list_olts}[${I}]    onucount    ELSE    Set Variable    ${num_of_olt_onus}
+    END
+    [Return]    ${num_of_olt_onus}
+
 Validate ONUs After OLT Disable
     [Documentation]    Validates the ONUs state in Voltha, ONUs port state in ONOS
     ...    and that pings do not succeed After corresponding OLT is Disabled
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index d17f71a..e08410a 100644
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -112,6 +112,7 @@
         ${of_id}=    Get ofID From OLT List    ${src['olt']}
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         ${olt_device_id}=    Get OLTDeviceID From OLT List    ${src['olt']}
+        ${num_of_olt_onus}=    Get Num of Onus From OLT SN    ${src['olt']}
         ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
         ...    ${of_id}
         # Remove Subscriber Access
@@ -122,14 +123,14 @@
         ...    Wait Until Keyword Succeeds    60s    2s
         ...    Check Ping    False    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
         ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
-        # TODO: Enhance the test to validate flows per OLT
+
         # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
-        ${onos_flows_count}=    Evaluate    4 * ( ${num_all_onus} - 1 )
+        ${onos_flows_count}=    Evaluate    4 * ( ${num_of_olt_onus} - 1 )
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Subscriber Access Flows Added Count DT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
         ...    ${of_id}    ${onos_flows_count}
         # Verify VOLTHA flows for OLT equals twice the number of ONUS (minus ONU under test) + 1 for LLDP
-        ${olt_flows}=    Evaluate    2 * ( ${num_all_onus} - 1 ) + 1
+        ${olt_flows}=    Evaluate    2 * ( ${num_of_olt_onus} - 1 ) + 1
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows    ${olt_flows}
         ...    ${olt_device_id}
         # Verify VOLTHA flows for ONU under test is Zero