[VOL-4155] Added keyword to wait for a particular device to be recognized as an OLT in ONOS, needed in the multi-stack scale test

Change-Id: I6d2442b24d55af489b1c4847a21d82cee31cdb4a
diff --git a/libraries/onos.robot b/libraries/onos.robot
index f2e7a27..1e2fd57 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -624,18 +624,33 @@
 
 Assert Olts in ONOS
     [Arguments]    ${onos_ssh_connection}     ${count}
-    [Documentation]    Check that a certain number of olts are known to ONOS
+    [Documentation]    DEPRECATED use Assert Olt in ONOS
+    ...     Check that a certain number of olts are known to ONOS
     ${olts}=    Execute ONOS CLI Command on open connection     ${onos_ssh_connection}
-        ...    volt-olts | wc -l
+    ...    volt-olts | wc -l
     Log     Found ${olts} of ${count} expected Olts
     Should Be Equal As Integers    ${olts}    ${count}
 
+Assert Olt in ONOS
+    [Arguments]    ${onos_ssh_connection}     ${deviceId}
+    [Documentation]    Check that a particular olt is known to ONOS
+    ${olts}=    Execute ONOS CLI Command on open connection     ${onos_ssh_connection}
+    ...    volt-olts | grep ${deviceId} | wc -l
+    Should Be Equal As Integers    ${olts}    1   "Device ${deviceId} is not recognized as an OLT"
+
 Wait for Olts in ONOS
     [Arguments]    ${onos_ssh_connection}    ${count}   ${max_wait_time}=10m
-    [Documentation]    Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
+    [Documentation]    DEPRECATED use Wait for Olt in ONOS
+    ...     Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
     Wait Until Keyword Succeeds     ${max_wait_time}     5s      Assert Olts in ONOS
     ...     ${onos_ssh_connection}     ${count}
 
+Wait for Olt in ONOS
+    [Arguments]    ${onos_ssh_connection}    ${deviceId}   ${max_wait_time}=10m
+    [Documentation]    Waits until a particular deviceId is recognized by ONOS as an OLT
+    Wait Until Keyword Succeeds     ${max_wait_time}     5s      Assert Olt in ONOS
+    ...     ${onos_ssh_connection}     ${deviceId}
+
 Assert Ports in ONOS
     [Arguments]    ${onos_ssh_connection}     ${count}     ${deviceId}    ${filter}
     [Documentation]    Check that a certain number of ports are enabled in ONOS
diff --git a/tests/bbsim/Voltha_BBSimTests.robot b/tests/bbsim/Voltha_BBSimTests.robot
index 567a4bc..15769f0 100644
--- a/tests/bbsim/Voltha_BBSimTests.robot
+++ b/tests/bbsim/Voltha_BBSimTests.robot
@@ -163,8 +163,8 @@
     # Perform OLT SoftReboot test
     ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
     Reboot Device    ${olt_device_id}
-    Wait Until Keyword Succeeds    ${timeout}    2s    Device Is Available In ONOS
-        ...    http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}    ${of_id}     false
+    Wait Until Keyword Succeeds    120s    2s    Device Is Available In ONOS
+    ...    http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}    ${of_id}     false
     Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    360s    5s
     ...    Validate OLT Device    ENABLED    ACTIVE
     ...    REACHABLE    ${olt_serial_number}
diff --git a/tests/scale/Voltha_Scale_Tests.robot b/tests/scale/Voltha_Scale_Tests.robot
index 3537b36..902d367 100644
--- a/tests/scale/Voltha_Scale_Tests.robot
+++ b/tests/scale/Voltha_Scale_Tests.robot
@@ -103,7 +103,10 @@
 OLTs in ONOS
     [Documentation]  Check that ONOS recognize the correct number of OLTs
     [Tags]  activation  plot-onos-olts
-    Wait for Olts in ONOS   ${onos_ssh_connection}  ${olt}
+    ${onos_devices}=    Compute Device IDs
+    FOR     ${deviceId}     IN  @{onos_devices}
+        Wait for Olt in ONOS   ${onos_ssh_connection}  ${deviceId}
+    END
 
 Onu Activation in VOLTHA
     [Documentation]    Check that all ONUs reach the ACTIVE/ENABLED state in VOLTHA