VOL-3370: Assertion failures during installation of Tech-Profile for TT workflow

- Pass Tcont reference to TP setup task even if TCONT was already installed before

Change-Id: Ie65d6a04b8a35e1b5fad5b3eb48162ced8fb5de4
diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
index b1e2baa..1aaff7d 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -619,8 +619,12 @@
                     reactor.callLater(retry, self.load_and_configure_tech_profile,
                                       uni_id, tp_path)
 
+                if self._pon.get_tcont(alloc_id) is None:
+                    self.log.error("no-valid-tcont-reference-for-tp-id--not-installing-gem", alloc_id=alloc_id, tp_id=tp_id)
+                    return
+
                 self._tp_service_specific_task[uni_id][tp_path] = \
-                    BrcmTpSetupTask(self.omci_agent, self, uni_id, [], new_gems, tp_id)
+                    BrcmTpSetupTask(self.omci_agent, self, uni_id, [self._pon.get_tcont(alloc_id)], new_gems, tp_id)
                 self._deferred = \
                     self._onu_omci_device.task_runner.queue_task(self._tp_service_specific_task[uni_id][tp_path])
                 self._deferred.addCallbacks(success, failure)
diff --git a/python/adapters/brcm_openomci_onu/pon_port.py b/python/adapters/brcm_openomci_onu/pon_port.py
index 2ee3344..18d4914 100644
--- a/python/adapters/brcm_openomci_onu/pon_port.py
+++ b/python/adapters/brcm_openomci_onu/pon_port.py
@@ -181,6 +181,13 @@
             self._tconts[tcont.alloc_id] = tcont
         return True
 
+    def get_tcont(self, alloc_id):
+        try:
+            return self._tconts[alloc_id]
+        except Exception as e:
+            self.log.error("error-fetching-tcont", alloc_id=alloc_id, e=e)
+            return None
+
     @inlineCallbacks
     def remove_tcont(self, alloc_id, remove_from_hw=True):