diff --git a/common/pon_resource_manager/__init__.py b/common/pon_resource_manager/__init__.py
new file mode 100644
index 0000000..2d104e0
--- /dev/null
+++ b/common/pon_resource_manager/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
diff --git a/common/pon_resource_manager/resource_kv_store.py b/common/pon_resource_manager/resource_kv_store.py
new file mode 100644
index 0000000..0ccbed8
--- /dev/null
+++ b/common/pon_resource_manager/resource_kv_store.py
@@ -0,0 +1,110 @@
+#
+# 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.
+#
+
+"""Resource KV store - interface between Resource Manager and backend store."""
+import structlog
+
+from voltha.core.config.config_backend import ConsulStore
+from voltha.core.config.config_backend import EtcdStore
+
+# KV store uses this prefix to store resource info
+PATH_PREFIX = 'resource_manager/{}/{}'
+
+
+class ResourceKvStore(object):
+    """Implements apis to store/get/remove resource in backend store."""
+
+    def __init__(self, technology, device_id, backend, host, port):
+        """
+        Create ResourceKvStore object.
+
+        Based on backend ('consul' and 'etcd' use the host and port
+        to create the respective object.
+
+        :param technology: PON technology
+        :param device_id: OLT device id
+        :param backend: Type of backend storage (etcd or consul)
+        :param host: host ip info for backend storage
+        :param port: port for the backend storage
+        :raises exception when invalid backend store passed as an argument
+        """
+        # logger
+        self._log = structlog.get_logger()
+
+        path = PATH_PREFIX.format(technology, device_id)
+        try:
+            if backend == 'consul':
+                self._kv_store = ConsulStore(host, port, path)
+                self._recurse = '?recurse'
+            elif backend == 'etcd':
+                self._kv_store = EtcdStore(host, port, path)
+                self._recurse = ''
+            else:
+                self._log.error('Invalid-backend')
+                raise Exception("Invalid-backend-for-kv-store")
+        except Exception as e:
+            self._log.exception("exception-in-init")
+            raise Exception(e)
+
+    def update_to_kv_store(self, path, resource):
+        """
+        Update resource.
+
+        :param path: path to update the resource
+        :param resource: updated resource
+        """
+        try:
+            self._kv_store[path] = str(resource)
+            self._log.debug("Resource-updated-in-kv-store", path=path)
+            return True
+        except BaseException:
+            self._log.exception("Resource-update-in-kv-store-failed",
+                                path=path, resource=resource)
+        return False
+
+    def get_from_kv_store(self, path):
+        """
+        Get resource.
+
+        :param path: path to get the resource
+        """
+        resource = None
+        try:
+            resource = self._kv_store[path]
+            self._log.debug("Got-resource-from-kv-store", path=path)
+        except KeyError:
+            self._log.info("Resource-not-found-updating-resource",
+                           path=path)
+        except BaseException:
+            self._log.exception("Getting-resource-from-kv-store-failed",
+                                path=path)
+        return resource
+
+    def remove_from_kv_store(self, path):
+        """
+        Remove resource.
+
+        :param path: path to remove the resource
+        """
+        path = path + self._recurse
+        try:
+            del self._kv_store[path]
+            self._log.debug("Resource-deleted-in-kv-store", path=path)
+            return True
+        except BaseException:
+            self._log.exception("Resource-delete-in-kv-store-failed",
+                                path=path)
+        return False
diff --git a/common/pon_resource_manager/resource_manager.py b/common/pon_resource_manager/resource_manager.py
new file mode 100644
index 0000000..4abead3
--- /dev/null
+++ b/common/pon_resource_manager/resource_manager.py
@@ -0,0 +1,460 @@
+#
+# 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.
+#
+
+"""
+Resource Manager will be unique for each OLT device.
+
+It exposes APIs to create/free alloc_ids/onu_ids/gemport_ids. Resource Manager
+uses a KV store in backend to ensure resiliency of the data.
+"""
+import json
+import structlog
+from bitstring import BitArray
+from twisted.internet.defer import returnValue, inlineCallbacks
+
+from common.kvstore.kvstore import create_kv_client
+from common.utils.asleep import asleep
+
+
+class PONResourceManager(object):
+    """Implements APIs to initialize/allocate/release alloc/gemport/onu IDs."""
+
+    # Constants to identify resource pool
+    ONU_ID = 'ONU_ID'
+    ALLOC_ID = 'ALLOC_ID'
+    GEMPORT_ID = 'GEMPORT_ID'
+
+    # The resource ranges for a given device vendor_type should be placed
+    # at 'resource_manager/<technology>/resource_ranges/<olt_vendor_type>'
+    # path on the KV store.
+    # If Resource Range parameters are to be read from the external KV store,
+    # they are expected to be stored in the following format.
+    # Note: All parameters are MANDATORY for now.
+    '''
+        {
+           "onu_start_idx": 1,
+           "onu_end_idx": 127,
+           "alloc_id_start_idx": 1024,
+           "alloc_id_end_idx": 65534,
+           "gem_port_id_start_idx": 1024,
+           "gem_port_id_end_idx": 16383,
+           "num_of_pon_port": 16
+        }
+    '''
+    # constants used as keys to reference the resource range parameters from
+    # and external KV store.
+    ONU_START_IDX = "onu_start_idx"
+    ONU_END_IDX = "onu_end_idx"
+    ALLOC_ID_START_IDX = "alloc_id_start_idx"
+    ALLOC_ID_END_IDX = "alloc_id_end_idx"
+    GEM_PORT_ID_START_IDX = "gem_port_id_start_idx"
+    GEM_PORT_ID_END_IDX = "gem_port_id_end_idx"
+    NUM_OF_PON_PORT = "num_of_pon_port"
+
+    # PON Resource range configuration on the KV store.
+    # Format: 'resource_manager/<technology>/resource_ranges/<olt_vendor_type>'
+    PON_RESOURCE_RANGE_CONFIG_PATH = 'resource_manager/{}/resource_ranges/{}'
+
+    # resource path in kv store
+    ALLOC_ID_POOL_PATH = 'resource_manager/{}/{}/alloc_id_pool/{}'
+    GEMPORT_ID_POOL_PATH = 'resource_manager/{}/{}/gemport_id_pool/{}'
+    ONU_ID_POOL_PATH = 'resource_manager/{}/{}/onu_id_pool/{}'
+
+    # Constants for internal usage.
+    PON_INTF_ID = 'pon_intf_id'
+    START_IDX = 'start_idx'
+    END_IDX = 'end_idx'
+    POOL = 'pool'
+
+    def __init__(self, technology, olt_vendor_type, device_id,
+                 backend, host, port):
+        """
+        Create PONResourceManager object.
+
+        :param technology: PON technology
+        :param: olt_vendor_type: This string defines the OLT vendor type
+        and is used as a Key to load the resource range configuration from
+        KV store location.
+        :param device_id: OLT device id
+        :param backend: backend store
+        :param host: ip of backend store
+        :param port: port on which backend store listens
+        :raises exception when invalid backend store passed as an argument
+        """
+        # logger
+        self._log = structlog.get_logger()
+
+        try:
+            self._kv_store = create_kv_client(backend, host, port)
+            self.technology = technology
+            self.olt_vendor_type = olt_vendor_type
+            self.device_id = device_id
+            # Below attribute, pon_resource_ranges, should be initialized
+            # by reading from KV store.
+            self.pon_resource_ranges = dict()
+        except Exception as e:
+            self._log.exception("exception-in-init")
+            raise Exception(e)
+
+    @inlineCallbacks
+    def init_pon_resource_ranges(self):
+        # Try to initialize the PON Resource Ranges from KV store if available
+        status = yield self.init_resource_ranges_from_kv_store()
+        # If reading from KV store fails, initialize to default values.
+        if not status:
+            self._log.error("failed-to-read-resource-ranges-from-kv-store")
+            self.init_default_pon_resource_ranges()
+
+    @inlineCallbacks
+    def init_resource_ranges_from_kv_store(self):
+        path = self.PON_RESOURCE_RANGE_CONFIG_PATH.format(
+            self.technology, self.olt_vendor_type)
+        # get resource from kv store
+        result = yield self._kv_store.get(path)
+        resource_range_config = result[0]
+
+        if resource_range_config is not None:
+            self.pon_resource_ranges = eval(resource_range_config.value)
+            self._log.debug("Init-resource-ranges-from-kvstore-success",
+                            pon_resource_ranges=self.pon_resource_ranges,
+                            path=path)
+            returnValue(True)
+
+        returnValue(False)
+
+    def init_default_pon_resource_ranges(self, onu_start_idx=1,
+                                         onu_end_idx=127,
+                                         alloc_id_start_idx=1024,
+                                         alloc_id_end_idx=65534,
+                                         gem_port_id_start_idx=1024,
+                                         gem_port_id_end_idx=16383,
+                                         num_of_pon_ports=16):
+        self._log.info("initialize-default-resource-range-values")
+        self.pon_resource_ranges[PONResourceManager.ONU_START_IDX] = onu_start_idx
+        self.pon_resource_ranges[PONResourceManager.ONU_END_IDX] = onu_end_idx
+        self.pon_resource_ranges[PONResourceManager.ALLOC_ID_START_IDX] = alloc_id_start_idx
+        self.pon_resource_ranges[PONResourceManager.ALLOC_ID_END_IDX] = alloc_id_end_idx
+        self.pon_resource_ranges[
+            PONResourceManager.GEM_PORT_ID_START_IDX] = gem_port_id_start_idx
+        self.pon_resource_ranges[
+            PONResourceManager.GEM_PORT_ID_END_IDX] = gem_port_id_end_idx
+        self.pon_resource_ranges[PONResourceManager.NUM_OF_PON_PORT] = num_of_pon_ports
+
+    def init_device_resource_pool(self):
+        i = 0
+        while i < self.pon_resource_ranges[PONResourceManager.NUM_OF_PON_PORT]:
+            self.init_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.ONU_ID,
+                start_idx=self.pon_resource_ranges[
+                    PONResourceManager.ONU_START_IDX],
+                end_idx=self.pon_resource_ranges[
+                    PONResourceManager.ONU_END_IDX])
+
+            self.init_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.ALLOC_ID,
+                start_idx=self.pon_resource_ranges[
+                    PONResourceManager.ALLOC_ID_START_IDX],
+                end_idx=self.pon_resource_ranges[
+                    PONResourceManager.ALLOC_ID_END_IDX])
+
+            self.init_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.GEMPORT_ID,
+                start_idx=self.pon_resource_ranges[
+                    PONResourceManager.GEM_PORT_ID_START_IDX],
+                end_idx=self.pon_resource_ranges[
+                    PONResourceManager.GEM_PORT_ID_END_IDX])
+            i += 1
+
+    def clear_device_resource_pool(self):
+        i = 0
+        while i < self.pon_resource_ranges[PONResourceManager.NUM_OF_PON_PORT]:
+            self.clear_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.ONU_ID,
+            )
+
+            self.clear_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.ALLOC_ID,
+            )
+
+            self.clear_resource_id_pool(
+                pon_intf_id=i,
+                resource_type=PONResourceManager.GEMPORT_ID,
+            )
+            i += 1
+
+    @inlineCallbacks
+    def init_resource_id_pool(self, pon_intf_id, resource_type, start_idx,
+                              end_idx):
+        """
+        Initialize Resource ID pool for a given Resource Type on a given PON Port
+
+        :param pon_intf_id: OLT PON interface id
+        :param resource_type: String to identify type of resource
+        :param start_idx: start index for onu id pool
+        :param end_idx: end index for onu id pool
+        :return boolean: True if resource id pool initialized else false
+        """
+        status = False
+        path = self._get_path(pon_intf_id, resource_type)
+        if path is None:
+            returnValue(status)
+
+        # In case of adapter reboot and reconciliation resource in kv store
+        # checked for its presence if not kv store update happens
+        resource = yield self._get_resource(path)
+
+        if resource is not None:
+            self._log.info("Resource-already-present-in-store", path=path)
+            status = True
+        else:
+            resource = self._format_resource(pon_intf_id, start_idx, end_idx)
+            self._log.info("Resource-initialized", path=path)
+
+            # Add resource as json in kv store.
+            result = yield self._kv_store.put(path, resource)
+            if result is None:
+                status = True
+        returnValue(status)
+
+    @inlineCallbacks
+    def get_resource_id(self, pon_intf_id, resource_type, num_of_id=1):
+        """
+        Create alloc/gemport/onu id for given OLT PON interface.
+
+        :param pon_intf_id: OLT PON interface id
+        :param resource_type: String to identify type of resource
+        :param num_of_id: required number of ids
+        :return list/int/None: list, int or None if resource type is
+                               alloc_id/gemport_id, onu_id or invalid type
+                               respectively
+        """
+        result = None
+        path = self._get_path(pon_intf_id, resource_type)
+        if path is None:
+            returnValue(result)
+
+        resource = yield self._get_resource(path)
+        try:
+            if resource is not None and resource_type == \
+                    PONResourceManager.ONU_ID:
+                result = self._generate_next_id(resource)
+            elif resource is not None and (
+                    resource_type == PONResourceManager.GEMPORT_ID or
+                    resource_type == PONResourceManager.ALLOC_ID):
+                result = list()
+                while num_of_id > 0:
+                    result.append(self._generate_next_id(resource))
+                    num_of_id -= 1
+
+            # Update resource in kv store
+            self._update_resource(path, resource)
+
+        except BaseException:
+            self._log.exception("Get-" + resource_type + "-id-failed",
+                                path=path)
+        self._log.debug("Get-" + resource_type + "-success", result=result,
+                        path=path)
+        returnValue(result)
+
+    @inlineCallbacks
+    def free_resource_id(self, pon_intf_id, resource_type, release_content):
+        """
+        Release alloc/gemport/onu id for given OLT PON interface.
+
+        :param pon_intf_id: OLT PON interface id
+        :param resource_type: String to identify type of resource
+        :param release_content: required number of ids
+        :return boolean: True if all IDs in given release_content released
+                         else False
+        """
+        status = False
+        path = self._get_path(pon_intf_id, resource_type)
+        if path is None:
+            returnValue(status)
+
+        resource = yield self._get_resource(path)
+        try:
+            if resource is not None and resource_type == \
+                    PONResourceManager.ONU_ID:
+                self._release_id(resource, release_content)
+            elif resource is not None and (
+                    resource_type == PONResourceManager.ALLOC_ID or
+                    resource_type == PONResourceManager.GEMPORT_ID):
+                for content in release_content:
+                    self._release_id(resource, content)
+            self._log.debug("Free-" + resource_type + "-success", path=path)
+
+            # Update resource in kv store
+            status = yield self._update_resource(path, resource)
+
+        except BaseException:
+            self._log.exception("Free-" + resource_type + "-failed", path=path)
+        returnValue(status)
+
+    @inlineCallbacks
+    def clear_resource_id_pool(self, pon_intf_id, resource_type):
+        """
+        Clear Resource Pool for a given Resource Type on a given PON Port.
+
+        :return boolean: True if removed else False
+        """
+        path = self._get_path(pon_intf_id, resource_type)
+        if path is None:
+            returnValue(False)
+
+        result = yield self._kv_store.delete(path)
+        if result is None:
+            self._log.debug("Resource-pool-cleared", device_id=self.device_id,
+                            path=path)
+            returnValue(True)
+        self._log.error("Clear-resource-pool-failed", device_id=self.device_id,
+                        path=path)
+        returnValue(False)
+
+    def _generate_next_id(self, resource):
+        """
+        Generate unique id having OFFSET as start index.
+
+        :param resource: resource used to generate ID
+        :return int: generated id
+        """
+        pos = resource[PONResourceManager.POOL].find('0b0')
+        resource[PONResourceManager.POOL].set(1, pos)
+        return pos[0] + resource[PONResourceManager.START_IDX]
+
+    def _release_id(self, resource, unique_id):
+        """
+        Release unique id having OFFSET as start index.
+
+        :param resource: resource used to release ID
+        :param unique_id: id need to be released
+        """
+        pos = ((int(unique_id)) - resource[PONResourceManager.START_IDX])
+        resource[PONResourceManager.POOL].set(0, pos)
+
+    def _get_path(self, pon_intf_id, resource_type):
+        """
+        Get path for given resource type.
+
+        :param pon_intf_id: OLT PON interface id
+        :param resource_type: String to identify type of resource
+        :return: path for given resource type
+        """
+        path = None
+        if resource_type == PONResourceManager.ONU_ID:
+            path = self._get_onu_id_resource_path(pon_intf_id)
+        elif resource_type == PONResourceManager.ALLOC_ID:
+            path = self._get_alloc_id_resource_path(pon_intf_id)
+        elif resource_type == PONResourceManager.GEMPORT_ID:
+            path = self._get_gemport_id_resource_path(pon_intf_id)
+        else:
+            self._log.error("invalid-resource-pool-identifier")
+        return path
+
+    def _get_alloc_id_resource_path(self, pon_intf_id):
+        """
+        Get alloc id resource path.
+
+        :param pon_intf_id: OLT PON interface id
+        :return: alloc id resource path
+        """
+        return PONResourceManager.ALLOC_ID_POOL_PATH.format(
+            self.technology, self.device_id, pon_intf_id)
+
+    def _get_gemport_id_resource_path(self, pon_intf_id):
+        """
+        Get gemport id resource path.
+
+        :param pon_intf_id: OLT PON interface id
+        :return: gemport id resource path
+        """
+        return PONResourceManager.GEMPORT_ID_POOL_PATH.format(
+            self.technology, self.device_id, pon_intf_id)
+
+    def _get_onu_id_resource_path(self, pon_intf_id):
+        """
+        Get onu id resource path.
+
+        :param pon_intf_id: OLT PON interface id
+        :return: onu id resource path
+        """
+        return PONResourceManager.ONU_ID_POOL_PATH.format(
+            self.technology, self.device_id, pon_intf_id)
+
+    @inlineCallbacks
+    def _update_resource(self, path, resource):
+        """
+        Update resource in resource kv store.
+
+        :param path: path to update resource
+        :param resource: resource need to be updated
+        :return boolean: True if resource updated in kv store else False
+        """
+        resource[PONResourceManager.POOL] = \
+            resource[PONResourceManager.POOL].bin
+        result = yield self._kv_store.put(path, json.dumps(resource))
+        if result is None:
+            returnValue(True)
+        returnValue(False)
+
+    @inlineCallbacks
+    def _get_resource(self, path):
+        """
+        Get resource from kv store.
+
+        :param path: path to get resource
+        :return: resource if resource present in kv store else None
+        """
+        # get resource from kv store
+        result = yield self._kv_store.get(path)
+        resource = result[0]
+
+        if resource is not None:
+            # decode resource fetched from backend store to dictionary
+            resource = eval(resource.value)
+
+            # resource pool in backend store stored as binary string whereas to
+            # access the pool to generate/release IDs it need to be converted
+            # as BitArray
+            resource[PONResourceManager.POOL] = \
+                BitArray('0b' + resource[PONResourceManager.POOL])
+
+        returnValue(resource)
+
+    def _format_resource(self, pon_intf_id, start_idx, end_idx):
+        """
+        Format resource as json.
+
+        :param pon_intf_id: OLT PON interface id
+        :param start_idx: start index for id pool
+        :param end_idx: end index for id pool
+        :return dictionary: resource formatted as dictionary
+        """
+        # Format resource as json to be stored in backend store
+        resource = dict()
+        resource[PONResourceManager.PON_INTF_ID] = pon_intf_id
+        resource[PONResourceManager.START_IDX] = start_idx
+        resource[PONResourceManager.END_IDX] = end_idx
+
+        # resource pool stored in backend store as binary string
+        resource[PONResourceManager.POOL] = BitArray(end_idx).bin
+
+        return json.dumps(resource)
diff --git a/tests/utests/common/test_pon_resource_manager.py b/tests/utests/common/test_pon_resource_manager.py
new file mode 100644
index 0000000..74c4736
--- /dev/null
+++ b/tests/utests/common/test_pon_resource_manager.py
@@ -0,0 +1,169 @@
+#
+# 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 json
+from unittest import TestCase, main
+
+from bitstring import BitArray
+from common.kvstore.kv_client import KVPair
+from common.pon_resource_manager.resource_manager import PONResourceManager
+from mock import Mock
+from twisted.internet.defer import inlineCallbacks
+
+
+class TestResourceManager(TestCase):
+    def setUp(self):
+        self._rm = PONResourceManager('xgspon', 'default',
+                                      '0001c889ee7189fb', 'consul',
+                                      'localhost', 8500)
+        self.default_resource_range = {
+            "onu_start_idx": 1,
+            "onu_end_idx": 127,
+            "alloc_id_start_idx": 1024,
+            "alloc_id_end_idx": 65534,
+            "gem_port_id_start_idx": 1024,
+            "gem_port_id_end_idx": 16383,
+            "num_of_pon_port": 16
+        }
+
+    def tearDown(self):
+        self._rm = None
+        self.default_resource_range = None
+
+    @inlineCallbacks
+    def test_init_pon_resource_ranges(self):
+        key = PONResourceManager.PON_RESOURCE_RANGE_CONFIG_PATH.format(
+            'xgspon', 'default')
+        value = json.dumps(self.default_resource_range).encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+
+        yield self._rm.init_pon_resource_ranges()
+        self.assertEqual(self._rm.pon_resource_ranges,
+                         self.default_resource_range)
+
+        self._rm._kv_store.get = Mock(return_value=(None, None))
+
+        yield self._rm.init_pon_resource_ranges()
+        self.assertEqual(self._rm.pon_resource_ranges,
+                         self.default_resource_range)
+
+    @inlineCallbacks
+    def test_init_resource_id_pool(self):
+        self._rm._kv_store.get = Mock(return_value=(None, None))
+        self._rm._kv_store.put = Mock(return_value=None)
+        status = yield self._rm.init_resource_id_pool(0, 'ONU_ID', 1, 127)
+        self.assertTrue(status)
+        status = yield self._rm.init_resource_id_pool(
+            1, 'ALLOC_ID', 1024, 16383)
+        self.assertTrue(status)
+        status = yield self._rm.init_resource_id_pool(
+            2, 'GEMPORT_ID', 1023, 65534)
+        self.assertTrue(status)
+
+    @inlineCallbacks
+    def test_get_resource_id(self):
+        # Get onu id test
+        onu_id_resource = self._rm._format_resource(0, 1, 127)
+        key = self._rm._get_path(0, PONResourceManager.ONU_ID)
+        value = onu_id_resource.encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        self._rm._kv_store.put = Mock(return_value=None)
+        result = yield self._rm.get_resource_id(0, 'ONU_ID')
+        self.assertEqual(result, 1)
+
+        # Get alloc id test
+        alloc_id_resource = self._rm._format_resource(1, 1024, 16383)
+        key = self._rm._get_path(1, PONResourceManager.ALLOC_ID)
+        value = alloc_id_resource.encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        result = yield self._rm.get_resource_id(1, 'ALLOC_ID', 1)
+        self.assertEqual(result[0], 1024)
+        result = yield self._rm.get_resource_id(1, 'ALLOC_ID', 4)
+        self.assertEqual(result, [1024, 1025, 1026, 1027])
+
+        # Get gemport id test
+        gemport_id_resource = self._rm._format_resource(2, 1023, 65534)
+        key = self._rm._get_path(2, PONResourceManager.GEMPORT_ID)
+        value = gemport_id_resource.encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        result = yield self._rm.get_resource_id(2, 'GEMPORT_ID', 1)
+        self.assertEqual(result[0], 1023)
+        result = yield self._rm.get_resource_id(2, 'GEMPORT_ID', 5)
+        self.assertEqual(result, [1023, 1024, 1025, 1026, 1027])
+
+    @inlineCallbacks
+    def test_free_resource_id(self):
+        # Free onu id test
+        self._rm._kv_store.put = Mock(return_value=None)
+        onu_id_resource = eval(self._rm._format_resource(0, 1, 127))
+        onu_id_resource['pool'] = BitArray('0b' + onu_id_resource['pool'])
+        self._rm._generate_next_id(onu_id_resource)
+        onu_id_resource['pool'] = onu_id_resource['pool'].bin
+        key = self._rm._get_path(0, PONResourceManager.ONU_ID)
+        value = json.dumps(onu_id_resource).encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        result = yield self._rm.free_resource_id(0, 'ONU_ID', 1)
+        self.assertTrue(result)
+
+        # Free alloc id test
+        alloc_id_resource = eval(self._rm._format_resource(1, 1024, 16383))
+        alloc_id_resource['pool'] = BitArray('0b' + alloc_id_resource['pool'])
+
+        for num in range(5):
+            self._rm._generate_next_id(alloc_id_resource)
+
+        alloc_id_resource['pool'] = alloc_id_resource['pool'].bin
+        key = self._rm._get_path(0, PONResourceManager.ALLOC_ID)
+        value = json.dumps(alloc_id_resource).encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        result = self._rm.free_resource_id(1, 'ALLOC_ID',
+                                           [1024, 1025, 1026, 1027, 1028])
+        self.assertTrue(result)
+
+        # Free gemport id test
+        gemport_id_resource = eval(self._rm._format_resource(2, 1023, 65534))
+        gemport_id_resource['pool'] = BitArray(
+            '0b' + gemport_id_resource['pool'])
+
+        for num in range(6):
+            self._rm._generate_next_id(gemport_id_resource)
+
+        gemport_id_resource['pool'] = gemport_id_resource['pool'].bin
+        key = self._rm._get_path(0, PONResourceManager.GEMPORT_ID)
+        value = json.dumps(gemport_id_resource).encode('utf-8')
+        output = KVPair(key, value, None)
+        self._rm._kv_store.get = Mock(return_value=(output, None))
+        result = self._rm.free_resource_id(2, 'GEMPORT_ID',
+                                           [1023, 1024, 1025, 1026, 1027, 1028])
+        self.assertTrue(result)
+
+    @inlineCallbacks
+    def test_clear_resource_id_pool(self):
+        self._rm._kv_store.delete = Mock(return_value=None)
+        status = yield self._rm.clear_resource_id_pool(0, 'ONU_ID')
+        self.assertTrue(status)
+        self._rm._kv_store.delete = Mock(return_value="error")
+        status = yield self._rm.clear_resource_id_pool(1, 'ALLOC_ID')
+        self.assertFalse(status)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/voltha/adapters/openolt/README.md b/voltha/adapters/openolt/README.md
new file mode 100644
index 0000000..5e174d3
--- /dev/null
+++ b/voltha/adapters/openolt/README.md
@@ -0,0 +1,65 @@
+# OpenOLT Device Adapter
+
+## Enable OpenOLT
+To preprovision and enable the OpenOLT use the below commands from the Voltha CLI. 
+```bash
+    (voltha) preprovision_olt -t openolt -H YOUR_OLT_MGMT_IP:9191
+    (voltha) enable
+```
+
+### Additional Notes
+1. The `bal_core_dist` and openolt driver should be running on the OLT device, before enabling the device from VOLTHA CLI.
+2. 9191 is the TCP port that the OpenOLT driver uses for its gRPC channel
+3. In the commands above, you can either use the loopback IP address (127.0.0.1) or substitute all its occurrences with the management IP of your OLT 
+
+## Using Resource Manager with Open OLT adapter
+Resource Manager is used to manage device PON resource pool and allocate PON resources
+from such pools. Resource Manager module currently manages assignment of ONU-ID, ALLOC-ID and GEM-PORT ID.
+The Resource Manager uses the KV store to back-up all the resource pool allocation data.
+
+The OpenOLT adapter interacts with Resource Manager module for PON resource assignments.
+The `openolt_resource_manager` module is responsible for interfacing with the Resource Manager.
+
+The Resource Manager optionally uses `olt_vendor_type` specific resource ranges to initialize the PON resource pools.
+In order to utilize this option, create an entry for `olt_vendor_type` specific PON resource ranges on the KV store.
+Please make sure to use the same KV store used by the VOLTHA core.
+
+### For example
+To specify ASFvOLT16 OLT device specific resource ranges, first create a JSON file `asfvolt16_resource_range.json` with the following entry
+```bash
+{
+    "onu_start_idx": 1,
+    "onu_end_idx": 127,
+    "alloc_id_start_idx": 1024,
+    "alloc_id_end_idx": 65534,
+    "gem_port_id_start_idx": 1024,
+    "gem_port_id_end_idx": 16383,
+    "num_of_pon_port": 16
+}
+```
+This data should be put on the KV store location `resource_manager/xgspon/resource_ranges/asfvolt16`
+
+The format of the KV store location is `resource_manager/<technology>/resource_ranges/<olt_vendor_type>` 
+
+In the below example the KV store is assumed to be Consul. However the same is applicable to be etcd or any other KV store.
+Please make sure to use the same KV store used by the VOLTHA core.
+```bash
+curl -X PUT -H "Content-Type: application/json" http://127.0.0.1:8500/v1/kv/resource_manager/xgspon/resource_ranges/asfvolt16 -d @./asfvolt16_resource_range.json 
+```
+
+The `olt_vendor_type` should be referred to during the preprovisiong step as shown below. The `olt_vendor_type` is an extra option and
+should be specified after `--`. The `-o` specifies the `olt_vendor_type`. 
+
+```bash
+ (voltha) preprovision_olt -t openolt -H 192.168.50.100:9191 -- -o asfvolt16
+```
+
+Once the OLT device is enabled, any further PON Resource assignments will happen within the PON Resource ranges defined
+in `asfvolt16_resource_range.json` and placed on the KV store.
+
+#### Additional Notes
+If a `default` resource range profile should be used with all `olt_vendor_type`s, then place such Resource Range profile
+at the below path on the KV store. 
+```bash
+resource_manager/xgspon/resource_ranges/default
+```
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 2bf6047..20ea471 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
+import sys
 import threading
 import binascii
 import grpc
@@ -22,6 +22,7 @@
 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
@@ -44,7 +45,9 @@
         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):
@@ -96,6 +99,7 @@
         is_reconciliation = kwargs.get('reconciliation', False)
         self.device_id = device.id
         self.host_and_port = device.host_and_port
+        self.extra_args = device.extra_args
         self.log = structlog.get_logger(id=self.device_id,
                                         ip=self.host_and_port)
         self.proxy = registry('core').get_proxy('/')
@@ -180,6 +184,7 @@
         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")
 
@@ -195,10 +200,15 @@
         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.logical_device_id,
+                                       self.resource_manager)
 
-        # TODO: use content of device_info for Resource manager (VOL-948)
+        yield self._initialize_resource_manager_resource_pools()
 
         # TODO: check for uptime and reboot if too long (VOL-1192)
 
@@ -278,7 +288,6 @@
         self.log.debug('post_down')
         self.flow_mgr.reset_flows()
 
-
     def indications_thread(self):
         self.log.debug('starting-indications-thread')
         self.log.debug('connecting to olt', device_id=self.device_id)
@@ -377,6 +386,7 @@
             # 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
@@ -400,14 +410,32 @@
             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)
+                                  serial_number_str, alloc_id, alloc_id)
             except Exception as e:
                 self.log.exception('onu-activation-failed', e=e)
 
@@ -436,8 +464,12 @@
                 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)
+                                      serial_number_str, alloc_id, alloc_id)
                 except Exception as e:
                     self.log.error('onu-activation-error',
                                    serial_number=serial_number_str, error=e)
@@ -445,6 +477,7 @@
                 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,
@@ -473,6 +506,12 @@
                            onu_id=onu_indication.onu_id)
             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',
@@ -574,14 +613,11 @@
 
                 # tcont creation (onu)
                 tcont = TcontsConfigData()
-                tcont.alloc_id = platform.mk_alloc_id(
-                    onu_indication.intf_id, onu_indication.onu_id)
+                tcont.alloc_id = alloc_id
 
                 # gem port creation
                 gem_port = GemportsConfigData()
-                gem_port.gemport_id = platform.mk_gemport_id(
-                    onu_indication.intf_id,
-                    onu_indication.onu_id)
+                gem_port.gemport_id = gemport_id
 
                 # ports creation/update
                 def port_config():
@@ -625,14 +661,12 @@
 
                 # tcont creation (onu)
                 tcont = TcontsConfigData()
-                tcont.alloc_id = platform.mk_alloc_id(
-                    onu_indication.intf_id, onu_indication.onu_id)
+                tcont.alloc_id = alloc_id
 
                 # gem port creation
                 gem_port = GemportsConfigData()
-                gem_port.gemport_id = platform.mk_gemport_id(
-                    onu_indication.intf_id,
-                    onu_indication.onu_id)
+                gem_port.gemport_id = gemport_id
+
                 gem_port.tcont_ref = str(tcont.alloc_id)
 
                 self.log.info('inject-tcont-gem-data-onu-handler',
@@ -696,7 +730,7 @@
         onu_device = self.adapter_agent.get_child_device(
             self.device_id, onu_id=omci_indication.onu_id,
             parent_port_no=platform.intf_id_to_port_no(
-                            omci_indication.intf_id, Port.PON_OLT),)
+                omci_indication.intf_id, Port.PON_OLT), )
 
         self.adapter_agent.receive_proxied_message(onu_device.proxy_address,
                                                    omci_indication.pkt)
@@ -706,8 +740,17 @@
         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
 
-        onu_id = platform.onu_id_from_gemport_id(pkt_indication.gemport_id)
+        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
+
         logical_port_num = platform.mk_uni_port_num(pkt_indication.intf_id,
                                                     onu_id)
 
@@ -773,10 +816,10 @@
 
     def send_proxied_message(self, proxy_address, msg):
         onu_device = self.adapter_agent.get_child_device(
-            self.device_id,
-            onu_id=proxy_address.onu_id,
-            parent_port_no=platform.intf_id_to_port_no(
-                proxy_address.channel_id, Port.PON_OLT))
+            self.device_id, onu_id=proxy_address.onu_id,
+                parent_port_no=platform.intf_id_to_port_no(
+                proxy_address.channel_id, Port.PON_OLT)
+        )
         if onu_device.connect_status != ConnectStatus.REACHABLE:
             self.log.debug('ONU is not reachable, cannot send OMCI',
                            serial_number=onu_device.serial_number,
@@ -900,19 +943,6 @@
                 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')
@@ -1005,6 +1035,10 @@
         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()
@@ -1031,16 +1065,18 @@
             self.log.info('openolt device reenabled')
 
     def activate_onu(self, intf_id, onu_id, serial_number,
-                     serial_number_str):
+                     serial_number_str, agg_port_id, sched_id):
         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)
+                              serial_number=serial_number, pir=pir,
+                              agg_port_id=agg_port_id, sched_id=sched_id)
         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,
@@ -1062,11 +1098,25 @@
             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)
+                              serial_number=serial_number,
+                              agg_port_id=alloc_id, sched_id=alloc_id)
         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:
@@ -1087,3 +1137,14 @@
 
     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 4c40910..692f639 100644
--- a/voltha/adapters/openolt/openolt_flow_mgr.py
+++ b/voltha/adapters/openolt/openolt_flow_mgr.py
@@ -16,6 +16,7 @@
 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, \
@@ -23,6 +24,7 @@
 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
 
@@ -44,7 +46,7 @@
 
 class OpenOltFlowMgr(object):
 
-    def __init__(self, log, stub, device_id, logical_device_id):
+    def __init__(self, log, stub, device_id, logical_device_id, resource_mgr):
         self.log = log
         self.stub = stub
         self.device_id = device_id
@@ -54,6 +56,7 @@
         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)
@@ -209,6 +212,7 @@
             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):
 
@@ -218,7 +222,7 @@
         if 'ip_proto' in classifier:
             if classifier['ip_proto'] == 17:
                 self.log.debug('dhcp flow add')
-                self.add_dhcp_trap(intf_id, onu_id, classifier,
+                yield 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')
@@ -229,48 +233,49 @@
         elif 'eth_type' in classifier:
             if classifier['eth_type'] == EAP_ETH_TYPE:
                 self.log.debug('eapol flow add')
-                self.add_eapol_flow(intf_id, onu_id, flow)
+                yield 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:
-                    self.add_eapol_flow(
+                    yield self.add_eapol_flow(
                         intf_id, onu_id, flow,
                         uplink_eapol_id=EAPOL_UPLINK_SECONDARY_FLOW_INDEX,
                         downlink_eapol_id=EAPOL_DOWNLINK_SECONDARY_FLOW_INDEX,
                         vlan_id=vlan_id)
             if classifier['eth_type'] == LLDP_ETH_TYPE:
                 self.log.debug('lldp flow add')
-                self.add_lldp_flow(intf_id, onu_id, flow, classifier,
+                yield self.add_lldp_flow(intf_id, onu_id, flow, classifier,
                                    action)
 
         elif 'push_vlan' in action:
-            self.add_upstream_data_flow(intf_id, onu_id, classifier, action,
-                                        flow)
+            yield self.add_upstream_data_flow(intf_id, onu_id, classifier, action,
+                                      flow)
         elif 'pop_vlan' in action:
-            self.add_downstream_data_flow(intf_id, onu_id, classifier,
+            yield 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):
 
         uplink_classifier['pkt_tag_type'] = 'single_tag'
 
-        self.add_hsia_flow(intf_id, onu_id, uplink_classifier,
+        yield 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:
-            self.add_eapol_flow(
-                intf_id, onu_id, eap_logical_flow,
+            yield self.add_eapol_flow(intf_id, onu_id, eap_logical_flow,
                 uplink_eapol_id=EAPOL_UPLINK_SECONDARY_FLOW_INDEX,
                 downlink_eapol_id=EAPOL_DOWNLINK_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['pkt_tag_type'] = 'double_tag'
@@ -278,7 +283,7 @@
         downlink_action['pop_vlan'] = True
         downlink_action['vlan_vid'] = downlink_classifier['vlan_vid']
 
-        self.add_hsia_flow(intf_id, onu_id, downlink_classifier,
+        yield self.add_hsia_flow(intf_id, onu_id, downlink_classifier,
                            downlink_action, 'downstream', HSIA_FLOW_INDEX,
                            flow)
 
@@ -286,21 +291,31 @@
     # 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):
 
-        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        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
+                     )
+
         flow_id = platform.mk_flow_id(intf_id, onu_id, hsia_id)
 
         flow = openolt_pb2.Flow(
                 onu_id=onu_id, flow_id=flow_id, flow_type=direction,
                 access_intf_id=intf_id, gemport_id=gemport_id,
+                alloc_id=alloc_id,
                 priority=logical_flow.priority,
                 classifier=self.mk_classifier(classifier),
                 action=self.mk_action(action))
 
         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,
@@ -311,12 +326,19 @@
         classifier['pkt_tag_type'] = 'single_tag'
         classifier.pop('vlan_vid', None)
 
-        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        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
+                     )
         flow_id = platform.mk_flow_id(intf_id, onu_id, DHCP_FLOW_INDEX)
 
         upstream_flow = openolt_pb2.Flow(
             onu_id=onu_id, flow_id=flow_id, flow_type="upstream",
             access_intf_id=intf_id, gemport_id=gemport_id,
+            alloc_id=alloc_id,
             priority=logical_flow.priority,
             classifier=self.mk_classifier(classifier),
             action=self.mk_action(action))
@@ -349,6 +371,7 @@
 
         self.add_flow_to_device(downstream_flow, downstream_logical_flow)
 
+    @inlineCallbacks
     def add_eapol_flow(self, intf_id, onu_id, logical_flow,
                        uplink_eapol_id=EAPOL_FLOW_INDEX,
                        downlink_eapol_id=EAPOL_DOWNLINK_FLOW_INDEX,
@@ -364,7 +387,13 @@
         uplink_action = {}
         uplink_action['trap_to_host'] = True
 
-        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
+        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.
 
@@ -373,6 +402,7 @@
         upstream_flow = openolt_pb2.Flow(
             onu_id=onu_id, flow_id=uplink_flow_id, flow_type="upstream",
             access_intf_id=intf_id, gemport_id=gemport_id,
+            alloc_id=alloc_id,
             priority=logical_flow.priority,
             classifier=self.mk_classifier(uplink_classifier),
             action=self.mk_action(uplink_action))
@@ -439,6 +469,7 @@
     def reset_flows(self):
         self.flows_proxy.update('/', Flows())
 
+    @inlineCallbacks
     def add_lldp_flow(self, intf_id, onu_id, logical_flow, classifier, action):
 
         self.log.debug('add lldp downstream trap', classifier=classifier,
@@ -448,12 +479,20 @@
         action['trap_to_host'] = True
         classifier['pkt_tag_type'] = 'untagged'
 
-        gemport_id = platform.mk_gemport_id(onu_id)
+        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
+                     )
+
         flow_id = platform.mk_flow_id(intf_id, onu_id, LLDP_FLOW_INDEX)
 
         downstream_flow = openolt_pb2.Flow(
             onu_id=onu_id, flow_id=flow_id, flow_type="downstream",
             access_intf_id=3, network_intf_id=0, gemport_id=gemport_id,
+            alloc_id=alloc_id,
             priority=logical_flow.priority,
             classifier=self.mk_classifier(classifier),
             action=self.mk_action(action))
diff --git a/voltha/adapters/openolt/openolt_platform.py b/voltha/adapters/openolt/openolt_platform.py
index a7f6904..b179d90 100644
--- a/voltha/adapters/openolt/openolt_platform.py
+++ b/voltha/adapters/openolt/openolt_platform.py
@@ -21,34 +21,6 @@
 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
 
     Identifies a flow within a single OLT
@@ -109,20 +81,6 @@
 def mk_uni_port_num(intf_id, onu_id):
     return intf_id << 11 | onu_id << 4
 
-
-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_flow_id(intf_id, onu_id, idx):
     return intf_id << 11 | onu_id << 4 | idx
 
@@ -184,3 +142,4 @@
         return True
 
     return False
+
diff --git a/voltha/adapters/openolt/openolt_resource_manager.py b/voltha/adapters/openolt/openolt_resource_manager.py
new file mode 100644
index 0000000..a85cbc5
--- /dev/null
+++ b/voltha/adapters/openolt/openolt_resource_manager.py
@@ -0,0 +1,276 @@
+#
+# 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()
diff --git a/voltha/adapters/openolt/protos/openolt.proto b/voltha/adapters/openolt/protos/openolt.proto
index 45ca664..c99814b 100644
--- a/voltha/adapters/openolt/protos/openolt.proto
+++ b/voltha/adapters/openolt/protos/openolt.proto
@@ -218,6 +218,9 @@
     fixed32 onu_id = 2;
     SerialNumber serial_number = 3;
     fixed32 pir = 4;   // peak information rate assigned to onu
+    fixed32 agg_port_id = 5;
+    fixed32 sched_id = 6;
+
 }
 
 message OmciMsg {
@@ -293,6 +296,7 @@
     string flow_type = 4;	// upstream, downstream, broadcast, multicast
     fixed32 network_intf_id = 5;
     fixed32 gemport_id = 6;
+    fixed32 alloc_id = 10;
     Classifier classifier = 7;
     Action action = 8;
     fixed32 priority = 9;
