memory leak test

Change-Id: Ib0ead7bb98660c70e08493ae77e7dda855b62f69
diff --git a/libraries/onos.robot b/libraries/onos.robot
index a6c7fd8..4dc7967 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -951,6 +951,40 @@
     Wait Until Keyword Succeeds     10m     5s      Validate number of flows
     ...     ${ip}    ${port}  0  ${deviceId}   any
 
+Check All Flows Removed
+    [Documentation]    Checks all flows removed per OLT
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        ${onu_port_list}=    Get ONU Ports per OLT    ${olt_serial_number}
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Check All Flows Removed per OLT    ${of_id}    ${onu_port_list}
+    END
+
+Check All Flows Removed per OLT
+    [Documentation]    Checks all flows removed per OLT, in case of flow remove, not after delete device!
+    ...                Attention: For ATT there must be the eapol flow still available!
+    [Arguments]        ${of_id}    ${onu_port_list}
+    ${expected_flows_onu}=    Set Variable If   "${workflow}"=="ATT"    1    0
+    FOR  ${onu_port}  IN  @{onu_port_list}
+        Wait Until Keyword Succeeds    ${timeout}    2s    Validate number of flows    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
+        ...    ${expected_flows_onu}  ${of_id}   any    ${onu_port}
+    END
+
+Get ONU Ports per OLT
+    [Documentation]    Collects all ONU ports per OLT
+    [Arguments]        ${olt}
+    ${onu_port_list}    Create List
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        Continue For Loop If    "${olt}"!="${src['olt']}"
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS    ${src['olt']}
+        ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
+        ...    ${of_id}    ${src['uni_id']}
+        ${port_id}=    Get Index From List    ${onu_port_list}   ${onu_port}
+        Continue For Loop If    -1 != ${port_id}
+        Append To List    ${onu_port_list}    ${onu_port}
+    END
+    [return]    ${onu_port_list}
 
 Get Limiting Bandwidth Details
     [Arguments]    ${bandwidth_profile_name}
diff --git a/libraries/onu_utilities.robot b/libraries/onu_utilities.robot
index 6265945..d07db50 100755
--- a/libraries/onu_utilities.robot
+++ b/libraries/onu_utilities.robot
@@ -243,6 +243,19 @@
         ...    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${add_sub_cmd}
     END
 
+Remove Flows all ONUs
+    [Documentation]    Remove all Flows from all onus
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        # Collect data for remove flow(s)
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS    ${src['olt']}
+        ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
+        ...    ${of_id}    ${src['uni_id']}
+        ${onu_sn}=    Set Variable   ${src['onu']}
+        # Remove Flows
+        Remove Flows Conditional    ${unitag_sub}    ${onu_sn}    ${of_id}    ${onu_port}
+    END
+
 Log Ports
     [Documentation]    This keyword logs all port data available in ONOS of first port per ONU
     [Arguments]    ${onlyenabled}=False