VOL-2753 Fix loop logic, improve loop error messages

Change-Id: I3af2e8ef01251d5ac77ec96222a01edd655c0c4a
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 3160c6c..921ca50 100644
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -33,13 +33,15 @@
     Should Not Be Empty    ${jsondata['devices']}
     ${length}=    Get Length    ${jsondata['devices']}
     @{serial_numbers}=    Create List
+    ${matched}=    Set Variable    False
     FOR    ${INDEX}    IN RANGE    0    ${length}
         ${value}=    Get From List    ${jsondata['devices']}    ${INDEX}
         ${of_id}=    Get From Dictionary    ${value}    id
         ${sn}=    Get From Dictionary    ${value}    serial
-        Run Keyword If    '${sn}' == '${serial_number}'    Exit For Loop
+        ${matched}=    Set Variable If    '${sn}' == '${serial_number}'    True    False
+        Exit For Loop If    ${matched}
     END
-    Should Be Equal As Strings    ${sn}    ${serial_number}
+    Should Be True    ${matched}    No match for ${serial_number} found
     [Return]    ${of_id}
 
 Get ONU Port in ONOS
@@ -51,14 +53,16 @@
     Should Not Be Empty    ${jsondata['ports']}
     ${length}=    Get Length    ${jsondata['ports']}
     @{ports}=    Create List
+    ${matched}=    Set Variable    False
     FOR    ${INDEX}    IN RANGE    0    ${length}
         ${value}=    Get From List    ${jsondata['ports']}    ${INDEX}
         ${annotations}=    Get From Dictionary    ${value}    annotations
         ${onu_port}=    Get From Dictionary    ${value}    port
         ${portName}=    Get From Dictionary    ${annotations}    portName
-        Run Keyword If    '${portName}' == '${onu_serial_number}'    Exit For Loop
+        ${matched}=    Set Variable If    '${portName}' == '${onu_serial_number}'    True    False
+        Exit For Loop If    ${matched}
     END
-    Should Be Equal As Strings    ${portName}    ${onu_serial_number}
+    Should Be True    ${matched}    No match for ${onu_serial_number} found
     [Return]    ${onu_port}
 
 Get FabricSwitch in ONOS
@@ -67,12 +71,15 @@
     ${jsondata}=    To Json    ${resp.content}
     Should Not Be Empty    ${jsondata['devices']}
     ${length}=    Get Length    ${jsondata['devices']}
+    ${matched}=    Set Variable    False
     FOR    ${INDEX}    IN RANGE    0    ${length}
         ${value}=    Get From List    ${jsondata['devices']}    ${INDEX}
         ${of_id}=    Get From Dictionary    ${value}    id
         ${type}=    Get From Dictionary    ${value}    type
-        Run Keyword If    '${type}' == "SWITCH"    Exit For Loop
+        ${matched}=    Set Variable If    '${type}' == "SWITCH"    True    False
+        Exit For Loop If    ${matched}
     END
+    Should Be True    ${matched}    No fabric switch found
     [Return]    ${of_id}
 
 Verify Eapol Flows Added