[VOL-3638] Using of id instead of device serial number to fetch device info

Change-Id: I22613c190ce4f99ffd5a98f5db71512ddc6b9742
diff --git a/tests/functional/Voltha_ScaleFunctionalTests.robot b/tests/functional/Voltha_ScaleFunctionalTests.robot
index 3eb1576..deb6251 100644
--- a/tests/functional/Voltha_ScaleFunctionalTests.robot
+++ b/tests/functional/Voltha_ScaleFunctionalTests.robot
@@ -123,8 +123,9 @@
     #validate total number of DHCP allocations
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
         Wait Until Keyword Succeeds  ${long_timeout}  20s  Validate DHCP Allocations  ${onos_ssh_connection}
-        ...    16   ${olt_serial_number}    BBSM
+        ...    16   ${of_id}    BBSM
     END
     #validate DHCP allocation for each port
     FOR    ${I}    IN RANGE    0    ${num_onus}
diff --git a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
index 10c859d..410a545 100755
--- a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
@@ -98,8 +98,9 @@
     [Setup]    Start Logging    ONUPortTest
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
         Run Keyword If    '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
-        ...    Do Onu Port Check    ${olt_serial_number}
+        ...    Do Onu Port Check    ${of_id}
         ...    ELSE    Pass Execution    ${skip_message}    skipped
     END
     [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
@@ -214,7 +215,8 @@
     Validate Onu Data In Etcd    0
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${olt_serial_number}    BBSM
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${of_id}    BBSM
     END
     Close ONOS SSH Connection   ${onos_ssh_connection}
     Remove Tech Profile
@@ -454,7 +456,8 @@
     #check no port is enabled in ONOS
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${olt_serial_number}    BBSM
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${of_id}    BBSM
     END
     Do Enable Onu Device
     Do Current State Test All Onus    ${state2check}
@@ -462,7 +465,8 @@
     #check that all the UNI ports show up in ONOS again
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Wait for Ports in ONOS    ${onos_ssh_connection}    ${num_all_onus}     ${olt_serial_number}    BBSM
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Wait for Ports in ONOS    ${onos_ssh_connection}    ${num_all_onus}     ${of_id}    BBSM
     END
 
 Do Reconcile Onu Device
@@ -487,7 +491,8 @@
     Do Disable Enable Onu Test
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Do Onu Port Check   ${olt_serial_number}
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Do Onu Port Check   ${of_id}
     END
 
 Do Power Off Power On Onu Device
@@ -515,7 +520,8 @@
     Run Keyword If    ${has_dataplane}    Do Current State Test All Onus    omci-flows-pushed
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Do Onu Port Check   ${olt_serial_number}
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Do Onu Port Check   ${of_id}
     END
 
 Do Disable Onu Device
diff --git a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
index 422ad02..0386b27 100755
--- a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
@@ -89,7 +89,8 @@
     Run Keyword If    ${teardown_device}    Delete All Devices and Verify
     FOR    ${I}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
-        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${olt_serial_number}    BBSM
+        ${of_id}=    Wait Until Keyword Succeeds    60s    5s    Validate OLT Device in ONOS    ${olt_serial_number}
+        Wait for Ports in ONOS    ${onos_ssh_connection}    0    ${of_id}    BBSM
     END
     # delete etcd MIB Template Data (for repeating test)
     Delete MIB Template Data