diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 4d2505b..2cdec29 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -22,7 +22,6 @@
 from twisted.internet import reactor
 from scapy.layers.l2 import Ether, Dot1Q
 from transitions import Machine
-from twisted.internet.defer import inlineCallbacks
 
 from voltha.protos.device_pb2 import Port, Device
 from voltha.protos.common_pb2 import OperStatus, AdminState, ConnectStatus
@@ -45,9 +44,7 @@
         DEFAULT_MGMT_VLAN
 from voltha.adapters.openolt.openolt_alarms import OpenOltAlarmMgr
 from voltha.adapters.openolt.openolt_bw import OpenOltBW
-from common.pon_resource_manager.resource_manager import PONResourceManager
 from voltha.extensions.alarms.onu.onu_discovery_alarm import OnuDiscoveryAlarm
-from voltha.adapters.openolt.openolt_resource_manager import OpenOltResourceMgr
 
 
 class OpenoltDevice(object):
@@ -184,7 +181,6 @@
         except Exception as e:
             self.log.exception('post_init failed', e=e)
 
-    @inlineCallbacks
     def do_state_connected(self, event):
         self.log.debug("do_state_connected")
 
@@ -200,15 +196,8 @@
         device.hardware_version = device_info.hardware_version
         device.firmware_version = device_info.firmware_version
 
-        self.resource_manager = OpenOltResourceMgr(self.device_id,
-                                                   self.host_and_port,
-                                                   self.extra_args,
-                                                   device_info)
         self.flow_mgr = OpenOltFlowMgr(self.log, self.stub, self.device_id,
-                                       self.logical_device_id,
-                                       self.resource_manager)
-
-        yield self._initialize_resource_manager_resource_pools()
+                                       self.logical_device_id)
 
         # TODO: check for uptime and reboot if too long (VOL-1192)
 
@@ -386,7 +375,6 @@
             # FIXME - handle PON oper state change
             pass
 
-    @inlineCallbacks
     def onu_discovery_indication(self, onu_disc_indication):
         intf_id = onu_disc_indication.intf_id
         serial_number = onu_disc_indication.serial_number
@@ -410,32 +398,15 @@
             serial_number=serial_number_str)
 
         if onu_device is None:
+            onu_id = self.new_onu_id(intf_id)
+
             try:
-                onu_id = yield self.resource_manager.get_resource_id(
-                    intf_id, PONResourceManager.ONU_ID)
-                if onu_id is None:
-                    raise Exception("onu-id-unavailable")
-
-                pon_intf_onu_id = (intf_id, onu_id)
-                self.resource_manager.init_resource_store(pon_intf_onu_id)
-
-                alloc_id = yield self.resource_manager.get_alloc_id(
-                    pon_intf_onu_id)
-                if alloc_id is None:
-                    # Free up other PON resources if are unable to
-                    # proceed ahead
-                    self.resource_manager.free_resource_id(
-                        intf_id, PONResourceManager.ONU_ID, onu_id
-                    )
-                    raise Exception("alloc-id-unavailable")
-
                 self.add_onu_device(
                     intf_id,
                     platform.intf_id_to_port_no(intf_id, Port.PON_OLT),
                     onu_id, serial_number)
-                # Use sched_id same as alloc_id for the ONU.
                 self.activate_onu(intf_id, onu_id, serial_number,
-                                  serial_number_str, alloc_id, alloc_id)
+                                  serial_number_str)
             except Exception as e:
                 self.log.exception('onu-activation-failed', e=e)
 
@@ -464,12 +435,8 @@
                 onu_device.oper_status = OperStatus.DISCOVERED
                 self.adapter_agent.update_device(onu_device)
                 try:
-                    pon_intf_onu_id = (intf_id, onu_id)
-                    alloc_id = yield self.resource_manager.get_alloc_id(
-                        pon_intf_onu_id)
-                    # Use sched_id same as alloc_id for the ONU.
                     self.activate_onu(intf_id, onu_id, serial_number,
-                                      serial_number_str, alloc_id, alloc_id)
+                                      serial_number_str)
                 except Exception as e:
                     self.log.error('onu-activation-error',
                                    serial_number=serial_number_str, error=e)
@@ -477,7 +444,6 @@
                 self.log.warn('unexpected state', onu_id=onu_id,
                               onu_device_oper_state=onu_device.oper_status)
 
-    @inlineCallbacks
     def onu_indication(self, onu_indication):
         self.log.debug("onu indication", intf_id=onu_indication.intf_id,
                        onu_id=onu_indication.onu_id,
@@ -507,11 +473,6 @@
             return
 
 
-        # We will use this alloc_id and gemport_id to pass on to the onu adapter
-        pon_intf_onu_id = (onu_indication.intf_id, onu_indication.onu_id)
-        alloc_id = yield self.resource_manager.get_alloc_id(pon_intf_onu_id)
-        gemport_id = yield self.resource_manager.get_gemport_id(pon_intf_onu_id)
-
         if platform.intf_id_from_pon_port_no(onu_device.parent_port_no) \
                 != onu_indication.intf_id:
             self.log.warn('ONU-is-on-a-different-intf-id-now',
@@ -607,11 +568,14 @@
 
                 # tcont creation (onu)
                 tcont = TcontsConfigData()
-                tcont.alloc_id = alloc_id
+                tcont.alloc_id = platform.mk_alloc_id(
+                    onu_indication.intf_id, onu_indication.onu_id)
 
                 # gem port creation
                 gem_port = GemportsConfigData()
-                gem_port.gemport_id = gemport_id
+                gem_port.gemport_id =  platform.mk_gemport_id(
+                    onu_indication.intf_id,
+                    onu_indication.onu_id)
 
                 gem_port.tcont_ref = str(tcont.alloc_id)
 
@@ -687,17 +651,8 @@
         self.log.debug("packet indication", intf_id=pkt_indication.intf_id,
                        gemport_id=pkt_indication.gemport_id,
                        flow_id=pkt_indication.flow_id)
-        onu_id = None
 
-        pon_intf_gemport = (pkt_indication.intf_id, pkt_indication.gemport_id)
-        try:
-            onu_id = self.resource_manager.pon_intf_gemport_to_onu_id_map[
-                pon_intf_gemport]
-        except KeyError:
-            self.log.error("no-onu-reference-for-gem",
-                           gemport_id=pkt_indication.gemport_id)
-            return
-
+        onu_id = platform.onu_id_from_gemport_id(pkt_indication.gemport_id)
         logical_port_num = platform.mk_uni_port_num(pkt_indication.intf_id,
                                                     onu_id)
 
@@ -890,6 +845,19 @@
                 self.adapter_agent.delete_port(self.device_id, port)
                 return
 
+    def new_onu_id(self, intf_id):
+        onu_devices = self.adapter_agent.get_child_devices(self.device_id)
+        pon_onu_ids = [onu_device.proxy_address.onu_id
+                       for onu_device in onu_devices
+                       if onu_device.proxy_address.channel_id == intf_id]
+        for i in range(1, platform.MAX_ONUS_PER_PON):
+            if i not in pon_onu_ids:
+                return i
+
+        self.log.error('All available onu_ids taken on this pon',
+                       intf_id=intf_id, ids_taken=platform.MAX_ONUS_PER_PON)
+        return None
+
     def update_flow_table(self, flows):
         self.log.debug('No updates here now, all is done in logical flows '
                        'update')
@@ -976,10 +944,6 @@
         self.log.info('deleting-olt', device_id=self.device_id,
                       logical_device_id=self.logical_device_id)
 
-        # Removes all data from the resource manager KV store
-        # for the device.
-        self.resource_manager.clear_device_resource_pool()
-
         try:
             # Rebooting to reset the state
             self.reboot()
@@ -1006,18 +970,16 @@
             self.log.info('openolt device reenabled')
 
     def activate_onu(self, intf_id, onu_id, serial_number,
-                     serial_number_str, agg_port_id, sched_id):
+                     serial_number_str):
         pir = self.bw_mgr.pir(serial_number_str)
         self.log.debug("activating-onu", intf_id=intf_id, onu_id=onu_id,
                        serial_number_str=serial_number_str,
                        serial_number=serial_number, pir=pir)
         onu = openolt_pb2.Onu(intf_id=intf_id, onu_id=onu_id,
-                              serial_number=serial_number, pir=pir,
-                              agg_port_id=agg_port_id, sched_id=sched_id)
+                              serial_number=serial_number, pir=pir)
         self.stub.ActivateOnu(onu)
         self.log.info('onu-activated', serial_number=serial_number_str)
 
-    @inlineCallbacks
     def delete_child_device(self, child_device):
         self.log.debug('sending-deactivate-onu',
                        olt_device_id=self.device_id,
@@ -1039,25 +1001,11 @@
             self.log.error('port delete error', error=e)
         serial_number = self.destringify_serial_number(
             child_device.serial_number)
-        pon_intf_id_onu_id = (child_device.proxy_address.channel_id,
-                              child_device.proxy_address.onu_id)
-        alloc_id = yield self.resource_manager.get_alloc_id(pon_intf_id_onu_id)
-        # Use sched_id same as alloc_id for the Onu.
         onu = openolt_pb2.Onu(intf_id=child_device.proxy_address.channel_id,
                               onu_id=child_device.proxy_address.onu_id,
-                              serial_number=serial_number,
-                              agg_port_id=alloc_id, sched_id=alloc_id)
+                              serial_number=serial_number)
         self.stub.DeleteOnu(onu)
 
-        # Remove reference to (pon_intf_id, onu_id) from the dictionary
-        # when ONU is being removed.
-        del self.resource_manager.pon_intf_id_onu_id_to_resource_map[
-            pon_intf_id_onu_id]
-        # Free any PON resources that were reserved for the ONU
-        self.resource_manager.free_pon_resources_for_onu(
-            child_device.proxy_address.channel_id,
-                                         child_device.proxy_address.onu_id)
-
     def reboot(self):
         self.log.debug('rebooting openolt device', device_id=self.device_id)
         try:
@@ -1079,13 +1027,3 @@
     def simulate_alarm(self, alarm):
         self.alarm_mgr.simulate_alarm(alarm)
 
-    @inlineCallbacks
-    def _initialize_resource_manager_resource_pools(self):
-        try:
-            yield self.resource_manager.initialize_device_resource_range_and_pool()
-        except Exception as e:
-            # When resource manager initialization fails we can't proceed
-            # further so, exiting without instantiating openolt adapter
-            self.log.exception("Resource-manager-initialization-failed", e=e)
-            sys.exit(1)
-
diff --git a/voltha/adapters/openolt/openolt_flow_mgr.py b/voltha/adapters/openolt/openolt_flow_mgr.py
index 8b57c6f..463ce68 100644
--- a/voltha/adapters/openolt/openolt_flow_mgr.py
+++ b/voltha/adapters/openolt/openolt_flow_mgr.py
@@ -16,7 +16,6 @@
 import copy
 from twisted.internet import reactor
 import grpc
-from twisted.internet.defer import inlineCallbacks, returnValue
 
 from voltha.protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, \
     ofp_flow_stats, OFPMT_OXM, Flows, FlowGroups, OFPXMT_OFB_IN_PORT, \
@@ -24,7 +23,6 @@
 from voltha.protos.device_pb2 import Port
 import voltha.core.flow_decomposer as fd
 import openolt_platform as platform
-from common.pon_resource_manager.resource_manager import  PONResourceManager
 from voltha.adapters.openolt.protos import openolt_pb2
 from voltha.registry import registry
 
@@ -73,7 +71,7 @@
 
 class OpenOltFlowMgr(object):
 
-    def __init__(self, log, stub, device_id, logical_device_id, resource_mgr):
+    def __init__(self, log, stub, device_id, logical_device_id):
         self.log = log
         self.stub = stub
         self.device_id = device_id
@@ -83,7 +81,6 @@
         self.flows_proxy = registry('core').get_proxy(
             '/devices/{}/flows'.format(self.device_id))
         self.root_proxy = registry('core').get_proxy('/')
-        self.resource_mgr = resource_mgr
 
     def add_flow(self, flow):
         self.log.debug('add flow', flow=flow)
@@ -239,7 +236,6 @@
             self.log.debug('no device flow to remove for this flow (normal '
                            'for multi table flows)', flow=flow)
 
-    @inlineCallbacks
     def divide_and_add_flow(self, intf_id, onu_id, classifier,
                             action, flow):
 
@@ -249,7 +245,7 @@
         if IP_PROTO in classifier:
             if classifier[IP_PROTO] == 17:
                 self.log.debug('dhcp flow add')
-                yield self.add_dhcp_trap(intf_id, onu_id, classifier,
+                self.add_dhcp_trap(intf_id, onu_id, classifier,
                                    action, flow)
             elif classifier[IP_PROTO] == 2:
                 self.log.warn('igmp flow add ignored, not implemented yet')
@@ -260,30 +256,29 @@
         elif ETH_TYPE in classifier:
             if classifier[ETH_TYPE] == EAP_ETH_TYPE:
                 self.log.debug('eapol flow add')
-                yield self.add_eapol_flow(intf_id, onu_id, flow)
+                self.add_eapol_flow(intf_id, onu_id, flow)
                 vlan_id = self.get_subscriber_vlan(fd.get_in_port(flow))
                 if vlan_id is not None:
-                    yield self.add_eapol_flow(
+                    self.add_eapol_flow(
                         intf_id, onu_id, flow,
                         eapol_id=EAPOL_SECONDARY_FLOW_INDEX,
                         vlan_id=vlan_id)
             if classifier[ETH_TYPE] == LLDP_ETH_TYPE:
                 self.log.debug('lldp flow add')
-                yield self.add_lldp_flow(flow)
+                self.add_lldp_flow(flow)
 
         elif PUSH_VLAN in action:
-            yield self.add_upstream_data_flow(intf_id, onu_id, classifier,
+            self.add_upstream_data_flow(intf_id, onu_id, classifier,
                                             action,
                                       flow)
         elif POP_VLAN in action:
-            yield self.add_downstream_data_flow(intf_id, onu_id, classifier,
+            self.add_downstream_data_flow(intf_id, onu_id, classifier,
                                           action, flow)
         else:
             self.log.debug('Invalid-flow-type-to-handle',
                            classifier=classifier,
                            action=action, flow=flow)
 
-    @inlineCallbacks
     def add_upstream_data_flow(self, intf_id, onu_id, uplink_classifier,
                                uplink_action, logical_flow):
 
@@ -291,20 +286,18 @@
         uplink_classifier[PACKET_TAG_TYPE] = SINGLE_TAG
 
 
-        yield self.add_hsia_flow(intf_id, onu_id, uplink_classifier,
+        self.add_hsia_flow(intf_id, onu_id, uplink_classifier,
                            uplink_action, UPSTREAM, HSIA_FLOW_INDEX,
                            logical_flow)
 
         # Secondary EAP on the subscriber vlan
         (eap_active, eap_logical_flow) = self.is_eap_enabled(intf_id, onu_id)
         if eap_active:
-
-            yield self.add_eapol_flow(intf_id, onu_id, eap_logical_flow,
+            self.add_eapol_flow(intf_id, onu_id, eap_logical_flow,
                 eapol_id=EAPOL_SECONDARY_FLOW_INDEX,
                 vlan_id=uplink_classifier[VLAN_VID])
 
 
-    @inlineCallbacks
     def add_downstream_data_flow(self, intf_id, onu_id, downlink_classifier,
                                  downlink_action, flow):
         downlink_classifier[PACKET_TAG_TYPE] = DOUBLE_TAG
@@ -312,7 +305,7 @@
         downlink_action[POP_VLAN] = True
         downlink_action[VLAN_VID] = downlink_classifier[VLAN_VID]
 
-        yield self.add_hsia_flow(intf_id, onu_id, downlink_classifier,
+        self.add_hsia_flow(intf_id, onu_id, downlink_classifier,
                            downlink_action, DOWNSTREAM, HSIA_FLOW_INDEX,
                            flow)
 
@@ -320,18 +313,11 @@
     # will take care of handling all the p bits.
     # We need to revisit when mulitple gem port per p bits is needed.
     # Waiting for Technology profile
-    @inlineCallbacks
     def add_hsia_flow(self, intf_id, onu_id, classifier, action,
                       direction, hsia_id, logical_flow):
 
-        pon_intf_onu_id = (intf_id, onu_id)
-        gemport_id = yield self.resource_mgr.get_gemport_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
-        alloc_id = yield self.resource_mgr.get_alloc_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
-
+        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        alloc_id = platform.mk_alloc_id(intf_id, onu_id)
         flow_id = platform.mk_flow_id(intf_id, onu_id, hsia_id)
 
         flow = openolt_pb2.Flow(
@@ -344,7 +330,6 @@
 
         self.add_flow_to_device(flow, logical_flow)
 
-    @inlineCallbacks
     def add_dhcp_trap(self, intf_id, onu_id, classifier, action, logical_flow):
 
         self.log.debug('add dhcp upstream trap', classifier=classifier,
@@ -355,13 +340,8 @@
         classifier[PACKET_TAG_TYPE] = SINGLE_TAG
         classifier.pop(VLAN_VID, None)
 
-        pon_intf_onu_id = (intf_id, onu_id)
-        gemport_id = yield self.resource_mgr.get_gemport_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
-        alloc_id = yield self.resource_mgr.get_alloc_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
+        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        alloc_id = platform.mk_alloc_id(intf_id, onu_id)
         flow_id = platform.mk_flow_id(intf_id, onu_id, DHCP_FLOW_INDEX)
 
         upstream_flow = openolt_pb2.Flow(
@@ -400,7 +380,6 @@
 
         self.add_flow_to_device(downstream_flow, downstream_logical_flow)
 
-    @inlineCallbacks
     def add_eapol_flow(self, intf_id, onu_id, logical_flow,
                        eapol_id=EAPOL_FLOW_INDEX,
                        vlan_id=DEFAULT_MGMT_VLAN):
@@ -413,16 +392,10 @@
         uplink_action = {}
         uplink_action[TRAP_TO_HOST] = True
 
-        pon_intf_onu_id = (intf_id, onu_id)
-        gemport_id = yield self.resource_mgr.get_gemport_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
-        alloc_id = yield self.resource_mgr.get_alloc_id(
-                          pon_intf_onu_id=pon_intf_onu_id
-                     )
-
         # Add Upstream EAPOL Flow.
 
+        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        alloc_id = platform.mk_alloc_id(intf_id, onu_id)
         uplink_flow_id = platform.mk_flow_id(intf_id, onu_id, eapol_id)
 
         upstream_flow = openolt_pb2.Flow(
@@ -499,7 +472,6 @@
 
     """ Add a downstream LLDP trap flow on the NNI interface
     """
-    @inlineCallbacks
     def add_lldp_flow(self, logical_flow, network_intf_id=0):
 
         classifier = {}
@@ -700,4 +672,4 @@
         if id >> 15 == 0x1:
             return (id & 0x7fff, UPSTREAM)
         else:
-            return (id, DOWNSTREAM)
\ No newline at end of file
+            return (id, DOWNSTREAM)
diff --git a/voltha/adapters/openolt/openolt_platform.py b/voltha/adapters/openolt/openolt_platform.py
index b179d90..5e091f6 100644
--- a/voltha/adapters/openolt/openolt_platform.py
+++ b/voltha/adapters/openolt/openolt_platform.py
@@ -20,6 +20,33 @@
 """
 Encoding of identifiers
 =======================
+GEM port ID
+
+    GEM port id is unique per PON port
+
+     10              3      0
+    +--+--------------+------+
+    |1 |     onu id   | GEM  |
+    |  |              | idx  |
+    +--+--------------+------+
+
+    GEM port id range (0, 1023) is reserved
+    onu id = 7 bits = 128 ONUs per PON
+    GEM index = 3 bits = 8 GEM ports per ONU
+
+Alloc ID
+
+    Uniquely identifies a T-CONT
+    Ranges from 0 to 4095
+    Unique per PON interface
+
+     12         6            0
+    +------------+------------+
+    |   onu id   | Alloc idx  |
+    +------------+------------+
+
+    onu id = 7 bits = 128 ONUs per PON
+    Alloc index = 6 bits = 64 GEM ports per ONU
 
 Flow id
 
@@ -78,6 +105,18 @@
 
 MAX_ONUS_PER_PON = 112
 
+def mk_alloc_id(intf_id, onu_id, idx=0):
+    # FIXME - driver should do prefixing 1 << 10 as it is Maple specific
+    # return 1<<10 | onu_id<<6 | idx
+    return 1023 + intf_id * MAX_ONUS_PER_PON + onu_id  # FIXME
+
+
+def mk_gemport_id(intf_id, onu_id, idx=0):
+    return 1024 + (((MAX_ONUS_PER_PON * intf_id + onu_id - 1) * 7) + idx)
+
+def onu_id_from_gemport_id(gemport_id):
+    return (((gemport_id - 1024) // 7) % MAX_ONUS_PER_PON) + 1
+
 def mk_uni_port_num(intf_id, onu_id):
     return intf_id << 11 | onu_id << 4
 
diff --git a/voltha/adapters/openolt/openolt_resource_manager.py b/voltha/adapters/openolt/openolt_resource_manager.py
deleted file mode 100644
index a85cbc5..0000000
--- a/voltha/adapters/openolt/openolt_resource_manager.py
+++ /dev/null
@@ -1,276 +0,0 @@
-#
-# Copyright 2018 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-import shlex
-from argparse import ArgumentParser, ArgumentError
-
-import structlog
-from twisted.internet.defer import inlineCallbacks, returnValue
-
-from common.pon_resource_manager.resource_manager import PONResourceManager
-from voltha.registry import registry
-
-
-# Used to parse extra arguments to OpenOlt adapter from the NBI
-class OpenOltArgumentParser(ArgumentParser):
-    # Must override the exit command to prevent it from
-    # calling sys.exit().  Return exception instead.
-    def exit(self, status=0, message=None):
-        raise Exception(message)
-
-
-class OpenOltResourceMgr(object):
-
-    GEMPORT_IDS = "gemport_ids"
-    ALLOC_IDS = "alloc_ids"
-
-    def __init__(self, device_id, host_and_port, extra_args, device_info):
-        self.log = structlog.get_logger(id=device_id,
-                                        ip=host_and_port)
-        self.device_id = device_id
-        self.host_and_port = host_and_port
-        self.extra_args = extra_args
-        self.device_info = device_info
-        # Below dictionary maintains a map of tuple (pon_intf_id, onu_id)
-        # to list of gemports and alloc_ids.
-        # Note: This is a stateful information and will be lost across
-        # VOLTHA reboots. When adapter is containerized, this information
-        # should be backed up in an external K/V store.
-        '''
-        Example:
-        {
-            (pon_intf_id_1, onu_id_1): {
-                    "gemport_ids": [1024,1025],
-                    "alloc_ids"  : [1024]
-            },
-            (pon_intf_id_1, onu_id_2): {
-                    "gemport_ids": [1026],
-                    "alloc_ids"  : [1025]
-            }
-        }
-        '''
-        self.pon_intf_id_onu_id_to_resource_map = dict()
-        self.pon_intf_gemport_to_onu_id_map = dict()
-        self.resource_mgr = self.\
-            _parse_extra_args_and_init_resource_manager_class()
-        # Flag to indicate whether information fetched from device should
-        # be used to intialize PON Resource Ranges
-        self.use_device_info = False
-
-    def _parse_extra_args_and_init_resource_manager_class(self):
-        self.args = registry('main').get_args()
-
-        # KV store's IP Address and PORT
-        host, port = '127.0.0.1', 8500
-        if self.args.backend == 'etcd':
-            host, port = self.args.etcd.split(':', 1)
-        elif self.args.backend == 'consul':
-            host, port = self.args.consul.split(':', 1)
-
-        if self.extra_args and len(self.extra_args) > 0:
-            parser = OpenOltArgumentParser(add_help=False)
-            parser.add_argument('--openolt_variant', '-o', action='store',
-                                choices=['default', 'asfvolt16'],
-                                default='default')
-            try:
-                args = parser.parse_args(shlex.split(self.extra_args))
-                self.log.debug('parsing-extra-arguments', args=args)
-
-                try:
-                    resource_manager = PONResourceManager(
-                        self.device_info.technology,
-                        args.openolt_variant,
-                        self.device_id, self.args.backend,
-                        host, port
-                    )
-                except Exception as e:
-                    raise Exception(e)
-
-            except ArgumentError as e:
-                raise Exception('invalid-arguments: {}'.format(e.message))
-
-            except Exception as e:
-                raise Exception(
-                    'option-parsing-error: {}'.format(e.message))
-        else:
-            try:
-                # OLT Vendor type not available, use device information
-                # to initialize PON resource ranges.
-                self.use_device_info = True
-
-                resource_manager = PONResourceManager(
-                    self.device_info.technology,
-                    self.device_info.vendor,
-                    self.device_id, self.args.backend,
-                    host, port
-                )
-            except Exception as e:
-                raise Exception(e)
-
-        return resource_manager
-
-    def init_resource_store(self, pon_intf_onu_id):
-        # Initialize the map to store the (pon_intf_id, onu_id) to gemport
-        # list and alloc_id list
-        if pon_intf_onu_id not in \
-                self.pon_intf_id_onu_id_to_resource_map.keys():
-            self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] = dict()
-            self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-                [OpenOltResourceMgr.GEMPORT_IDS] = list()
-            self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-                [OpenOltResourceMgr.ALLOC_IDS] = list()
-
-    @inlineCallbacks
-    def get_resource_id(self, pon_intf_id, resource_type, num_of_id=1):
-        resource = yield self.resource_mgr.get_resource_id(
-            pon_intf_id, resource_type, num_of_id)
-        returnValue(resource)
-
-    @inlineCallbacks
-    def free_resource_id(self, pon_intf_id, resource_type, release_content):
-        result = yield self.resource_mgr.free_resource_id(
-            pon_intf_id, resource_type, release_content)
-        returnValue(result)
-
-    @inlineCallbacks
-    def get_alloc_id(self, pon_intf_onu_id):
-        # Derive the pon_intf from the pon_intf_onu_id tuple
-        pon_intf = pon_intf_onu_id[0]
-        alloc_id = None
-
-        # Since we support only one alloc_id for the ONU at the moment,
-        # return the first alloc_id in the list, if available, for that
-        # ONU.
-        if len(self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-                       [OpenOltResourceMgr.ALLOC_IDS]) > 0:
-            alloc_id = self.pon_intf_id_onu_id_to_resource_map[
-                pon_intf_onu_id][OpenOltResourceMgr.ALLOC_IDS][0]
-            returnValue(alloc_id)
-
-        # get_alloc_id returns a list of alloc_id.
-        alloc_id_list = yield self.resource_mgr.get_resource_id(
-            pon_intf_id=pon_intf,
-            resource_type=PONResourceManager.ALLOC_ID,
-            num_of_id=1
-        )
-        if alloc_id_list and len(alloc_id_list) == 0:
-            self.log.error("no-alloc-id-available")
-            returnValue(alloc_id)
-
-        # store the alloc id list per (pon_intf_id, onu_id) tuple
-        self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-            [OpenOltResourceMgr.ALLOC_IDS].extend(alloc_id_list)
-
-        # Since we request only one alloc id, we refer the 0th
-        # index
-        alloc_id = alloc_id_list[0]
-
-        returnValue(alloc_id)
-
-    @inlineCallbacks
-    def get_gemport_id(self, pon_intf_onu_id):
-        # Derive the pon_intf and onu_id from the pon_intf_onu_id tuple
-        pon_intf = pon_intf_onu_id[0]
-        onu_id = pon_intf_onu_id[1]
-        gemport = None
-
-        if len(self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-                       [OpenOltResourceMgr.GEMPORT_IDS]) > 0:
-            # Since we support only one gemport_id on the ONU at the moment,
-            # return the first gemport_id in the list, if available, for that
-            # ONU.
-            gemport = self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-                [OpenOltResourceMgr.GEMPORT_IDS][0]
-            returnValue(gemport)
-
-        # get_gem_id returns a list of gem_id.
-        gemport_id_list = yield self.resource_mgr.get_resource_id(
-            pon_intf_id=pon_intf,
-            resource_type=PONResourceManager.GEMPORT_ID,
-            num_of_id=1
-        )
-
-        if gemport_id_list and len(gemport_id_list) == 0:
-            self.log.error("no-gemport-id-available")
-            returnValue(gemport)
-
-        # store the gem port id list per (pon_intf_id, onu_id) tuple
-        self.pon_intf_id_onu_id_to_resource_map[pon_intf_onu_id] \
-            [OpenOltResourceMgr.GEMPORT_IDS].extend(gemport_id_list)
-
-        # We currently use only one gemport
-        gemport = gemport_id_list[0]
-
-        pon_intf_gemport = (pon_intf, gemport)
-        # This information is used when packet_indication is received and
-        # we need to derive the ONU Id for which the packet arrived based
-        # on the pon_intf and gemport available in the packet_indication
-        self.pon_intf_gemport_to_onu_id_map[pon_intf_gemport] = onu_id
-
-        returnValue(gemport)
-
-    def free_pon_resources_for_onu(self, pon_intf_id, onu_id):
-        # Frees Alloc Ids and Gemport Ids from Resource Manager for
-        # a given onu on a particular pon port
-
-        pon_intf_id_onu_id = (pon_intf_id, onu_id)
-        alloc_ids = \
-            self.pon_intf_id_onu_id_to_resource_map[pon_intf_id_onu_id] \
-                [OpenOltResourceMgr.ALLOC_IDS]
-        gemport_ids = \
-            self.pon_intf_id_onu_id_to_resource_map[pon_intf_id_onu_id] \
-                [OpenOltResourceMgr.GEMPORT_IDS]
-        self.resource_mgr.free_resource_id(pon_intf_id,
-                                               PONResourceManager.ONU_ID,
-                                               onu_id)
-        self.resource_mgr.free_resource_id(pon_intf_id,
-                                               PONResourceManager.ALLOC_ID,
-                                               alloc_ids)
-        self.resource_mgr.free_resource_id(pon_intf_id,
-                                               PONResourceManager.GEMPORT_ID,
-                                               gemport_ids)
-
-        # We need to clear the mapping of (pon_intf_id, gemport_id) to onu_id
-        for gemport_id in gemport_ids:
-            del self.pon_intf_gemport_to_onu_id_map[(pon_intf_id, gemport_id)]
-
-    @inlineCallbacks
-    def initialize_device_resource_range_and_pool(self):
-        if not self.use_device_info:
-            status = yield self.resource_mgr.init_resource_ranges_from_kv_store()
-            if not status:
-                self.log.error("failed-to-load-resource-range-from-kv-store")
-                # When we have failed to read the PON Resource ranges from KV
-                # store, use the information fetched from device.
-                self.use_device_info = True
-
-        if self.use_device_info:
-            self.log.info("using-device-info-to-init-pon-resource-ranges")
-            self.resource_mgr.init_default_pon_resource_ranges(
-                self.device_info.onu_id_start,
-                self.device_info.onu_id_end,
-                self.device_info.alloc_id_start,
-                self.device_info.alloc_id_end,
-                self.device_info.gemport_id_start,
-                self.device_info.gemport_id_end,
-                self.device_info.pon_ports
-            )
-
-        # After we have initialized resource ranges, initialize the
-        # resource pools accordingly.
-        self.resource_mgr.init_device_resource_pool()
-
-    def clear_device_resource_pool(self):
-        self.resource_mgr.clear_device_resource_pool()
