improve memory leak tests

Change-Id: I30ee1b0a01b183b46aa6d5b6d0f865eb793d242e
diff --git a/libraries/onu_utilities.robot b/libraries/onu_utilities.robot
index 82d416d..544dab6 100755
--- a/libraries/onu_utilities.robot
+++ b/libraries/onu_utilities.robot
@@ -245,13 +245,18 @@
 
 Remove Flows all ONUs
     [Documentation]    Remove all Flows from all onus
+    @{onu_list}=    Create List
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         # Collect data for remove flow(s)
         ${src}=    Set Variable    ${hosts.src[${I}]}
+        # skip if we have already handled this ONU
+        ${onu_sn}=     Set Variable    ${src['onu']}
+        ${onu_id}=    Get Index From List    ${onu_list}   ${onu_sn}
+        Continue For Loop If    -1 != ${onu_id}
+        Append To List    ${onu_list}    ${onu_sn}
         ${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']}
+        ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${onu_sn}
         ...    ${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
diff --git a/tests/memory-leak/VOLTHA_Memory_Leak_Tests.robot b/tests/memory-leak/VOLTHA_Memory_Leak_Tests.robot
index d283c60..7e6f61b 100755
--- a/tests/memory-leak/VOLTHA_Memory_Leak_Tests.robot
+++ b/tests/memory-leak/VOLTHA_Memory_Leak_Tests.robot
@@ -159,6 +159,10 @@
 
 Teardown Test
     [Documentation]    Post-test Teardown
+    # log ONOS flows after remove check
+    ${flow}=    Run Keyword If    "${TEST STATUS}"=="FAIL"    Execute ONOS CLI Command use single connection
+    ...    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    flows -s any ${of_id}
+    Run Keyword If    "${TEST STATUS}"=="FAIL"    Log    ${flow}
     Run Keyword If    ${pausebeforecleanup}    Import Library    Dialogs
     Run Keyword If    ${pausebeforecleanup}    Pause Execution    Press OK to continue with clean up!
     Run Keyword If    ${pausebeforecleanup}    Log    Teardown will be continued...    console=yes