VOL-1181 Add an extra OLT indication when Voltha reconnects

Change-Id: Ia47cc4c0a5cc4f8c47578876f354dff9a6d43673
diff --git a/common/server.cc b/common/server.cc
index 54d32ac..b37e6dc 100644
--- a/common/server.cc
+++ b/common/server.cc
@@ -155,6 +155,22 @@
         std::cout << "Connection to Voltha established. Indications enabled"
         << std::endl;
 
+        if (state.previsouly_connected()) {
+            // Reconciliation / recovery case
+            if (state.is_activated()){
+                // Adding extra olt indication of current state
+                openolt::Indication ind;
+                openolt::OltIndication* oltInd = new openolt::OltIndication();
+                if (state.is_activated()) {
+                    oltInd->set_oper_state("up");
+                } else {
+                    oltInd->set_oper_state("down");
+                }
+                ind.set_allocated_olt_ind(oltInd);
+                oltIndQ.push(ind);
+            }
+        }
+
         state.connect();
 
         while (state.is_connected()) {
diff --git a/common/state.h b/common/state.h
index 331b09d..b19280f 100644
--- a/common/state.h
+++ b/common/state.h
@@ -12,8 +12,13 @@
         return activated;
     }
 
+    bool previsouly_connected() {
+        return connected_once;
+    }
+
     void connect() {
         connected_to_voltha = true;
+        connected_once = true;
     }
 
     void disconnect() {
@@ -31,5 +36,6 @@
   private:
     bool connected_to_voltha = false;
     bool activated = false;
+    bool connected_once = false;
 };
 #endif