diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
index 18f7fbf..eaa8ff5 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
@@ -185,14 +185,9 @@
                 yield self.perform_initial_bridge_setup()
 
                 for uni_port in self._handler.uni_ports:
-                    yield self.enable_uni(uni_port, True)
-
                     # Provision the initial bridge configuration
                     yield self.perform_uni_initial_bridge_setup(uni_port)
 
-                    # And re-enable the UNIs if needed
-                    yield self.enable_uni(uni_port, False)
-
                 self.deferred.callback('initial-download-success')
 
             except TimeoutError as e:
@@ -318,51 +313,3 @@
             raise
 
         returnValue(None)
-
-    @inlineCallbacks
-    def enable_uni(self, uni_port, force_lock):
-        """
-        Lock or unlock a single uni port
-
-        :param uni_port: UniPort to admin up/down
-        :param force_lock: (boolean) If True, force lock regardless of enabled state
-        """
-        self.log.debug('function-entry')
-
-        omci_cc = self._onu_device.omci_cc
-        frame = None
-
-        ################################################################################
-        #  Lock/Unlock UNI  -  0 to Unlock, 1 to lock
-        #
-        #  EntityID is referenced by:
-        #            - MAC bridge port configuration data for the UNI side
-        #  References:
-        #            - Nothing
-        try:
-            state = 1 if force_lock or not uni_port.enabled else 0
-            msg = None
-            if uni_port.type.value == UniType.PPTP.value:
-                msg = PptpEthernetUniFrame(uni_port.entity_id,
-                                           attributes=dict(administrative_state=state))
-            elif uni_port.type.value == UniType.VEIP.value:
-                msg = VeipUniFrame(uni_port.entity_id,
-                                   attributes=dict(administrative_state=state))
-            else:
-                self.log.warn('unknown-uni-type', uni_port=uni_port)
-
-            if msg:
-               frame = msg.set()
-               self.log.debug('openomci-msg', omci_msg=msg)
-               results = yield omci_cc.send(frame)
-               self.check_status_and_state(results, 'set-pptp-ethernet-uni-lock-restore')
-
-        except TimeoutError as e:
-            self.log.warn('rx-timeout', e=e)
-            raise
-
-        except Exception as e:
-            self.log.exception('omci-failure', e=e)
-            raise
-
-        returnValue(None)
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
index 8e9a2e1..2edd43c 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
@@ -74,7 +74,6 @@
         super(BrcmUniLockTask, self).start()
         self._local_deferred = reactor.callLater(0, self.perform_lock)
 
-    @inlineCallbacks
     def perform_lock(self):
         """
         Perform the lock/unlock
@@ -88,53 +87,51 @@
             pptp_list = sorted(self._config.pptp_entities) if self._config.pptp_entities else []
             veip_list = sorted(self._config.veip_entities) if self._config.veip_entities else []
 
-            for entity_id in pptp_list:
-                pptp_value = self._config.pptp_entities[entity_id]
-                msg = PptpEthernetUniFrame(entity_id,
-                                           attributes=dict(administrative_state=state))
-                yield self._send_uni_lock_msg(entity_id, pptp_value, msg)
+            if self._lock is True:
+                # lock unis first, ontg must be last
+                for entity_id in pptp_list:
+                    msg = PptpEthernetUniFrame(entity_id,
+                                               attributes=dict(administrative_state=state))
+                    self._send_omci_msg(msg)
 
-            for entity_id in veip_list:
-                veip_value = self._config.veip_entities[entity_id]
-                msg = VeipUniFrame(entity_id,
-                                   attributes=dict(administrative_state=state))
-                yield self._send_uni_lock_msg(entity_id, veip_value, msg)
+                for entity_id in veip_list:
+                    msg = VeipUniFrame(entity_id,
+                                       attributes=dict(administrative_state=state))
+                    self._send_omci_msg(msg)
 
-            msg = OntGFrame(attributes={'administrative_state': state})
-            frame = msg.set()
-            self.log.debug('openomci-msg', omci_msg=msg)
-            results = yield self._device.omci_cc.send(frame)
-            self.strobe_watchdog()
-
-            status = results.fields['omci_message'].fields['success_code']
-            self.log.info('response-status', status=status)
-
-            # Success?
-            if status in (RC.Success.value, RC.InstanceExists):
-                self.log.debug('set-lock-ontg', lock=self._lock)
+                msg = OntGFrame(attributes={'administrative_state': state})
+                self._send_omci_msg(msg)
             else:
-                self.log.warn('cannot-set-lock-ontg', lock=self._lock)
+                # ontg must be unlocked first, then unis
+                msg = OntGFrame(attributes={'administrative_state': state})
+                self._send_omci_msg(msg)
 
-            self.deferred.callback(self)
+                for entity_id in pptp_list:
+                    msg = PptpEthernetUniFrame(entity_id,
+                                               attributes=dict(administrative_state=state))
+                    self._send_omci_msg(msg)
+
+                for entity_id in veip_list:
+                    msg = VeipUniFrame(entity_id,
+                                       attributes=dict(administrative_state=state))
+                    self._send_omci_msg(msg)
+
+            self.deferred.callback('setting-uni-lock-state-finished')
 
         except Exception as e:
             self.log.exception('setting-uni-lock-state', e=e)
             self.deferred.errback(failure.Failure(e))
 
     @inlineCallbacks
-    def _send_uni_lock_msg(self, entity_id, value, me_message):
+    def _send_omci_msg(self, me_message):
         frame = me_message.set()
         self.log.debug('openomci-msg', omci_msg=me_message)
         results = yield self._device.omci_cc.send(frame)
         self.strobe_watchdog()
 
         status = results.fields['omci_message'].fields['success_code']
-        self.log.info('response-status', status=status)
+        self.log.debug('response-status', status=status)
 
         # Success?
-        if status in (RC.Success.value, RC.InstanceExists):
-            self.log.debug('set-lock-uni', uni=entity_id, value=value, lock=self._lock)
-        else:
-            self.log.warn('cannot-set-lock-uni', uni=entity_id, value=value, lock=self._lock)
-
-        returnValue(None)
+        if status not in (RC.Success.value, RC.InstanceExists):
+            raise BrcmUniLockException('openomci-set-failed')
