VOL-1633: Use defined proceed test instead of waiting for arbitrary time

We now test that all ONUs are ready especially in the case of BBSim
before proceeding to Discovery Test Case
Move Freeswitch setup items earlier to accomodate BBSim
- Fix unassignment issue
- Modify Robot accordingly
- Change Robot steps to hide exact method used
- Account for ipv6 DHCP detection flows in new version of onos

Change-Id: Ib0022ab13ba87071e1bf0866e9df592476447113
diff --git a/tests/atests/common/preprovisioning.py b/tests/atests/common/preprovisioning.py
index fb68634..2b077c9 100755
--- a/tests/atests/common/preprovisioning.py
+++ b/tests/atests/common/preprovisioning.py
@@ -28,7 +28,7 @@
     """
     This class implements voltha pre-provisioning test
     """
-    
+
     def __init__(self):
         self.dirs = dict()
         self.dirs['log'] = None
@@ -99,6 +99,7 @@
         assert statusLines, 'No Olt listed under devices'
         self.__fields = testCaseUtils.parse_fields(statusLines, '|')
         assert self.check_states(self.__oltType), 'States of %s does match expected' % self.__oltType
+        hostPortCount = False
         for field in self.__fields:
             if field.strip() == self.__oltIpAddress + ':' + str(self.__oltPort):
                 hostPortCount = True
@@ -128,6 +129,23 @@
                                                  'voltha_devices_after_enable.log', 'devices')
         testCaseUtils.print_log_file(self, 'voltha_devices_after_enable.log')
 
+    def proceed(self):
+        logging.info('Pre-provisioning hold')
+        onuOnline = 0
+        portType = None
+        if self.__oltType == 'ponsim_olt':
+            portType = 'PON_OLT'
+        elif self.__oltType == 'openolt':
+            portType = 'ETHERNET_UNI'
+        while onuOnline < self.__onuCount:
+            testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'), 'voltha_olt_device.log', 'device ' +
+                                                     self.__oltDeviceId, 'voltha_olt_ports.log', 'ports')
+            statusLines = testCaseUtils.get_fields_from_grep_command(self, portType, 'voltha_olt_ports.log')
+            lines = statusLines.splitlines()
+            onuOnline = len(lines)
+            time.sleep(5)
+        logging.info('All ONUs now Online!')
+
 
 def run_test(olt_ip_address, olt_port, olt_type, onu_type, onu_count, log_dir):
     preprovisioning = Preprovisioning()
@@ -142,3 +160,4 @@
     preprovisioning.query_devices_after_enabling()
     preprovisioning.check_olt_fields_after_enabling()
     preprovisioning.check_onu_fields_after_enabling()
+    preprovisioning.proceed()