VOL-1257 - OpenOLT Driver Agent should support platforms-defined port topologies

Updated openolt driver initial activation sequence with BAL to query and
extract the topology information. This includes both number of ports as
well as the technology for each port. Presently, it is assumed that
all ports use same technology until the adapter resource manager supports
per-port technonologies. Updated hardcoded iterator extents to use
the dynamic results via NumPonIf_() and NumNniIf_(). Added construct
to allow vendors to specify their vendor/model name used in
DeviceInfo discovery.

Change-Id: I9050d78c3246d1be4e869ffdfb3a3f9314b9d959
diff --git a/common/main.cc b/common/main.cc
index 2898219..b211cfb 100644
--- a/common/main.cc
+++ b/common/main.cc
@@ -15,6 +15,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include <iostream>
+#include <unistd.h>
 
 #include "server.h"
 #include "core.h"
@@ -29,6 +30,18 @@
         return 1;
     }
 
+    // Wait for successful activation before allowing VOLTHA to connect. 
+    // This is necessary to allow the device topology to be dynamically
+    // queried from driver after initialization and activation is complete.
+    int maxTrials = 300;
+    while (!state.is_activated()) {
+        sleep(1);
+        if (--maxTrials == 0) {
+            std::cout << "ERROR: OLT/PON Activation failed" << std::endl;
+            return 1;
+        }
+    }
+
     RunServer();
 
     return 0;