diff --git a/pkg/models/device/db.go b/pkg/models/device/db.go
new file mode 100644
index 0000000..a98213e
--- /dev/null
+++ b/pkg/models/device/db.go
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package modifiablecomponent stores ModifiableComponent methods and functions
+package device
+
+import (
+	"context"
+	"encoding/json"
+	"errors"
+	"fmt"
+
+	"github.com/opencord/device-management-interface/go/dmi"
+
+	"github.com/opencord/voltha-lib-go/v4/pkg/log"
+
+	"github.com/opencord/opendevice-manager/pkg/db"
+
+	copy "github.com/jinzhu/copier"
+)
+
+// DBGetByName func reads device record by name
+func DBGetByName(ctx context.Context, name string) (*DeviceRecord, error) {
+	if name == "" {
+		logger.Errorw(ctx, "DBGetByName-failed-missing-device-name", log.Fields{})
+		return nil, errors.New("name field is empty")
+	}
+
+	logger.Debugw(ctx, "DBGetByName-invoked", log.Fields{"name": name})
+	defer logger.Debugw(ctx, "DBGetByName-completed", log.Fields{"name": name})
+
+	if val, ok := cache.nameToRec.Load(name); ok {
+		return val.(*DeviceRecord), nil
+	}
+
+	key := fmt.Sprintf(DbPathNameToRecord, name)
+	entry, err := db.Read(ctx, key)
+	if err != nil {
+		logger.Errorw(ctx, "DBGetByName-failed-read-db", log.Fields{"error": err, "key": key})
+		return nil, err
+	}
+
+	rec := new(DeviceRecord)
+	if err = json.Unmarshal([]byte(entry), rec); err != nil {
+		logger.Errorw(ctx, "Failed-to-unmarshal-at-DBGetByName", log.Fields{"reason": err, "entry": entry})
+		return nil, err
+	}
+
+	cache.nameToRec.Store(name, rec)
+
+	return rec, nil
+}
+
+// DBGetByUuid func reads device record by Uuid
+func DBGetByUuid(ctx context.Context, uuid string) (*DeviceRecord, error) {
+
+	if uuid == "" {
+		logger.Errorw(ctx, "DBGetByUuid-failed-missing-device-uuid", log.Fields{})
+		return nil, errors.New("uuid field is empty")
+	}
+
+	logger.Debugw(ctx, "DBGetByUuid-invoked", log.Fields{"uuid": uuid})
+	defer logger.Debugw(ctx, "DBGetByUuid-completed", log.Fields{"uuid": uuid})
+
+	var name string
+	var err error
+
+	if val, ok := cache.uuidToName.Load(uuid); ok {
+		name = val.(string)
+	} else {
+
+		key := fmt.Sprintf(DbPathUuidToName, uuid)
+		name, err = db.Read(ctx, key)
+		if err != nil {
+			logger.Errorw(ctx, "DBGetByUuid-failed-read-db", log.Fields{"error": err, "key": key})
+			return nil, err
+		}
+	}
+
+	cache.uuidToName.Store(uuid, name)
+
+	return DBGetByName(ctx, name)
+}
+
+// DBGetAll func returns all device records
+func DBGetAll(ctx context.Context) ([]*DeviceRecord, error) {
+	key := fmt.Sprintf(DbPathNameToRecord, "")
+	kvPairs, err := db.ReadAll(ctx, key)
+	if err != nil {
+		logger.Errorw(ctx, "DBGetAll-failed-read-db", log.Fields{"error": err, "key": key})
+		return nil, err
+	}
+
+	var listDevs []*DeviceRecord
+
+	for _, entry := range kvPairs {
+		rec := new(DeviceRecord)
+		if err = json.Unmarshal([]byte(entry), rec); err != nil {
+			logger.Errorw(ctx, "Failed-to-unmarshal-at-DBGetByName", log.Fields{"reason": err, "entry": entry})
+		} else {
+			listDevs = append(listDevs, rec)
+		}
+	}
+
+	logger.Infow(ctx, "DBGetAll-success", log.Fields{"entry": listDevs})
+
+	return listDevs, nil
+}
+
+// DBAddByName inserts Device Info record to DB with Name as Key
+func (rec *DeviceRecord) DBAddByName(ctx context.Context) error {
+	if rec.Name == "" {
+		logger.Errorw(ctx, "DBAddByName-failed-missing-device-name", log.Fields{"rec": rec})
+		return errors.New("missing name")
+	}
+	key := fmt.Sprintf(DbPathNameToRecord, rec.Name)
+	b, _ := json.Marshal(rec)
+	entry := string(b)
+	err := db.Put(ctx, key, entry)
+	cache.nameToRec.Store(rec.Name, rec)
+	logger.Infow(ctx, "Inserting-device-info-to-Db-in-DBAddByName-method", log.Fields{"rec": rec, "error": err})
+	return err
+}
+
+// DBAddUuidLookup creates a lookup of name from uuid
+func (rec *DeviceRecord) DBAddUuidLookup(ctx context.Context) error {
+	if rec.Uuid == "" || rec.Name == "" {
+		logger.Errorw(ctx, "DBAddUuidLookup-failed-missing-device-name-or-uuid", log.Fields{"rec": rec})
+		return errors.New("missing name")
+	}
+	key := fmt.Sprintf(DbPathUuidToName, rec.Uuid)
+	err := db.Put(ctx, key, rec.Name)
+	cache.uuidToName.Store(rec.Uuid, rec.Name)
+	logger.Infow(ctx, "DBAddUuidLookup-success", log.Fields{"rec": rec, "error": err})
+	return err
+}
+
+// DBDelRecord deletes all entries for Device Info
+func (rec *DeviceRecord) DBDelRecord(ctx context.Context) error {
+
+	var err error
+
+	if rec.Name != "" {
+		key := fmt.Sprintf(DbPathNameToRecord, rec.Name)
+		logger.Infow(ctx, "deleting-device-info-record-using-name", log.Fields{"name": rec.Name, "key": key})
+		err = db.Del(ctx, key)
+		cache.nameToRec.Delete(rec.Name)
+	}
+
+	if err == nil && rec.Uuid != "" {
+		key := fmt.Sprintf(DbPathUuidToName, rec.Uuid)
+		logger.Infow(ctx, "deleting-device-info-record-using-uuid", log.Fields{"uuid": rec.Uuid, "key": key})
+		err = db.Del(ctx, key)
+		cache.uuidToName.Delete(rec.Uuid)
+	}
+
+	return err
+}
+
+// DBSaveHwInfo stores hardware copies info from response and stores in db
+func (rec *DeviceRecord) DBSaveHwInfo(ctx context.Context, hw *dmi.Hardware) error {
+	defer logger.Infow(ctx, "saving-hw-info-to-device-record-completed", log.Fields{"rec": rec})
+	rec.LastBooted = hw.LastBooted
+	rec.LastChange = hw.LastChange
+	name := rec.Name
+	uuid := rec.Uuid
+	if err := copy.Copy(&rec, &hw.Root); err != nil {
+		logger.Errorw(ctx, "copy-failed-at-DBSaveHwInfo", log.Fields{"rec": rec, "error": err, "hw": hw})
+		return err
+	}
+	rec.Children = []string{}
+	for _, child := range hw.Root.Children {
+		rec.Children = append(rec.Children, child.Uuid.Uuid)
+	}
+	rec.Name = name
+	rec.Uuid = uuid
+	return rec.DBAddByName(ctx)
+}
diff --git a/pkg/models/device/models.go b/pkg/models/device/models.go
new file mode 100644
index 0000000..ab9611d
--- /dev/null
+++ b/pkg/models/device/models.go
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package device stores methods and functions related to device
+package device
+
+import (
+	"context"
+	"sync"
+
+	"github.com/opencord/device-management-interface/go/dmi"
+
+	"github.com/jinzhu/copier"
+	"github.com/opencord/opendevice-manager/pkg/config"
+
+	v1 "github.com/opencord/opendevice-manager/pkg/models/device/v1"
+	"github.com/opencord/voltha-lib-go/v4/pkg/log"
+)
+
+// Constants defined are the DB Path meant for storing device info records
+const (
+	DbPathUuidToName   = config.DBPrefix + config.CurDBVer + "/DevRec/DevUuid/%s"
+	DbPathNameToRecord = config.DBPrefix + config.CurDBVer + "/DevRec/DevName/%s"
+)
+
+// deviceCache stores device informations in buffer
+type deviceCache struct {
+	nameToRec  *sync.Map // nameToRecord maintains cache for mapping from name to main record
+	uuidToName *sync.Map // uuidToName maintains cache for mapping from uuid to name
+}
+
+var cache *deviceCache
+
+// logger represents the log object
+var logger log.CLogger
+
+// initCache initialises device cache
+func initCache() {
+	cache = new(deviceCache)
+	cache.nameToRec = new(sync.Map)
+	cache.uuidToName = new(sync.Map)
+}
+
+// init function for the package
+func init() {
+	logger = config.Initlog()
+	initCache()
+}
+
+// ClearCacheEntry clearsentry from device cache
+func ClearCacheEntry(ctx context.Context, name, uuid string) {
+	if name != "" {
+		logger.Debugw(ctx, "Clearing-name-key-from-device-cache", log.Fields{"name": name})
+		cache.nameToRec.Delete(name)
+	}
+	if uuid != "" {
+		logger.Debugw(ctx, "Clearing-uuid-key-from-device-cache", log.Fields{"uuid": uuid})
+		cache.uuidToName.Delete(name)
+	}
+}
+
+// DeviceRecord refers to the structure defined for storing OLT info
+type DeviceRecord v1.DeviceRecordV1_0
+
+// NewDeviceRecord return record for aliased ModifiableComponent
+func NewDeviceRecord(ctx context.Context, req *dmi.ModifiableComponent) (*DeviceRecord, error) {
+	rec := new(DeviceRecord)
+	err := copier.Copy(&rec, &req)
+	if err != nil {
+		logger.Errorw(ctx, "Failed-at-creating-object-for-new-device-info", log.Fields{"error": err, "req": req})
+		return nil, err
+	}
+	rec.Uri = req.Uri.Uri
+	rec.State = new(dmi.ComponentState)
+	rec.State.AdminState = req.AdminState
+	logger.Infow(ctx, "Successful-at-creating-object-for-new-device-info", log.Fields{"new-object": rec})
+	return rec, nil
+}
diff --git a/pkg/models/device/util.go b/pkg/models/device/util.go
new file mode 100644
index 0000000..8930cab
--- /dev/null
+++ b/pkg/models/device/util.go
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package modifiablecomponent stores ModifiableComponent methods and functions
+package device
+
+import (
+	"context"
+
+	"github.com/opencord/device-management-interface/go/dmi"
+
+	"github.com/opencord/voltha-lib-go/v4/pkg/log"
+)
+
+// GetLoggableEntitiesFromDevRec represnets the fetch the log level with entity from device record
+func (rec *DeviceRecord) GetLoggableEntitiesFromDevRec(ctx context.Context, entities []string) ([]*dmi.EntitiesLogLevel, bool) {
+
+	var traceLevel, debugLevel, infoLevel, warnLevel, errorLevel []string
+
+	if len(entities) > 0 {
+		// getLogLevel request for given entities
+		for _, entity := range entities {
+			if logLevel, ok := rec.Logging.LoggableEntities[entity]; ok {
+				switch logLevel {
+				case dmi.LogLevel_TRACE:
+					traceLevel = append(traceLevel, entity)
+				case dmi.LogLevel_DEBUG:
+					debugLevel = append(debugLevel, entity)
+				case dmi.LogLevel_INFO:
+					infoLevel = append(infoLevel, entity)
+				case dmi.LogLevel_WARN:
+					warnLevel = append(warnLevel, entity)
+				case dmi.LogLevel_ERROR:
+					errorLevel = append(errorLevel, entity)
+				}
+			} else {
+				logger.Warnw(ctx, "entity-was-not-found-in-device-record", log.Fields{"device-name": rec.Name, "entity": entity})
+				return nil, false
+			}
+
+		}
+	} else if len(rec.Logging.LoggableEntities) == 0 {
+		// if LoggableEntities length is zero means loglevel is applicable for entire hardware
+		logger.Debug(ctx, "all-entities-have-common-loglevel", log.Fields{"device-name": rec.Name, "log-level": rec.Logging.LogLevel})
+		return []*dmi.EntitiesLogLevel{{LogLevel: rec.Logging.LogLevel}}, true
+	} else {
+		// get globle log level or get loggble entities will  invoke here
+		logger.Debug(ctx, "all-entities-have-diffrent-loglevel", log.Fields{"device-name": rec.Name})
+		for entity, logLevel := range rec.Logging.LoggableEntities {
+			switch logLevel {
+			case dmi.LogLevel_TRACE:
+				traceLevel = append(traceLevel, entity)
+			case dmi.LogLevel_DEBUG:
+				debugLevel = append(debugLevel, entity)
+			case dmi.LogLevel_INFO:
+				infoLevel = append(infoLevel, entity)
+			case dmi.LogLevel_WARN:
+				warnLevel = append(warnLevel, entity)
+			case dmi.LogLevel_ERROR:
+				errorLevel = append(errorLevel, entity)
+			}
+		}
+	}
+
+	entitiesLogLevel := []*dmi.EntitiesLogLevel{
+		{LogLevel: dmi.LogLevel_TRACE, Entities: traceLevel},
+		{LogLevel: dmi.LogLevel_DEBUG, Entities: debugLevel},
+		{LogLevel: dmi.LogLevel_INFO, Entities: infoLevel},
+		{LogLevel: dmi.LogLevel_WARN, Entities: warnLevel},
+		{LogLevel: dmi.LogLevel_ERROR, Entities: errorLevel},
+	}
+	logger.Debug(ctx, "entities-with-log-level", log.Fields{"entities": entitiesLogLevel})
+
+	return entitiesLogLevel, true
+}
+
+// SaveLoggableEntities func is is used to save the log level with entity in device record
+func (rec *DeviceRecord) SaveLoggableEntities(ctx context.Context, listEntities []*dmi.EntitiesLogLevel) {
+
+	if rec.Logging.LoggableEntities == nil {
+
+		logger.Debug(ctx, "allocating-memory-for-loggable-entitie", log.Fields{"device-name": rec.Name})
+		rec.Logging.LoggableEntities = make(map[string]dmi.LogLevel)
+	}
+
+	if len(listEntities) == 1 && listEntities[0].Entities == nil {
+
+		logger.Debug(ctx, "set-global-log-level", log.Fields{"device-name": rec.Name})
+		rec.Logging.LogLevel = listEntities[0].LogLevel
+
+	} else {
+
+		logger.Debug(ctx, "setting-entity-log-level", log.Fields{"device-name": rec.Name, "list-of-entities": listEntities})
+		for _, entities := range listEntities {
+			logLevel := entities.LogLevel
+			for _, entity := range entities.Entities {
+				rec.Logging.LoggableEntities[entity] = logLevel
+			}
+		}
+	}
+}
diff --git a/pkg/models/device/v1/models.go b/pkg/models/device/v1/models.go
new file mode 100644
index 0000000..cf0a1ad
--- /dev/null
+++ b/pkg/models/device/v1/models.go
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package contains version v1 of Device Info
+package v1
+
+import (
+	"github.com/golang/protobuf/ptypes/timestamp"
+	"github.com/opencord/device-management-interface/go/dmi"
+)
+
+type DeviceRecordV1_0 struct {
+	Uuid         string               `json:"uuid,omitempty"`
+	Name         string               `json:"name,omitempty"`
+	Make         string               `json:"make,omitempty"`
+	Class        dmi.ComponentType    `json:"class,omitempty"`
+	Parent       *dmi.Component       `json:"parent,omitempty"`
+	ParentRelPos int32                `json:"parent_rel_pos,omitempty"`
+	Alias        string               `json:"alias,omitempty"`
+	AssetId      string               `json:"asset_id,omitempty"`
+	Uri          string               `json:"uri,omitempty"`
+	HardwareRev  string               `json:"hardware_rev,omitempty"`
+	FirmwareRev  string               `json:"firmware_rev,omitempty"`
+	SoftwareRev  string               `json:"software_rev,omitempty"`
+	SerialNum    string               `json:"serial_num,omitempty"`
+	ModelName    string               `json:"model_name,omitempty"`
+	MfgName      string               `json:"mfg_name,omitempty"`
+	MfgDate      *timestamp.Timestamp `json:"mfg_date,omitempty"`
+	State        *dmi.ComponentState  `json:"state,omitempty"`
+	Inventories  map[string]string    `json:"inventories,omitempty"`
+	Children     []string             `json:"children,omitempty"` // Children stores uuid of all direct child
+	Logging      LoggingInfo          `json:"logging,omitempty"`
+	LastChange   *timestamp.Timestamp `json:"last_change,omitempty"`
+	LastBooted   *timestamp.Timestamp `json:"last_booted,omitempty"` // Timestamp at which the hardware last booted
+}
+
+type LoggingInfo struct {
+	EndPoint         string                  `json:"end_point,omitempty"`
+	Protocol         string                  `json:"protocol,omitempty"`
+	LogLevel         dmi.LogLevel            `json:"log_level,omitempty"`
+	LoggableEntities map[string]dmi.LogLevel `json:"loggable_entities,omitempty"`
+}
diff --git a/pkg/models/hwcomponents/db.go b/pkg/models/hwcomponents/db.go
new file mode 100644
index 0000000..7d59d3f
--- /dev/null
+++ b/pkg/models/hwcomponents/db.go
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package hwcomponents stores methods and functions related to hardware
+package hwcomponents
+
+import (
+	"context"
+	"encoding/json"
+	"errors"
+	"fmt"
+
+	copy "github.com/jinzhu/copier"
+	dmi "github.com/opencord/device-management-interface/go/dmi"
+
+	"github.com/opencord/opendevice-manager/pkg/db"
+	log "github.com/opencord/voltha-lib-go/v4/pkg/log"
+)
+
+// DBAddByName inserts Device Info record to DB with Name as Key
+func (rec *HwCompRecord) DBAddByUuid(ctx context.Context, deviceUuid string) error {
+	if rec.Uuid == "" || deviceUuid == "" {
+		logger.Errorw(ctx, "DBAddByUuid-failed-missing-uuid", log.Fields{"rec": rec, "dev-uuid": deviceUuid})
+		return errors.New("missing uuid")
+	}
+	key := fmt.Sprintf(DbPathUuidToRecord, deviceUuid, rec.Uuid)
+	b, _ := json.Marshal(rec)
+	entry := string(b)
+	err := db.Put(ctx, key, entry)
+	cache.store(deviceUuid, rec)
+	logger.Infow(ctx, "Inserting-hw-comp-info-to-Db-in-DBAddByUuid-method", log.Fields{"rec": rec, "error": err})
+	return err
+}
+
+// DBAddByName inserts Device Info record to DB with Name as Key
+func DBAddNameToUuidlookup(ctx context.Context, deviceUuid string, nameToUuidMap map[string]string) error {
+	if deviceUuid == "" || len(nameToUuidMap) == 0 {
+		logger.Errorw(ctx, "DBAddNameToUuidlookup-failed-missing-uuid-or-map", log.Fields{"map": nameToUuidMap, "dev-uuid": deviceUuid})
+		return errors.New("missing info")
+	}
+	key := fmt.Sprintf(DbPathNameToUuid, deviceUuid)
+	b, _ := json.Marshal(nameToUuidMap)
+	entry := string(b)
+	err := db.Put(ctx, key, entry)
+	logger.Infow(ctx, "DBAddNameToUuidlookup-method-complete", log.Fields{"map": nameToUuidMap, "error": err})
+	return err
+}
+
+// DBSaveHwCompsFromPhysicalInventory iterates through each children and store hwcomponents in db
+func DBSaveHwCompsFromPhysicalInventory(ctx context.Context, deviceUuid string, nameToUuidMap map[string]string, children []*dmi.Component) {
+	if len(children) == 0 {
+		return
+	}
+	for _, child := range children {
+		hwRec := new(HwCompRecord)
+		if err := copy.Copy(&hwRec, &child); hwRec.Name == "" {
+			logger.Errorw(ctx, "Failed-at-copying-hw-comp-from-inventory-list", log.Fields{"error": err, "child": child, "hw-comp": hwRec})
+			continue
+		}
+		if child.Uri != nil {
+			hwRec.Uri = child.Uri.Uri
+		}
+		if child.Uuid != nil {
+			hwRec.Uuid = child.Uuid.Uuid
+		}
+		for _, grandChild := range child.Children {
+			hwRec.Children = append(hwRec.Children, grandChild.Uuid.Uuid)
+		}
+		hwRec.DBAddByUuid(ctx, deviceUuid)
+		nameToUuidMap[hwRec.Name] = hwRec.Uuid
+		DBSaveHwCompsFromPhysicalInventory(ctx, deviceUuid, nameToUuidMap, child.Children)
+		logger.Infow(ctx, "Successful-at-creating-object-for-new-hw-info", log.Fields{"new-object": child})
+	}
+}
+
+// DBDelRecord deletes all entries for Device Info
+func DBDelAllHwComponents(ctx context.Context, deviceUuid string) error {
+
+	var err error
+
+	if deviceUuid == "" {
+		logger.Errorw(ctx, "deleting-all-hw-components-failed", log.Fields{"reason": "missing-device-uuid"})
+		return errors.New("missing device uuid")
+	}
+
+	key := fmt.Sprintf(DbPrefix, deviceUuid)
+	err = db.DelAll(ctx, key)
+	cache.delDevice(deviceUuid)
+	logger.Infow(ctx, "deleting-all-hw-components-completed", log.Fields{"key": key})
+
+	return err
+}
+
+// DBGetRecByUuid func reads hw comp record by uuid
+func DBGetRecByUuid(ctx context.Context, deviceUuid, hwCompUuid string) (*HwCompRecord, error) {
+	if deviceUuid == "" || hwCompUuid == "" {
+		logger.Errorw(ctx, "DBGetHwCompRec-failed-missing-uuid", log.Fields{"device-uuid": deviceUuid, "hw-comp-uuid": hwCompUuid})
+		return nil, errors.New("uuid field is empty")
+	}
+
+	if rec := cache.get(deviceUuid, hwCompUuid); rec != nil {
+		return rec, nil
+	}
+
+	key := fmt.Sprintf(DbPathUuidToRecord, deviceUuid, hwCompUuid)
+	entry, err := db.Read(ctx, key)
+	if err != nil {
+		logger.Errorw(ctx, "DBGetRecByUuid-failed-read-db", log.Fields{"error": err, "key": key})
+		return nil, err
+	}
+
+	rec := new(HwCompRecord)
+	if err = json.Unmarshal([]byte(entry), rec); err != nil {
+		logger.Errorw(ctx, "Failed-to-unmarshal-at-DBGetRecByUuid", log.Fields{"reason": err, "entry": entry})
+		return nil, err
+	}
+
+	cache.store(deviceUuid, rec)
+
+	logger.Debugw(ctx, "DBGetHwCompRec-completed", log.Fields{"device-uuid": deviceUuid, "hw-comp-uuid": hwCompUuid, "rec": rec})
+	return rec, nil
+}
+
+// DBGetRecByName func reads hw comp record by name
+func DBGetRecByName(ctx context.Context, deviceUuid, hwName string) (*HwCompRecord, error) {
+	if deviceUuid == "" || hwName == "" {
+		logger.Errorw(ctx, "DBGetRecByName-failed-missing-uuid", log.Fields{"device-uuid": deviceUuid, "hw-comp-name": hwName})
+		return nil, errors.New("name field is empty")
+	}
+	key := fmt.Sprintf(DbPathNameToUuid, deviceUuid)
+	entry, err := db.Read(ctx, key)
+	if err != nil {
+		logger.Errorw(ctx, "DBGetRecByName-failed-read-db", log.Fields{"error": err, "key": key})
+		return nil, err
+	}
+
+	nameToUuidMap := make(map[string]string)
+	if err = json.Unmarshal([]byte(entry), &nameToUuidMap); nameToUuidMap == nil || err != nil {
+		logger.Errorw(ctx, "Failed-to-unmarshal-at-DBGetRecByName", log.Fields{"reason": err, "entry": entry})
+		return nil, err
+	}
+
+	if hwUuid, ok := nameToUuidMap[hwName]; ok {
+		rec, err2 := DBGetRecByUuid(ctx, deviceUuid, hwUuid)
+		logger.Debugw(ctx, "DBGetRecByName-completed", log.Fields{"device-uuid": deviceUuid, "hw-comp-name": hwName, "rec": rec, "error": err2})
+	}
+
+	return nil, errors.New("name not found")
+}
diff --git a/pkg/models/hwcomponents/models.go b/pkg/models/hwcomponents/models.go
new file mode 100644
index 0000000..9906b53
--- /dev/null
+++ b/pkg/models/hwcomponents/models.go
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package hwcomponents stores methods and functions related to hardware
+package hwcomponents
+
+import (
+	"sync"
+
+	config "github.com/opencord/opendevice-manager/pkg/config"
+	v1 "github.com/opencord/opendevice-manager/pkg/models/hwcomponents/v1"
+	log "github.com/opencord/voltha-lib-go/v4/pkg/log"
+)
+
+// Constants defined are the DB Path meant for storing hw component info records
+const (
+	DbPrefix = config.DBPrefix + config.CurDBVer + "/HwCompRec/%s"
+	// Key : /OpenDevMgr/v1/HwCompRec/{Device-Uuid}/Components
+	// Val : Map => {"hw-comp-name-1":"hw-comp-uuid-1", "hw-comp-name-2":"hw-comp-uuid-2"}
+	DbPathNameToUuid = DbPrefix + "/Components"
+	// Key : /OpenDevMgr/v1/HwCompRec/{Device-Uuid}/Uuid/{Hw-Comp-Uuid}
+	// Val : HwCompRecord{}
+	DbPathUuidToRecord = DbPrefix + "/Uuid/%s"
+)
+
+// compCache stores component information in buffer
+type compCache struct {
+	uuidToRec map[string]map[string]*HwCompRecord // nameToRecord maintains cache for mapping from name to main record
+	mutex     sync.Mutex
+}
+
+var cache *compCache
+
+// logger represents the log object
+var logger log.CLogger
+
+// initCache initialises device cache
+func initCache() {
+	cache = new(compCache)
+	cache.uuidToRec = make(map[string]map[string]*HwCompRecord)
+	cache.mutex = sync.Mutex{}
+}
+
+// init function for the package
+func init() {
+	logger = config.Initlog()
+	initCache()
+}
+
+type HwCompRecord v1.HwCompRecordV1_0
+
+func (*compCache) store(devUuid string, rec *HwCompRecord) {
+	cache.mutex.Lock()
+	defer cache.mutex.Unlock()
+
+	var uuidToRecMap map[string]*HwCompRecord
+
+	if val, ok := cache.uuidToRec[devUuid]; !ok {
+		uuidToRecMap = make(map[string]*HwCompRecord)
+	} else {
+		uuidToRecMap = val
+	}
+
+	uuidToRecMap[rec.Uuid] = rec
+	cache.uuidToRec[devUuid] = uuidToRecMap
+}
+
+func (*compCache) get(devUuid, compUuid string) *HwCompRecord {
+	cache.mutex.Lock()
+	defer cache.mutex.Unlock()
+
+	var uuidToRecMap map[string]*HwCompRecord
+
+	if val, ok := cache.uuidToRec[devUuid]; !ok {
+		return nil
+	} else {
+		uuidToRecMap = val
+	}
+
+	if rec, ok := uuidToRecMap[compUuid]; ok {
+		return rec
+	}
+
+	return nil
+}
+
+func (*compCache) delDevice(devUuid string) *HwCompRecord {
+	cache.mutex.Lock()
+	defer cache.mutex.Unlock()
+	delete(cache.uuidToRec, devUuid)
+	return nil
+}
diff --git a/pkg/models/hwcomponents/v1/models.go b/pkg/models/hwcomponents/v1/models.go
new file mode 100644
index 0000000..b7734a8
--- /dev/null
+++ b/pkg/models/hwcomponents/v1/models.go
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2020-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.
+ */
+
+// Package v1 stores models for hw components
+package v1
+
+import (
+	dmi "github.com/opencord/device-management-interface/go/dmi"
+
+	timestamp "github.com/golang/protobuf/ptypes/timestamp"
+)
+
+type HwCompRecordV1_0 struct {
+	Name         string                     `json:"name,omitempty"`
+	Class        dmi.ComponentType          `json:"class,omitempty"`
+	Description  string                     `json:"description,omitempty"`
+	Parent       string                     `json:"parent,omitempty"`
+	ParentRelPos int32                      `json:"parent_rel_pos,omitempty"`
+	Children     []string                   `json:"children,omitempty"` // Children stores uuid of all direct child
+	SerialNum    string                     `json:"serial_num,omitempty"`
+	MfgName      string                     `json:"mfg_name,omitempty"`
+	ModelName    string                     `json:"model_name,omitempty"`
+	Alias        string                     `json:"alias,omitempty"`
+	AssetId      string                     `json:"asset_id,omitempty"`
+	IsFru        bool                       `json:"is_fru,omitempty"`
+	MfgDate      *timestamp.Timestamp       `json:"mfg_date,omitempty"`
+	Uri          string                     `json:"uri,omitempty"`
+	Uuid         string                     `json:"uuid,omitempty"`
+	State        *dmi.ComponentState        `json:"state,omitempty"`
+	SensorData   []*dmi.ComponentSensorData `json:"sensor_data,omitempty"`
+	Specific     string                     `json:"specific,omitempty"`
+}
