diff --git a/database/database.go b/database/database.go
index fe88556..0344e7d 100644
--- a/database/database.go
+++ b/database/database.go
@@ -33,7 +33,6 @@
 )
 
 var logger log.CLogger
-var ctx = context.TODO()
 
 // Database structure
 type Database struct {
@@ -45,7 +44,7 @@
 
 // Initialize the database module. The database module runs as a singleton
 // object and is initialized when the adapter is created.
-func Initialize(storeType string, address string, timeout int) (*Database, error) {
+func Initialize(ctx context.Context, storeType string, address string, timeout int) (*Database, error) {
 	var err error
 	var database Database
 	logger.Infow(ctx, "kv-store-type", log.Fields{"store": storeType})
@@ -64,13 +63,13 @@
 // as a string
 
 // Put to add value to database
-func (db *Database) Put(fullKeyPath, value string) error {
-	return db.kvc.Put(context.Background(), fullKeyPath, value)
+func (db *Database) Put(ctx context.Context, fullKeyPath, value string) error {
+	return db.kvc.Put(ctx, fullKeyPath, value)
 }
 
 // Get to retrieve value from database
-func (db *Database) Get(key string) (string, error) {
-	kv, err := db.kvc.Get(context.Background(), key)
+func (db *Database) Get(ctx context.Context, key string) (string, error) {
+	kv, err := db.kvc.Get(ctx, key)
 	if err != nil {
 		return "", err
 	}
@@ -81,8 +80,8 @@
 }
 
 // Del to delete value from database
-func (db *Database) Del(fullPath string) error {
-	if err := db.kvc.Delete(context.Background(), fullPath); err != nil {
+func (db *Database) Del(ctx context.Context, fullPath string) error {
+	if err := db.kvc.Delete(ctx, fullPath); err != nil {
 		logger.Errorw(ctx, "The path doesn't exist", log.Fields{"key": fullPath, "Error": err})
 		return err
 	}
@@ -90,8 +89,8 @@
 }
 
 // DeleteAll to delete all value from database
-func (db *Database) DeleteAll(fullPath string) error {
-	if err := db.kvc.DeleteWithPrefix(context.Background(), fullPath); err != nil {
+func (db *Database) DeleteAll(ctx context.Context, fullPath string) error {
+	if err := db.kvc.DeleteWithPrefix(ctx, fullPath); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": fullPath, "Error": err})
 		return err
 	}
@@ -99,8 +98,8 @@
 }
 
 // DeleteAllUnderHashKey to delete all values under hash key
-func (db *Database) DeleteAllUnderHashKey(hashKeyPrefix string) error {
-	if err := db.kvc.Delete(context.Background(), hashKeyPrefix); err != nil {
+func (db *Database) DeleteAllUnderHashKey(ctx context.Context, hashKeyPrefix string) error {
+	if err := db.kvc.Delete(ctx, hashKeyPrefix); err != nil {
 		logger.Errorw(ctx, "The key path doesn't exist", log.Fields{"key": hashKeyPrefix, "Error": err})
 		return err
 	}
@@ -108,8 +107,8 @@
 }
 
 // List to list the values
-func (db *Database) List(key string) (map[string]*kvstore.KVPair, error) {
-	kv, err := db.kvc.List(context.Background(), key)
+func (db *Database) List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error) {
+	kv, err := db.kvc.List(ctx, key)
 	if err != nil {
 		return nil, err
 	}
@@ -122,21 +121,21 @@
 // OLT specific database items
 
 // GetOlt to get olt info
-func (db *Database) GetOlt(deviceID string) (string, error) {
+func (db *Database) GetOlt(ctx context.Context, deviceID string) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DevicePath), deviceID)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutOlt to add olt info
-func (db *Database) PutOlt(deviceID string, value string) error {
+func (db *Database) PutOlt(ctx context.Context, deviceID string, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DevicePath), deviceID)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelOlt to delete olt info
-func (db *Database) DelOlt(deviceID string) error {
+func (db *Database) DelOlt(ctx context.Context, deviceID string) error {
 	key := fmt.Sprintf(GetKeyPath(DevicePath), deviceID)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -146,27 +145,27 @@
 // Flows specific database actions
 
 // PutFlow to add flow
-func (db *Database) PutFlow(deviceID string, flowID uint64, value string) error {
+func (db *Database) PutFlow(ctx context.Context, deviceID string, flowID uint64, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID) + strconv.FormatUint(flowID, 10)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetFlow to get flow
-func (db *Database) GetFlow(deviceID string, flowID uint64) (string, error) {
+func (db *Database) GetFlow(ctx context.Context, deviceID string, flowID uint64) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID) + strconv.FormatUint(flowID, 10)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetFlows to get multiple flows
-func (db *Database) GetFlows(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetFlows(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // DelFlow to delete flow
-func (db *Database) DelFlow(deviceID string, flowID uint64) error {
+func (db *Database) DelFlow(ctx context.Context, deviceID string, flowID uint64) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID) + strconv.FormatUint(flowID, 10)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -176,28 +175,28 @@
 // Group specific database actions
 
 // PutGroup to add group info
-func (db *Database) PutGroup(deviceID string, groupID uint32, value string) error {
+func (db *Database) PutGroup(ctx context.Context, deviceID string, groupID uint32, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceGroupPath), deviceID) + strconv.FormatUint(uint64(groupID), 10)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetGroup to get group info
-func (db *Database) GetGroup(deviceID string, groupID uint32) (string, error) {
+func (db *Database) GetGroup(ctx context.Context, deviceID string, groupID uint32) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceGroupPath), deviceID) + strconv.FormatUint(uint64(groupID), 10)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetGroups to get multiple group info
-func (db *Database) GetGroups(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetGroups(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceGroupPath), deviceID)
 	logger.Infow(ctx, "key", log.Fields{"Key": key})
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // DelGroup to delete group info
-func (db *Database) DelGroup(deviceID string, groupID uint32) error {
+func (db *Database) DelGroup(ctx context.Context, deviceID string, groupID uint32) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceGroupPath), deviceID) + strconv.FormatUint(uint64(groupID), 10)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -205,9 +204,9 @@
 }
 
 // DelAllGroup to delete all group info
-func (db *Database) DelAllGroup(deviceID string) error {
+func (db *Database) DelAllGroup(ctx context.Context, deviceID string) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceGroupPath), deviceID)
-	if err := db.DeleteAllUnderHashKey(key); err != nil {
+	if err := db.DeleteAllUnderHashKey(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -216,9 +215,9 @@
 }
 
 // DelAllPorts to delete all ports info
-func (db *Database) DelAllPorts(device string) error {
+func (db *Database) DelAllPorts(ctx context.Context, device string) error {
 	key := fmt.Sprintf(GetKeyPath(DevicePortPath), device)
-	if err := db.DeleteAllUnderHashKey(key); err != nil {
+	if err := db.DeleteAllUnderHashKey(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -229,27 +228,27 @@
 // Ports specific database actions
 
 // PutPort to add port info
-func (db *Database) PutPort(deviceID string, portID uint32, value string) error {
+func (db *Database) PutPort(ctx context.Context, deviceID string, portID uint32, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DevicePortPath), deviceID) + strconv.FormatUint(uint64(portID), 10)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetPort to get port info
-func (db *Database) GetPort(deviceID string, portID uint32) (string, error) {
+func (db *Database) GetPort(ctx context.Context, deviceID string, portID uint32) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DevicePortPath), deviceID) + strconv.FormatUint(uint64(portID), 10)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetPorts to get multiple ports info
-func (db *Database) GetPorts(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetPorts(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(DevicePortPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // DelPort to delete port info
-func (db *Database) DelPort(deviceID string, portID uint32) error {
+func (db *Database) DelPort(ctx context.Context, deviceID string, portID uint32) error {
 	key := fmt.Sprintf(GetKeyPath(DevicePortPath), deviceID) + strconv.FormatUint(uint64(portID), 10)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -259,27 +258,27 @@
 // Device meter specific database actions
 
 // PutDeviceMeter to add device meter info
-func (db *Database) PutDeviceMeter(deviceID string, meterID uint32, value string) error {
+func (db *Database) PutDeviceMeter(ctx context.Context, deviceID string, meterID uint32, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceMeterPath), deviceID) + strconv.FormatUint(uint64(meterID), 10)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetDeviceMeter to get device meter info
-func (db *Database) GetDeviceMeter(deviceID string, meterID uint32) (string, error) {
+func (db *Database) GetDeviceMeter(ctx context.Context, deviceID string, meterID uint32) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceMeterPath), deviceID) + strconv.FormatUint(uint64(meterID), 10)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetDeviceMeters to get multiple device meter info
-func (db *Database) GetDeviceMeters(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetDeviceMeters(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceMeterPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // DelDeviceMeter to delete device meter info
-func (db *Database) DelDeviceMeter(deviceID string, meterID uint32) error {
+func (db *Database) DelDeviceMeter(ctx context.Context, deviceID string, meterID uint32) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceMeterPath), deviceID) + strconv.FormatUint(uint64(meterID), 10)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -289,27 +288,27 @@
 // Service specific database actions
 
 // GetServices to get multiple services info
-func (db *Database) GetServices() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetServices(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(ServicePath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetService to get service info
-func (db *Database) GetService(name string) (string, error) {
+func (db *Database) GetService(ctx context.Context, name string) (string, error) {
 	key := GetKeyPath(ServicePath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutService to add service info
-func (db *Database) PutService(name string, value string) error {
+func (db *Database) PutService(ctx context.Context, name string, value string) error {
 	key := GetKeyPath(ServicePath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelService to delete service info
-func (db *Database) DelService(name string) error {
+func (db *Database) DelService(ctx context.Context, name string) error {
 	key := GetKeyPath(ServicePath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -319,27 +318,27 @@
 // Virtual networks specific database actions
 
 // GetVnets to get multiple vnets info
-func (db *Database) GetVnets() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetVnets(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(VnetPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetVnet to get vnet info
-func (db *Database) GetVnet(name string) (string, error) {
+func (db *Database) GetVnet(ctx context.Context, name string) (string, error) {
 	key := GetKeyPath(VnetPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutVnet to add vnet info
-func (db *Database) PutVnet(name string, value string) error {
+func (db *Database) PutVnet(ctx context.Context, name string, value string) error {
 	key := GetKeyPath(VnetPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelVnet to delete vnet info
-func (db *Database) DelVnet(name string) error {
+func (db *Database) DelVnet(ctx context.Context, name string) error {
 	key := GetKeyPath(VnetPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -349,30 +348,30 @@
 // Virtual networks on ports specific database actions
 
 // GetVpvs to get multiple vpvs info
-func (db *Database) GetVpvs() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetVpvs(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(VpvPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetVpv to get vpv info
-func (db *Database) GetVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16) (string, error) {
+func (db *Database) GetVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16) (string, error) {
 	name := port + fmt.Sprintf("-%v-%v-%v", SVlan, CVlan, UniVlan)
 	key := GetKeyPath(VpvPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutVpv to add vpv info
-func (db *Database) PutVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16, value string) error {
+func (db *Database) PutVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16, value string) error {
 	name := port + fmt.Sprintf("-%v-%v-%v", SVlan, CVlan, UniVlan)
 	key := GetKeyPath(VpvPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelVpv to delete vpv info
-func (db *Database) DelVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16) error {
+func (db *Database) DelVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16) error {
 	name := port + fmt.Sprintf("-%v-%v-%v", SVlan, CVlan, UniVlan)
 	key := GetKeyPath(VpvPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -382,30 +381,30 @@
 // Virtual networks on ports specific database actions
 
 // GetMvlans to get multiple mvlans info
-func (db *Database) GetMvlans() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetMvlans(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(MvlanPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetMvlan to get mvlan info
-func (db *Database) GetMvlan(mvlan uint16) (string, error) {
+func (db *Database) GetMvlan(ctx context.Context, mvlan uint16) (string, error) {
 	name := strconv.FormatInt(int64(mvlan), 10)
 	key := GetKeyPath(MvlanPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutMvlan to add mvlan info
-func (db *Database) PutMvlan(mvlan uint16, value string) error {
+func (db *Database) PutMvlan(ctx context.Context, mvlan uint16, value string) error {
 	name := strconv.FormatInt(int64(mvlan), 10)
 	key := GetKeyPath(MvlanPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelMvlan to delete mvlan info
-func (db *Database) DelMvlan(mvlan uint16) error {
+func (db *Database) DelMvlan(ctx context.Context, mvlan uint16) error {
 	name := strconv.FormatInt(int64(mvlan), 10)
 	key := GetKeyPath(MvlanPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -415,9 +414,9 @@
 // database specific actions on IGMP config
 
 // DelIGMPCfg to delete icmp config
-func (db *Database) DelIGMPCfg() error {
+func (db *Database) DelIGMPCfg(ctx context.Context) error {
 	key := GetKeyPath(IgmpConfPath)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -427,27 +426,27 @@
 // database specific actions on IGMP Profile
 
 // GetIgmpProfiles to get multiple igmp profile info
-func (db *Database) GetIgmpProfiles() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetIgmpProfiles(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpProfPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpProfile to get igmp profile info
-func (db *Database) GetIgmpProfile(name string) (string, error) {
+func (db *Database) GetIgmpProfile(ctx context.Context, name string) (string, error) {
 	key := GetKeyPath(IgmpProfPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutIgmpProfile to put igmp profile info
-func (db *Database) PutIgmpProfile(name string, value string) error {
+func (db *Database) PutIgmpProfile(ctx context.Context, name string, value string) error {
 	key := GetKeyPath(IgmpProfPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelIgmpProfile to delete igmp profile
-func (db *Database) DelIgmpProfile(name string) error {
+func (db *Database) DelIgmpProfile(ctx context.Context, name string) error {
 	key := GetKeyPath(IgmpProfPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -457,27 +456,27 @@
 // database specific actions on Mcast config Info
 
 // GetMcastConfigs to get multiple mcast config info
-func (db *Database) GetMcastConfigs() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetMcastConfigs(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(McastConfigPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetMcastConfig to get igmp profile info
-func (db *Database) GetMcastConfig(name string) (string, error) {
+func (db *Database) GetMcastConfig(ctx context.Context, name string) (string, error) {
 	key := GetKeyPath(McastConfigPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutMcastConfig to put igmp profile info
-func (db *Database) PutMcastConfig(name string, value string) error {
+func (db *Database) PutMcastConfig(ctx context.Context, name string, value string) error {
 	key := GetKeyPath(McastConfigPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelMcastConfig to delete igmp profile
-func (db *Database) DelMcastConfig(name string) error {
+func (db *Database) DelMcastConfig(ctx context.Context, name string) error {
 	key := GetKeyPath(McastConfigPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -487,21 +486,21 @@
 // database specific actions on health
 
 // GetHealth to get health info
-func (db *Database) GetHealth() (string, error) {
+func (db *Database) GetHealth(ctx context.Context) (string, error) {
 	key := GetKeyPath(HealthPath)
-	return db.Get(key)
+	return db.Get(ctx,key)
 }
 
 // PutHealth to add health info
-func (db *Database) PutHealth(value string) error {
+func (db *Database) PutHealth(ctx context.Context, value string) error {
 	key := GetKeyPath(HealthPath)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelHealth to delete health info
-func (db *Database) DelHealth() error {
+func (db *Database) DelHealth(ctx context.Context) error {
 	key := GetKeyPath(HealthPath)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -511,27 +510,27 @@
 // Meters
 
 // GetMeters to get multiple meters info
-func (db *Database) GetMeters() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetMeters(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(MeterPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetMeter to get meter info
-func (db *Database) GetMeter(name string) (string, error) {
+func (db *Database) GetMeter(ctx context.Context, name string) (string, error) {
 	key := GetKeyPath(MeterPath) + name
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutMeter to add meter info
-func (db *Database) PutMeter(name string, value string) error {
+func (db *Database) PutMeter(ctx context.Context, name string, value string) error {
 	key := GetKeyPath(MeterPath) + name
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelMeter to delete meter info
-func (db *Database) DelMeter(name string) error {
+func (db *Database) DelMeter(ctx context.Context, name string) error {
 	key := GetKeyPath(MeterPath) + name
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -539,9 +538,9 @@
 }
 
 // DelAllMeter to delete meter info
-func (db *Database) DelAllMeter(device string) error {
+func (db *Database) DelAllMeter(ctx context.Context, device string) error {
 	key := GetKeyPath(DevicePath) + device + "/" + MeterPath
-	if err := db.DeleteAllUnderHashKey(key); err != nil {
+	if err := db.DeleteAllUnderHashKey(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -552,27 +551,27 @@
 // IGMP groups
 
 // GetIgmpGroups to get multiple igmp groups info
-func (db *Database) GetIgmpGroups() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetIgmpGroups(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpGroupPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpGroup to get igmp group info
-func (db *Database) GetIgmpGroup(id string) (string, error) {
+func (db *Database) GetIgmpGroup(ctx context.Context, id string) (string, error) {
 	key := GetKeyPath(IgmpGroupPath) + id
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutIgmpGroup to add igmp group info
-func (db *Database) PutIgmpGroup(id string, value string) error {
+func (db *Database) PutIgmpGroup(ctx context.Context, id string, value string) error {
 	key := GetKeyPath(IgmpGroupPath) + id
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelIgmpGroup to delete igmp group info
-func (db *Database) DelIgmpGroup(id string) error {
+func (db *Database) DelIgmpGroup(ctx context.Context, id string) error {
 	key := GetKeyPath(IgmpGroupPath) + id
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -582,39 +581,39 @@
 // IGMP group devices
 
 // GetAllIgmpDevices to get multiple igmp devices info
-func (db *Database) GetAllIgmpDevices() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllIgmpDevices(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpDevicePath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetPrevIgmpDevices to get previous igmp devices
-func (db *Database) GetPrevIgmpDevices(mvlan of.VlanType, gid string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetPrevIgmpDevices(ctx context.Context, mvlan of.VlanType, gid string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpDevicePath) + mvlan.String() + "/" + gid + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpDevices to get igmp devices
-func (db *Database) GetIgmpDevices(mvlan of.VlanType, gid string, gip net.IP) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetIgmpDevices(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpDevicePath) + mvlan.String() + "/" + gid + "/" + gip.String() + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpDevice to get igmp device
-func (db *Database) GetIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string) (string, error) {
+func (db *Database) GetIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string) (string, error) {
 	key := GetKeyPath(IgmpDevicePath) + mvlan.String() + "/" + gid + "/" + gip.String() + "/" + device
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutIgmpDevice to add igmp device
-func (db *Database) PutIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string, value string) error {
+func (db *Database) PutIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string, value string) error {
 	key := GetKeyPath(IgmpDevicePath) + mvlan.String() + "/" + gid + "/" + gip.String() + "/" + device
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelIgmpDevice to delete igmp device
-func (db *Database) DelIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string) error {
+func (db *Database) DelIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string) error {
 	key := GetKeyPath(IgmpDevicePath) + mvlan.String() + "/" + gid + "/" + gip.String() + "/" + device
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -624,39 +623,39 @@
 // IGMP group channels
 
 // GetAllIgmpChannels to get all igmp channels
-func (db *Database) GetAllIgmpChannels() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllIgmpChannels(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpChannelPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetPrevIgmpChannels to get previous igmp channels
-func (db *Database) GetPrevIgmpChannels(gName, device string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetPrevIgmpChannels(ctx context.Context, gName, device string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpChannelPath) + gName + "/" + device + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpChannels to get multiple igmp channels
-func (db *Database) GetIgmpChannels(mvlan of.VlanType, gName, device string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetIgmpChannels(ctx context.Context, mvlan of.VlanType, gName, device string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpChannelPath) + mvlan.String() + "/" + gName + "/" + device + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpChannel to get igmp channel
-func (db *Database) GetIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP) (string, error) {
+func (db *Database) GetIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP) (string, error) {
 	key := GetKeyPath(IgmpChannelPath) + mvlan.String() + "/" + gName + "/" + device + "/" + gip.String()
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutIgmpChannel to add igmp channel info
-func (db *Database) PutIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP, value string) error {
+func (db *Database) PutIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP, value string) error {
 	key := GetKeyPath(IgmpChannelPath) + mvlan.String() + "/" + gName + "/" + device + "/" + gip.String()
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelIgmpChannel to delete igmp channel info
-func (db *Database) DelIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP) error {
+func (db *Database) DelIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP) error {
 	key := GetKeyPath(IgmpChannelPath) + mvlan.String() + "/" + gName + "/" + device + "/" + gip.String()
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -666,39 +665,39 @@
 // IGMP group receivers
 
 // GetAllIgmpRcvrs to get all igmp receivers info
-func (db *Database) GetAllIgmpRcvrs() (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllIgmpRcvrs(ctx context.Context) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpPortPath)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetPrevIgmpRcvrs to get previous igmp receivers info
-func (db *Database) GetPrevIgmpRcvrs(gip net.IP, device string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetPrevIgmpRcvrs(ctx context.Context, gip net.IP, device string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpPortPath) + gip.String() + "/" + device + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpRcvrs to get multiple igmp receivers info
-func (db *Database) GetIgmpRcvrs(mvlan of.VlanType, gip net.IP, device string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetIgmpRcvrs(ctx context.Context, mvlan of.VlanType, gip net.IP, device string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(IgmpPortPath) + mvlan.String() + "/" + gip.String() + "/" + device + "/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetIgmpRcvr to get igmp receiver info
-func (db *Database) GetIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string) (string, error) {
+func (db *Database) GetIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string) (string, error) {
 	key := GetKeyPath(IgmpPortPath) + mvlan.String() + "/" + gip.String() + "/" + device + "/" + rcvr
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutIgmpRcvr to add igmp receiver info
-func (db *Database) PutIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string, value string) error {
+func (db *Database) PutIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string, value string) error {
 	key := GetKeyPath(IgmpPortPath) + mvlan.String() + "/" + gip.String() + "/" + device + "/" + rcvr
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelIgmpRcvr to delete igmp receiver info
-func (db *Database) DelIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string) error {
+func (db *Database) DelIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string) error {
 	key := GetKeyPath(IgmpPortPath) + mvlan.String() + "/" + gip.String() + "/" + device + "/" + rcvr
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -706,9 +705,9 @@
 }
 
 // DelAllIgmpRcvr to delete all igmp receiver info
-func (db *Database) DelAllIgmpRcvr(mvlan of.VlanType, gip net.IP, device string) error {
+func (db *Database) DelAllIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string) error {
 	key := GetKeyPath(IgmpPortPath) + mvlan.String() + "/" + gip.String() + "/" + device + "/"
-	if err := db.DeleteAll(key); err != nil {
+	if err := db.DeleteAll(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -716,11 +715,11 @@
 }
 
 // DelAllRoutesForDevice to delete all routes for device
-func (db *Database) DelAllRoutesForDevice(device string) error {
+func (db *Database) DelAllRoutesForDevice(ctx context.Context, device string) error {
 	/* service/vgc/v1/devices/<deviceID>/flows/ */
 	logger.Infow(ctx, "Deleting all the flows for device", log.Fields{"device": device})
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), device)
-	if err := db.DeleteAllUnderHashKey(key); err != nil {
+	if err := db.DeleteAllUnderHashKey(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -728,47 +727,47 @@
 }
 
 // PutNbDevicePort to add device port info
-func (db *Database) PutNbDevicePort(device string, ponPortID uint32, value string) {
+func (db *Database) PutNbDevicePort(ctx context.Context, device string, ponPortID uint32, value string) {
 	key := GetKeyPath(NbDevicePath) + device + "/pon-port/" + fmt.Sprintf("%v", ponPortID)
 
-	if err := db.kvc.Put(context.Background(), key, value); err != nil {
+	if err := db.kvc.Put(ctx, key, value); err != nil {
 		logger.Warnw(ctx, "Put Device Port failed", log.Fields{"key": key})
 	}
 }
 
 // DelNbDevicePort to delete device port
-func (db *Database) DelNbDevicePort(device string, ponPortID uint32) {
+func (db *Database) DelNbDevicePort(ctx context.Context, device string, ponPortID uint32) {
 	key := GetKeyPath(NbDevicePath) + device + "/pon-port/" + fmt.Sprintf("%v", ponPortID)
 
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete Device Port failed", log.Fields{"key": key})
 	}
 }
 
 // GetAllNbPorts to get all ports info
-func (db *Database) GetAllNbPorts(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllNbPorts(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(NbDevicePath) + deviceID + "/pon-port/"
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 //Functions for migration database
 
 // GetMigrationInfo to get migration info
-func (db *Database) GetMigrationInfo() (string, error) {
+func (db *Database) GetMigrationInfo(ctx context.Context) (string, error) {
 	key := GetKeyPath(MigrationInfoPath)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutMigrationInfo to add migration info
-func (db *Database) PutMigrationInfo(value string) error {
+func (db *Database) PutMigrationInfo(ctx context.Context, value string) error {
 	key := GetKeyPath(MigrationInfoPath)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelMigrationInfo to delete migration info
-func (db *Database) DelMigrationInfo() error {
+func (db *Database) DelMigrationInfo(ctx context.Context) error {
 	key := GetKeyPath(MigrationInfoPath)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -778,27 +777,27 @@
 //PON counters
 
 // GetAllPonCounters to get all pon counters info
-func (db *Database) GetAllPonCounters(device string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllPonCounters(ctx context.Context, device string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(PonCounterPath) + device
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetPonCounter to get pon counter info
-func (db *Database) GetPonCounter(device, ponID string) (string, error) {
+func (db *Database) GetPonCounter(ctx context.Context, device, ponID string) (string, error) {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutPonCounter to add pon counter info
-func (db *Database) PutPonCounter(device, ponID, value string) error {
+func (db *Database) PutPonCounter(ctx context.Context, device, ponID, value string) error {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelPonCounter to delete pon counter info
-func (db *Database) DelPonCounter(device, ponID string) error {
+func (db *Database) DelPonCounter(ctx context.Context, device, ponID string) error {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -808,27 +807,27 @@
 //PON Channel counters
 
 // GetAllPonChannelCounters to get all pon channel counters
-func (db *Database) GetAllPonChannelCounters(device, ponID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllPonChannelCounters(ctx context.Context, device, ponID string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID + "/" + ChannelCounterPath
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetPonChannelCounter to get pon channel counter
-func (db *Database) GetPonChannelCounter(device, ponID, channel string) (string, error) {
+func (db *Database) GetPonChannelCounter(ctx context.Context, device, ponID, channel string) (string, error) {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID + "/" + ChannelCounterPath + channel
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutPonChannelCounter to add pon channel counter
-func (db *Database) PutPonChannelCounter(device, ponID, channel, value string) error {
+func (db *Database) PutPonChannelCounter(ctx context.Context, device, ponID, channel, value string) error {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID + "/" + ChannelCounterPath + channel
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelPonChannelCounter to delete pon channel counter
-func (db *Database) DelPonChannelCounter(device, ponID, channel string) error {
+func (db *Database) DelPonChannelCounter(ctx context.Context, device, ponID, channel string) error {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID + "/" + ChannelCounterPath + channel
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -836,56 +835,56 @@
 }
 
 // DelAllPONCounters to delete all pon channel counters
-func (db *Database) DelAllPONCounters(device string) error {
+func (db *Database) DelAllPONCounters(ctx context.Context, device string) error {
 	key := GetKeyPath(PonCounterPath) + device + "/"
-	return db.DeleteAll(key)
+	return db.DeleteAll(ctx, key)
 }
 
 // DelPONCounters to delete pon counters
-func (db *Database) DelPONCounters(device string, ponID string) {
+func (db *Database) DelPONCounters(ctx context.Context, device string, ponID string) {
 	key := GetKeyPath(PonCounterPath) + device + "/" + ponID + "/"
-	if err := db.DeleteAll(key); err != nil {
+	if err := db.DeleteAll(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete Pon counters failed", log.Fields{"key": key})
 	}
 	//DeletePonCounter(device, ponID)
 }
 
 // PutOltIgmpCounters to add Olt Igmp counter info
-func (db *Database) PutOltIgmpCounters(device, value string) error {
+func (db *Database) PutOltIgmpCounters(ctx context.Context, device, value string) error {
 	key := GetKeyPath(OltIgmpCounterPath) + device
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetOltIgmpCounter to get Olt Igmp counter info
-func (db *Database) GetOltIgmpCounter(device string) (string, error) {
+func (db *Database) GetOltIgmpCounter(ctx context.Context, device string) (string, error) {
 	key := GetKeyPath(OltIgmpCounterPath) + device
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 //Service Channel counters
 
 // GetAllServiceChannelCounters to get all service channel counters info
-func (db *Database) GetAllServiceChannelCounters(serviceName string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllServiceChannelCounters(ctx context.Context, serviceName string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(ServiceCounterPath) + serviceName + "/" + ChannelCounterPath
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // GetServiceChannelCounter to get service channel counter info
-func (db *Database) GetServiceChannelCounter(serviceName, channel string) (string, error) {
+func (db *Database) GetServiceChannelCounter(ctx context.Context, serviceName, channel string) (string, error) {
 	key := GetKeyPath(ServiceCounterPath) + serviceName + "/" + ChannelCounterPath + channel
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutServiceChannelCounter to add service channel counter
-func (db *Database) PutServiceChannelCounter(serviceName, channel, value string) error {
+func (db *Database) PutServiceChannelCounter(ctx context.Context, serviceName, channel, value string) error {
 	key := GetKeyPath(ServiceCounterPath) + serviceName + "/" + ChannelCounterPath + channel
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // DelServiceChannelCounter to delete service channel counter
-func (db *Database) DelServiceChannelCounter(serviceName, channel string) error {
+func (db *Database) DelServiceChannelCounter(ctx context.Context, serviceName, channel string) error {
 	key := GetKeyPath(ServiceCounterPath) + serviceName + "/" + ChannelCounterPath + channel
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -893,14 +892,14 @@
 }
 
 // DelAllServiceChannelCounter to delete all service channel counter
-func (db *Database) DelAllServiceChannelCounter(serviceName string) error {
+func (db *Database) DelAllServiceChannelCounter(ctx context.Context, serviceName string) error {
 	key := GetKeyPath(ServiceCounterPath) + serviceName + "/" + ChannelCounterPath
-	return db.DeleteAllUnderHashKey(key)
+	return db.DeleteAllUnderHashKey(ctx, key)
 }
 
 // OltExists to know if the ONU is added to the database
-func (db *Database) OltExists(deviceID string) bool {
-	if _, err := db.GetOlt(deviceID); err != nil {
+func (db *Database) OltExists(ctx context.Context, deviceID string) bool {
+	if _, err := db.GetOlt(ctx, deviceID); err != nil {
 		return false
 	}
 	return true
@@ -908,119 +907,119 @@
 }
 
 // PutFlowHash to add flowhash for the device
-func (db *Database) PutFlowHash(deviceID string, value string) error {
+func (db *Database) PutFlowHash(ctx context.Context, deviceID string, value string) error {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID)
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetFlowHash gets the flow hash for the device
-func (db *Database) GetFlowHash(deviceID string) (string, error) {
+func (db *Database) GetFlowHash(ctx context.Context, deviceID string) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(DeviceFlowPath), deviceID)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // PutPortAlarmProfile to add port alarm profile
-func (db *Database) PutPortAlarmProfile(portAlarmProfileID string, value string) {
+func (db *Database) PutPortAlarmProfile(ctx context.Context, portAlarmProfileID string, value string) {
 	key := GetKeyPath(PortAlarmProfilePath) + fmt.Sprintf("%v", portAlarmProfileID)
-	if err := db.kvc.Put(context.Background(), key, value); err != nil {
+	if err := db.kvc.Put(ctx, key, value); err != nil {
 		logger.Warnw(ctx, "Put PortAlarmProfile failed", log.Fields{"key": key})
 	}
 }
 
 // DelPortAlarmProfile to delete port alarm profile
-func (db *Database) DelPortAlarmProfile(portAlarmProfileID string) {
+func (db *Database) DelPortAlarmProfile(ctx context.Context, portAlarmProfileID string) {
 	key := GetKeyPath(PortAlarmProfilePath) + fmt.Sprintf("%v", portAlarmProfileID)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete PortAlarmProfile failed", log.Fields{"key": key})
 	}
 }
 
 // GetPortAlarmProfile to get port alarm profile
-func (db *Database) GetPortAlarmProfile(portAlarmProfileID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetPortAlarmProfile(ctx context.Context, portAlarmProfileID string) (map[string]*kvstore.KVPair, error) {
 	key := GetKeyPath(PortAlarmProfilePath) + fmt.Sprintf("%v", portAlarmProfileID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // PutPortAlarmData to add port alarm data
-func (db *Database) PutPortAlarmData(deviceID string, portID uint32, value string) {
+func (db *Database) PutPortAlarmData(ctx context.Context, deviceID string, portID uint32, value string) {
 	key := fmt.Sprintf(GetKeyPath(PortAlarmDataPath), deviceID) + fmt.Sprintf("%v", portID)
-	if err := db.kvc.Put(context.Background(), key, value); err != nil {
+	if err := db.kvc.Put(ctx, key, value); err != nil {
 		logger.Warnw(ctx, "Put PortAlarmData failed", log.Fields{"key": key})
 	}
 }
 
 // DelPortAlarmData to delete port alarm data
-func (db *Database) DelPortAlarmData(deviceID string, portID uint32) {
+func (db *Database) DelPortAlarmData(ctx context.Context, deviceID string, portID uint32) {
 	key := fmt.Sprintf(GetKeyPath(PortAlarmDataPath), deviceID) + fmt.Sprintf("%v", portID)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete PortAlarmData failed", log.Fields{"key": key})
 	}
 }
 
 // GetPortAlarmData to get port alarm data
-func (db *Database) GetPortAlarmData(deviceID string, portID uint32) (string, error) {
+func (db *Database) GetPortAlarmData(ctx context.Context, deviceID string, portID uint32) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(PortAlarmDataPath), deviceID) + fmt.Sprintf("%v", portID)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetAllPortAlarmData to get port alarm data for all ports
-func (db *Database) GetAllPortAlarmData(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllPortAlarmData(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(PortAlarmDataPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // PutSubAlarmData to add subscriber alarm data
-func (db *Database) PutSubAlarmData(deviceID string, portName string, value string) {
+func (db *Database) PutSubAlarmData(ctx context.Context, deviceID string, portName string, value string) {
 	key := fmt.Sprintf(GetKeyPath(SubAlarmDataPath), deviceID) + fmt.Sprintf("%v", portName)
-	if err := db.kvc.Put(context.Background(), key, value); err != nil {
+	if err := db.kvc.Put(ctx, key, value); err != nil {
 		logger.Warnw(ctx, "Put Subscriber AlarmData failed", log.Fields{"key": key})
 	}
 }
 
 // DelSubAlarmData to delete subscriber alarm data
-func (db *Database) DelSubAlarmData(deviceID string, portName string) {
+func (db *Database) DelSubAlarmData(ctx context.Context, deviceID string, portName string) {
 	key := fmt.Sprintf(GetKeyPath(SubAlarmDataPath), deviceID) + fmt.Sprintf("%v", portName)
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete Subscriber AlarmData failed", log.Fields{"key": key})
 	}
 }
 
 // GetSubAlarmData to get subscriber alarm data
-func (db *Database) GetSubAlarmData(deviceID string, portName string) (string, error) {
+func (db *Database) GetSubAlarmData(ctx context.Context, deviceID string, portName string) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(SubAlarmDataPath), deviceID) + fmt.Sprintf("%v", portName)
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetAllSubAlarmData to get sub alarm data for all subscribers
-func (db *Database) GetAllSubAlarmData(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllSubAlarmData(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(SubAlarmDataPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // Migrate Service req specific database actions
 
 // PutMigrateServicesReq to add MigrateServicesReq info
-func (db *Database) PutMigrateServicesReq(deviceID string, vnet string, value string) error {
+func (db *Database) PutMigrateServicesReq(ctx context.Context, deviceID string, vnet string, value string) error {
 	key := fmt.Sprintf(GetKeyPath(ServicesMigrateReqPath), deviceID) + vnet
-	return db.kvc.Put(context.Background(), key, value)
+	return db.kvc.Put(ctx, key, value)
 }
 
 // GetMigrateServicesReq to get MigrateServicesReq info
-func (db *Database) GetMigrateServicesReq(deviceID string, vnet string) (string, error) {
+func (db *Database) GetMigrateServicesReq(ctx context.Context, deviceID string, vnet string) (string, error) {
 	key := fmt.Sprintf(GetKeyPath(ServicesMigrateReqPath), deviceID) + vnet
-	return db.Get(key)
+	return db.Get(ctx, key)
 }
 
 // GetAllMigrateServicesReq to get multiple MigrateServicesReq info
-func (db *Database) GetAllMigrateServicesReq(deviceID string) (map[string]*kvstore.KVPair, error) {
+func (db *Database) GetAllMigrateServicesReq(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
 	key := fmt.Sprintf(GetKeyPath(ServicesMigrateReqPath), deviceID)
-	return db.List(key)
+	return db.List(ctx, key)
 }
 
 // DelMigrateServicesReq to delete MigrateServicesReq info
-func (db *Database) DelMigrateServicesReq(deviceID string, vnet string) error {
+func (db *Database) DelMigrateServicesReq(ctx context.Context, deviceID string, vnet string) error {
 	key := fmt.Sprintf(GetKeyPath(ServicesMigrateReqPath), deviceID) + vnet
-	if err := db.kvc.Delete(context.Background(), key); err != nil {
+	if err := db.kvc.Delete(ctx, key); err != nil {
 		logger.Errorw(ctx, "The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
@@ -1028,9 +1027,9 @@
 }
 
 // DelAllMigrateServicesReq to delete all MigrateServicesReq info
-func (db *Database) DelAllMigrateServicesReq(deviceID string) error {
+func (db *Database) DelAllMigrateServicesReq(ctx context.Context, deviceID string) error {
 	key := fmt.Sprintf(GetKeyPath(ServicesMigrateReqPath), deviceID)
-	if err := db.DeleteAllUnderHashKey(key); err != nil {
+	if err := db.DeleteAllUnderHashKey(ctx, key); err != nil {
 		logger.Warnw(ctx, "Delete All failed: The key doesn't exist", log.Fields{"key": key, "Error": err})
 		return err
 	}
diff --git a/database/dbintf.go b/database/dbintf.go
index b8b491f..8a6a43b 100644
--- a/database/dbintf.go
+++ b/database/dbintf.go
@@ -17,6 +17,7 @@
 
 import (
 	"net"
+	"context"
 
 	"voltha-go-controller/internal/pkg/of"
 	"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
@@ -26,132 +27,132 @@
 
 // DBIntf defines db related methods
 type DBIntf interface {
-	Get(key string) (string, error)
-	Put(fullKeyPath string, value string) error
-	Del(path string) error
-	List(key string) (map[string]*kvstore.KVPair, error)
-	DeleteAll(path string) error
-	DeleteAllUnderHashKey(hashKeyPrefix string) error
-	GetOlt(deviceID string) (string, error)
-	PutOlt(deviceID string, value string) error
-	DelOlt(deviceID string) error
-	GetFlow(deviceID string, flowID uint64) (string, error)
-	GetFlows(deviceID string) (map[string]*kvstore.KVPair, error)
-	PutFlow(deviceID string, flowID uint64, value string) error
-	DelFlow(deviceID string, flowID uint64) error
-	PutGroup(deviceID string, groupID uint32, value string) error
-	GetGroup(deviceID string, groupID uint32) (string, error)
-	GetGroups(deviceID string) (map[string]*kvstore.KVPair, error)
-	DelGroup(deviceID string, groupID uint32) error
-	DelAllGroup(string) error
-	DelAllPorts(deviceID string) error
-	DelPort(deviceID string, portID uint32) error
-	PutPort(deviceID string, portID uint32, value string) error
-	GetPort(deviceID string, portID uint32) (string, error)
-	GetPorts(deviceID string) (map[string]*kvstore.KVPair, error)
-	PutDeviceMeter(deviceID string, meterID uint32, value string) error
-	GetDeviceMeter(deviceID string, meterID uint32) (string, error)
-	GetDeviceMeters(deviceID string) (map[string]*kvstore.KVPair, error)
-	DelDeviceMeter(deviceID string, meterID uint32) error
-	GetService(name string) (string, error)
-	GetServices() (map[string]*kvstore.KVPair, error)
-	PutService(name string, value string) error
-	DelService(name string) error
-	GetVnets() (map[string]*kvstore.KVPair, error)
-	GetVnet(name string) (string, error)
-	PutVnet(name string, value string) error
-	DelVnet(name string) error
-	GetVpvs() (map[string]*kvstore.KVPair, error)
-	GetVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16) (string, error)
-	PutVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16, value string) error
-	DelVpv(port string, SVlan uint16, CVlan uint16, UniVlan uint16) error
-	GetMvlans() (map[string]*kvstore.KVPair, error)
-	GetMvlan(mvlan uint16) (string, error)
-	PutMvlan(mvlan uint16, value string) error
-	DelMvlan(mvlan uint16) error
-	DelIGMPCfg() error
-	GetHealth() (string, error)
-	PutHealth(value string) error
-	DelHealth() error
-	GetMeters() (map[string]*kvstore.KVPair, error)
-	GetMeter(name string) (string, error)
-	PutMeter(name string, value string) error
-	DelMeter(name string) error
-	DelAllMeter(device string) error
-	GetIgmpGroups() (map[string]*kvstore.KVPair, error)
-	GetIgmpGroup(id string) (string, error)
-	PutIgmpGroup(id string, value string) error
-	DelIgmpGroup(id string) error
-	GetAllIgmpDevices() (map[string]*kvstore.KVPair, error)
-	GetPrevIgmpDevices(mvlan of.VlanType, gid string) (map[string]*kvstore.KVPair, error)
-	GetIgmpDevices(mvlan of.VlanType, gid string, gip net.IP) (map[string]*kvstore.KVPair, error)
-	GetIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string) (string, error)
-	PutIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string, value string) error
-	DelIgmpDevice(mvlan of.VlanType, gid string, gip net.IP, device string) error
-	GetAllIgmpChannels() (map[string]*kvstore.KVPair, error)
-	GetPrevIgmpChannels(gname string, device string) (map[string]*kvstore.KVPair, error)
-	GetIgmpChannels(mvlan of.VlanType, gname string, device string) (map[string]*kvstore.KVPair, error)
-	GetIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP) (string, error)
-	PutIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP, value string) error
-	DelIgmpChannel(mvlan of.VlanType, gName string, device string, gip net.IP) error
-	GetAllIgmpRcvrs() (map[string]*kvstore.KVPair, error)
-	GetPrevIgmpRcvrs(gip net.IP, device string) (map[string]*kvstore.KVPair, error)
-	GetIgmpRcvrs(mvlan of.VlanType, gip net.IP, device string) (map[string]*kvstore.KVPair, error)
-	GetIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string) (string, error)
-	PutIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string, value string) error
-	DelIgmpRcvr(mvlan of.VlanType, gip net.IP, device string, rcvr string) error
-	DelAllIgmpRcvr(mvlan of.VlanType, gip net.IP, device string) error
-	DelAllRoutesForDevice(device string) error
-	DelNbDevicePort(device string, ponPortID uint32)
-	GetAllNbPorts(deviceID string) (map[string]*kvstore.KVPair, error)
-	GetMigrationInfo() (string, error)
-	PutMigrationInfo(value string) error
-	DelMigrationInfo() error
-	GetAllPonCounters(device string) (map[string]*kvstore.KVPair, error)
-	GetPonCounter(device string, ponID string) (string, error)
-	PutPonCounter(device string, ponID string, value string) error
-	DelPonCounter(device string, ponID string) error
-	GetAllPonChannelCounters(device string, ponID string) (map[string]*kvstore.KVPair, error)
-	GetPonChannelCounter(device string, ponID string, channel string) (string, error)
-	PutNbDevicePort(device string, ponPortID uint32, value string)
-	PutPonChannelCounter(device string, ponID string, channel string, value string) error
-	DelPonChannelCounter(device string, ponID string, channel string) error
-	DelAllPONCounters(device string) error
-	DelPONCounters(device string, ponID string)
-	GetAllServiceChannelCounters(serviceName string) (map[string]*kvstore.KVPair, error)
-	GetServiceChannelCounter(serviceName string, channel string) (string, error)
-	PutServiceChannelCounter(serviceName string, channel string, value string) error
-	DelServiceChannelCounter(serviceName string, channel string) error
-	DelAllServiceChannelCounter(serviceName string) error
-	PutOltIgmpCounters(device string, value string) error
-	GetOltIgmpCounter(device string) (string, error)
-	PutFlowHash(deviceID string, value string) error
-	GetFlowHash(deviceID string) (string, error)
-	OltExists(deviceID string) bool
-	GetIgmpProfiles() (map[string]*kvstore.KVPair, error)
-	GetIgmpProfile(name string) (string, error)
-	PutIgmpProfile(name string, value string) error
-	DelIgmpProfile(name string) error
-	GetMcastConfigs() (map[string]*kvstore.KVPair, error)
-	GetMcastConfig(name string) (string, error)
-	PutMcastConfig(name string, value string) error
-	DelMcastConfig(name string) error
-	PutPortAlarmProfile(portAlarmProfileID string, value string)
-	GetPortAlarmProfile(portAlarmProfileID string) (map[string]*kvstore.KVPair, error)
-	DelPortAlarmProfile(portAlarmProfileID string)
-	PutPortAlarmData(deviceID string, portID uint32, value string)
-	GetPortAlarmData(deviceID string, portID uint32) (string, error)
-	DelPortAlarmData(deviceID string, portID uint32)
-	GetAllPortAlarmData(deviceID string) (map[string]*kvstore.KVPair, error)
-	PutSubAlarmData(deviceID string, portName string, value string)
-	GetSubAlarmData(deviceID string, portName string) (string, error)
-	DelSubAlarmData(deviceID string, portName string)
-	GetAllSubAlarmData(deviceID string) (map[string]*kvstore.KVPair, error)
-	PutMigrateServicesReq(deviceID string, vlan string, value string) error
-	GetMigrateServicesReq(deviceID string, vlan string) (string, error)
-	GetAllMigrateServicesReq(deviceID string) (map[string]*kvstore.KVPair, error)
-	DelMigrateServicesReq(deviceID string, vlan string) error
-	DelAllMigrateServicesReq(deviceID string) error
+	Get(ctx context.Context, key string) (string, error)
+	Put(ctx context.Context, fullKeyPath string, value string) error
+	Del(ctx context.Context, path string) error
+	List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error)
+	DeleteAll(ctx context.Context, path string) error
+	DeleteAllUnderHashKey(ctx context.Context, hashKeyPrefix string) error
+	GetOlt(ctx context.Context, deviceID string) (string, error)
+	PutOlt(ctx context.Context, deviceID string, value string) error
+	DelOlt(ctx context.Context, deviceID string) error
+	GetFlow(ctx context.Context, deviceID string, flowID uint64) (string, error)
+	GetFlows(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	PutFlow(ctx context.Context, deviceID string, flowID uint64, value string) error
+	DelFlow(ctx context.Context, deviceID string, flowID uint64) error
+	PutGroup(ctx context.Context, deviceID string, groupID uint32, value string) error
+	GetGroup(ctx context.Context, deviceID string, groupID uint32) (string, error)
+	GetGroups(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	DelGroup(ctx context.Context, deviceID string, groupID uint32) error
+	DelAllGroup(ctx context.Context, deviceID string) error
+	DelAllPorts(ctx context.Context, deviceID string) error
+	DelPort(ctx context.Context, deviceID string, portID uint32) error
+	PutPort(ctx context.Context, deviceID string, portID uint32, value string) error
+	GetPort(ctx context.Context, deviceID string, portID uint32) (string, error)
+	GetPorts(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	PutDeviceMeter(ctx context.Context, deviceID string, meterID uint32, value string) error
+	GetDeviceMeter(ctx context.Context, deviceID string, meterID uint32) (string, error)
+	GetDeviceMeters(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	DelDeviceMeter(ctx context.Context, deviceID string, meterID uint32) error
+	GetService(ctx context.Context, name string) (string, error)
+	GetServices(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	PutService(ctx context.Context, name string, value string) error
+	DelService(ctx context.Context, name string) error
+	GetVnets(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetVnet(ctx context.Context, name string) (string, error)
+	PutVnet(ctx context.Context, name string, value string) error
+	DelVnet(ctx context.Context, name string) error
+	GetVpvs(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16) (string, error)
+	PutVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16, value string) error
+	DelVpv(ctx context.Context, port string, SVlan uint16, CVlan uint16, UniVlan uint16) error
+	GetMvlans(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetMvlan(ctx context.Context, mvlan uint16) (string, error)
+	PutMvlan(ctx context.Context, mvlan uint16, value string) error
+	DelMvlan(ctx context.Context, mvlan uint16) error
+	DelIGMPCfg(ctx context.Context) error
+	GetHealth(ctx context.Context) (string, error)
+	PutHealth(ctx context.Context, value string) error
+	DelHealth(ctx context.Context) error
+	GetMeters(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetMeter(ctx context.Context, name string) (string, error)
+	PutMeter(ctx context.Context, name string, value string) error
+	DelMeter(ctx context.Context, name string) error
+	DelAllMeter(ctx context.Context, device string) error
+	GetIgmpGroups(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetIgmpGroup(ctx context.Context, id string) (string, error)
+	PutIgmpGroup(ctx context.Context, id string, value string) error
+	DelIgmpGroup(ctx context.Context, id string) error
+	GetAllIgmpDevices(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetPrevIgmpDevices(ctx context.Context, mvlan of.VlanType, gid string) (map[string]*kvstore.KVPair, error)
+	GetIgmpDevices(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP) (map[string]*kvstore.KVPair, error)
+	GetIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string) (string, error)
+	PutIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string, value string) error
+	DelIgmpDevice(ctx context.Context, mvlan of.VlanType, gid string, gip net.IP, device string) error
+	GetAllIgmpChannels(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetPrevIgmpChannels(ctx context.Context, gname string, device string) (map[string]*kvstore.KVPair, error)
+	GetIgmpChannels(ctx context.Context, mvlan of.VlanType, gname string, device string) (map[string]*kvstore.KVPair, error)
+	GetIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP) (string, error)
+	PutIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP, value string) error
+	DelIgmpChannel(ctx context.Context, mvlan of.VlanType, gName string, device string, gip net.IP) error
+	GetAllIgmpRcvrs(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetPrevIgmpRcvrs(ctx context.Context, gip net.IP, device string) (map[string]*kvstore.KVPair, error)
+	GetIgmpRcvrs(ctx context.Context, mvlan of.VlanType, gip net.IP, device string) (map[string]*kvstore.KVPair, error)
+	GetIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string) (string, error)
+	PutIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string, value string) error
+	DelIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string, rcvr string) error
+	DelAllIgmpRcvr(ctx context.Context, mvlan of.VlanType, gip net.IP, device string) error
+	DelAllRoutesForDevice(ctx context.Context, device string) error
+	DelNbDevicePort(ctx context.Context, device string, ponPortID uint32)
+	GetAllNbPorts(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	GetMigrationInfo(ctx context.Context) (string, error)
+	PutMigrationInfo(ctx context.Context, value string) error
+	DelMigrationInfo(ctx context.Context) error
+	GetAllPonCounters(ctx context.Context, device string) (map[string]*kvstore.KVPair, error)
+	GetPonCounter(ctx context.Context, device string, ponID string) (string, error)
+	PutPonCounter(ctx context.Context, device string, ponID string, value string) error
+	DelPonCounter(ctx context.Context, device string, ponID string) error
+	GetAllPonChannelCounters(ctx context.Context, device string, ponID string) (map[string]*kvstore.KVPair, error)
+	GetPonChannelCounter(ctx context.Context, device string, ponID string, channel string) (string, error)
+	PutNbDevicePort(ctx context.Context, device string, ponPortID uint32, value string)
+	PutPonChannelCounter(ctx context.Context, device string, ponID string, channel string, value string) error
+	DelPonChannelCounter(ctx context.Context, device string, ponID string, channel string) error
+	DelAllPONCounters(ctx context.Context, device string) error
+	DelPONCounters(ctx context.Context, device string, ponID string)
+	GetAllServiceChannelCounters(ctx context.Context, serviceName string) (map[string]*kvstore.KVPair, error)
+	GetServiceChannelCounter(ctx context.Context, serviceName string, channel string) (string, error)
+	PutServiceChannelCounter(ctx context.Context, serviceName string, channel string, value string) error
+	DelServiceChannelCounter(ctx context.Context, serviceName string, channel string) error
+	DelAllServiceChannelCounter(ctx context.Context, serviceName string) error
+	PutOltIgmpCounters(ctx context.Context, device string, value string) error
+	GetOltIgmpCounter(ctx context.Context, device string) (string, error)
+	PutFlowHash(ctx context.Context, deviceID string, value string) error
+	GetFlowHash(ctx context.Context, deviceID string) (string, error)
+	OltExists(ctx context.Context, deviceID string) bool
+	GetIgmpProfiles(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetIgmpProfile(ctx context.Context, name string) (string, error)
+	PutIgmpProfile(ctx context.Context, name string, value string) error
+	DelIgmpProfile(ctx context.Context, name string) error
+	GetMcastConfigs(ctx context.Context) (map[string]*kvstore.KVPair, error)
+	GetMcastConfig(ctx context.Context, name string) (string, error)
+	PutMcastConfig(ctx context.Context, name string, value string) error
+	DelMcastConfig(ctx context.Context, name string) error
+	PutPortAlarmProfile(ctx context.Context, portAlarmProfileID string, value string)
+	GetPortAlarmProfile(ctx context.Context, portAlarmProfileID string) (map[string]*kvstore.KVPair, error)
+	DelPortAlarmProfile(ctx context.Context, portAlarmProfileID string)
+	PutPortAlarmData(ctx context.Context, deviceID string, portID uint32, value string)
+	GetPortAlarmData(ctx context.Context, deviceID string, portID uint32) (string, error)
+	DelPortAlarmData(ctx context.Context, deviceID string, portID uint32)
+	GetAllPortAlarmData(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	PutSubAlarmData(ctx context.Context, deviceID string, portName string, value string)
+	GetSubAlarmData(ctx context.Context, deviceID string, portName string) (string, error)
+	DelSubAlarmData(ctx context.Context, deviceID string, portName string)
+	GetAllSubAlarmData(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	PutMigrateServicesReq(ctx context.Context, deviceID string, vlan string, value string) error
+	GetMigrateServicesReq(ctx context.Context, deviceID string, vlan string) (string, error)
+	GetAllMigrateServicesReq(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error)
+	DelMigrateServicesReq(ctx context.Context, deviceID string, vlan string) error
+	DelAllMigrateServicesReq(ctx context.Context, deviceID string) error
 }
 
 //GetDatabase - returns databse operation based on configuration
diff --git a/internal/pkg/application/application.go b/internal/pkg/application/application.go
index 9476e55..e7d2d04 100644
--- a/internal/pkg/application/application.go
+++ b/internal/pkg/application/application.go
@@ -84,7 +84,7 @@
 var PacketHandlers map[string]CallBack
 
 // CallBack : registered call back function for different protocol packets
-type CallBack func(device string, port string, pkt gopacket.Packet)
+type CallBack func(cntx context.Context, device string, port string, pkt gopacket.Packet)
 
 const (
 	// ARP packet
@@ -338,7 +338,7 @@
 }
 
 // pushFlowsForUnis to send port-up-indication for uni ports.
-func (d *VoltDevice) pushFlowsForUnis() {
+func (d *VoltDevice) pushFlowsForUnis(cntx context.Context) {
 
 	logger.Info(ctx, "NNI Discovered, Sending Port UP Ind for UNIs")
 	d.Ports.Range(func(key, value interface{}) bool {
@@ -359,7 +359,7 @@
 
 		for _, vpv := range vnets.([]*VoltPortVnet) {
 			vpv.VpvLock.Lock()
-			vpv.PortUpInd(d, port)
+			vpv.PortUpInd(cntx, d, port)
 			vpv.VpvLock.Unlock()
 
 		}
@@ -447,12 +447,12 @@
 }
 
 // RestoreNbDeviceFromDb restores the NB Device in case of VGC pod restart.
-func (va *VoltApplication) RestoreNbDeviceFromDb(deviceID string) *NbDevice {
+func (va *VoltApplication) RestoreNbDeviceFromDb(cntx context.Context, deviceID string) *NbDevice {
 
 	nbDevice := NewNbDevice()
 	nbDevice.SouthBoundID = deviceID
 
-	nbPorts, _ := db.GetAllNbPorts(deviceID)
+	nbPorts, _ := db.GetAllNbPorts(cntx, deviceID)
 
 	for key, p := range nbPorts {
 		b, ok := p.Value.([]byte)
@@ -481,17 +481,17 @@
 }
 
 // WriteToDb writes nb device port config to kv store
-func (nbd *NbDevice) WriteToDb(portID uint32, ponPort *PonPortCfg) {
+func (nbd *NbDevice) WriteToDb(cntx context.Context, portID uint32, ponPort *PonPortCfg) {
 	b, err := json.Marshal(ponPort)
 	if err != nil {
 		logger.Errorw(ctx, "PonPortConfig-marshal-failed", log.Fields{"err": err})
 		return
 	}
-	db.PutNbDevicePort(nbd.SouthBoundID, portID, string(b))
+	db.PutNbDevicePort(cntx, nbd.SouthBoundID, portID, string(b))
 }
 
 // AddPortToNbDevice Adds pon port to NB Device and DB
-func (nbd *NbDevice) AddPortToNbDevice(portID, allowedChannels uint32,
+func (nbd *NbDevice) AddPortToNbDevice(cntx context.Context, portID, allowedChannels uint32,
 	enableMulticastKPI bool, portAlarmProfileID string) *PonPortCfg {
 
 	ponPort := &PonPortCfg{
@@ -501,12 +501,12 @@
 		PortAlarmProfileID: portAlarmProfileID,
 	}
 	nbd.PonPorts.Store(portID, ponPort)
-	nbd.WriteToDb(portID, ponPort)
+	nbd.WriteToDb(cntx, portID, ponPort)
 	return ponPort
 }
 
 // UpdatePortToNbDevice Adds pon port to NB Device and DB
-func (nbd *NbDevice) UpdatePortToNbDevice(portID, allowedChannels uint32, enableMulticastKPI bool, portAlarmProfileID string) *PonPortCfg {
+func (nbd *NbDevice) UpdatePortToNbDevice(cntx context.Context, portID, allowedChannels uint32, enableMulticastKPI bool, portAlarmProfileID string) *PonPortCfg {
 
 	p, exists := nbd.PonPorts.Load(portID)
 	if !exists {
@@ -521,17 +521,17 @@
 	}
 
 	nbd.PonPorts.Store(portID, port)
-	nbd.WriteToDb(portID, port)
+	nbd.WriteToDb(cntx, portID, port)
 	return port
 }
 
 // DeletePortFromNbDevice Deletes pon port from NB Device and DB
-func (nbd *NbDevice) DeletePortFromNbDevice(portID uint32) {
+func (nbd *NbDevice) DeletePortFromNbDevice(cntx context.Context, portID uint32) {
 
 	if _, ok := nbd.PonPorts.Load(portID); ok {
 		nbd.PonPorts.Delete(portID)
 	}
-	db.DelNbDevicePort(nbd.SouthBoundID, portID)
+	db.DelNbDevicePort(cntx, nbd.SouthBoundID, portID)
 }
 
 // GetApplication : Interface to access the singleton object
@@ -559,8 +559,8 @@
 	va.VnetsToDelete = make(map[string]bool)
 	va.ServicesToDelete = make(map[string]bool)
 	va.VoltPortVnetsToDelete = make(map[*VoltPortVnet]bool)
-	go va.Start(TimerCfg{tick: 100 * time.Millisecond}, tickTimer)
-	go va.Start(TimerCfg{tick: time.Duration(GroupExpiryTime) * time.Minute}, pendingPoolTimer)
+	go va.Start(context.Background(), TimerCfg{tick: 100 * time.Millisecond}, tickTimer)
+	go va.Start(context.Background(), TimerCfg{tick: time.Duration(GroupExpiryTime) * time.Minute}, pendingPoolTimer)
 	InitEventFuncMapper()
 	db = database.GetDatabase()
 	return &va
@@ -647,9 +647,9 @@
 }
 
 //RestoreUpgradeStatus - gets upgrade/migration status from DB and updates local flags
-func (va *VoltApplication) RestoreUpgradeStatus() {
+func (va *VoltApplication) RestoreUpgradeStatus(cntx context.Context) {
 	Migrate := new(DataMigration)
-	if err := GetMigrationInfo(Migrate); err == nil {
+	if err := GetMigrationInfo(cntx, Migrate); err == nil {
 		if Migrate.Status == MigrationInProgress {
 			isUpgradeComplete = false
 			return
@@ -662,25 +662,25 @@
 
 // ReadAllFromDb : If we are restarted, learn from the database the current execution
 // stage
-func (va *VoltApplication) ReadAllFromDb() {
+func (va *VoltApplication) ReadAllFromDb(cntx context.Context) {
 	logger.Info(ctx, "Reading the meters from DB")
-	va.RestoreMetersFromDb()
+	va.RestoreMetersFromDb(cntx)
 	logger.Info(ctx, "Reading the VNETs from DB")
-	va.RestoreVnetsFromDb()
+	va.RestoreVnetsFromDb(cntx)
 	logger.Info(ctx, "Reading the VPVs from DB")
-	va.RestoreVpvsFromDb()
+	va.RestoreVpvsFromDb(cntx)
 	logger.Info(ctx, "Reading the Services from DB")
-	va.RestoreSvcsFromDb()
+	va.RestoreSvcsFromDb(cntx)
 	logger.Info(ctx, "Reading the MVLANs from DB")
-	va.RestoreMvlansFromDb()
+	va.RestoreMvlansFromDb(cntx)
 	logger.Info(ctx, "Reading the IGMP profiles from DB")
-	va.RestoreIGMPProfilesFromDb()
+	va.RestoreIGMPProfilesFromDb(cntx)
 	logger.Info(ctx, "Reading the Mcast configs from DB")
-	va.RestoreMcastConfigsFromDb()
+	va.RestoreMcastConfigsFromDb(cntx)
 	logger.Info(ctx, "Reading the IGMP groups for DB")
-	va.RestoreIgmpGroupsFromDb()
+	va.RestoreIgmpGroupsFromDb(cntx)
 	logger.Info(ctx, "Reading Upgrade status from DB")
-	va.RestoreUpgradeStatus()
+	va.RestoreUpgradeStatus(cntx)
 	logger.Info(ctx, "Reconciled from DB")
 }
 
@@ -723,7 +723,7 @@
 // a single NNI port per OLT. This is true whether the network uses any
 // protection mechanism (LAG, ERPS, etc.). The aggregate of the such protection
 // is represented by a single NNI port
-func (va *VoltApplication) AddDevice(device string, slno, southBoundID string) {
+func (va *VoltApplication) AddDevice(cntx context.Context, device string, slno, southBoundID string) {
 	logger.Warnw(ctx, "Received Device Ind: Add", log.Fields{"Device": device, "SrNo": slno})
 	if _, ok := va.DevicesDisc.Load(device); ok {
 		logger.Warnw(ctx, "Device Exists", log.Fields{"Device": device})
@@ -742,7 +742,7 @@
 		nbDevice.(*NbDevice).PonPorts.Range(addPort)
 	} else {
 		// Check if NbPort exists in DB. VGC restart case.
-		nbd := va.RestoreNbDeviceFromDb(southBoundID)
+		nbd := va.RestoreNbDeviceFromDb(cntx, southBoundID)
 		nbd.PonPorts.Range(addPort)
 	}
 	va.DevicesDisc.Store(device, d)
@@ -757,16 +757,16 @@
 }
 
 // DelDevice to delete a device.
-func (va *VoltApplication) DelDevice(device string) {
+func (va *VoltApplication) DelDevice(cntx context.Context, device string) {
 	logger.Warnw(ctx, "Received Device Ind: Delete", log.Fields{"Device": device})
 	if vdIntf, ok := va.DevicesDisc.Load(device); ok {
 		vd := vdIntf.(*VoltDevice)
 		va.DevicesDisc.Delete(device)
-		_ = db.DelAllRoutesForDevice(device)
-		va.HandleFlowClearFlag(device, vd.SerialNum, vd.SouthBoundID)
-		_ = db.DelAllGroup(device)
-		_ = db.DelAllMeter(device)
-		_ = db.DelAllPorts(device)
+		_ = db.DelAllRoutesForDevice(cntx, device)
+		va.HandleFlowClearFlag(cntx, device, vd.SerialNum, vd.SouthBoundID)
+		_ = db.DelAllGroup(cntx, device)
+		_ = db.DelAllMeter(cntx, device)
+		_ = db.DelAllPorts(cntx, device)
 		logger.Debugw(ctx, "Device deleted", log.Fields{"Device": device})
 	} else {
 		logger.Warnw(ctx, "Device Doesn't Exist", log.Fields{"Device": device})
@@ -788,7 +788,7 @@
 // PortAddInd : This is a PORT add indication coming from the VPAgent, which is essentially
 // a request coming from VOLTHA. The device and identity of the port is provided
 // in this request. Add them to the application for further use
-func (va *VoltApplication) PortAddInd(device string, id uint32, portName string) {
+func (va *VoltApplication) PortAddInd(cntx context.Context, device string, id uint32, portName string) {
 	logger.Infow(ctx, "Received Port Ind: Add", log.Fields{"Device": device, "Port": portName})
 	va.portLock.Lock()
 	if d := va.GetDevice(device); d != nil {
@@ -797,7 +797,7 @@
 		va.portLock.Unlock()
 		nni, _ := va.GetNniPort(device)
 		if nni == portName {
-			d.pushFlowsForUnis()
+			d.pushFlowsForUnis(cntx)
 		}
 	} else {
 		va.portLock.Unlock()
@@ -807,13 +807,13 @@
 
 // PortDelInd : Only the NNI ports are recorded in the device for now. When port delete
 // arrives, only the NNI ports need adjustments.
-func (va *VoltApplication) PortDelInd(device string, port string) {
+func (va *VoltApplication) PortDelInd(cntx context.Context, device string, port string) {
 	logger.Infow(ctx, "Received Port Ind: Delete", log.Fields{"Device": device, "Port": port})
 	if d := va.GetDevice(device); d != nil {
 		p := d.GetPort(port)
 		if p != nil && p.State == PortStateUp {
 			logger.Infow(ctx, "Port state is UP. Trigerring Port Down Ind before deleting", log.Fields{"Port": p})
-			va.PortDownInd(device, port)
+			va.PortDownInd(cntx, device, port)
 		}
 		va.portLock.Lock()
 		defer va.portLock.Unlock()
@@ -840,7 +840,7 @@
 }
 
 // AddNbPonPort Add pon port to nbDevice
-func (va *VoltApplication) AddNbPonPort(oltSbID string, portID, maxAllowedChannels uint32,
+func (va *VoltApplication) AddNbPonPort(cntx context.Context, oltSbID string, portID, maxAllowedChannels uint32,
 	enableMulticastKPI bool, portAlarmProfileID string) error {
 
 	var nbd *NbDevice
@@ -852,7 +852,7 @@
 	} else {
 		nbd = nbDevice.(*NbDevice)
 	}
-	port := nbd.AddPortToNbDevice(portID, maxAllowedChannels, enableMulticastKPI, portAlarmProfileID)
+	port := nbd.AddPortToNbDevice(cntx, portID, maxAllowedChannels, enableMulticastKPI, portAlarmProfileID)
 
 	// Add this port to voltDevice
 	addPort := func(key, value interface{}) bool {
@@ -872,7 +872,7 @@
 }
 
 // UpdateNbPonPort update pon port to nbDevice
-func (va *VoltApplication) UpdateNbPonPort(oltSbID string, portID, maxAllowedChannels uint32, enableMulticastKPI bool, portAlarmProfileID string) error {
+func (va *VoltApplication) UpdateNbPonPort(cntx context.Context, oltSbID string, portID, maxAllowedChannels uint32, enableMulticastKPI bool, portAlarmProfileID string) error {
 
 	var nbd *NbDevice
 	nbDevice, ok := va.NbDevice.Load(oltSbID)
@@ -883,7 +883,7 @@
 	}
 	nbd = nbDevice.(*NbDevice)
 
-	port := nbd.UpdatePortToNbDevice(portID, maxAllowedChannels, enableMulticastKPI, portAlarmProfileID)
+	port := nbd.UpdatePortToNbDevice(cntx, portID, maxAllowedChannels, enableMulticastKPI, portAlarmProfileID)
 	if port == nil {
 		return fmt.Errorf("Port-doesn't-exists-%v", portID)
 	}
@@ -913,10 +913,10 @@
 }
 
 // DeleteNbPonPort Delete pon port to nbDevice
-func (va *VoltApplication) DeleteNbPonPort(oltSbID string, portID uint32) error {
+func (va *VoltApplication) DeleteNbPonPort(cntx context.Context, oltSbID string, portID uint32) error {
 	nbDevice, ok := va.NbDevice.Load(oltSbID)
 	if ok {
-		nbDevice.(*NbDevice).DeletePortFromNbDevice(portID)
+		nbDevice.(*NbDevice).DeletePortFromNbDevice(cntx, portID)
 		va.NbDevice.Store(oltSbID, nbDevice.(*NbDevice))
 	} else {
 		logger.Warnw(ctx, "Delete pon received for unknown device", log.Fields{"oltSbID": oltSbID})
@@ -954,19 +954,19 @@
 }
 
 // NniDownInd process for Nni down indication.
-func (va *VoltApplication) NniDownInd(deviceID string, devSrNo string) {
+func (va *VoltApplication) NniDownInd(cntx context.Context, deviceID string, devSrNo string) {
 
 	logger.Debugw(ctx, "NNI Down Ind", log.Fields{"device": devSrNo})
 
 	handleIgmpDsFlows := func(key interface{}, value interface{}) bool {
 		mvProfile := value.(*MvlanProfile)
-		mvProfile.removeIgmpMcastFlows(devSrNo)
+		mvProfile.removeIgmpMcastFlows(cntx, devSrNo)
 		return true
 	}
 	va.MvlanProfilesByName.Range(handleIgmpDsFlows)
 
 	//Clear Static Group
-	va.ReceiverDownInd(deviceID, StaticPort)
+	va.ReceiverDownInd(cntx, deviceID, StaticPort)
 }
 
 // DeviceUpInd changes device state to up.
@@ -990,7 +990,7 @@
 }
 
 // DeviceRebootInd process for handling flow clear flag for device reboot
-func (va *VoltApplication) DeviceRebootInd(device string, serialNum string, southBoundID string) {
+func (va *VoltApplication) DeviceRebootInd(cntx context.Context, device string, serialNum string, southBoundID string) {
 	logger.Warnw(ctx, "Received Device Ind: Reboot", log.Fields{"Device": device, "SerialNumber": serialNum})
 
 	if d := va.GetDevice(device); d != nil {
@@ -1000,12 +1000,12 @@
 		}
 		d.State = controller.DeviceStateREBOOTED
 	}
-	va.HandleFlowClearFlag(device, serialNum, southBoundID)
+	va.HandleFlowClearFlag(cntx, device, serialNum, southBoundID)
 
 }
 
 // DeviceDisableInd handles device deactivation process
-func (va *VoltApplication) DeviceDisableInd(device string) {
+func (va *VoltApplication) DeviceDisableInd(cntx context.Context, device string) {
 	logger.Warnw(ctx, "Received Device Ind: Disable", log.Fields{"Device": device})
 
 	d := va.GetDevice(device)
@@ -1015,11 +1015,11 @@
 	}
 
 	d.State = controller.DeviceStateDISABLED
-	va.HandleFlowClearFlag(device, d.SerialNum, d.SouthBoundID)
+	va.HandleFlowClearFlag(cntx, device, d.SerialNum, d.SouthBoundID)
 }
 
 // ProcessIgmpDSFlowForMvlan for processing Igmp DS flow for device
-func (va *VoltApplication) ProcessIgmpDSFlowForMvlan(d *VoltDevice, mvp *MvlanProfile, addFlow bool) {
+func (va *VoltApplication) ProcessIgmpDSFlowForMvlan(cntx context.Context, d *VoltDevice, mvp *MvlanProfile, addFlow bool) {
 
 	logger.Debugw(ctx, "Process IGMP DS Flows for MVlan", log.Fields{"device": d.Name, "Mvlan": mvp.Mvlan, "addFlow": addFlow})
 	portState := false
@@ -1030,20 +1030,20 @@
 
 	if addFlow {
 		if portState {
-			mvp.pushIgmpMcastFlows(d.SerialNum)
+			mvp.pushIgmpMcastFlows(cntx, d.SerialNum)
 		}
 	} else {
-		mvp.removeIgmpMcastFlows(d.SerialNum)
+		mvp.removeIgmpMcastFlows(cntx, d.SerialNum)
 	}
 }
 
 // ProcessIgmpDSFlowForDevice for processing Igmp DS flow for device
-func (va *VoltApplication) ProcessIgmpDSFlowForDevice(d *VoltDevice, addFlow bool) {
+func (va *VoltApplication) ProcessIgmpDSFlowForDevice(cntx context.Context, d *VoltDevice, addFlow bool) {
 	logger.Debugw(ctx, "Process IGMP DS Flows for device", log.Fields{"device": d.Name, "addFlow": addFlow})
 
 	handleIgmpDsFlows := func(key interface{}, value interface{}) bool {
 		mvProfile := value.(*MvlanProfile)
-		va.ProcessIgmpDSFlowForMvlan(d, mvProfile, addFlow)
+		va.ProcessIgmpDSFlowForMvlan(cntx, d, mvProfile, addFlow)
 		return true
 	}
 	va.MvlanProfilesByName.Range(handleIgmpDsFlows)
@@ -1166,13 +1166,13 @@
 // device - Device Obj
 // vnet - vnet profile name
 // enabled - vlan enabled/disabled - based on the status, the flow shall be added/removed
-func (va *VoltApplication) ProcessDevFlowForDevice(device *VoltDevice, vnet *VoltVnet, enabled bool) {
+func (va *VoltApplication) ProcessDevFlowForDevice(cntx context.Context, device *VoltDevice, vnet *VoltVnet, enabled bool) {
 	_, applied := device.ConfiguredVlanForDeviceFlows.Get(VnetKey(vnet.SVlan, vnet.CVlan, 0))
 	if enabled {
-		va.PushDevFlowForVlan(vnet)
+		va.PushDevFlowForVlan(cntx, vnet)
 	} else if !enabled && applied {
 		//va.DeleteDevFlowForVlan(vnet)
-		va.DeleteDevFlowForVlanFromDevice(vnet, device.SerialNum)
+		va.DeleteDevFlowForVlanFromDevice(cntx, vnet, device.SerialNum)
 	}
 }
 
@@ -1212,7 +1212,7 @@
 // Port UP indication is passed to all services associated with the port
 // so that the services can configure flows applicable when the port goes
 // up from down state
-func (va *VoltApplication) PortUpInd(device string, port string) {
+func (va *VoltApplication) PortUpInd(cntx context.Context, device string, port string) {
 	d := va.GetDevice(device)
 
 	if d == nil {
@@ -1264,9 +1264,9 @@
 		for _, vpv := range vpvs.([]*VoltPortVnet) {
 			vpv.VpvLock.Lock()
 			logger.Warnw(ctx, "Removing existing VPVs/Services flows for for Subscriber: UNI Detected on wrong PON", log.Fields{"Port": vpv.Port, "Vnet": vpv.VnetName})
-			vpv.PortDownInd(device, port)
+			vpv.PortDownInd(cntx, device, port)
 			if vpv.IgmpEnabled {
-				va.ReceiverDownInd(device, port)
+				va.ReceiverDownInd(cntx, device, port)
 			}
 			vpv.VpvLock.Unlock()
 		}
@@ -1288,7 +1288,7 @@
 		// part of service delete (during the lock wait duration)
 		// In that case, the services associated wil be zero
 		if vpv.servicesCount.Load() != 0 {
-			vpv.PortUpInd(d, port)
+			vpv.PortUpInd(cntx, d, port)
 		}
 		vpv.VpvLock.Unlock()
 	}
@@ -1342,7 +1342,7 @@
 
 // PortDownInd : Port down indication is passed on to the services so that the services
 // can make changes at this transition.
-func (va *VoltApplication) PortDownInd(device string, port string) {
+func (va *VoltApplication) PortDownInd(cntx context.Context, device string, port string) {
 	logger.Infow(ctx, "Received SouthBound Port Ind: DOWN", log.Fields{"Device": device, "Port": port})
 	d := va.GetDevice(device)
 
@@ -1371,9 +1371,9 @@
 
 	if p.Type == VoltPortTypeNni {
 		logger.Warnw(ctx, "Received NNI Port Ind: DOWN", log.Fields{"Device": device, "Port": port})
-		va.DeleteDevFlowForDevice(d)
-		va.NniDownInd(device, d.SerialNum)
-		va.RemovePendingGroups(device, true)
+		va.DeleteDevFlowForDevice(cntx, d)
+		va.NniDownInd(cntx, device, d.SerialNum)
+		va.RemovePendingGroups(cntx, device, true)
 	}
 	vpvs, ok := va.VnetsByPort.Load(port)
 	if !ok || nil == vpvs || len(vpvs.([]*VoltPortVnet)) == 0 {
@@ -1390,9 +1390,9 @@
 */
 	for _, vpv := range vpvs.([]*VoltPortVnet) {
 		vpv.VpvLock.Lock()
-		vpv.PortDownInd(device, port)
+		vpv.PortDownInd(cntx, device, port)
 		if vpv.IgmpEnabled {
-			va.ReceiverDownInd(device, port)
+			va.ReceiverDownInd(cntx, device, port)
 		}
 		vpv.VpvLock.Unlock()
 	}
@@ -1406,7 +1406,7 @@
 // packet is decoded and the right processor is called. Currently, we
 // plan to support only DHCP and IGMP. In future, we can add more
 // capabilities as needed
-func (va *VoltApplication) PacketInInd(device string, port string, pkt []byte) {
+func (va *VoltApplication) PacketInInd(cntx context.Context, device string, port string, pkt []byte) {
 	// Decode the incoming packet
 	packetSide := US
 	if strings.Contains(port, NNI) {
@@ -1440,7 +1440,7 @@
 	arpl := gopkt.Layer(layers.LayerTypeARP)
 	if arpl != nil {
 		if callBack, ok := PacketHandlers[ARP]; ok {
-			callBack(device, port, gopkt)
+			callBack(cntx, device, port, gopkt)
 		} else {
 			logger.Debugw(ctx, "ARP handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 		}
@@ -1455,7 +1455,7 @@
 			dhcpl := gopkt.Layer(layers.LayerTypeDHCPv4)
 			if dhcpl != nil {
 				if callBack, ok := PacketHandlers[DHCPv4]; ok {
-					callBack(device, port, gopkt)
+					callBack(cntx, device, port, gopkt)
 				} else {
 					logger.Debugw(ctx, "DHCPv4 handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 				}
@@ -1463,7 +1463,7 @@
 		} else if ip.Protocol == layers.IPProtocolIGMP {
 			logger.Debugw(ctx, "Received Southbound IGMP packet in", log.Fields{"StreamSide": packetSide})
 			if callBack, ok := PacketHandlers[IGMP]; ok {
-				callBack(device, port, gopkt)
+				callBack(cntx, device, port, gopkt)
 			} else {
 				logger.Debugw(ctx, "IGMP handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 			}
@@ -1478,7 +1478,7 @@
 			dhcpl := gopkt.Layer(layers.LayerTypeDHCPv6)
 			if dhcpl != nil {
 				if callBack, ok := PacketHandlers[DHCPv6]; ok {
-					callBack(device, port, gopkt)
+					callBack(cntx, device, port, gopkt)
 				} else {
 					logger.Debugw(ctx, "DHCPv6 handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 				}
@@ -1491,7 +1491,7 @@
 	if pppoel != nil {
 		logger.Debugw(ctx, "Received Southbound PPPoE packet in", log.Fields{"StreamSide": packetSide})
 		if callBack, ok := PacketHandlers[PPPOE]; ok {
-			callBack(device, port, gopkt)
+			callBack(cntx, device, port, gopkt)
 		} else {
 			logger.Debugw(ctx, "PPPoE handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 		}
@@ -1528,7 +1528,7 @@
 }
 
 // HandleFlowClearFlag to handle flow clear flag during reboot
-func (va *VoltApplication) HandleFlowClearFlag(deviceID string, serialNum, southBoundID string) {
+func (va *VoltApplication) HandleFlowClearFlag(cntx context.Context, deviceID string, serialNum, southBoundID string) {
 	logger.Warnw(ctx, "Clear All flags for Device", log.Fields{"Device": deviceID, "SerialNum": serialNum, "SBID": southBoundID})
 	dev, ok := va.DevicesDisc.Load(deviceID)
 	if ok && dev != nil {
@@ -1557,13 +1557,13 @@
 				logger.Infow(ctx, "Clear Flags for vpv",
 					log.Fields{"device": vpv.Device, "port": vpv.Port,
 						"svlan": vpv.SVlan, "cvlan": vpv.CVlan, "univlan": vpv.UniVlan})
-				vpv.ClearAllServiceFlags()
-				vpv.ClearAllVpvFlags()
+				vpv.ClearAllServiceFlags(cntx)
+				vpv.ClearAllVpvFlags(cntx)
 
 				if vpv.IgmpEnabled {
-					va.ReceiverDownInd(vpv.Device, vpv.Port)
+					va.ReceiverDownInd(cntx, vpv.Device, vpv.Port)
 					//Also clear service igmp stats
-					vpv.ClearServiceCounters()
+					vpv.ClearServiceCounters(cntx)
 				}
 			}
 		}
@@ -1572,12 +1572,12 @@
 	va.VnetsByPort.Range(getVpvs)
 
 	//Clear Static Group
-	va.ReceiverDownInd(deviceID, StaticPort)
+	va.ReceiverDownInd(cntx, deviceID, StaticPort)
 
 	logger.Warnw(ctx, "All flags cleared for device", log.Fields{"Device": deviceID})
 
 	//Reset pending group pool
-	va.RemovePendingGroups(deviceID, true)
+	va.RemovePendingGroups(cntx, deviceID, true)
 
 	//Process all Migrate Service Request - force udpate all profiles since resources are already cleaned up
 	if dev != nil {
@@ -1585,7 +1585,7 @@
 			msrList := value.(*util.ConcurrentMap)
 			forceUpdateServices := func(key, value interface{}) bool {
 				msr := value.(*MigrateServicesRequest)
-				forceUpdateAllServices(msr)
+				forceUpdateAllServices(cntx, msr)
 				return true
 			}
 			msrList.Range(forceUpdateServices)
@@ -1593,7 +1593,7 @@
 		}
 		dev.(*VoltDevice).MigratingServices.Range(triggerForceUpdate)
 	} else {
-		va.FetchAndProcessAllMigrateServicesReq(deviceID, forceUpdateAllServices)
+		va.FetchAndProcessAllMigrateServicesReq(cntx, deviceID, forceUpdateAllServices)
 	}
 }
 
@@ -1604,7 +1604,7 @@
 }
 
 //ProcessFlowModResultIndication - Processes Flow mod operation indications from controller
-func (va *VoltApplication) ProcessFlowModResultIndication(flowStatus intf.FlowStatus) {
+func (va *VoltApplication) ProcessFlowModResultIndication(cntx context.Context, flowStatus intf.FlowStatus) {
 
 	d := va.GetDevice(flowStatus.Device)
 	if d == nil {
@@ -1612,7 +1612,7 @@
 		return
 	}
 
-	cookieExists := ExecuteFlowEvent(d, flowStatus.Cookie, flowStatus)
+	cookieExists := ExecuteFlowEvent(cntx, d, flowStatus.Cookie, flowStatus)
 
 	if flowStatus.Flow != nil {
 		flowAdd := (flowStatus.FlowModType == of.CommandAdd)
@@ -1670,12 +1670,12 @@
 }
 
 //UpdateMvlanProfilesForDevice to update mvlan profile for device
-func (va *VoltApplication) UpdateMvlanProfilesForDevice(device string) {
+func (va *VoltApplication) UpdateMvlanProfilesForDevice(cntx context.Context, device string) {
 
 	checkAndAddMvlanUpdateTask := func(key, value interface{}) bool {
 		mvp := value.(*MvlanProfile)
 		if mvp.IsUpdateInProgressForDevice(device) {
-			mvp.UpdateProfile(device)
+			mvp.UpdateProfile(cntx, device)
 		}
 		return true
 	}
@@ -1867,26 +1867,26 @@
 }
 
 //RemoveGroupsFromPendingPool - removes the group from global pending group pool
-func (va *VoltApplication) RemoveGroupsFromPendingPool(device string, mvlan of.VlanType) {
+func (va *VoltApplication) RemoveGroupsFromPendingPool(cntx context.Context, device string, mvlan of.VlanType) {
 	GetApplication().PendingPoolLock.Lock()
 	defer GetApplication().PendingPoolLock.Unlock()
 
 	logger.Infow(ctx, "Removing IgmpGroups from Global Pending Pool for given Deivce & Mvlan", log.Fields{"Device": device, "Mvlan": mvlan.String()})
 
 	key := getPendingPoolKey(mvlan, device)
-	va.RemoveGroupListFromPendingPool(key)
+	va.RemoveGroupListFromPendingPool(cntx, key)
 }
 
 //RemoveGroupListFromPendingPool - removes the groups for provided key
 // 1. Deletes the group from device
 // 2. Delete the IgmpGroup obj and release the group ID to pool
 // Note: Make sure to obtain PendingPoolLock lock before calling this func
-func (va *VoltApplication) RemoveGroupListFromPendingPool(key string) {
+func (va *VoltApplication) RemoveGroupListFromPendingPool(cntx context.Context, key string) {
 	if grpMap, ok := va.IgmpPendingPool[key]; ok {
 		delete(va.IgmpPendingPool, key)
 		for ig := range grpMap {
 			for device := range ig.Devices {
-				ig.DeleteIgmpGroupDevice(device)
+				ig.DeleteIgmpGroupDevice(cntx, device)
 			}
 		}
 	}
@@ -1942,7 +1942,7 @@
 // reference - mvlan/device ID
 // isRefDevice - true  - Device as reference
 //               false - Mvlan as reference
-func (va *VoltApplication) RemovePendingGroups(reference string, isRefDevice bool) {
+func (va *VoltApplication) RemovePendingGroups(cntx context.Context, reference string, isRefDevice bool) {
 	va.PendingPoolLock.Lock()
 	defer va.PendingPoolLock.Unlock()
 
@@ -1960,7 +1960,7 @@
 	for key := range va.IgmpPendingPool {
 		keyParams := strings.Split(key, "_")
 		if keyParams[paramPosition] == reference {
-			va.RemoveGroupListFromPendingPool(key)
+			va.RemoveGroupListFromPendingPool(cntx, key)
 		}
 	}
 }
@@ -1969,26 +1969,26 @@
 	return mvlan.String() + "_" + device
 }
 
-func (va *VoltApplication) removeExpiredGroups() {
+func (va *VoltApplication) removeExpiredGroups(cntx context.Context) {
 	logger.Debug(ctx, "Check for expired Igmp Groups")
 	removeExpiredGroups := func(key interface{}, value interface{}) bool {
 		ig := value.(*IgmpGroup)
-		ig.removeExpiredGroupFromDevice()
+		ig.removeExpiredGroupFromDevice(cntx)
 		return true
 	}
 	va.IgmpGroups.Range(removeExpiredGroups)
 }
 
 //TriggerPendingProfileDeleteReq - trigger pending profile delete request
-func (va *VoltApplication) TriggerPendingProfileDeleteReq(device string) {
-	va.TriggerPendingServiceDeleteReq(device)
-	va.TriggerPendingVpvDeleteReq(device)
-	va.TriggerPendingVnetDeleteReq(device)
+func (va *VoltApplication) TriggerPendingProfileDeleteReq(cntx context.Context, device string) {
+	va.TriggerPendingServiceDeleteReq(cntx, device)
+	va.TriggerPendingVpvDeleteReq(cntx, device)
+	va.TriggerPendingVnetDeleteReq(cntx, device)
 	logger.Warnw(ctx, "All Pending Profile Delete triggered for device", log.Fields{"Device": device})
 }
 
 //TriggerPendingServiceDeleteReq - trigger pending service delete request
-func (va *VoltApplication) TriggerPendingServiceDeleteReq(device string) {
+func (va *VoltApplication) TriggerPendingServiceDeleteReq(cntx context.Context, device string) {
 
 	logger.Warnw(ctx, "Pending Services to be deleted", log.Fields{"Count": len(va.ServicesToDelete)})
 	for serviceName := range va.ServicesToDelete {
@@ -1996,9 +1996,9 @@
 		if vs := va.GetService(serviceName); vs != nil {
 			if vs.Device == device {
 				logger.Warnw(ctx, "Triggering Pending Service delete", log.Fields{"Service": vs.Name})
-				vs.DelHsiaFlows()
+				vs.DelHsiaFlows(cntx)
 				if vs.ForceDelete {
-					vs.DelFromDb()
+					vs.DelFromDb(cntx)
 					/*
 					portState := msgbus.PortDown
 					if d, err := va.GetDeviceFromPort(vs.Port); d != nil {
@@ -2027,19 +2027,19 @@
 }
 
 //TriggerPendingVpvDeleteReq - trigger pending VPV delete request
-func (va *VoltApplication) TriggerPendingVpvDeleteReq(device string) {
+func (va *VoltApplication) TriggerPendingVpvDeleteReq(cntx context.Context, device string) {
 
 	logger.Warnw(ctx, "Pending VPVs to be deleted", log.Fields{"Count": len(va.VoltPortVnetsToDelete)})
 	for vpv := range va.VoltPortVnetsToDelete {
 		if vpv.Device == device {
 			logger.Warnw(ctx, "Triggering Pending VPv flow delete", log.Fields{"Port": vpv.Port, "Device": vpv.Device, "Vnet": vpv.VnetName})
-			va.DelVnetFromPort(vpv.Port, vpv)
+			va.DelVnetFromPort(cntx, vpv.Port, vpv)
 		}
 	}
 }
 
 //TriggerPendingVnetDeleteReq - trigger pending vnet delete request
-func (va *VoltApplication) TriggerPendingVnetDeleteReq(device string) {
+func (va *VoltApplication) TriggerPendingVnetDeleteReq(cntx context.Context, device string) {
 
 	logger.Warnw(ctx, "Pending Vnets to be deleted", log.Fields{"Count": len(va.VnetsToDelete)})
 	for vnetName := range va.VnetsToDelete {
@@ -2047,7 +2047,7 @@
 			vnet := vnetIntf.(*VoltVnet)
 			logger.Warnw(ctx, "Triggering Pending Vnet flows delete", log.Fields{"Vnet": vnet.Name})
 			if d := va.GetDeviceBySerialNo(vnet.PendingDeviceToDelete); d != nil && d.SerialNum == vnet.PendingDeviceToDelete {
-				va.DeleteDevFlowForVlanFromDevice(vnet, vnet.PendingDeviceToDelete)
+				va.DeleteDevFlowForVlanFromDevice(cntx, vnet, vnet.PendingDeviceToDelete)
 				va.deleteVnetConfig(vnet)
 			} else {
 				logger.Warnw(ctx, "Vnet Delete Failed : Device Not Found", log.Fields{"Vnet": vnet.Name, "Device": vnet.PendingDeviceToDelete})
diff --git a/internal/pkg/application/dhcprelay.go b/internal/pkg/application/dhcprelay.go
index c57771c..b779f1f 100644
--- a/internal/pkg/application/dhcprelay.go
+++ b/internal/pkg/application/dhcprelay.go
@@ -17,6 +17,7 @@
 
 import (
 	"encoding/hex"
+	"context"
 	"errors"
 	"net"
 	"sync"
@@ -93,9 +94,9 @@
 	GetDhcpv6State() Dhcpv6RelayState
 	SetDhcpState(DhcpRelayState)
 	SetDhcpv6State(Dhcpv6RelayState)
-	SetMacAddr(net.HardwareAddr)
-	DhcpResultInd(*layers.DHCPv4)
-	Dhcpv6ResultInd(ipv6Addr net.IP, leaseTime uint32)
+	SetMacAddr(context.Context, net.HardwareAddr)
+	DhcpResultInd(context.Context, *layers.DHCPv4)
+	Dhcpv6ResultInd(cntx context.Context, ipv6Addr net.IP, leaseTime uint32)
 }
 
 // DhcpRelayVnet : The DHCP relay sessions are stored in a map to be retrieved from when
@@ -547,7 +548,7 @@
 // session is derived from the list of DHCP sessions stored in the
 // common map. The key for retrieval includes the VLAN tags in the
 // the packet and the MAC address of the client.
-func (va *VoltApplication) ProcessDsDhcpv4Packet(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessDsDhcpv4Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 
 	// Retrieve the layers to build the outgoing packet. It is not
 	// possible to add/remove layers to the existing packet and thus
@@ -600,9 +601,9 @@
 					// flow installation request, VGC to update US HSIA flow with leanrt MAC.
 					// separate go rotuine is spawned to avoid drop of ACK packet
 					// as HSIA flows will be deleted if new MAC is learnt.
-					go vpv.SetMacAddr(dhcp4.ClientHWAddr)
+					go vpv.SetMacAddr(cntx, dhcp4.ClientHWAddr)
 				}
-				vpv.DhcpResultInd(dhcp4)
+				vpv.DhcpResultInd(cntx, dhcp4)
 
 			}
 			raiseDHCPv4Indication(msgType, vpv, dhcp4.ClientHWAddr, ipAddr, dsPbit, device, leaseTime)
@@ -761,7 +762,7 @@
 
 // ProcessUsDhcpv4Packet : The US DHCPv4 packet is identified the DHCP OP in the packet. A request is considered upstream
 // and the service associated with the packet is located by the port and VLANs in the packet
-func (va *VoltApplication) ProcessUsDhcpv4Packet(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessUsDhcpv4Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// We received the packet on an access port and the service for the packet can be
 	// gotten from the port and the packet
 	vpv, svc := va.GetVnetFromPkt(device, port, pkt)
@@ -819,7 +820,7 @@
 				if NonZeroMacAddress(vpv.MacAddr) && vpv.MacLearning == Learn {
 					// update learnt mac for debug purpose
 					vpv.LearntMacAddr = dhcp4.ClientHWAddr
-					vpv.WriteToDb()
+					vpv.WriteToDb(cntx)
 					logger.Warnw(ctx, "Dropping the packet Mac relearn is disabled",
 						log.Fields{"vpv.MacAddr": vpv.MacAddr, "LearntMac": dhcp4.ClientHWAddr})
 					return
@@ -923,13 +924,13 @@
 }
 
 // ProcessUDP4Packet : CallBack function registered with application to handle DHCP packetIn
-func ProcessUDP4Packet(device string, port string, pkt gopacket.Packet) {
-	GetApplication().ProcessUDP4Packet(device, port, pkt)
+func ProcessUDP4Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
+	GetApplication().ProcessUDP4Packet(cntx, device, port, pkt)
 }
 
 // ProcessUDP4Packet : The packet is a UDP packet and currently only DHCP relay application is supported
 // We determine the packet direction and process it based on the direction
-func (va *VoltApplication) ProcessUDP4Packet(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessUDP4Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// Currently DHCP is the only application supported by the application
 	// We check for DHCP before proceeding futher. In future, this could be
 	// based on registration and the callbacks
@@ -943,17 +944,17 @@
 		// This is treated as an upstream packet in the VOLT application
 		// as VOLT serves access subscribers who use DHCP to acquire IP
 		// address and these packets go upstream to the network
-		va.ProcessUsDhcpv4Packet(device, port, pkt)
+		va.ProcessUsDhcpv4Packet(cntx, device, port, pkt)
 	} else {
 		// This is a downstream packet
-		va.ProcessDsDhcpv4Packet(device, port, pkt)
+		va.ProcessDsDhcpv4Packet(cntx, device, port, pkt)
 	}
 
 }
 
 // ProcessUDP6Packet : CallBack function registered with application to handle DHCPv6 packetIn
-func ProcessUDP6Packet(device string, port string, pkt gopacket.Packet) {
-	GetApplication().ProcessUDP6Packet(device, port, pkt)
+func ProcessUDP6Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
+	GetApplication().ProcessUDP6Packet(cntx, device, port, pkt)
 }
 
 // ProcessUDP6Packet : As a LDRA node, we expect to see only RelayReply from the DHCP server and we always
@@ -962,7 +963,7 @@
 // we should also see Renew. However, we should always pack the US message by adding
 // additional option that identifies to the server that the DHCP packet is forwarded
 // by an LDRA node.
-func (va *VoltApplication) ProcessUDP6Packet(device string, port string, pkt gopacket.Packet) []byte {
+func (va *VoltApplication) ProcessUDP6Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) []byte {
 	dhcpl := pkt.Layer(layers.LayerTypeDHCPv6)
 	if dhcpl == nil {
 		return nil
@@ -973,14 +974,14 @@
 	case layers.DHCPv6MsgTypeSolicit, layers.DHCPv6MsgTypeRequest, layers.DHCPv6MsgTypeRenew,
 		layers.DHCPv6MsgTypeRelease, layers.DHCPv6MsgTypeRebind, layers.DHCPv6MsgTypeInformationRequest,
 		layers.DHCPv6MsgTypeDecline:
-		va.ProcessUsDhcpv6Packet(device, port, pkt)
+		va.ProcessUsDhcpv6Packet(cntx, device, port, pkt)
 	case layers.DHCPv6MsgTypeAdvertise, layers.DHCPv6MsgTypeConfirm, layers.DHCPv6MsgTypeReconfigure:
 		logger.Warnw(ctx, "SouthBound DHCPv6 DS Messages Expected For a Relay Agent", log.Fields{"Type": dhcpv6.MsgType})
 	case layers.DHCPv6MsgTypeRelayForward:
 		logger.Warn(ctx, "As the first DHCPv6 Relay Agent, Unexpected Relay Forward")
 	case layers.DHCPv6MsgTypeRelayReply:
 		// We received a response from the server
-		va.ProcessDsDhcpv6Packet(device, port, pkt)
+		va.ProcessDsDhcpv6Packet(cntx, device, port, pkt)
 	}
 	return nil
 }
@@ -1017,7 +1018,7 @@
 }
 
 // ProcessUsDhcpv6Packet to rpocess upstream DHCPv6 packet
-func (va *VoltApplication) ProcessUsDhcpv6Packet(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessUsDhcpv6Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// We received the packet on an access port and the service for the packet can be
 	// gotten from the port and the packet
 	logger.Infow(ctx, "Processing Southbound US DHCPv6 packet", log.Fields{"Port": port})
@@ -1092,7 +1093,7 @@
 				if NonZeroMacAddress(vpv.MacAddr) && vpv.MacLearning == Learn {
 					// update learnt mac for debug purpose
 					vpv.LearntMacAddr = sourceMac
-					vpv.WriteToDb()
+					vpv.WriteToDb(cntx)
 					logger.Warnw(ctx, "Dropping the packet Mac relearn is disabled",
 						log.Fields{"vpv.MacAddr": vpv.MacAddr, "LearntMac": sourceMac})
 					return
@@ -1191,7 +1192,7 @@
 }
 
 // ProcessDsDhcpv6Packet to process downstream dhcpv6 packet
-func (va *VoltApplication) ProcessDsDhcpv6Packet(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessDsDhcpv6Packet(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	logger.Infow(ctx, "Processing Southbound DS DHCPv6 packet", log.Fields{"Port": port})
 	logger.Debugw(ctx, "Packet IN", log.Fields{"Pkt": hex.EncodeToString(pkt.Data())})
 
@@ -1249,9 +1250,9 @@
 				// separate go rotuine is spawned to avoid drop of ACK packet
 				// as HSIA flows will be deleted if new MAC is learnt.
 				if len(vpvList) == 1 {
-					go vpv.SetMacAddr(clientMac)
+					go vpv.SetMacAddr(cntx, clientMac)
 				}
-				vpv.Dhcpv6ResultInd(ipv6Addr, leaseTime)
+				vpv.Dhcpv6ResultInd(cntx, ipv6Addr, leaseTime)
 			}
 			raiseDHCPv6Indication(dhcp6.MsgType, vpv, clientMac, ipv6Addr, dsPbit, device, leaseTime)
 		}
diff --git a/internal/pkg/application/flowevent.go b/internal/pkg/application/flowevent.go
index f6f3584..fe37b74 100644
--- a/internal/pkg/application/flowevent.go
+++ b/internal/pkg/application/flowevent.go
@@ -16,6 +16,8 @@
 package application
 
 import (
+	"context"
+
 	infraerrorcode "voltha-go-controller/internal/pkg/errorcodes/service"
 
 	"voltha-go-controller/internal/pkg/intf"
@@ -29,7 +31,7 @@
 type FlowEventType string
 
 //FlowEventHandler - Func prototype for flow event handling funcs
-type FlowEventHandler func(*FlowEvent, intf.FlowStatus)
+type FlowEventHandler func(context.Context, *FlowEvent, intf.FlowStatus)
 
 var eventMapper map[FlowEventType]FlowEventHandler
 
@@ -74,7 +76,7 @@
 }
 
 //ExecuteFlowEvent - Process flow based event triggers
-func ExecuteFlowEvent(vd *VoltDevice, cookie string, flowStatus intf.FlowStatus) bool {
+func ExecuteFlowEvent(cntx context.Context, vd *VoltDevice, cookie string, flowStatus intf.FlowStatus) bool {
 	var event interface{}
 
 	flowEventMap, err := vd.GetFlowEventRegister(flowStatus.FlowModType)
@@ -92,12 +94,12 @@
 	flowEventMap.Remove(cookie)
 	flowEventMap.MapLock.Unlock()
 	flowEvent := event.(*FlowEvent)
-	eventMapper[flowEvent.eType](flowEvent, flowStatus)
+	eventMapper[flowEvent.eType](cntx, flowEvent, flowStatus)
 	return true
 }
 
 //ProcessUsIgmpFlowAddEvent - Process Us Igmp Flow event trigger
-func ProcessUsIgmpFlowAddEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessUsIgmpFlowAddEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Add Event for US Igmp", log.Fields{"Cookie": event.cookie, "event": event})
 	vpv := event.eventData.(*VoltPortVnet)
@@ -109,19 +111,19 @@
 }
 
 //ProcessServiceFlowAddEvent - Process Service Flow event trigger
-func ProcessServiceFlowAddEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessServiceFlowAddEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Add Event for Service", log.Fields{"Cookie": event.cookie, "event": event})
 	vs := event.eventData.(*VoltService)
 	if isFlowStatusSuccess(flowStatus.Status, true) {
-		vs.FlowInstallSuccess(event.cookie, flowStatus.AdditionalData)
+		vs.FlowInstallSuccess(cntx, event.cookie, flowStatus.AdditionalData)
 	} else {
 		vs.FlowInstallFailure(event.cookie, flowStatus.Status, flowStatus.Reason)
 	}
 }
 
 //ProcessControlFlowAddEvent - Process Control Flow event trigger
-func ProcessControlFlowAddEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessControlFlowAddEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Add Event for VPV", log.Fields{"Cookie": event.cookie, "event": event})
 	vpv := event.eventData.(*VoltPortVnet)
@@ -131,50 +133,50 @@
 }
 
 //ProcessServiceFlowDelEvent - Process Service Flow event trigger
-func ProcessServiceFlowDelEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessServiceFlowDelEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Remove Event for Service", log.Fields{"Cookie": event.cookie, "event": event})
 	vs := event.eventData.(*VoltService)
 	if isFlowStatusSuccess(flowStatus.Status, false) {
-		vs.FlowRemoveSuccess(event.cookie)
+		vs.FlowRemoveSuccess(cntx, event.cookie)
 	} else {
-		vs.FlowRemoveFailure(event.cookie, flowStatus.Status, flowStatus.Reason)
+		vs.FlowRemoveFailure(cntx, event.cookie, flowStatus.Status, flowStatus.Reason)
 	}
 }
 
 //ProcessControlFlowDelEvent - Process Control Flow event trigger
-func ProcessControlFlowDelEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessControlFlowDelEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Remove Event for VPV", log.Fields{"Cookie": event.cookie, "event": event})
 	vpv := event.eventData.(*VoltPortVnet)
 	if isFlowStatusSuccess(flowStatus.Status, false) {
-		vpv.FlowRemoveSuccess(event.cookie, event.device)
+		vpv.FlowRemoveSuccess(cntx, event.cookie, event.device)
 	} else {
-		vpv.FlowRemoveFailure(event.cookie, event.device, flowStatus.Status, flowStatus.Reason)
+		vpv.FlowRemoveFailure(cntx, event.cookie, event.device, flowStatus.Status, flowStatus.Reason)
 	}
 }
 
 //ProcessMcastFlowDelEvent - Process Control Flow event trigger
-func ProcessMcastFlowDelEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessMcastFlowDelEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Remove Event for Mcast/Igmp", log.Fields{"Cookie": event.cookie, "event": event})
 	mvp := event.eventData.(*MvlanProfile)
 	if isFlowStatusSuccess(flowStatus.Status, false) {
-		mvp.FlowRemoveSuccess(event.cookie, event.device)
+		mvp.FlowRemoveSuccess(cntx, event.cookie, event.device)
 	} else {
 		mvp.FlowRemoveFailure(event.cookie, event.device, flowStatus.Status, flowStatus.Reason)
 	}
 }
 
 //ProcessDeviceFlowDelEvent - Process Control Flow event trigger
-func ProcessDeviceFlowDelEvent(event *FlowEvent, flowStatus intf.FlowStatus) {
+func ProcessDeviceFlowDelEvent(cntx context.Context, event *FlowEvent, flowStatus intf.FlowStatus) {
 
 	logger.Infow(ctx, "Processing Post Flow Remove Event for VNET", log.Fields{"Cookie": event.cookie, "event": event})
 	vnet := event.eventData.(*VoltVnet)
 	if isFlowStatusSuccess(flowStatus.Status, false) {
-		vnet.FlowRemoveSuccess(event.cookie, event.device)
+		vnet.FlowRemoveSuccess(cntx, event.cookie, event.device)
 	} else {
-		vnet.FlowRemoveFailure(event.cookie, event.device, flowStatus.Status, flowStatus.Reason)
+		vnet.FlowRemoveFailure(cntx, event.cookie, event.device, flowStatus.Status, flowStatus.Reason)
 	}
 }
 
diff --git a/internal/pkg/application/igmp.go b/internal/pkg/application/igmp.go
index 32eed0d..2e49a41 100644
--- a/internal/pkg/application/igmp.go
+++ b/internal/pkg/application/igmp.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"errors"
 	"net"
@@ -106,7 +107,7 @@
 }
 
 // ProcessIgmpPacket : CallBack function registered with application to handle IGMP packetIn
-func ProcessIgmpPacket(device string, port string, pkt gopacket.Packet) {
+func ProcessIgmpPacket(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	GetApplication().IgmpPacketInd(device, port, pkt)
 }
 
@@ -420,7 +421,7 @@
 }
 
 //AddToPendingPool - adds Igmp Device obj to pending pool
-func AddToPendingPool(device string, groupKey string) bool {
+func AddToPendingPool(cntx context.Context, device string, groupKey string) bool {
 
 	logger.Infow(ctx, "Add Device to IgmpGroup Pending Pool", log.Fields{"Device": device, "GroupKey": groupKey})
 	if grp, ok := GetApplication().IgmpGroups.Load(groupKey); ok {
@@ -429,7 +430,7 @@
 		logger.Infow(ctx, "Adding Device to IgmpGroup Pending Pool", log.Fields{"Device": device, "GroupID": ig.GroupID, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String()})
 		ig.PendingGroupForDevice[device] = time.Now().Add(time.Duration(GroupExpiryTime) * time.Minute)
 		ig.PendingPoolLock.Unlock()
-		if err := ig.WriteToDb(); err != nil {
+		if err := ig.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 		}
 		return true
@@ -504,9 +505,9 @@
 }
 
 // RestoreIgmpGroupsFromDb to restore igmp groups from database
-func (va *VoltApplication) RestoreIgmpGroupsFromDb() {
+func (va *VoltApplication) RestoreIgmpGroupsFromDb(cntx context.Context) {
 
-	groups, _ := db.GetIgmpGroups()
+	groups, _ := db.GetIgmpGroups(cntx)
 	for _, group := range groups {
 		b, ok := group.Value.([]byte)
 		if !ok {
@@ -532,7 +533,7 @@
 		if _, err := va.GetIgmpGroupID(ig.GroupID); err != nil {
 			logger.Warnw(ctx, "GetIgmpGroupID Failed", log.Fields{"igGroupID": ig.GroupID, "Error": err})
 		}
-		ig.RestoreDevices()
+		ig.RestoreDevices(cntx)
 
 		if ig.NumDevicesActive() == 0 {
 			va.AddGroupToPendingPool(&ig)
@@ -544,16 +545,16 @@
 // AddIgmpGroup : When the first IGMP packet is received, the MVLAN profile is identified
 // for the IGMP group and grp obj is obtained from the available pending pool of groups.
 // If not, new group obj will be created based on available group IDs
-func (va *VoltApplication) AddIgmpGroup(mvpName string, gip net.IP, device string) *IgmpGroup {
+func (va *VoltApplication) AddIgmpGroup(cntx context.Context, mvpName string, gip net.IP, device string) *IgmpGroup {
 
 	var ig *IgmpGroup
 	if mvp, grpName := va.GetMvlanProfileForMcIP(mvpName, gip); mvp != nil {
 		if ig = va.GetGroupFromPendingPool(mvp.Mvlan, device); ig != nil {
 			logger.Infow(ctx, "Igmp Group obtained from global pending pool", log.Fields{"MvlanProfile": mvpName, "GroupID": ig.GroupID, "Device": device, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String()})
 			oldKey := mvp.generateGroupKey(ig.GroupName, ig.GroupAddr.String())
-			ig.IgmpGroupReInit(grpName, gip)
+			ig.IgmpGroupReInit(cntx, grpName, gip)
 			ig.IsGroupStatic = mvp.Groups[grpName].IsStatic
-			ig.UpdateIgmpGroup(oldKey, ig.getKey())
+			ig.UpdateIgmpGroup(cntx, oldKey, ig.getKey())
 		} else {
 			logger.Infow(ctx, "No Igmp Group available in global pending pool. Creating new Igmp Group", log.Fields{"MvlanProfile": mvpName, "Device": device, "GroupAddr": gip.String()})
 			if ig = va.GetAvailIgmpGroupID(); ig == nil {
@@ -564,7 +565,7 @@
 			grpKey := ig.getKey()
 			va.IgmpGroups.Store(grpKey, ig)
 		}
-		if err := ig.WriteToDb(); err != nil {
+		if err := ig.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 		}
 		return ig
@@ -606,7 +607,7 @@
 
 // DelIgmpGroup : When the last subscriber leaves the IGMP group across all the devices
 // the IGMP group is removed.
-func (va *VoltApplication) DelIgmpGroup(ig *IgmpGroup) {
+func (va *VoltApplication) DelIgmpGroup(cntx context.Context, ig *IgmpGroup) {
 
 	profile, found := GetApplication().MvlanProfilesByTag.Load(ig.Mvlan)
 	if found {
@@ -621,11 +622,11 @@
 				logger.Debugw(ctx, "Deleting IGMP Group", log.Fields{"Group": grpKey})
 				va.PutIgmpGroupID(ig)
 				va.IgmpGroups.Delete(grpKey)
-				_ = db.DelIgmpGroup(grpKey)
+				_ = db.DelIgmpGroup(cntx, grpKey)
 			} else {
 				logger.Infow(ctx, "Skipping IgmpGroup Device. Pending Igmp Group Devices present", log.Fields{"GroupID": ig.GroupID, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String(), "PendingDevices": len(ig.Devices)})
 				va.AddGroupToPendingPool(ig)
-				if err := ig.WriteToDb(); err != nil {
+				if err := ig.WriteToDb(cntx); err != nil {
 					logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 				}
 			}
@@ -807,7 +808,7 @@
 }
 
 // ProcessIgmpv2Pkt : This is IGMPv2 packet.
-func (va *VoltApplication) ProcessIgmpv2Pkt(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessIgmpv2Pkt(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// First get the layers of interest
 	dot1Q := pkt.Layer(layers.LayerTypeDot1Q).(*layers.Dot1Q)
 	pktVlan := of.VlanType(dot1Q.VLANIdentifier)
@@ -868,11 +869,11 @@
 				ig.IgmpGroupLock.Unlock()
 				return
 			}
-			ig.AddReceiver(device, port, igmpv2.GroupAddress, nil, IgmpVersion2, dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
+			ig.AddReceiver(cntx, device, port, igmpv2.GroupAddress, nil, IgmpVersion2, dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
 			ig.IgmpGroupLock.Unlock()
 		} else {
 			// Create the IGMP group and then add the receiver to the group
-			if ig := va.AddIgmpGroup(vpv.MvlanProfileName, igmpv2.GroupAddress, device); ig != nil {
+			if ig := va.AddIgmpGroup(cntx, vpv.MvlanProfileName, igmpv2.GroupAddress, device); ig != nil {
 				logger.Infow(ctx, "New IGMP Group", log.Fields{"Group": ig.GroupID, "devices": ig.Devices})
 				ig.IgmpGroupLock.Lock()
 				// Check for port state to avoid race condition where PortDown event
@@ -885,7 +886,7 @@
 					ig.IgmpGroupLock.Unlock()
 					return
 				}
-				ig.AddReceiver(device, port, igmpv2.GroupAddress, nil, IgmpVersion2, dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
+				ig.AddReceiver(cntx, device, port, igmpv2.GroupAddress, nil, IgmpVersion2, dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
 				ig.IgmpGroupLock.Unlock()
 			} else {
 				logger.Errorw(ctx, "IGMP Group Creation Failed", log.Fields{"Addr": igmpv2.GroupAddress})
@@ -914,10 +915,10 @@
 		if ig := va.GetIgmpGroup(mvlan, igmpv2.GroupAddress); ig != nil {
 			ig.IgmpGroupLock.Lock()
 			// Delete the receiver once the IgmpGroup is identified
-			ig.DelReceiver(device, port, igmpv2.GroupAddress, nil, ponPortID)
+			ig.DelReceiver(cntx, device, port, igmpv2.GroupAddress, nil, ponPortID)
 			ig.IgmpGroupLock.Unlock()
 			if ig.NumDevicesActive() == 0 {
-				va.DelIgmpGroup(ig)
+				va.DelIgmpGroup(cntx, ig)
 			}
 		}
 	} else {
@@ -936,13 +937,13 @@
 		defer mvp.mvpLock.RUnlock()
 
 		if net.ParseIP("0.0.0.0").Equal(igmpv2.GroupAddress) {
-			va.processIgmpQueries(device, pktVlan, IgmpVersion2)
+			va.processIgmpQueries(cntx, device, pktVlan, IgmpVersion2)
 		} else {
 			if ig := va.GetIgmpGroup(pktVlan, igmpv2.GroupAddress); ig != nil {
 				ig.IgmpGroupLock.Lock()
 				igd, ok := ig.Devices[device]
 				if ok {
-					igd.ProcessQuery(igmpv2.GroupAddress, IgmpVersion2)
+					igd.ProcessQuery(cntx, igmpv2.GroupAddress, IgmpVersion2)
 				} else {
 					logger.Warnw(ctx, "IGMP Device not found", log.Fields{"Device": device, "Group": igmpv2.GroupAddress})
 				}
@@ -953,7 +954,7 @@
 }
 
 // ProcessIgmpv3Pkt : Process IGMPv3 packet
-func (va *VoltApplication) ProcessIgmpv3Pkt(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessIgmpv3Pkt(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// First get the layers of interest
 	dot1QLayer := pkt.Layer(layers.LayerTypeDot1Q)
 
@@ -1018,13 +1019,13 @@
 						ig.IgmpGroupLock.Unlock()
 						return
 					}
-					ig.AddReceiver(device, port, group.MulticastAddress, &group, IgmpVersion3,
+					ig.AddReceiver(cntx, device, port, group.MulticastAddress, &group, IgmpVersion3,
 						dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
 					ig.IgmpGroupLock.Unlock()
 				} else {
 					// Create the IGMP group and then add the receiver to the group
 					logger.Infow(ctx, "IGMP Join received for new group", log.Fields{"Addr": group.MulticastAddress, "Port": port})
-					if ig := va.AddIgmpGroup(vpv.MvlanProfileName, group.MulticastAddress, device); ig != nil {
+					if ig := va.AddIgmpGroup(cntx, vpv.MvlanProfileName, group.MulticastAddress, device); ig != nil {
 						ig.IgmpGroupLock.Lock()
 						// Check for port state to avoid race condition where PortDown event
 						// acquired lock before packet processing
@@ -1036,7 +1037,7 @@
 							ig.IgmpGroupLock.Unlock()
 							return
 						}
-						ig.AddReceiver(device, port, group.MulticastAddress, &group, IgmpVersion3,
+						ig.AddReceiver(cntx, device, port, group.MulticastAddress, &group, IgmpVersion3,
 							dot1Q.VLANIdentifier, dot1Q.Priority, ponPortID)
 						ig.IgmpGroupLock.Unlock()
 					} else {
@@ -1046,10 +1047,10 @@
 			} else if ig != nil {
 				logger.Infow(ctx, "IGMP Leave received for existing group", log.Fields{"Addr": group.MulticastAddress, "Port": port})
 				ig.IgmpGroupLock.Lock()
-				ig.DelReceiver(device, port, group.MulticastAddress, &group, ponPortID)
+				ig.DelReceiver(cntx, device, port, group.MulticastAddress, &group, ponPortID)
 				ig.IgmpGroupLock.Unlock()
 				if ig.NumDevicesActive() == 0 {
-					va.DelIgmpGroup(ig)
+					va.DelIgmpGroup(cntx, ig)
 				}
 			} else {
 				logger.Warnw(ctx, "IGMP Leave received for unknown group", log.Fields{"Addr": group.MulticastAddress})
@@ -1071,13 +1072,13 @@
 		defer mvp.mvpLock.RUnlock()
 
 		if net.ParseIP("0.0.0.0").Equal(igmpv3.GroupAddress) {
-			va.processIgmpQueries(device, pktVlan, IgmpVersion3)
+			va.processIgmpQueries(cntx, device, pktVlan, IgmpVersion3)
 		} else {
 			if ig := va.GetIgmpGroup(pktVlan, igmpv3.GroupAddress); ig != nil {
 				ig.IgmpGroupLock.Lock()
 				igd, ok := ig.Devices[device]
 				if ok {
-					igd.ProcessQuery(igmpv3.GroupAddress, IgmpVersion3)
+					igd.ProcessQuery(cntx, igmpv3.GroupAddress, IgmpVersion3)
 				} else {
 					logger.Warnw(ctx, "IGMP Device not found", log.Fields{"Device": device, "Group": igmpv3.GroupAddress})
 				}
@@ -1088,7 +1089,7 @@
 }
 
 // processIgmpQueries to process the igmp queries
-func (va *VoltApplication) processIgmpQueries(device string, pktVlan of.VlanType, version uint8) {
+func (va *VoltApplication) processIgmpQueries(cntx context.Context, device string, pktVlan of.VlanType, version uint8) {
 	// This is a generic query and respond with all the groups channels in currently being viewed.
 	processquery := func(key interface{}, value interface{}) bool {
 		ig := value.(*IgmpGroup)
@@ -1105,7 +1106,7 @@
 		}
 		processQueryForEachChannel := func(key interface{}, value interface{}) bool {
 			groupAddr := key.(string)
-			igd.ProcessQuery(net.ParseIP(groupAddr), version)
+			igd.ProcessQuery(cntx, net.ParseIP(groupAddr), version)
 			return true
 		}
 		igd.GroupChannels.Range(processQueryForEachChannel)
@@ -1143,7 +1144,7 @@
 
 // IgmpProcessPkt to process the IGMP packet received. The packet received brings along with it
 // the port on which the packet is received and the device the port is in.
-func (va *VoltApplication) IgmpProcessPkt(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) IgmpProcessPkt(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	igmpl := pkt.Layer(layers.LayerTypeIGMP)
 	if igmpl == nil {
 		logger.Error(ctx, "Invalid IGMP packet arrived as IGMP packet")
@@ -1152,12 +1153,12 @@
 	if igmp, ok := igmpl.(*layers.IGMPv1or2); ok {
 		// This is an IGMPv2 packet.
 		logger.Debugw(ctx, "IGMPv2 Packet Received", log.Fields{"IPAddr": igmp.GroupAddress})
-		va.ProcessIgmpv2Pkt(device, port, pkt)
+		va.ProcessIgmpv2Pkt(cntx, device, port, pkt)
 		return
 	}
 	if igmpv3, ok := igmpl.(*layers.IGMP); ok {
 		logger.Debugw(ctx, "IGMPv3 Packet Received", log.Fields{"NumOfGroups": igmpv3.NumberOfGroupRecords})
-		va.ProcessIgmpv3Pkt(device, port, pkt)
+		va.ProcessIgmpv3Pkt(cntx, device, port, pkt)
 	}
 }
 
@@ -1180,8 +1181,8 @@
 }
 
 // RestoreMvlansFromDb to read from the DB and restore all the MVLANs
-func (va *VoltApplication) RestoreMvlansFromDb() {
-	mvlans, _ := db.GetMvlans()
+func (va *VoltApplication) RestoreMvlansFromDb(cntx context.Context) {
+	mvlans, _ := db.GetMvlans(cntx)
 	for _, mvlan := range mvlans {
 		b, ok := mvlan.Value.([]byte)
 		if !ok {
@@ -1223,7 +1224,7 @@
 }
 
 //UpdateMvlanProfile - only channel groups be updated
-func (va *VoltApplication) UpdateMvlanProfile(name string, vlan of.VlanType, groups map[string][]string, activeChannelCount int, proxy map[string]common.MulticastGroupProxy) error {
+func (va *VoltApplication) UpdateMvlanProfile(cntx context.Context, name string, vlan of.VlanType, groups map[string][]string, activeChannelCount int, proxy map[string]common.MulticastGroupProxy) error {
 
 	mvpIntf, ok := va.MvlanProfilesByName.Load(name)
 	if !ok {
@@ -1256,7 +1257,7 @@
 		logger.Info(ctx, "No change in groups config")
 		if uint32(activeChannelCount) != mvp.MaxActiveChannels {
 			mvp.MaxActiveChannels = uint32(activeChannelCount)
-			if err := mvp.WriteToDb(); err != nil {
+			if err := mvp.WriteToDb(cntx); err != nil {
 				logger.Errorw(ctx, "Mvlan profile Write to DB failed", log.Fields{"ProfileName": mvp.Name})
 			}
 			if prevMaxActiveChannels != mvp.MaxActiveChannels {
@@ -1275,7 +1276,7 @@
 	mvp.oldGroups = existingGroup
 	mvp.oldProxy = existingProxy
 	va.storeMvlansMap(vlan, name, mvp)
-	if err := mvp.WriteToDb(); err != nil {
+	if err := mvp.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Mvlan profile Write to DB failed", log.Fields{"ProfileName": mvp.Name})
 	}
 	if prevMaxActiveChannels != mvp.MaxActiveChannels {
@@ -1321,7 +1322,7 @@
 }
 
 // AddMcastConfig for addition of a MVLAN profile
-func (va *VoltApplication) AddMcastConfig(MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) error {
+func (va *VoltApplication) AddMcastConfig(cntx context.Context, MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) error {
 	var mcastCfg *McastConfig
 
 	mcastCfg = va.GetMcastConfig(OltSerialNum, MvlanProfileID)
@@ -1371,61 +1372,61 @@
 	va.IgmpGroups.Range(iterIgmpGroups)
 
 	va.storeMcastConfig(OltSerialNum, MvlanProfileID, mcastCfg)
-	if err := mcastCfg.WriteToDb(); err != nil {
+	if err := mcastCfg.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "McastConfig Write to DB failed", log.Fields{"OltSerialNum": mcastCfg.OltSerialNum, "MvlanProfileID": mcastCfg.MvlanProfileID})
 	}
-	va.addOltToMvlan(MvlanProfileID, OltSerialNum)
+	va.addOltToMvlan(cntx, MvlanProfileID, OltSerialNum)
 
 	return nil
 }
 
-func (va *VoltApplication) addOltToMvlan(MvlanProfileID string, OltSerialNum string) {
+func (va *VoltApplication) addOltToMvlan(cntx context.Context, MvlanProfileID string, OltSerialNum string) {
 	var mvp *MvlanProfile
 	if mvpIntf, ok := va.MvlanProfilesByName.Load(MvlanProfileID); ok {
 		servVersion := IgmpVersion0
 		mvp = mvpIntf.(*MvlanProfile)
 		mvp.DevicesList[OltSerialNum] = NoOp
 		mvp.IgmpServVersion[OltSerialNum] = &servVersion
-		if err := mvp.WriteToDb(); err != nil {
+		if err := mvp.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Mvlan profile Write to DB failed", log.Fields{"ProfileName": mvp.Name})
 		}
-		mvp.pushIgmpMcastFlows(OltSerialNum)
+		mvp.pushIgmpMcastFlows(cntx, OltSerialNum)
 	}
 }
 
-func (va *VoltApplication) delOltFromMvlan(MvlanProfileID string, OltSerialNum string) {
+func (va *VoltApplication) delOltFromMvlan(cntx context.Context, MvlanProfileID string, OltSerialNum string) {
 	var mvp *MvlanProfile
 	if mvpIntf, ok := va.MvlanProfilesByName.Load(MvlanProfileID); ok {
 		mvp = mvpIntf.(*MvlanProfile)
 		//Delete from mvp list
-		mvp.removeIgmpMcastFlows(OltSerialNum)
+		mvp.removeIgmpMcastFlows(cntx, OltSerialNum)
 		delete(mvp.DevicesList, OltSerialNum)
-		if err := mvp.WriteToDb(); err != nil {
+		if err := mvp.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Mvlan profile Write to DB failed", log.Fields{"ProfileName": mvp.Name})
 		}
 	}
 }
 
 // DelMcastConfig for addition of a MVLAN profile
-func (va *VoltApplication) DelMcastConfig(MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) {
+func (va *VoltApplication) DelMcastConfig(cntx context.Context, MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) {
 
-	va.delOltFromMvlan(MvlanProfileID, OltSerialNum)
+	va.delOltFromMvlan(cntx, MvlanProfileID, OltSerialNum)
 	va.deleteMcastConfig(OltSerialNum, MvlanProfileID)
-	_ = db.DelMcastConfig(McastConfigKey(OltSerialNum, MvlanProfileID))
+	_ = db.DelMcastConfig(cntx, McastConfigKey(OltSerialNum, MvlanProfileID))
 	if d := va.GetDeviceBySerialNo(OltSerialNum); d != nil {
 		if mvp := va.GetMvlanProfileByName(MvlanProfileID); mvp != nil {
-			va.RemoveGroupsFromPendingPool(d.Name, mvp.Mvlan)
+			va.RemoveGroupsFromPendingPool(cntx, d.Name, mvp.Mvlan)
 		}
 	}
 }
 
 // DelAllMcastConfig for deletion of all mcast config
-func (va *VoltApplication) DelAllMcastConfig(OltSerialNum string) error {
+func (va *VoltApplication) DelAllMcastConfig(cntx context.Context, OltSerialNum string) error {
 
 	deleteIndividualMcastConfig := func(key interface{}, value interface{}) bool {
 		mcastCfg := value.(*McastConfig)
 		if mcastCfg.OltSerialNum == OltSerialNum {
-			va.DelMcastConfig(mcastCfg.MvlanProfileID, mcastCfg.IgmpProfileID, mcastCfg.IgmpProxyIP.String(), mcastCfg.OltSerialNum)
+			va.DelMcastConfig(cntx, mcastCfg.MvlanProfileID, mcastCfg.IgmpProfileID, mcastCfg.IgmpProxyIP.String(), mcastCfg.OltSerialNum)
 		}
 		return true
 	}
@@ -1434,7 +1435,7 @@
 }
 
 // UpdateMcastConfig for addition of a MVLAN profile
-func (va *VoltApplication) UpdateMcastConfig(MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) error {
+func (va *VoltApplication) UpdateMcastConfig(cntx context.Context, MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) error {
 
 	mcastCfg := va.GetMcastConfig(OltSerialNum, MvlanProfileID)
 	if mcastCfg == nil {
@@ -1463,7 +1464,7 @@
 		mcastCfg.IgmpGroupDevices.Range(updateIgdProxyCfg)
 	}
 
-	if err := mcastCfg.WriteToDb(); err != nil {
+	if err := mcastCfg.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "McastConfig Write to DB failed", log.Fields{"OltSerialNum": mcastCfg.OltSerialNum, "MvlanProfileID": mcastCfg.MvlanProfileID})
 	}
 
@@ -1471,21 +1472,21 @@
 }
 
 // WriteToDb is utility to write Mcast config Info to database
-func (mc *McastConfig) WriteToDb() error {
+func (mc *McastConfig) WriteToDb(cntx context.Context) error {
 	mc.Version = database.PresentVersionMap[database.McastConfigPath]
 	b, err := json.Marshal(mc)
 	if err != nil {
 		return err
 	}
-	if err1 := db.PutMcastConfig(McastConfigKey(mc.OltSerialNum, mc.MvlanProfileID), string(b)); err1 != nil {
+	if err1 := db.PutMcastConfig(cntx, McastConfigKey(mc.OltSerialNum, mc.MvlanProfileID), string(b)); err1 != nil {
 		return err1
 	}
 	return nil
 }
 
 // RestoreMcastConfigsFromDb to read from the DB and restore Mcast configs
-func (va *VoltApplication) RestoreMcastConfigsFromDb() {
-	mcastConfigs, _ := db.GetMcastConfigs()
+func (va *VoltApplication) RestoreMcastConfigsFromDb(cntx context.Context) {
+	mcastConfigs, _ := db.GetMcastConfigs(cntx)
 	for hash, mcastConfig := range mcastConfigs {
 		b, ok := mcastConfig.Value.([]byte)
 		if !ok {
@@ -1504,7 +1505,7 @@
 }
 
 // AddMvlanProfile for addition of a MVLAN profile
-func (va *VoltApplication) AddMvlanProfile(name string, mvlan of.VlanType, ponVlan of.VlanType,
+func (va *VoltApplication) AddMvlanProfile(cntx context.Context, name string, mvlan of.VlanType, ponVlan of.VlanType,
 	groups map[string][]string, isChannelBasedGroup bool, OLTSerialNum []string, activeChannelsPerPon int, proxy map[string]common.MulticastGroupProxy) error {
 	var mvp *MvlanProfile
 
@@ -1518,7 +1519,7 @@
 			if mvp.DevicesList[serialNum] != Nil {
 				//This is backup restore scenario, just update the profile
 				logger.Info(ctx, "Add Mvlan : Profile Name already exists, update-the-profile")
-				return va.UpdateMvlanProfile(name, mvlan, groups, activeChannelsPerPon, proxy)
+				return va.UpdateMvlanProfile(cntx, name, mvlan, groups, activeChannelsPerPon, proxy)
 			}
 		}
 	}
@@ -1546,7 +1547,7 @@
 	logger.Debugw(ctx, "Added MVLAN Profile", log.Fields{"MVLAN": mvp.Mvlan, "PonVlan": mvp.PonVlan, "Name": mvp.Name, "Grp IPs": mvp.Groups, "IsPonVlanPresent": mvp.IsPonVlanPresent})
 	mvp.mvpLock.Unlock()
 
-	if err := mvp.WriteToDb(); err != nil {
+	if err := mvp.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Mvlan profile Write to DB failed", log.Fields{"ProfileName": mvp.Name})
 	}
 
@@ -1570,7 +1571,7 @@
 }
 
 // IgmpTick for igmp tick info
-func (va *VoltApplication) IgmpTick() {
+func (va *VoltApplication) IgmpTick(cntx context.Context) {
 	tickCount++
 	if (tickCount % 1000) == 0 {
 		logger.Debugw(ctx, "Time @ Tick", log.Fields{"Tick": tickCount, "Time": time.Now()})
@@ -1580,10 +1581,10 @@
 		if ig.NumDevicesActive() != 0 {
 			if tickCount%10 == ig.Hash()%10 {
 				ig.IgmpGroupLock.Lock()
-				ig.Tick()
+				ig.Tick(cntx)
 				ig.IgmpGroupLock.Unlock()
 				if ig.NumDevicesActive() == 0 {
-					va.DelIgmpGroup(ig)
+					va.DelIgmpGroup(cntx, ig)
 				}
 			}
 		}
@@ -1600,12 +1601,12 @@
 }
 
 //AddIgmpProfile for addition of IGMP Profile
-func (va *VoltApplication) AddIgmpProfile(igmpProfileConfig *common.IGMPConfig) error {
+func (va *VoltApplication) AddIgmpProfile(cntx context.Context, igmpProfileConfig *common.IGMPConfig) error {
 	var igmpProfile *IgmpProfile
 
 	if igmpProfileConfig.ProfileID == DefaultIgmpProfID {
 		logger.Info(ctx, "Updating default IGMP profile")
-		return va.UpdateIgmpProfile(igmpProfileConfig)
+		return va.UpdateIgmpProfile(cntx, igmpProfileConfig)
 	}
 
 	igmpProfile = va.checkIgmpProfileMap(igmpProfileConfig.ProfileID)
@@ -1618,7 +1619,7 @@
 
 	va.storeIgmpProfileMap(igmpProfileConfig.ProfileID, igmpProfile)
 
-	if err := igmpProfile.WriteToDb(); err != nil {
+	if err := igmpProfile.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp profile Write to DB failed", log.Fields{"profileID": igmpProfile.ProfileID})
 	}
 
@@ -1633,7 +1634,7 @@
 	return nil
 }
 
-func (va *VoltApplication) resetIgmpProfileToDefault() {
+func (va *VoltApplication) resetIgmpProfileToDefault(cntx context.Context) {
 	igmpProf := va.getIgmpProfileMap(DefaultIgmpProfID)
 	defIgmpProf := newDefaultIgmpProfile()
 
@@ -1651,7 +1652,7 @@
 	igmpProf.IgmpVerToServer = defIgmpProf.IgmpVerToServer
 	igmpProf.IgmpSourceIP = defIgmpProf.IgmpSourceIP
 
-	if err := igmpProf.WriteToDb(); err != nil {
+	if err := igmpProf.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp profile Write to DB failed", log.Fields{"profileID": igmpProf.ProfileID})
 	}
 }
@@ -1678,11 +1679,11 @@
 }
 
 //DelIgmpProfile for addition of IGMP Profile
-func (va *VoltApplication) DelIgmpProfile(igmpProfileConfig *common.IGMPConfig) error {
+func (va *VoltApplication) DelIgmpProfile(cntx context.Context, igmpProfileConfig *common.IGMPConfig) error {
 	// Deletion of default igmp profile is blocked from submgr. Keeping additional check for safety.
 	if igmpProfileConfig.ProfileID == DefaultIgmpProfID {
 		logger.Info(ctx, "Resetting default IGMP profile")
-		va.resetIgmpProfileToDefault()
+		va.resetIgmpProfileToDefault(cntx)
 		return nil
 	}
 	igmpProfile := va.checkIgmpProfileMap(igmpProfileConfig.ProfileID)
@@ -1693,13 +1694,13 @@
 
 	va.deleteIgmpProfileMap(igmpProfileConfig.ProfileID)
 
-	_ = db.DelIgmpProfile(igmpProfileConfig.ProfileID)
+	_ = db.DelIgmpProfile(cntx, igmpProfileConfig.ProfileID)
 
 	return nil
 }
 
 //UpdateIgmpProfile for addition of IGMP Profile
-func (va *VoltApplication) UpdateIgmpProfile(igmpProfileConfig *common.IGMPConfig) error {
+func (va *VoltApplication) UpdateIgmpProfile(cntx context.Context, igmpProfileConfig *common.IGMPConfig) error {
 	igmpProfile := va.checkIgmpProfileMap(igmpProfileConfig.ProfileID)
 	if igmpProfile == nil {
 		logger.Errorw(ctx, "Igmp Profile not found. Unable to update", log.Fields{"Profile ID": igmpProfileConfig.ProfileID})
@@ -1738,7 +1739,7 @@
 		igmpProfile.IgmpSourceIP = net.ParseIP(igmpProfileConfig.IgmpSourceIP)
 	}
 
-	if err := igmpProfile.WriteToDb(); err != nil {
+	if err := igmpProfile.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp profile Write to DB failed", log.Fields{"profileID": igmpProfile.ProfileID})
 	}
 
@@ -1746,9 +1747,9 @@
 }
 
 // RestoreIGMPProfilesFromDb to read from the DB and restore IGMP Profiles
-func (va *VoltApplication) RestoreIGMPProfilesFromDb() {
+func (va *VoltApplication) RestoreIGMPProfilesFromDb(cntx context.Context) {
 	// Loading IGMP profiles
-	igmpProfiles, _ := db.GetIgmpProfiles()
+	igmpProfiles, _ := db.GetIgmpProfiles(cntx)
 	for _, igmpProfile := range igmpProfiles {
 		b, ok := igmpProfile.Value.([]byte)
 		if !ok {
@@ -1777,13 +1778,13 @@
 }
 
 // DelMvlanProfile for deletion of a MVLAN group
-func (va *VoltApplication) DelMvlanProfile(name string) error {
+func (va *VoltApplication) DelMvlanProfile(cntx context.Context, name string) error {
 	if mvpIntf, ok := va.MvlanProfilesByName.Load(name); ok {
 		mvp := mvpIntf.(*MvlanProfile)
 
 		if len(mvp.DevicesList) == 0 {
 			mvp.DeleteInProgress = true
-			mvp.DelFromDb()
+			mvp.DelFromDb(cntx)
 			va.deleteMvlansMap(mvp.Mvlan, name)
 			logger.Debugw(ctx, "Deleted MVLAN Profile", log.Fields{"Name": mvp.Name})
 		} else {
@@ -1839,7 +1840,7 @@
 }
 
 // ReceiverDownInd to send receiver down indication
-func (va *VoltApplication) ReceiverDownInd(device string, port string) {
+func (va *VoltApplication) ReceiverDownInd(cntx context.Context, device string, port string) {
 	logger.Infow(ctx, " Receiver Indication: DOWN", log.Fields{"device": device, "port": port})
 
 	ponPortID := va.GetPonPortID(device, port)
@@ -1847,10 +1848,10 @@
 	del := func(key interface{}, value interface{}) bool {
 		ig := value.(*IgmpGroup)
 		ig.IgmpGroupLock.Lock()
-		ig.DelReceiveronDownInd(device, port, ponPortID)
+		ig.DelReceiveronDownInd(cntx, device, port, ponPortID)
 		ig.IgmpGroupLock.Unlock()
 		if ig.NumDevicesActive() == 0 {
-			va.DelIgmpGroup(ig)
+			va.DelIgmpGroup(cntx, ig)
 		}
 		return true
 	}
diff --git a/internal/pkg/application/igmpgroup.go b/internal/pkg/application/igmpgroup.go
index 629d92c..a7107cd 100644
--- a/internal/pkg/application/igmpgroup.go
+++ b/internal/pkg/application/igmpgroup.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 	"sync"
@@ -76,7 +77,7 @@
 }
 
 // IgmpGroupReInit to re-initialize igmp group members
-func (ig *IgmpGroup) IgmpGroupReInit(name string, gip net.IP) {
+func (ig *IgmpGroup) IgmpGroupReInit(cntx context.Context, name string, gip net.IP) {
 
 	logger.Infow(ctx, "Reinitialize Igmp Group", log.Fields{"GroupID": ig.GroupID, "OldName": ig.GroupName, "Name": name, "OldAddr": ig.GroupAddr.String(), "GroupAddr": gip.String()})
 
@@ -88,12 +89,12 @@
 	}
 
 	for _, igd := range ig.Devices {
-		igd.IgmpGroupDeviceReInit(ig)
+		igd.IgmpGroupDeviceReInit(cntx, ig)
 	}
 }
 
 // updateGroupName to update group name
-func (ig *IgmpGroup) updateGroupName(newGroupName string) {
+func (ig *IgmpGroup) updateGroupName(cntx context.Context, newGroupName string) {
 	if !ig.IsChannelBasedGroup {
 		logger.Errorw(ctx, "Group name update not supported for GroupChannel based group", log.Fields{"Ig": ig})
 		return
@@ -101,36 +102,36 @@
 	oldKey := ig.getKey()
 	ig.GroupName = newGroupName
 	for _, igd := range ig.Devices {
-		igd.updateGroupName(newGroupName)
+		igd.updateGroupName(cntx, newGroupName)
 	}
-	if err := ig.WriteToDb(); err != nil {
+	if err := ig.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 	}
 	if !ig.IsChannelBasedGroup {
-		_ = db.DelIgmpGroup(oldKey)
+		_ = db.DelIgmpGroup(cntx, oldKey)
 	}
 }
 
 //HandleGroupMigration - handles migration of group members between static & dynamic
-func (ig *IgmpGroup) HandleGroupMigration(deviceID string, groupAddr net.IP) {
+func (ig *IgmpGroup) HandleGroupMigration(cntx context.Context, deviceID string, groupAddr net.IP) {
 
 	var group *layers.IGMPv3GroupRecord
 	app := GetApplication()
 	if deviceID == "" {
 		logger.Infow(ctx, "Handle Group Migration Request for all devices", log.Fields{"DeviceID": deviceID, "GroupAddr": groupAddr, "IG": ig.GroupName, "Mvlan": ig.Mvlan})
 		for device := range ig.Devices {
-			ig.HandleGroupMigration(device, groupAddr)
+			ig.HandleGroupMigration(cntx, device, groupAddr)
 		}
 	} else {
 		logger.Infow(ctx, "Handle Group Migration Request", log.Fields{"DeviceID": deviceID, "GroupAddr": groupAddr, "IG": ig.GroupName})
 		var newIg *IgmpGroup
-		receivers := ig.DelIgmpChannel(deviceID, groupAddr)
+		receivers := ig.DelIgmpChannel(cntx, deviceID, groupAddr)
 		if ig.NumDevicesActive() == 0 {
-			app.DelIgmpGroup(ig)
+			app.DelIgmpGroup(cntx, ig)
 		}
 		if newIg = app.GetIgmpGroup(ig.Mvlan, groupAddr); newIg == nil {
 			logger.Infow(ctx, "IG Group doesn't exist, creating new group", log.Fields{"DeviceID": deviceID, "GroupAddr": groupAddr, "IG": ig.GroupName, "Mvlan": ig.Mvlan})
-			if newIg = app.AddIgmpGroup(app.GetMvlanProfileByTag(ig.Mvlan).Name, groupAddr, deviceID); newIg == nil {
+			if newIg = app.AddIgmpGroup(cntx, app.GetMvlanProfileByTag(ig.Mvlan).Name, groupAddr, deviceID); newIg == nil {
 				logger.Errorw(ctx, "Group Creation failed during group migration", log.Fields{"DeviceID": deviceID, "GroupAddr": groupAddr})
 				return
 			}
@@ -161,7 +162,7 @@
 			}
 			logger.Infow(ctx, "Adding receiver to new group", log.Fields{"DeviceID": deviceID, "GroupAddr": groupAddr, "newIg": newIg.GroupName, "IGP": igp})
 			ponPort := GetApplication().GetPonPortID(deviceID, port)
-			newIg.AddReceiver(deviceID, port, groupAddr, group, igp.Version, igp.CVlan, igp.Pbit, ponPort)
+			newIg.AddReceiver(cntx, deviceID, port, groupAddr, group, igp.Version, igp.CVlan, igp.Pbit, ponPort)
 		}
 		newIg.IgmpGroupLock.Unlock()
 	}
@@ -169,11 +170,11 @@
 
 // AddIgmpGroupDevice add a device to the group which happens when the first receiver of the device
 // is added to the IGMP group.
-func (ig *IgmpGroup) AddIgmpGroupDevice(device string, id uint32, version uint8) *IgmpGroupDevice {
+func (ig *IgmpGroup) AddIgmpGroupDevice(cntx context.Context, device string, id uint32, version uint8) *IgmpGroupDevice {
 	logger.Infow(ctx, "Adding Device to IGMP group", log.Fields{"Device": device, "GroupName": ig.GroupName})
 	igd := NewIgmpGroupDevice(device, ig, id, version)
 	ig.Devices[device] = igd
-	if err := igd.WriteToDb(); err != nil {
+	if err := igd.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
 	}
 	return igd
@@ -181,14 +182,14 @@
 
 // DelIgmpGroupDevice delete the device from the group which happens when we receive a leave or when
 // there is not response for IGMP query from the receiver
-func (ig *IgmpGroup) DelIgmpGroupDevice(igd *IgmpGroupDevice) {
+func (ig *IgmpGroup) DelIgmpGroupDevice(cntx context.Context, igd *IgmpGroupDevice) {
 	logger.Infow(ctx, "Deleting Device from IGMP group", log.Fields{"Device": igd.Device, "Name": ig.GroupName})
 	va := GetApplication()
 	countersToBeUpdated := false
 	if igd.NumReceivers() != 0 {
 		countersToBeUpdated = true
 	}
-	igd.DelAllChannels()
+	igd.DelAllChannels(cntx)
 
 	//Clear all internal maps so that the groups can be reused
 	igd.PortChannelMap.Range(func(key, value interface{}) bool {
@@ -215,34 +216,34 @@
 		logger.Debugw(ctx, "Igd deleted from mcast config", log.Fields{"mvlan": mcastCfg.MvlanProfileID, "groupId": igd.GroupID})
 	}
 	if !igd.GroupInstalled {
-		_ = db.DelIgmpDevice(igd.Mvlan, ig.GroupName, ig.GroupAddr, igd.Device)
+		_ = db.DelIgmpDevice(cntx, igd.Mvlan, ig.GroupName, ig.GroupAddr, igd.Device)
 		delete(ig.Devices, igd.Device)
 	}
 }
 
 // AddReceiver delete the device from the group which happens when we receive a leave or when
 // there is not response for IGMP query from the receiver
-func (ig *IgmpGroup) AddReceiver(device string, port string, groupIP net.IP,
+func (ig *IgmpGroup) AddReceiver(cntx context.Context, device string, port string, groupIP net.IP,
 	group *layers.IGMPv3GroupRecord, ver uint8, cvlan uint16, pbit uint8, ponPort uint32) {
 
 	logger.Debugw(ctx, "Adding Receiver", log.Fields{"Port": port})
-	if igd, ok := ig.getIgmpGroupDevice(device); !ok {
-		igd = ig.AddIgmpGroupDevice(device, ig.GroupID, ver)
-		igd.AddReceiver(port, groupIP, group, ver, cvlan, pbit, ponPort)
+	if igd, ok := ig.getIgmpGroupDevice(cntx, device); !ok {
+		igd = ig.AddIgmpGroupDevice(cntx, device, ig.GroupID, ver)
+		igd.AddReceiver(cntx, port, groupIP, group, ver, cvlan, pbit, ponPort)
 	} else {
 		logger.Infow(ctx, "IGMP Group Receiver", log.Fields{"IGD": igd.Device})
-		igd.AddReceiver(port, groupIP, group, ver, cvlan, pbit, ponPort)
+		igd.AddReceiver(cntx, port, groupIP, group, ver, cvlan, pbit, ponPort)
 	}
 }
 
-func (ig *IgmpGroup) getIgmpGroupDevice(device string) (*IgmpGroupDevice, bool) {
+func (ig *IgmpGroup) getIgmpGroupDevice(cntx context.Context, device string) (*IgmpGroupDevice, bool) {
 	ig.PendingPoolLock.Lock()
 	defer ig.PendingPoolLock.Unlock()
 
 	if _, ok := ig.PendingGroupForDevice[device]; ok {
 		logger.Infow(ctx, "Removing the IgmpGroupDevice from pending pool", log.Fields{"GroupID": ig.GroupID, "Device": device, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String()})
 		delete(ig.PendingGroupForDevice, device)
-		if err := ig.WriteToDb(); err != nil {
+		if err := ig.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 		}
 	}
@@ -252,7 +253,7 @@
 
 // DelReceiveronDownInd deletes a receiver which is the combination of device (OLT)
 // and port on Port Down event
-func (ig *IgmpGroup) DelReceiveronDownInd(device string, port string, ponPortID uint32) {
+func (ig *IgmpGroup) DelReceiveronDownInd(cntx context.Context, device string, port string, ponPortID uint32) {
 	logger.Debugw(ctx, "Deleting Receiver for Group", log.Fields{"Device": device, "port": port})
 
 	mvp := GetApplication().GetMvlanProfileByTag(ig.Mvlan)
@@ -274,23 +275,23 @@
 
 	for _, groupAddr := range ipsList {
 		logger.Debugw(ctx, "Port Channels", log.Fields{"Port": port, "IPsList": ipsList, "GroupAddr": groupAddr, "Len": len(ipsList)})
-		igd.DelReceiver(groupAddr, port, nil, ponPortID)
+		igd.DelReceiver(cntx, groupAddr, port, nil, ponPortID)
 	}
 
 	if igd.NumReceivers() == 0 {
-		ig.DelIgmpGroupDevice(igd)
+		ig.DelIgmpGroupDevice(cntx, igd)
 	}
 }
 
 // DelReceiver deletes a receiver which is the combination of device (OLT)
 // and port
-func (ig *IgmpGroup) DelReceiver(device string, port string, groupAddr net.IP, group *layers.IGMPv3GroupRecord, ponPortID uint32) {
+func (ig *IgmpGroup) DelReceiver(cntx context.Context, device string, port string, groupAddr net.IP, group *layers.IGMPv3GroupRecord, ponPortID uint32) {
 	logger.Debugw(ctx, "Deleting Receiver for Group", log.Fields{"Device": device, "port": port, "GroupIP": groupAddr.String()})
 	if igd, ok := ig.Devices[device]; ok {
 		//igd.DelReceiverForGroupAddr(groupAddr, port)
-		igd.DelReceiver(groupAddr, port, group, ponPortID)
+		igd.DelReceiver(cntx, groupAddr, port, group, ponPortID)
 		if igd.NumReceivers() == 0 {
-			ig.DelIgmpGroupDevice(igd)
+			ig.DelIgmpGroupDevice(cntx, igd)
 		}
 	}
 }
@@ -329,18 +330,18 @@
 }
 
 // DelIgmpChannel deletes all receivers for the provided igmp group channel for the given device
-func (ig *IgmpGroup) DelIgmpChannel(deviceID string, groupAddr net.IP) map[string]*IgmpGroupPort {
+func (ig *IgmpGroup) DelIgmpChannel(cntx context.Context, deviceID string, groupAddr net.IP) map[string]*IgmpGroupPort {
 	logger.Infow(ctx, "Deleting Channel from devices", log.Fields{"Device": deviceID, "Group": ig.GroupName, "Channel": groupAddr.String()})
 	if deviceID == "" {
 		for device := range ig.Devices {
-			ig.DelIgmpChannel(device, groupAddr)
+			ig.DelIgmpChannel(cntx, device, groupAddr)
 		}
 		return nil
 	}
 	igd := ig.Devices[deviceID]
-	receivers := igd.DelChannelReceiver(groupAddr)
+	receivers := igd.DelChannelReceiver(cntx, groupAddr)
 	if igd.NumReceivers() == 0 {
-		ig.DelIgmpGroupDevice(igd)
+		ig.DelIgmpGroupDevice(cntx, igd)
 	}
 	return receivers
 }
@@ -373,7 +374,7 @@
 }
 
 // Tick for Addition of groups to an MVLAN profile
-func (ig *IgmpGroup) Tick() {
+func (ig *IgmpGroup) Tick(cntx context.Context) {
 	now := time.Now()
 	for _, igd := range ig.Devices {
 		var igdChangeCnt uint8
@@ -399,14 +400,14 @@
 			igd.GroupChannels.Range(sendQueryForAllChannels)
 		}
 		if now.After(igd.QueryExpiryTime) {
-			igd.QueryExpiry()
+			igd.QueryExpiry(cntx)
 			// This will keep it quiet till the next query time and then
 			// it will be reset to a value after the query initiation time
 			igd.QueryExpiryTime = igd.NextQueryTime
 			logger.Debugw(ctx, "Expiry", log.Fields{"NextQuery": igd.NextQueryTime, "Expiry": igd.QueryExpiryTime})
 			igdChangeCnt++
 			if igd.NumReceivers() == 0 {
-				ig.DelIgmpGroupDevice(igd)
+				ig.DelIgmpGroupDevice(cntx, igd)
 				continue
 			}
 		}
@@ -414,7 +415,7 @@
 		igdChangeCnt += igd.Tick()
 
 		if igdChangeCnt > 0 {
-			if err := igd.WriteToDb(); err != nil {
+			if err := igd.WriteToDb(cntx); err != nil {
 				logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device,
 							"GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
 			}
@@ -426,12 +427,12 @@
 // expiry, process the consolidated response for each of the devices participating
 // in the MC stream. When a device has no receivers, the device is deleted
 // from the group.
-func (ig *IgmpGroup) QueryExpiry() {
+func (ig *IgmpGroup) QueryExpiry(cntx context.Context) {
 	for _, igd := range ig.Devices {
 		if _, ok := GetApplication().DevicesDisc.Load(igd.Device); ok {
-			igd.QueryExpiry()
+			igd.QueryExpiry(cntx)
 			if igd.NumReceivers() == 0 {
-				ig.DelIgmpGroupDevice(igd)
+				ig.DelIgmpGroupDevice(cntx, igd)
 			}
 
 		} else {
@@ -496,10 +497,10 @@
 }
 
 // RestoreDevices : IGMP group write to DB
-func (ig *IgmpGroup) RestoreDevices() {
+func (ig *IgmpGroup) RestoreDevices(cntx context.Context) {
 
-	ig.migrateIgmpDevices()
-	devices, _ := db.GetIgmpDevices(ig.Mvlan, ig.GroupName, ig.GroupAddr)
+	ig.migrateIgmpDevices(cntx)
+	devices, _ := db.GetIgmpDevices(cntx, ig.Mvlan, ig.GroupName, ig.GroupAddr)
 	for _, device := range devices {
 		b, ok := device.Value.([]byte)
 		if !ok {
@@ -526,7 +527,7 @@
 				logger.Debugw(ctx, "VGC igd upgrade", log.Fields{"igd grp name": igd.GroupName})
 				igd.NextQueryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
 				igd.QueryExpiryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
-				if err := igd.WriteToDb(); err != nil {
+				if err := igd.WriteToDb(cntx); err != nil {
 					logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device,
 								"GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
 				}
@@ -534,10 +535,10 @@
 
 			ig.Devices[igd.Device] = igd
 			if ig.IsChannelBasedGroup {
-				channel, _ := db.GetIgmpChannel(igd.Mvlan, igd.GroupName, igd.Device, igd.GroupAddr)
-				igd.RestoreChannel([]byte(channel))
+				channel, _ := db.GetIgmpChannel(cntx, igd.Mvlan, igd.GroupName, igd.Device, igd.GroupAddr)
+				igd.RestoreChannel(cntx, []byte(channel))
 			} else {
-				igd.RestoreChannels()
+				igd.RestoreChannels(cntx)
 			}
 			igd.PortChannelMap.Range(printPortChannel)
 			logger.Infow(ctx, "Group Device Restored", log.Fields{"IGD": igd})
@@ -558,20 +559,20 @@
 }
 
 // WriteToDb is utility to write Igmp Group Info to database
-func (ig *IgmpGroup) WriteToDb() error {
+func (ig *IgmpGroup) WriteToDb(cntx context.Context) error {
         ig.Version = database.PresentVersionMap[database.IgmpGroupPath]
         b, err := json.Marshal(ig)
         if err != nil {
                 return err
         }
-        if err1 := db.PutIgmpGroup(ig.getKey(), string(b)); err1 != nil {
+        if err1 := db.PutIgmpGroup(cntx, ig.getKey(), string(b)); err1 != nil {
                 return err1
         }
         return nil
 }
 
 // UpdateIgmpGroup : When the pending group is allocated to new
-func (ig *IgmpGroup) UpdateIgmpGroup(oldKey, newKey string) {
+func (ig *IgmpGroup) UpdateIgmpGroup(cntx context.Context, oldKey, newKey string) {
 
         //If the group is allocated to same McastGroup, no need to update the
         //IgmpGroups map
@@ -581,15 +582,15 @@
         logger.Infow(ctx, "Updating Igmp Group with new MVP Group Info", log.Fields{"OldKey": oldKey, "NewKey": newKey, "GroupID": ig.GroupID})
 
         GetApplication().IgmpGroups.Delete(oldKey)
-        _ = db.DelIgmpGroup(oldKey)
+        _ = db.DelIgmpGroup(cntx, oldKey)
 
         GetApplication().IgmpGroups.Store(newKey, ig)
-        if err := ig.WriteToDb(); err != nil {
+        if err := ig.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
         }
 }
 
-func (ig *IgmpGroup) removeExpiredGroupFromDevice() {
+func (ig *IgmpGroup) removeExpiredGroupFromDevice(cntx context.Context) {
         ig.PendingPoolLock.Lock()
         defer ig.PendingPoolLock.Unlock()
 
@@ -613,13 +614,13 @@
                 // Remove the group entry from device and remove the IgmpDev Obj
                 // from IgmpGrp Pending pool
                 if groupExistsInPendingPool {
-                        ig.DeleteIgmpGroupDevice(device)
+                        ig.DeleteIgmpGroupDevice(cntx, device)
                 }
         }
 }
 
 //DeleteIgmpGroupDevice - removes the IgmpGroupDevice obj from IgmpGroup and database
-func (ig *IgmpGroup) DeleteIgmpGroupDevice(device string) {
+func (ig *IgmpGroup) DeleteIgmpGroupDevice(cntx context.Context, device string) {
 
         logger.Infow(ctx, "Deleting IgmpGroupDevice from IG Pending Pool", log.Fields{"Device": device, "GroupID": ig.GroupID, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String(), "PendingDevices": len(ig.Devices)})
 
@@ -627,24 +628,24 @@
         igd.DelMcGroup(true)
         delete(ig.Devices, device)
         delete(ig.PendingGroupForDevice, device)
-        _ = db.DelIgmpDevice(igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device)
+        _ = db.DelIgmpDevice(cntx, igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device)
 
         //If the group is not associated to any other device, then the entire Igmp Group obj itself can be removed
         if ig.NumDevicesAll() == 0 {
                 logger.Infow(ctx, "Deleting IgmpGroup as all pending groups has expired", log.Fields{"Device": device, "GroupID": ig.GroupID, "GroupName": ig.GroupName, "GroupAddr": ig.GroupAddr.String(), "PendingDevices": len(ig.Devices)})
-                GetApplication().DelIgmpGroup(ig)
+                GetApplication().DelIgmpGroup(cntx, ig)
                 return
         }
-        if err := ig.WriteToDb(); err != nil {
+        if err := ig.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
         }
 }
 
 // DelIgmpGroup deletes all devices for the provided igmp group
-func (ig *IgmpGroup) DelIgmpGroup() {
+func (ig *IgmpGroup) DelIgmpGroup(cntx context.Context) {
         logger.Infow(ctx, "Deleting All Device for Group", log.Fields{"Group": ig.GroupName})
         for _, igd := range ig.Devices {
-                ig.DelIgmpGroupDevice(igd)
+                ig.DelIgmpGroupDevice(cntx, igd)
         }
-        GetApplication().DelIgmpGroup(ig)
+        GetApplication().DelIgmpGroup(cntx, ig)
 }
diff --git a/internal/pkg/application/igmpgroupchannel.go b/internal/pkg/application/igmpgroupchannel.go
index ed39d23..d17e209 100644
--- a/internal/pkg/application/igmpgroupchannel.go
+++ b/internal/pkg/application/igmpgroupchannel.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 
@@ -77,10 +78,10 @@
 }
 
 // RestorePorts to restore ports
-func (igc *IgmpGroupChannel) RestorePorts() {
+func (igc *IgmpGroupChannel) RestorePorts(cntx context.Context) {
 
-        igc.migrateIgmpPorts()
-        ports, _ := db.GetIgmpRcvrs(igc.Mvlan, igc.GroupAddr, igc.Device)
+        igc.migrateIgmpPorts(cntx)
+        ports, _ := db.GetIgmpRcvrs(cntx, igc.Mvlan, igc.GroupAddr, igc.Device)
         for _, port := range ports {
                 b, ok := port.Value.([]byte)
                 if !ok {
@@ -94,18 +95,18 @@
                         logger.Warn(ctx, "Failed to decode port from DB")
                 }
         }
-        if err := igc.WriteToDb(); err != nil {
+        if err := igc.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
         }
 }
 
 // WriteToDb is utility to write IGMPGroupChannel Info to database
-func (igc *IgmpGroupChannel) WriteToDb() error {
+func (igc *IgmpGroupChannel) WriteToDb(cntx context.Context) error {
         b, err := json.Marshal(igc)
         if err != nil {
                 return err
         }
-        if err1 := db.PutIgmpChannel(igc.Mvlan, igc.GroupName, igc.Device, igc.GroupAddr, string(b)); err1 != nil {
+        if err1 := db.PutIgmpChannel(cntx, igc.Mvlan, igc.GroupName, igc.Device, igc.GroupAddr, string(b)); err1 != nil {
                 return err1
         }
         logger.Info(ctx, "IGC Updated")
@@ -246,7 +247,7 @@
 // ProcessSources process the received list of either included sources or the excluded sources
 // The return value indicate sif the group is modified and needs to be informed
 // to the upstream multicast servers
-func (igc *IgmpGroupChannel) ProcessSources(port string, ip []net.IP, incl bool) (bool, bool) {
+func (igc *IgmpGroupChannel) ProcessSources(cntx context.Context, port string, ip []net.IP, incl bool) (bool, bool) {
         groupChanged := false
         groupExclUpdated := false
         receiverSrcListEmpty := false
@@ -341,7 +342,7 @@
                 }
                 groupExclUpdated = igc.UpdateExclSource(ip)
         }
-        if err := igp.WriteToDb(igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
+        if err := igp.WriteToDb(cntx, igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
                 logger.Errorw(ctx, "Igmp group port Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
         }
         return (groupChanged || groupExclUpdated), receiverSrcListEmpty
@@ -359,7 +360,7 @@
 // AddReceiver add the receiver to the device and perform other actions such as adding the group
 // to the physical device, add members, add flows to point the MC packets to the
 // group. Also, send a IGMP report upstream if there is a change in the group
-func (igc *IgmpGroupChannel) AddReceiver(port string, group *layers.IGMPv3GroupRecord, cvlan uint16, pbit uint8) bool {
+func (igc *IgmpGroupChannel) AddReceiver(cntx context.Context, port string, group *layers.IGMPv3GroupRecord, cvlan uint16, pbit uint8) bool {
 
         var igp *IgmpGroupPort
         var groupModified = false
@@ -409,7 +410,7 @@
                         logger.Debugw(ctx, "New IGMP receiver", log.Fields{"Group": igc.GroupAddr.String(), "Port": port})
                         if len(igc.NewReceivers) == 1 && len(igc.CurReceivers) == 0 {
                                 groupModified = true
-                                igc.AddMcFlow()
+                                igc.AddMcFlow(cntx)
                                 logger.Debugw(ctx, "Added New Flow", log.Fields{"Group": igc.GroupAddr.String(), "Port": port})
                         }
                         if !incl {
@@ -419,7 +420,7 @@
         }
 
         // Process the include/exclude list which may end up modifying the group
-        if change, _ := igc.ProcessSources(port, ip, incl); change {
+        if change, _ := igc.ProcessSources(cntx, port, ip, incl); change {
                 groupModified = true
         }
         igc.ProcessMode(port, incl)
@@ -435,10 +436,10 @@
 
         logger.Debugw(ctx, "Channel Receiver Added", log.Fields{"Group Channel": igc.GroupAddr, "Group Port": igp})
 
-        if err := igc.WriteToDb(); err != nil {
+        if err := igc.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
         }
-        if err := igp.WriteToDb(igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
+        if err := igp.WriteToDb(cntx, igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
                 logger.Errorw(ctx, "Igmp group port Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
         }
         return isNewReceiver
@@ -446,7 +447,7 @@
 
 // DelReceiver is called when Query expiry happened for a receiver. This removes the receiver from the
 // the group
-func (igc *IgmpGroupChannel) DelReceiver(port string, incl bool, srcList []net.IP) bool {
+func (igc *IgmpGroupChannel) DelReceiver(cntx context.Context, port string, incl bool, srcList []net.IP) bool {
         // The receiver may exist either in NewReceiver list or
         // the CurReceivers list. Find and remove it from either
         // of the lists.
@@ -455,7 +456,7 @@
         logger.Debugw(ctx, "Current Receivers", log.Fields{"Current": igc.CurReceivers})
 
         receiversUpdated := false
-        groupModified, receiverSrcListEmpty := igc.ProcessSources(port, srcList, incl)
+        groupModified, receiverSrcListEmpty := igc.ProcessSources(cntx, port, srcList, incl)
 
         if len(srcList) == 0 || len(igc.IncludeList) == 0 || receiverSrcListEmpty {
                 if igp, ok := igc.NewReceivers[port]; ok {
@@ -478,11 +479,11 @@
                                 return false
                         }
                 }
-                _ = db.DelIgmpRcvr(igc.Mvlan, igc.GroupAddr, igc.Device, port)
+                _ = db.DelIgmpRcvr(cntx, igc.Mvlan, igc.GroupAddr, igc.Device, port)
         }
 
         if igc.NumReceivers() == 0 {
-                igc.DelMcFlow()
+                igc.DelMcFlow(cntx)
                 mvp := GetApplication().GetMvlanProfileByTag(igc.Mvlan)
                 /* If proxy is configured and NumReceivers is 0, then we can reset the igc src list so that we send leave */
                 if _, ok := mvp.Proxy[igc.GroupName]; ok {
@@ -496,7 +497,7 @@
                 igc.SendReport(false)
                 logger.Infow(ctx, "Updated SourceList for Channel", log.Fields{"Current": igc.CurReceivers, "New": igc.NewReceivers})
         }
-        if err := igc.WriteToDb(); err != nil {
+        if err := igc.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
         }
         logger.Infow(ctx, "Updated Receiver info for Channel", log.Fields{"Current": igc.CurReceivers, "New": igc.NewReceivers})
@@ -505,11 +506,11 @@
 }
 
 // DelAllReceivers deletes all receiver for the provided igmp device
-func (igc *IgmpGroupChannel) DelAllReceivers() {
+func (igc *IgmpGroupChannel) DelAllReceivers(cntx context.Context) {
         logger.Infow(ctx, "Deleting All Receiver for Channel", log.Fields{"Device": igc.Device, "Channel": igc.GroupAddr.String()})
-        _ = db.DelAllIgmpRcvr(igc.Mvlan, igc.GroupAddr, igc.Device)
+        _ = db.DelAllIgmpRcvr(cntx, igc.Mvlan, igc.GroupAddr, igc.Device)
         igc.Exclude = 0
-        igc.DelMcFlow()
+        igc.DelMcFlow(cntx)
         igc.SendLeaveToServer()
         logger.Infow(ctx, "MC Flow deleted and Leave sent", log.Fields{"Channel": igc.GroupAddr.String(), "Device": igc.Device})
 }
@@ -581,18 +582,18 @@
 }
 
 // AddMcFlow adds flow to the device when the first receiver joins
-func (igc *IgmpGroupChannel) AddMcFlow() {
+func (igc *IgmpGroupChannel) AddMcFlow(cntx context.Context) {
         flow, err := igc.BuildMcFlow()
         if err != nil {
                 logger.Warnw(ctx, "MC Flow Build Failed", log.Fields{"Reason": err.Error()})
                 return
         }
         port, _ := GetApplication().GetNniPort(igc.Device)
-        _ = cntlr.GetController().AddFlows(port, igc.Device, flow)
+        _ = cntlr.GetController().AddFlows(cntx, port, igc.Device, flow)
 }
 
 // DelMcFlow deletes flow from the device when the last receiver leaves
-func (igc *IgmpGroupChannel) DelMcFlow() {
+func (igc *IgmpGroupChannel) DelMcFlow(cntx context.Context) {
         flow, err := igc.BuildMcFlow()
         if err != nil {
                 logger.Warnw(ctx, "MC Flow Build Failed", log.Fields{"Reason": err.Error()})
@@ -603,7 +604,7 @@
 
         if mvpIntf, _ := GetApplication().MvlanProfilesByTag.Load(igc.Mvlan); mvpIntf != nil {
                 mvp := mvpIntf.(*MvlanProfile)
-                err := mvp.DelFlows(device, flow)
+                err := mvp.DelFlows(cntx, device, flow)
                 if err != nil {
                         logger.Warnw(ctx, "Delering IGMP Flow for device failed ", log.Fields{"Device": device, "err": err})
                 }
diff --git a/internal/pkg/application/igmpgroupdevice.go b/internal/pkg/application/igmpgroupdevice.go
index 07c2f82..0d59747 100644
--- a/internal/pkg/application/igmpgroupdevice.go
+++ b/internal/pkg/application/igmpgroupdevice.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 	"sync"
@@ -103,12 +104,12 @@
 
 // IgmpGroupDeviceReInit is re-initializer for a device. The default IGMP version is set to 3
 // as the protocol defines the way to manage backward compatibility
-func (igd *IgmpGroupDevice) IgmpGroupDeviceReInit(ig *IgmpGroup) {
+func (igd *IgmpGroupDevice) IgmpGroupDeviceReInit(cntx context.Context, ig *IgmpGroup) {
 
         logger.Infow(ctx, "Reinitialize Igmp Group Device", log.Fields{"Device": igd.Device, "GroupID": ig.GroupID, "OldName": igd.GroupName, "Name": ig.GroupName, "OldAddr": igd.GroupAddr.String(), "GroupAddr": ig.GroupAddr.String()})
 
         if (igd.GroupName != ig.GroupName) || !igd.GroupAddr.Equal(ig.GroupAddr) {
-                _ = db.DelIgmpDevice(igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device)
+                _ = db.DelIgmpDevice(cntx, igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device)
                 igd.GroupName = ig.GroupName
                 igd.GroupAddr = ig.GroupAddr
         }
@@ -126,7 +127,7 @@
                 mcastCfg.IgmpGroupDevices.Store(ig.GroupID, igd)
                 logger.Debugw(ctx, "Igd added to mcast config", log.Fields{"mvlan": mcastCfg.MvlanProfileID, "groupId": ig.GroupID})
         }
-        if err := igd.WriteToDb(); err != nil {
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
 }
@@ -144,24 +145,24 @@
 }
 
 // updateGroupName to update the group name
-func (igd *IgmpGroupDevice) updateGroupName(newGroupName string) {
+func (igd *IgmpGroupDevice) updateGroupName(cntx context.Context, newGroupName string) {
 
         oldName := igd.GroupName
         igd.GroupName = newGroupName
         updateGroupName := func(key, value interface{}) bool {
                 igc := value.(*IgmpGroupChannel)
                 igc.GroupName = newGroupName
-                if err := igc.WriteToDb(); err != nil {
+                if err := igc.WriteToDb(cntx); err != nil {
                         logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
                 }
-                _ = db.DelIgmpChannel(igc.Mvlan, oldName, igc.Device, igc.GroupAddr)
+                _ = db.DelIgmpChannel(cntx, igc.Mvlan, oldName, igc.Device, igc.GroupAddr)
                 return true
         }
         igd.GroupChannels.Range(updateGroupName)
-        if err := igd.WriteToDb(); err != nil {
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
-        _ = db.DelIgmpDevice(igd.Mvlan, oldName, igd.GroupAddr, igd.Device)
+        _ = db.DelIgmpDevice(cntx, igd.Mvlan, oldName, igd.GroupAddr, igd.Device)
 }
 
 // NewIgmpGroupDeviceFromBytes is to create the IGMP group port from a byte slice
@@ -184,14 +185,14 @@
 }
 
 // RestoreChannel to restore channel
-func (igd *IgmpGroupDevice) RestoreChannel(igmpGroupChannel []byte) {
+func (igd *IgmpGroupDevice) RestoreChannel(cntx context.Context, igmpGroupChannel []byte) {
 
         if igc, err := NewIgmpGroupChannelFromBytes(igmpGroupChannel); err == nil {
                 igc.ServVersion = igd.ServVersion
                 igc.IgmpProxyIP = &igd.IgmpProxyIP
                 igc.proxyCfg = &igd.proxyCfg
                 igd.GroupChannels.Store(igc.GroupAddr.String(), igc)
-                igc.RestorePorts()
+                igc.RestorePorts(cntx)
 
                 for port, igp := range igc.NewReceivers {
                         ipsList := []net.IP{}
@@ -215,10 +216,10 @@
 }
 
 // RestoreChannels to restore channels
-func (igd *IgmpGroupDevice) RestoreChannels() {
+func (igd *IgmpGroupDevice) RestoreChannels(cntx context.Context) {
 
-        igd.migrateIgmpChannels()
-        channels, _ := db.GetIgmpChannels(igd.Mvlan, igd.GroupName, igd.Device)
+        igd.migrateIgmpChannels(cntx)
+        channels, _ := db.GetIgmpChannels(cntx, igd.Mvlan, igd.GroupName, igd.Device)
         for _, channel := range channels {
 
                 b, ok := channel.Value.([]byte)
@@ -226,19 +227,19 @@
                         logger.Warn(ctx, "The value type is not []byte")
                         continue
                 }
-                igd.RestoreChannel(b)
+                igd.RestoreChannel(cntx, b)
         }
 
 }
 
 
 // WriteToDb is utility to write IGMP Group Device Info to the database
-func (igd *IgmpGroupDevice) WriteToDb() error {
+func (igd *IgmpGroupDevice) WriteToDb(cntx context.Context) error {
         b, err := json.Marshal(igd)
         if err != nil {
                 return err
         }
-        if err1 := db.PutIgmpDevice(igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device, string(b)); err1 != nil {
+        if err1 := db.PutIgmpDevice(cntx, igd.Mvlan, igd.GroupName, igd.GroupAddr, igd.Device, string(b)); err1 != nil {
                 return err1
         }
         logger.Info(ctx, "IGD Updated")
@@ -332,7 +333,7 @@
 // AddReceiver add the receiver to the device and perform other actions such as adding the group
 // to the physical device, add members, add flows to point the MC packets to the
 // group. Also, send a IGMP report upstream if there is a change in the group
-func (igd *IgmpGroupDevice) AddReceiver(port string, groupAddr net.IP,
+func (igd *IgmpGroupDevice) AddReceiver(cntx context.Context, port string, groupAddr net.IP,
         group *layers.IGMPv3GroupRecord, version uint8, cvlan uint16, pbit uint8, ponPortID uint32) {
 
         var igc *IgmpGroupChannel
@@ -347,11 +348,11 @@
         }
 
         if !igd.GroupInstalled {
-                igd.AddNewReceiver(port, groupAddr, group, cvlan, pbit, ponPortID)
+                igd.AddNewReceiver(cntx, port, groupAddr, group, cvlan, pbit, ponPortID)
                 return
         }
 
-        isNewReceiver := igc.AddReceiver(port, group, cvlan, pbit)
+        isNewReceiver := igc.AddReceiver(cntx, port, group, cvlan, pbit)
         if isNewReceiver {
                 ipsList := []net.IP{}
                 ipsIntf, _ := igd.PortChannelMap.Load(port)
@@ -368,13 +369,13 @@
                         igd.ModMcGroup()
                 }
         }
-        if err := igd.WriteToDb(); err != nil {
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
 }
 
 // AddNewReceiver to add new receiver
-func (igd *IgmpGroupDevice) AddNewReceiver(port string, groupAddr net.IP, group *layers.IGMPv3GroupRecord, cvlan uint16, pbit uint8, ponPortID uint32) {
+func (igd *IgmpGroupDevice) AddNewReceiver(cntx context.Context, port string, groupAddr net.IP, group *layers.IGMPv3GroupRecord, cvlan uint16, pbit uint8, ponPortID uint32) {
 
         logger.Debugw(ctx, "Adding New Device Receiver", log.Fields{"Channel": groupAddr, "Port": port, "Device": igd.Device})
         igcIntf, _ := igd.GroupChannels.Load(groupAddr.String())
@@ -395,8 +396,8 @@
         logger.Debugw(ctx, "Port Channel Updated", log.Fields{"Port": port, "NewChannelList": ipsList, "Addr": groupAddr})
 
         igd.AddMcGroup()
-        igc.AddReceiver(port, group, cvlan, pbit)
-        if err := igd.WriteToDb(); err != nil {
+        igc.AddReceiver(cntx, port, group, cvlan, pbit)
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
 }
@@ -415,7 +416,7 @@
 
 // DelReceiver is called when Query expiry happened for a receiver. This removes the receiver from the
 // the group
-func (igd *IgmpGroupDevice) DelReceiver(groupAddr net.IP, port string, group *layers.IGMPv3GroupRecord, ponPortID uint32) {
+func (igd *IgmpGroupDevice) DelReceiver(cntx context.Context, groupAddr net.IP, port string, group *layers.IGMPv3GroupRecord, ponPortID uint32) {
 
         logger.Debugw(ctx, "Deleting Receiver for Device", log.Fields{"port": port, "GroupIP": groupAddr.String()})
         var igc *IgmpGroupChannel
@@ -437,12 +438,12 @@
                 return
         }
         igc = igcIntf.(*IgmpGroupChannel)
-        if ok := igc.DelReceiver(port, incl, srcList); !ok {
+        if ok := igc.DelReceiver(cntx, port, incl, srcList); !ok {
                 return
         }
 
         if igc.NumReceivers() == 0 {
-                igd.DelIgmpGroupChannel(igc)
+                igd.DelIgmpGroupChannel(cntx, igc)
         }
         igd.DelPortFromChannel(port, groupAddr)
         isGroupModified := igd.RemoveChannelFromChannelsPerPon(port, groupAddr, ponPortID)
@@ -451,14 +452,14 @@
         if isGroupModified {
                 igd.ModMcGroup()
         }
-        if err := igd.WriteToDb(); err != nil {
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
 }
 
 // DelChannelReceiver is called when Query expiry happened for a receiver. This removes the receiver from the
 // the group
-func (igd *IgmpGroupDevice) DelChannelReceiver(groupAddr net.IP) map[string]*IgmpGroupPort {
+func (igd *IgmpGroupDevice) DelChannelReceiver(cntx context.Context, groupAddr net.IP) map[string]*IgmpGroupPort {
 
         portsRemoved := make(map[string]*IgmpGroupPort)
         groupModified := false
@@ -471,7 +472,7 @@
         igc := igcIntf.(*IgmpGroupChannel)
 
         for port, igp := range igc.NewReceivers {
-                _ = db.DelIgmpRcvr(igc.Mvlan, igc.GroupAddr, igc.Device, port) //TODO: Y not here
+                _ = db.DelIgmpRcvr(cntx, igc.Mvlan, igc.GroupAddr, igc.Device, port) //TODO: Y not here
                 igd.DelPortFromChannel(port, igc.GroupAddr)
                 ponPortID := GetApplication().GetPonPortID(igd.Device, port)
                 groupModified = igd.RemoveChannelFromChannelsPerPon(port, igc.GroupAddr, ponPortID)
@@ -479,7 +480,7 @@
                 portsRemoved[port] = igp
         }
         for port, igp := range igc.CurReceivers {
-                _ = db.DelIgmpRcvr(igc.Mvlan, igc.GroupAddr, igc.Device, port)
+                _ = db.DelIgmpRcvr(cntx, igc.Mvlan, igc.GroupAddr, igc.Device, port)
                 igd.DelPortFromChannel(port, igc.GroupAddr)
                 ponPortID := GetApplication().GetPonPortID(igd.Device, port)
                 groupModified = igd.RemoveChannelFromChannelsPerPon(port, igc.GroupAddr, ponPortID)
@@ -487,15 +488,15 @@
                 portsRemoved[port] = igp
         }
 
-        igc.DelMcFlow()
-        igd.DelIgmpGroupChannel(igc)
+        igc.DelMcFlow(cntx)
+        igd.DelIgmpGroupChannel(cntx, igc)
         igc.Exclude = 0
         igc.SendLeaveToServer()
 
         if groupModified {
                 igd.ModMcGroup()
         }
-        if err := igd.WriteToDb(); err != nil {
+        if err := igd.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device, "GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
         }
         logger.Debugw(ctx, "Deleted the receiver Flow", log.Fields{"Num Receivers": igc.NumReceivers()})
@@ -503,12 +504,12 @@
 }
 
 // DelIgmpGroupChannel to delete igmp group channel
-func (igd *IgmpGroupDevice) DelIgmpGroupChannel(igc *IgmpGroupChannel) {
+func (igd *IgmpGroupDevice) DelIgmpGroupChannel(cntx context.Context, igc *IgmpGroupChannel) {
 
         if igc.NumReceivers() != 0 {
-                igc.DelAllReceivers()
+                igc.DelAllReceivers(cntx)
         }
-        _ = db.DelIgmpChannel(igc.Mvlan, igc.GroupName, igc.Device, igc.GroupAddr)
+        _ = db.DelIgmpChannel(cntx, igc.Mvlan, igc.GroupName, igc.Device, igc.GroupAddr)
         igd.GroupChannels.Delete(igc.GroupAddr.String())
         logger.Infow(ctx, "Deleted the Channel from Device", log.Fields{"Channel": igc.GroupAddr.String()})
         isLenZero := true
@@ -554,24 +555,24 @@
 }
 
 // DelAllChannels deletes all receiver for the provided igmp device
-func (igd *IgmpGroupDevice) DelAllChannels() {
+func (igd *IgmpGroupDevice) DelAllChannels(cntx context.Context) {
         logger.Infow(ctx, "Deleting All Channel for Device", log.Fields{"Device": igd.Device, "Group": igd.GroupName})
         delGroupChannels := func(key interface{}, value interface{}) bool {
                 igc := value.(*IgmpGroupChannel)
-                igd.DelIgmpGroupChannel(igc)
+                igd.DelIgmpGroupChannel(cntx, igc)
                 return true
         }
         igd.GroupChannels.Range(delGroupChannels)
 }
 
 // ProcessQuery process query received from the upstream IGMP server
-func (igd *IgmpGroupDevice) ProcessQuery(groupAddr net.IP, ver uint8) {
+func (igd *IgmpGroupDevice) ProcessQuery(cntx context.Context, groupAddr net.IP, ver uint8) {
         logger.Debugw(ctx, "Received Query From Server", log.Fields{"Version": ver})
         if ver != *igd.ServVersion {
                 igd.ServVersionExpiry = time.Now().Add(time.Duration(2*igd.proxyCfg.KeepAliveInterval) * time.Second)
                 *igd.ServVersion = ver
                 mvp := GetApplication().GetMvlanProfileByTag(igd.Mvlan)
-                if err := mvp.WriteToDb(); err != nil {
+                if err := mvp.WriteToDb(cntx); err != nil {
                         logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": mvp.Name})
                 }
         }
@@ -676,7 +677,7 @@
 
 // QueryExpiry processes query expiry. Upon expiry, take stock of the situation
 // add either retain/release the group based on number of receivers left
-func (igd *IgmpGroupDevice) QueryExpiry() {
+func (igd *IgmpGroupDevice) QueryExpiry(cntx context.Context) {
         logger.Debugw(ctx, "Query Expiry", log.Fields{"Device": igd.Device})
 
 
@@ -695,7 +696,7 @@
                         logger.Debugw(ctx, "Expired Member Port State", log.Fields{"state": state})
                         ponPortID := GetApplication().GetPonPortID(igd.Device, portKey)
                         if err == nil && state == cntlr.PortStateDown {
-                                igd.DelReceiver(igc.GroupAddr, portKey, nil, ponPortID)
+                                igd.DelReceiver(cntx, igc.GroupAddr, portKey, nil, ponPortID)
                         }
 
                         port.QueryTimeoutCount++
@@ -703,10 +704,10 @@
                         if port.QueryTimeoutCount >= (*igc.proxyCfg).KeepAliveCount {
                                 logger.Errorw(ctx, "Expiry Timeout count exceeded. Trigger delete receiver", log.Fields{"PortKey": portKey,
                                         "GroupAddr": igc.GroupAddr, "Count": port.QueryTimeoutCount})
-                                igd.DelReceiver(igc.GroupAddr, portKey, nil, ponPortID)
+                                igd.DelReceiver(cntx, igc.GroupAddr, portKey, nil, ponPortID)
                                 SendQueryExpiredEventGroupSpecific(portKey, igd, igc)
                         } else {
-                                _ = port.WriteToDb(igc.Mvlan, igc.GroupAddr, igc.Device)
+                                _ = port.WriteToDb(cntx, igc.Mvlan, igc.GroupAddr, igc.Device)
                         }
                 }
                 return true
diff --git a/internal/pkg/application/igmpport.go b/internal/pkg/application/igmpport.go
index 5fe88e0..b22b901 100644
--- a/internal/pkg/application/igmpport.go
+++ b/internal/pkg/application/igmpport.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 
@@ -100,12 +101,12 @@
 }
 
 // WriteToDb is utility to write IGMP Group Port Info to database
-func (igp *IgmpGroupPort) WriteToDb(mvlan of.VlanType, gip net.IP, device string) error {
+func (igp *IgmpGroupPort) WriteToDb(cntx context.Context, mvlan of.VlanType, gip net.IP, device string) error {
         b, err := json.Marshal(igp)
         if err != nil {
                 return err
         }
-        if err1 := db.PutIgmpRcvr(mvlan, gip, device, igp.Port, string(b)); err1 != nil {
+        if err1 := db.PutIgmpRcvr(cntx, mvlan, gip, device, igp.Port, string(b)); err1 != nil {
                 return err1
         }
         return nil
diff --git a/internal/pkg/application/igmpprofiles.go b/internal/pkg/application/igmpprofiles.go
index b5b24d4..192c8e2 100644
--- a/internal/pkg/application/igmpprofiles.go
+++ b/internal/pkg/application/igmpprofiles.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"encoding/json"
 	"errors"
 	"net"
@@ -157,7 +158,7 @@
 }
 
 // WriteToDb is utility to write Mvlan Profile Info to database
-func (mvp *MvlanProfile) WriteToDb() error {
+func (mvp *MvlanProfile) WriteToDb(cntx context.Context) error {
 
         if mvp.DeleteInProgress {
                 logger.Warnw(ctx, "Skipping Redis Update for MvlanProfile, MvlanProfile delete in progress", log.Fields{"Mvlan": mvp.Mvlan})
@@ -169,7 +170,7 @@
         if err != nil {
                 return err
         }
-        if err1 := db.PutMvlan(uint16(mvp.Mvlan), string(b)); err1 != nil {
+        if err1 := db.PutMvlan(cntx, uint16(mvp.Mvlan), string(b)); err1 != nil {
                 return err1
         }
         return nil
@@ -288,12 +289,12 @@
 }
 
 // DelFromDb to delere mvlan from database
-func (mvp *MvlanProfile) DelFromDb() {
-        _ = db.DelMvlan(uint16(mvp.Mvlan))
+func (mvp *MvlanProfile) DelFromDb(cntx context.Context) {
+        _ = db.DelMvlan(cntx, uint16(mvp.Mvlan))
 }
 
 //DelFlows - Triggers flow deletion after registering for flow indication event
-func (mvp *MvlanProfile) DelFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (mvp *MvlanProfile) DelFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
         mvp.mvpFlowLock.Lock()
         defer mvp.mvpFlowLock.Unlock()
 
@@ -316,14 +317,14 @@
                 flowMap[cookie] = true
                 mvp.PendingDeleteFlow[device.Name] = flowMap
         }
-        if err := mvp.WriteToDb(); err != nil {
+        if err := mvp.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": mvp.Name})
         }
-        return cntlr.GetController().DelFlows(device.NniPort, device.Name, flow)
+        return cntlr.GetController().DelFlows(cntx, device.NniPort, device.Name, flow)
 }
 
 //FlowRemoveSuccess - Process flow success indication
-func (mvp *MvlanProfile) FlowRemoveSuccess(cookie string, device string) {
+func (mvp *MvlanProfile) FlowRemoveSuccess(cntx context.Context, cookie string, device string) {
         mvp.mvpFlowLock.Lock()
         defer mvp.mvpFlowLock.Unlock()
 
@@ -333,7 +334,7 @@
                 delete(mvp.PendingDeleteFlow[device], cookie)
         }
 
-        if err := mvp.WriteToDb(); err != nil {
+        if err := mvp.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": mvp.Name})
         }
 }
@@ -394,7 +395,7 @@
 }
 
 //pushIgmpMcastFlows - Adds all IGMP related flows (generic DS flow & static group flows)
-func (mvp *MvlanProfile) pushIgmpMcastFlows(OLTSerialNum string) {
+func (mvp *MvlanProfile) pushIgmpMcastFlows(cntx context.Context, OLTSerialNum string) {
 
         mvp.mvpLock.RLock()
         defer mvp.mvpLock.RUnlock()
@@ -416,7 +417,7 @@
                 logger.Infow(ctx, "NNI Port Status is: UP & Vlan Enabled", log.Fields{"Device": d, "port": p})
 
                 //Push Igmp DS Control Flows
-                err := mvp.ApplyIgmpDSFlowForMvp(d.Name)
+                err := mvp.ApplyIgmpDSFlowForMvp(cntx, d.Name)
                 if err != nil {
                         logger.Errorw(ctx, "DS IGMP Flow Add Failed for device",
                                 log.Fields{"Reason": err.Error(), "device": d.Name})
@@ -424,14 +425,14 @@
 
                 //Trigger Join for static channels
                 if channelList, containsStatic := mvp.getAllStaticChannels(); containsStatic {
-                        mvp.ProcessStaticGroup(d.Name, channelList, true)
+                        mvp.ProcessStaticGroup(cntx, d.Name, channelList, true)
                 } else {
                         logger.Infow(ctx, "No Static Channels Present", log.Fields{"mvp": mvp.Name, "Mvlan": mvp.Mvlan})
                 }
         }
 }
 //removeIgmpMcastFlows - Removes all IGMP related flows (generic DS flow & static group flows)
-func (mvp *MvlanProfile) removeIgmpMcastFlows(oltSerialNum string) {
+func (mvp *MvlanProfile) removeIgmpMcastFlows(cntx context.Context, oltSerialNum string) {
 
         mvp.mvpLock.RLock()
         defer mvp.mvpLock.RUnlock()
@@ -446,7 +447,7 @@
 
                         //Trigger Leave for static channels
                         if channelList, containsStatic := mvp.getAllStaticChannels(); containsStatic {
-                                mvp.ProcessStaticGroup(d.Name, channelList, false)
+                                mvp.ProcessStaticGroup(cntx, d.Name, channelList, false)
                         } else {
                                 logger.Infow(ctx, "No Static Channels Present", log.Fields{"mvp": mvp.Name, "Mvlan": mvp.Mvlan})
                         }
@@ -456,16 +457,16 @@
                                 ig := value.(*IgmpGroup)
                                 if ig.Mvlan == mvp.Mvlan {
                                         igd := ig.Devices[d.Name]
-                                        ig.DelIgmpGroupDevice(igd)
+                                        ig.DelIgmpGroupDevice(cntx, igd)
                                         if ig.NumDevicesActive() == 0 {
-                                                GetApplication().DelIgmpGroup(ig)
+                                                GetApplication().DelIgmpGroup(cntx, ig)
                                         }
                                 }
                                 return true
                         })
 
                         //Remove DS Igmp trap flow
-                        err := mvp.RemoveIgmpDSFlowForMvp(d.Name)
+                        err := mvp.RemoveIgmpDSFlowForMvp(cntx, d.Name)
                         if err != nil {
                                 logger.Errorw(ctx, "DS IGMP Flow Del Failed", log.Fields{"Reason": err.Error(), "device": d.Name})
                         }
@@ -474,7 +475,7 @@
 }
 
 // ApplyIgmpDSFlowForMvp to apply Igmp DS flow for mvlan.
-func (mvp *MvlanProfile) ApplyIgmpDSFlowForMvp(device string) error {
+func (mvp *MvlanProfile) ApplyIgmpDSFlowForMvp(cntx context.Context, device string) error {
         va := GetApplication()
         dIntf, ok := va.DevicesDisc.Load(device)
         if !ok {
@@ -487,7 +488,7 @@
         if !ok || !flowAlreadyApplied {
                 flows, err := mvp.BuildIgmpDSFlows(device)
                 if err == nil {
-                        err = cntlr.GetController().AddFlows(d.NniPort, device, flows)
+                        err = cntlr.GetController().AddFlows(cntx, d.NniPort, device, flows)
                         if err != nil {
                                 logger.Warnw(ctx, "Configuring IGMP Flow for device failed ", log.Fields{"Device": device, "err": err})
                                 return err
@@ -504,7 +505,7 @@
 }
 
 // RemoveIgmpDSFlowForMvp to remove Igmp DS flow for mvlan.
-func (mvp *MvlanProfile) RemoveIgmpDSFlowForMvp(device string) error {
+func (mvp *MvlanProfile) RemoveIgmpDSFlowForMvp(cntx context.Context, device string) error {
 
         va := GetApplication()
         mvlan := mvp.Mvlan
@@ -522,7 +523,7 @@
         if err == nil {
                 flows.ForceAction = true
 
-                err = mvp.DelFlows(d, flows)
+                err = mvp.DelFlows(cntx, d, flows)
                 if err != nil {
                         logger.Warnw(ctx, "De-Configuring IGMP Flow for device failed ", log.Fields{"Device": device, "err": err})
                         return err
@@ -572,7 +573,7 @@
 }
 
 //updateStaticGroups - Generates static joins & leaves for newly added and removed static channels respectively
-func (mvp *MvlanProfile) updateStaticGroups(deviceID string, added []net.IP, removed []net.IP) {
+func (mvp *MvlanProfile) updateStaticGroups(cntx context.Context, deviceID string, added []net.IP, removed []net.IP) {
 
         //Update static group configs for all associated devices
         updateGroups := func(key interface{}, value interface{}) bool {
@@ -583,8 +584,8 @@
                         return true
                 }
                 //TODO if mvp.IsChannelBasedGroup {
-                mvp.ProcessStaticGroup(d.Name, added, true)
-                mvp.ProcessStaticGroup(d.Name, removed, false)
+                mvp.ProcessStaticGroup(cntx, d.Name, added, true)
+                mvp.ProcessStaticGroup(cntx, d.Name, removed, false)
                 //}
                 return true
         }
@@ -598,7 +599,7 @@
 }
 
 //updateDynamicGroups - Generates joins with updated sources for existing channels
-func (mvp *MvlanProfile) updateDynamicGroups(deviceID string, added []net.IP, removed []net.IP) {
+func (mvp *MvlanProfile) updateDynamicGroups(cntx context.Context, deviceID string, added []net.IP, removed []net.IP) {
 
         //mvlan := mvp.Mvlan
         va := GetApplication()
@@ -617,7 +618,7 @@
                         logger.Debugw(ctx, "IGMP Group", log.Fields{"Group": grpKey, "groupAddr": groupAddr})
                         if igIntf, ok := va.IgmpGroups.Load(grpKey); ok {
                                 ig := igIntf.(*IgmpGroup)
-                                if igd, ok := ig.getIgmpGroupDevice(d.Name); ok {
+                                if igd, ok := ig.getIgmpGroupDevice(cntx, d.Name); ok {
                                         if igcIntf, ok := igd.GroupChannels.Load(groupAddr.String()); ok {
                                                 igc := igcIntf.(*IgmpGroupChannel)
                                                 incl := false
@@ -631,12 +632,12 @@
                                                 }
                                                 for port, igp := range igc.NewReceivers {
                                                         // Process the include/exclude list which may end up modifying the group
-                                                        if change, _ := igc.ProcessSources(port, ip, incl); change {
+                                                        if change, _ := igc.ProcessSources(cntx, port, ip, incl); change {
                                                                 groupModified = true
                                                         }
                                                         igc.ProcessMode(port, incl)
 
-                                                        if err := igp.WriteToDb(igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
+                                                        if err := igp.WriteToDb(cntx, igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
                                                                 logger.Errorw(ctx, "Igmp group port Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
                                                         }
                                                 }
@@ -646,7 +647,7 @@
                                                         logger.Debug(ctx, "Group Modified and IGMP report sent to the upstream server")
                                                         igc.SendReport(false)
                                                 }
-                                                if err := igc.WriteToDb(); err != nil {
+                                                if err := igc.WriteToDb(cntx); err != nil {
                                                         logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
                                                 }
                                         }
@@ -667,7 +668,7 @@
 
 //GroupsUpdated - Handles removing of Igmp Groups, flows & group table entries for
 //channels removed as part of update
-func (mvp *MvlanProfile) GroupsUpdated(deviceID string) {
+func (mvp *MvlanProfile) GroupsUpdated(cntx context.Context, deviceID string) {
 
         deleteChannelIfRemoved := func(key interface{}, value interface{}) bool {
                 ig := value.(*IgmpGroup)
@@ -703,32 +704,32 @@
                                                 // If channel is not Static but existing Group is static - Migrate (from static to dynamic)
                                                 //    (Channel removed from satic but part of dynamic)
                                                 if (staticChannel != mvp.IsStaticGroup(ig.GroupName)) || (ig.IsGroupStatic != mvp.IsStaticGroup(ig.GroupName)) { // Equivalent of XOR
-                                                        ig.HandleGroupMigration(deviceID, channelIP)
+                                                        ig.HandleGroupMigration(cntx, deviceID, channelIP)
                                                 } else {
                                                         if (ig.IsGroupStatic) && mvp.IsStaticGroup(ig.GroupName) {
                                                                 if ig.GroupName != mvp.GetStaticGroupName(channelIP) {
-                                                                        ig.HandleGroupMigration(deviceID, channelIP)
+                                                                        ig.HandleGroupMigration(cntx, deviceID, channelIP)
                                                                 }
                                                         }
                                                         continue
                                                 }
                                         } else {
                                                 logger.Debugw(ctx, "Channel Removed", log.Fields{"Channel": channel, "Group": grpName})
-                                                ig.DelIgmpChannel(deviceID, net.ParseIP(channel))
+                                                ig.DelIgmpChannel(cntx, deviceID, net.ParseIP(channel))
                                                 if ig.NumDevicesActive() == 0 {
-                                                        GetApplication().DelIgmpGroup(ig)
+                                                        GetApplication().DelIgmpGroup(cntx, ig)
                                                 }
                                         }
                                 }
                                 ig.IsGroupStatic = mvp.IsStaticGroup(ig.GroupName)
-                                if err := ig.WriteToDb(); err != nil {
+                                if err := ig.WriteToDb(cntx); err != nil {
                                         logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
                                 }
                                 return true
                         }
                 }
                 logger.Debugw(ctx, "Group Removed", log.Fields{"Channel": ig.GroupAddr, "Group": grpName, "ChannelBasedGroup": ig.IsChannelBasedGroup})
-                ig.DelIgmpGroup()
+                ig.DelIgmpGroup(cntx)
                 logger.Debugw(ctx, "Removed Igmp Group", log.Fields{"Channel": ig.GroupAddr, "Group": grpName})
                 return true
         }
@@ -771,7 +772,7 @@
 }
 
 // ProcessStaticGroup - Process Static Join/Leave Req for static channels
-func (mvp *MvlanProfile) ProcessStaticGroup(device string, groupAddresses []net.IP, isJoin bool) {
+func (mvp *MvlanProfile) ProcessStaticGroup(cntx context.Context, device string, groupAddresses []net.IP, isJoin bool) {
 
         logger.Debugw(ctx, "Received Static Group Request", log.Fields{"Device": device, "Join": isJoin, "Group Address List": groupAddresses})
 
@@ -790,9 +791,9 @@
                         if ig == nil {
                                 // First time group Creation: Create the IGMP group and then add the receiver to the group
                                 logger.Infow(ctx, "Static IGMP Add received for new group", log.Fields{"Addr": groupAddr, "Port": StaticPort})
-                                if ig := GetApplication().AddIgmpGroup(mvp.Name, groupAddr, device); ig != nil {
+                                if ig := GetApplication().AddIgmpGroup(cntx, mvp.Name, groupAddr, device); ig != nil {
                                         ig.IgmpGroupLock.Lock()
-                                        ig.AddReceiver(device, StaticPort, groupAddr, nil, getVersion(ver),
+                                        ig.AddReceiver(cntx, device, StaticPort, groupAddr, nil, getVersion(ver),
                                                 0, 0, 0xFF)
                                         ig.IgmpGroupLock.Unlock()
                                 } else {
@@ -801,12 +802,12 @@
                         } else {
                                 //Converting existing dynamic group to static group
                                 if !mvp.IsStaticGroup(ig.GroupName) {
-                                        ig.updateGroupName(ig.GroupName)
+                                        ig.updateGroupName(cntx, ig.GroupName)
                                 }
                                 // Update case: If the IGMP group is already created. just add the receiver
                                 logger.Infow(ctx, "Static IGMP Add received for existing group", log.Fields{"Addr": groupAddr, "Port": StaticPort})
                                 ig.IgmpGroupLock.Lock()
-                                ig.AddReceiver(device, StaticPort, groupAddr, nil, getVersion(ver),
+                                ig.AddReceiver(cntx, device, StaticPort, groupAddr, nil, getVersion(ver),
                                         0, 0, 0xFF)
                                 ig.IgmpGroupLock.Unlock()
                         }
@@ -817,19 +818,19 @@
                                 grpName := mvp.GetMvlanGroup(ig.GroupAddr)
                                 if grpName != "" {
                                         ig.IgmpGroupLock.Lock()
-                                        ig.DelReceiver(device, StaticPort, groupAddr, nil, 0xFF)
+                                        ig.DelReceiver(cntx, device, StaticPort, groupAddr, nil, 0xFF)
                                         ig.IgmpGroupLock.Unlock()
-                                        ig.updateGroupName(grpName)
+                                        ig.updateGroupName(cntx, grpName)
                                 } else {
-                                        ig.DelIgmpGroup()
+                                        ig.DelIgmpGroup(cntx)
                                 }
                         } else {
                                 ig.IgmpGroupLock.Lock()
-                                ig.DelReceiver(device, StaticPort, groupAddr, nil, 0xFF)
+                                ig.DelReceiver(cntx, device, StaticPort, groupAddr, nil, 0xFF)
                                 ig.IgmpGroupLock.Unlock()
                         }
                         if ig.NumDevicesActive() == 0 {
-                                GetApplication().DelIgmpGroup(ig)
+                                GetApplication().DelIgmpGroup(cntx, ig)
                         }
                 } else {
                         logger.Warnw(ctx, "Static IGMP Del received for unknown group", log.Fields{"Addr": groupAddr})
@@ -894,7 +895,7 @@
 }
 
 // UpdateProfile - Updates the group & member info w.r.t the mvlan profile for the given device
-func (mvp *MvlanProfile) UpdateProfile(deviceID string) {
+func (mvp *MvlanProfile) UpdateProfile(cntx context.Context, deviceID string) {
         logger.Infow(ctx, "Update Mvlan Profile task triggered", log.Fields{"Mvlan": mvp.Mvlan})
         var removedStaticChannels []net.IP
         addedStaticChannels := []net.IP{}
@@ -922,12 +923,12 @@
                 logger.Debugw(ctx, "Update Task - Static Group Changes", log.Fields{"Added": addedStaticChannels, "Removed": removedStaticChannels})
 
                 if len(addedStaticChannels) > 0 || len(removedStaticChannels) > 0 {
-                        mvp.updateStaticGroups(deviceID, []net.IP{}, removedStaticChannels)
+                        mvp.updateStaticGroups(cntx, deviceID, []net.IP{}, removedStaticChannels)
                 }
         }
-        mvp.GroupsUpdated(deviceID)
+        mvp.GroupsUpdated(cntx, deviceID)
         if len(addedStaticChannels) > 0 {
-                mvp.updateStaticGroups(deviceID, addedStaticChannels, []net.IP{})
+                mvp.updateStaticGroups(cntx, deviceID, addedStaticChannels, []net.IP{})
         }
 
         /* Need to handle if SSM params are modified for groups */
@@ -936,10 +937,10 @@
                 if mvp.checkStaticGrpSSMProxyDiff(mvp.oldProxy[key], mvp.Proxy[key]) {
                         if mvp.Groups[key].IsStatic {
                                 /* Static group proxy modified, need to trigger membership report with new mode/src-list for existing channels */
-                                mvp.updateStaticGroups(deviceID, commonChannels, []net.IP{})
+                                mvp.updateStaticGroups(cntx, deviceID, commonChannels, []net.IP{})
                         } else {
                                 /* Dynamic group proxy modified, need to trigger membership report with new mode/src-list for existing channels */
-                                mvp.updateDynamicGroups(deviceID, commonChannels, []net.IP{})
+                                mvp.updateDynamicGroups(cntx, deviceID, commonChannels, []net.IP{})
                         }
                 }
         }
@@ -949,7 +950,7 @@
         if deviceID == "" || !mvp.isUpdateInProgress() {
                 mvp.oldGroups = nil
         }
-        if err := mvp.WriteToDb(); err != nil {
+        if err := mvp.WriteToDb(cntx); err != nil {
                 logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": mvp.Name})
         }
         logger.Debugw(ctx, "Updated MVLAN Profile", log.Fields{"VLAN": mvp.Mvlan, "Name": mvp.Name, "Grp IPs": mvp.Groups})
@@ -1055,7 +1056,7 @@
 }
 
 //TriggerAssociatedFlowDelete - Re-trigger delete for pending delete flows
-func (mvp *MvlanProfile) TriggerAssociatedFlowDelete(device string) bool {
+func (mvp *MvlanProfile) TriggerAssociatedFlowDelete(cntx context.Context, device string) bool {
         mvp.mvpFlowLock.Lock()
 
         cookieList := []uint64{}
@@ -1078,7 +1079,7 @@
                         subFlow.Cookie = cookie
                         flow.SubFlows[cookie] = subFlow
                         logger.Infow(ctx, "Retriggering Vnet Delete Flow", log.Fields{"Device": device, "Mvlan": mvp.Mvlan.String(), "Cookie": cookie})
-                        err := mvp.DelFlows(vd, flow)
+                        err := mvp.DelFlows(cntx, vd, flow)
                         if err != nil {
                                 logger.Warnw(ctx, "De-Configuring IGMP Flow for device failed ", log.Fields{"Device": device, "err": err})
                         }
@@ -1216,13 +1217,13 @@
 }
 
 // WriteToDb is utility to write Igmp Config Info to database
-func (igmpProfile *IgmpProfile) WriteToDb() error {
+func (igmpProfile *IgmpProfile) WriteToDb(cntx context.Context) error {
         igmpProfile.Version = database.PresentVersionMap[database.IgmpProfPath]
         b, err := json.Marshal(igmpProfile)
         if err != nil {
                 return err
         }
-        if err1 := db.PutIgmpProfile(igmpProfile.ProfileID, string(b)); err1 != nil {
+        if err1 := db.PutIgmpProfile(cntx, igmpProfile.ProfileID, string(b)); err1 != nil {
                 return err1
         }
         return nil
diff --git a/internal/pkg/application/igmptasks.go b/internal/pkg/application/igmptasks.go
index af42562..268453c 100644
--- a/internal/pkg/application/igmptasks.go
+++ b/internal/pkg/application/igmptasks.go
@@ -72,7 +72,7 @@
 func (tt *TickTask) Start(ctx context.Context, taskID uint8) error {
 	tt.taskID = taskID
 	tt.ctx = ctx
-	GetApplication().IgmpTick()
+	GetApplication().IgmpTick(ctx)
 	return nil
 }
 
@@ -124,7 +124,7 @@
 func (pt *IgmpPacketTask) Start(ctx context.Context, taskID uint8) error {
 	pt.taskID = taskID
 	pt.ctx = ctx
-	GetApplication().IgmpProcessPkt(pt.Device, pt.Port, pt.Pkt)
+	GetApplication().IgmpProcessPkt(ctx, pt.Device, pt.Port, pt.Pkt)
 	return nil
 }
 
@@ -170,6 +170,6 @@
 	mt.taskID = taskID
 	mt.ctx = ctx
 	mvp := mt.mvp
-	mvp.UpdateProfile(mt.DeviceID)
+	mvp.UpdateProfile(ctx, mt.DeviceID)
 	return nil
 }
diff --git a/internal/pkg/application/major_upgrade.go b/internal/pkg/application/major_upgrade.go
index 639822b..b423b58 100644
--- a/internal/pkg/application/major_upgrade.go
+++ b/internal/pkg/application/major_upgrade.go
@@ -48,7 +48,7 @@
 	ModuleVer map[string]string // eg. "service": "v1"
 }
 
-type paramsMigrationFunc func([]byte) string
+type paramsMigrationFunc func(context.Context, []byte) string
 
 //map to store conversion functions
 var migrationMap = map[string]paramsMigrationFunc{
@@ -79,32 +79,32 @@
 }
 
 // WriteToDb write a meter profile to DB
-func (md *DataMigration) WriteToDb() error {
+func (md *DataMigration) WriteToDb(cntx context.Context) error {
 	b, err := json.Marshal(md)
 	if err != nil {
 		return err
 	}
-	if err1 := db.PutMigrationInfo(string(b)); err1 != nil {
+	if err1 := db.PutMigrationInfo(cntx, string(b)); err1 != nil {
 		return err1
 	}
 	return nil
 }
 
 // DelFromDb delete a meter profile from DB
-func (md *DataMigration) DelFromDb() {
-	if err := db.DelMigrationInfo(); err != nil {
+func (md *DataMigration) DelFromDb(cntx context.Context) {
+	if err := db.DelMigrationInfo(cntx); err != nil {
 		logger.Warnw(ctx, "DelMigrationInfo Failed", log.Fields{"Error": err})
 	}
 }
 
 // GetMigrationInfo to get data migration info
-func GetMigrationInfo(dmInfo *DataMigration) error {
+func GetMigrationInfo(cntx context.Context, dmInfo *DataMigration) error {
 	var migrationInfo string
 	var err error
 	if db == nil {
 		db = database.GetDatabase()
 	}
-	if migrationInfo, err = db.GetMigrationInfo(); err != nil {
+	if migrationInfo, err = db.GetMigrationInfo(cntx); err != nil {
 		return err
 	}
 	err = json.Unmarshal([]byte(migrationInfo), &dmInfo)
@@ -122,7 +122,7 @@
 func CheckIfMigrationRequired(ctx context.Context) bool {
 	Migrate := new(DataMigration)
 	var NoDataInDB bool
-	err := GetMigrationInfo(Migrate)
+	err := GetMigrationInfo(ctx, Migrate)
 	logger.Debugw(ctx, "Migration data", log.Fields{"DataMigration": Migrate})
 	// No DB entry represents N verison Bring Up for the First time
 	if err != nil {
@@ -135,7 +135,7 @@
 		Migrate.Version = database.PresentVersion
 		Migrate.Status = MigrationComplete
 		Migrate.ModuleVer = database.PresentVersionMap
-		if err := Migrate.WriteToDb(); err != nil {
+		if err := Migrate.WriteToDb(ctx); err != nil {
 			logger.Errorw(ctx, "DB Write failed for Migration Path", log.Fields{"error": err})
 		}
 		//MigrateProbestatus has to be Updated to Complete when No Migration is Required
@@ -191,11 +191,11 @@
 
 	go func() {
 		logger.Debug(ctx, "Started Go Routine for data migration")
-		err = MigrateDBData()
+		err = MigrateDBData(ctx)
 		if err != nil {
 			logger.Errorw(ctx, "Failed to Migrate the Data", log.Fields{"error": err})
 			Migrate.Status = MigrationFailed
-			if err := Migrate.WriteToDb(); err != nil {
+			if err := Migrate.WriteToDb(ctx); err != nil {
 				logger.Errorw(ctx, "DB Write failed to Migration Path", log.Fields{"error": err})
 			}
 		}
@@ -205,7 +205,7 @@
 		Migrate.Version = database.PresentVersion
 		Migrate.Status = MigrationInProgress
 		Migrate.ModuleVer = database.PresentVersionMap
-		if err = Migrate.WriteToDb(); err != nil {
+		if err = Migrate.WriteToDb(ctx); err != nil {
 			logger.Errorw(ctx, "DB Write failed for Migration Path", log.Fields{"error": err})
 			return
 		}
@@ -215,7 +215,7 @@
 		if err := recover(); err != nil {
 			logger.Errorw(ctx, "Migration failure due to Exception happend", log.Fields{"reason": err})
 			Migrate.Status = MigrationFailed
-			if err := Migrate.WriteToDb(); err != nil {
+			if err := Migrate.WriteToDb(ctx); err != nil {
 				logger.Errorw(ctx, "DB Write failed for Migration Path", log.Fields{"error": err})
 			}
 			//probe.UpdateDBMigrationStatus(ctx, false)
@@ -226,14 +226,14 @@
 	migrationWG.Wait()
 	//probe.UpdateDBMigrationStatus(ctx, true)
 	Migrate.Status = MigrationComplete
-	if err := Migrate.WriteToDb(); err != nil {
+	if err := Migrate.WriteToDb(ctx); err != nil {
 		logger.Errorw(ctx, "DB Write failed for Migration Path", log.Fields{"error": err})
 	}
 	logger.Infow(ctx, "Migration completed successfully", log.Fields{"Status": Migrate.Status})
 }
 
 // MigrateDBData to migrate database data
-func MigrateDBData() error {
+func MigrateDBData(cntx context.Context) error {
 
 	var err error
 	for module, currentVersion := range database.PresentVersionMap {
@@ -251,7 +251,7 @@
 				database.DeviceFlowHashPath:
 				err = FetchAndMigrateDeviceDBData(module)
 			default:
-				err = FetchAndMigrateDBData(module)
+				err = FetchAndMigrateDBData(cntx, module)
 			}
 		} else {
 			logger.Infow(ctx, "No Data Migration handling found for module", log.Fields{"Table": module, "Version": currentVersion})
@@ -272,10 +272,10 @@
 }
 
 //FetchAndMigrateDBData fetchs the data from database and migrte the same to latest versions and store ot back ot database
-func FetchAndMigrateDBData(module string) error {
+func FetchAndMigrateDBData(cntx context.Context, module string) error {
 
 	previousPath := database.GetModuleKeypath(module, database.PreviousVersionMap[module])
-	dbPathKeysValueMap, err := db.List(previousPath)
+	dbPathKeysValueMap, err := db.List(cntx, previousPath)
 	if err != nil {
 		logger.Errorw(ctx, "failed to Fetch the Keys from Redis", log.Fields{"error": err})
 		//No return required, Data might not be present in DB
@@ -296,7 +296,7 @@
 			return errors.New("Error-in-migration")
 		}
 
-		presentParams := migrationMap[module](b)
+		presentParams := migrationMap[module](cntx, b)
 		logger.Infow(ctx, "Migrated data", log.Fields{"presentParams": presentParams})
 		if "" == presentParams {
 			logger.Error(ctx, "Error in migrating data\n")
@@ -306,7 +306,7 @@
 		}
 		presentPath := database.GetKeyPath(module) + hash
 		logger.Infow(ctx, "Before writing to DB", log.Fields{"presentParams": presentParams})
-		if err := db.Put(presentPath, presentParams); err != nil {
+		if err := db.Put(cntx, presentPath, presentParams); err != nil {
 			logger.Errorw(ctx, "Update Params failed", log.Fields{"key": presentPath, "presentparams": presentParams})
 			return err
 		}
@@ -315,7 +315,7 @@
 }
 
 //MigrateServices modifyies the old data as per current version requirement and updates the database
-func MigrateServices(data []byte) string {
+func MigrateServices(cntx context.Context, data []byte) string {
 	var vs VoltService
 	var updatedData, updatedData1 []byte
 	var vsmap map[string]interface{}
@@ -356,43 +356,43 @@
 }
 
 //MigrateDevices modifyies the old data as per current version requirement and updates the database
-func MigrateDevices(data []byte) string {
+func MigrateDevices(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Devices")
 	return ""
 }
 
 //MigrateDevicePorts modifyies the old data as per current version requirement and updates the database
-func MigrateDevicePorts(data []byte) string {
+func MigrateDevicePorts(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Ports")
 	return ""
 }
 
 //MigrateDeviceFlows modifyies the old data as per current version requirement and updates the database
-func MigrateDeviceFlows(data []byte) string {
+func MigrateDeviceFlows(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Flows")
 	return ""
 }
 
 //MigrateDeviceGroups modifyies the old data as per current version requirement and updates the database
-func MigrateDeviceGroups(data []byte) string {
+func MigrateDeviceGroups(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Groups")
 	return ""
 }
 
 //MigrateDeviceMeters modifyies the old data as per current version requirement and updates the database
-func MigrateDeviceMeters(data []byte) string {
+func MigrateDeviceMeters(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Meters")
 	return ""
 }
 
 //MigrateDeviceFlowHash modifyies the old data as per current version requirement and updates the database
-func MigrateDeviceFlowHash(data []byte) string {
+func MigrateDeviceFlowHash(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for FlowHash")
 	return ""
 }
 
 //MigrateVnets modifyies the old data as per current version requirement and updates the database
-func MigrateVnets(data []byte) string {
+func MigrateVnets(cntx context.Context, data []byte) string {
 
 	var vnet VoltVnet
 	var updatedData []byte
@@ -423,7 +423,7 @@
 }
 
 //MigrateVpvs modifyies the old data as per current version requirement and updates the database
-func MigrateVpvs(data []byte) string {
+func MigrateVpvs(cntx context.Context, data []byte) string {
 	var vpv VoltPortVnet
 	var updatedData, updatedData1 []byte
 	var vpvmap map[string]interface{}
@@ -479,7 +479,7 @@
 }
 
 //MigrateMvlans modifyies the old data as per current version requirement and updates the database
-func MigrateMvlans(data []byte) string {
+func MigrateMvlans(cntx context.Context, data []byte) string {
 	var mvp MvlanProfile
 	var updatedData []byte
 
@@ -504,13 +504,13 @@
 }
 
 //MigrateMeters modifyies the old data as per current version requirement and updates the database
-func MigrateMeters(data []byte) string {
+func MigrateMeters(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Meters")
 	return ""
 }
 
 //MigrateIgmpConfs modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpConfs(data []byte) string {
+func MigrateIgmpConfs(cntx context.Context, data []byte) string {
 	var igmpProfile IgmpProfile
 
 	err := json.Unmarshal(data, &igmpProfile)
@@ -518,7 +518,7 @@
 		logger.Warn(ctx, "Unmarshal of IGMP failed")
 		return ""
 	}
-	if err := igmpProfile.WriteToDb(); err != nil {
+	if err := igmpProfile.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp profile Write to DB failed", log.Fields{"profileID": igmpProfile.ProfileID})
 	}
 
@@ -527,73 +527,73 @@
 }
 
 //MigrateIgmpGroups modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpGroups(data []byte) string {
+func MigrateIgmpGroups(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for IGMP Groups")
 	return ""
 }
 
 //MigrateIgmpDevices modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpDevices(data []byte) string {
+func MigrateIgmpDevices(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for IGMP Device")
 	return ""
 }
 
 //MigrateIgmpChannels modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpChannels(data []byte) string {
+func MigrateIgmpChannels(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for IGMP Channels")
 	return ""
 }
 
 //MigrateIgmpPorts modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpPorts(data []byte) string {
+func MigrateIgmpPorts(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for IGMP Ports")
 	return ""
 }
 
 //MigrateIgmpProfs modifyies the old data as per current version requirement and updates the database
-func MigrateIgmpProfs(data []byte) string {
+func MigrateIgmpProfs(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for IGMP Profs")
 	return ""
 }
 
 //MigrateMcastConfs modifyies the old data as per current version requirement and updates the database
-func MigrateMcastConfs(data []byte) string {
+func MigrateMcastConfs(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Mcast Confs")
 	return ""
 }
 
 //MigrateLogLevels modifyies the old data as per current version requirement and updates the database
-func MigrateLogLevels(data []byte) string {
+func MigrateLogLevels(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Log Levels")
 	return ""
 }
 
 //MigrateHealth modifyies the old data as per current version requirement and updates the database
-func MigrateHealth(data []byte) string {
+func MigrateHealth(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Health")
 	return ""
 }
 
 //MigratePonCounters modifyies the old data as per current version requirement and updates the database
-func MigratePonCounters(data []byte) string {
+func MigratePonCounters(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Pon Counters")
 	return ""
 }
 
 //MigrateChannelCounters modifyies the old data as per current version requirement and updates the database
-func MigrateChannelCounters(data []byte) string {
+func MigrateChannelCounters(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Channel Counters")
 	return ""
 }
 
 //MigrateServiceCounters modifyies the old data as per current version requirement and updates the database
-func MigrateServiceCounters(data []byte) string {
+func MigrateServiceCounters(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for Service Counters")
 	return ""
 }
 
 //MigrateNbDevices modifyies the old data as per current version requirement and updates the database
-func MigrateNbDevices(data []byte) string {
+func MigrateNbDevices(cntx context.Context, data []byte) string {
 	logger.Error(ctx, "Data Migration not implemented for NB Devices")
 	return ""
 }
@@ -605,11 +605,11 @@
 }
 
 //DeleteDbPathKeys Deleted the paths from DB
-func DeleteDbPathKeys(keyPath string) error {
+func DeleteDbPathKeys(cntx context.Context, keyPath string) error {
 	logger.Debugw(ctx, "Deleting paths for version", log.Fields{"Path": keyPath})
 
 	// Delete all the keys
-	err := db.DeleteAll(keyPath)
+	err := db.DeleteAll(cntx, keyPath)
 	if err != nil && err.Error() != common.ErrEntryNotFound.Error() {
 		logger.Errorw(ctx, "Delete Key failed", log.Fields{"error": err})
 		return err
diff --git a/internal/pkg/application/meters.go b/internal/pkg/application/meters.go
index cd3e724..276fe99 100644
--- a/internal/pkg/application/meters.go
+++ b/internal/pkg/application/meters.go
@@ -18,6 +18,7 @@
 import (
 	"encoding/json"
 	"errors"
+	"context"
 	"sync"
 
 	cntlr "voltha-go-controller/internal/pkg/controller"
@@ -87,21 +88,21 @@
 }
 
 // WriteToDb to write a meter profile to DB
-func (vm *VoltMeter) WriteToDb() error {
+func (vm *VoltMeter) WriteToDb(cntx context.Context) error {
 	vm.Version = database.PresentVersionMap[database.MeterPath]
 	b, err := json.Marshal(vm)
 	if err != nil {
 		return err
 	}
-	if err1 := db.PutMeter(vm.Name, string(b)); err1 != nil {
+	if err1 := db.PutMeter(cntx, vm.Name, string(b)); err1 != nil {
 		return err1
 	}
 	return nil
 }
 
 // DelFromDb to delete a meter profile from DB
-func (vm *VoltMeter) DelFromDb() {
-	_ = db.DelMeter(vm.Name)
+func (vm *VoltMeter) DelFromDb(cntx context.Context) {
+	_ = db.DelMeter(cntx, vm.Name)
 }
 
 // GetMeterByName to get meter by name
@@ -215,10 +216,10 @@
 }
 
 // RestoreMetersFromDb to read from the DB and restore all the services
-func (m *MeterMgr) RestoreMetersFromDb() {
+func (m *MeterMgr) RestoreMetersFromDb(cntx context.Context) {
 	// VNETS must be learnt first
 	logger.Infow(ctx, "LastMeterID on restart", log.Fields{"LastMeterID": m.LastMeterID})
-	ms, _ := db.GetMeters()
+	ms, _ := db.GetMeters(cntx)
 	for _, mt := range ms {
 		b, ok := mt.Value.([]byte)
 		if !ok {
@@ -241,7 +242,7 @@
 }
 
 // AddMeterProf to add the meter profile name as key
-func (va *VoltApplication) AddMeterProf(cfg VoltMeter) {
+func (va *VoltApplication) AddMeterProf(cntx context.Context, cfg VoltMeter) {
 
 	mm := &va.MeterMgr
 	if _, ok := mm.GetMeterByName(cfg.Name); ok {
@@ -256,20 +257,20 @@
 	id := mm.LastMeterID
 	cfg.ID = id
 	mm.AddMeter(&cfg)
-	if err := cfg.WriteToDb(); err != nil {
+	if err := cfg.WriteToDb(cntx); err != nil {
 		logger.Warnw(ctx, "MeterProf Write to DB Failed", log.Fields{"MeterConfig": cfg, "Error": err})
 	}
 }
 
 // UpdateMeterProf to update the meter profile
-func (va *VoltApplication) UpdateMeterProf(cfg VoltMeter) {
+func (va *VoltApplication) UpdateMeterProf(cntx context.Context, cfg VoltMeter) {
 	mm := &va.MeterMgr
 	if _, ok := mm.GetMeterByName(cfg.Name); !ok {
 		logger.Warnw(ctx, "Meter profile does not exist", log.Fields{"Name": cfg.Name})
 		return
 	}
 	mm.AddMeter(&cfg)
-	if err := cfg.WriteToDb(); err != nil {
+	if err := cfg.WriteToDb(cntx); err != nil {
 		logger.Warnw(ctx, "MeterProf Write to DB Failed", log.Fields{"MeterConfig": cfg, "Error": err})
 	}
 }
@@ -304,7 +305,7 @@
 }
 
 // DelMeterProf to delete meter profile
-func (va *VoltApplication) DelMeterProf(name string) error {
+func (va *VoltApplication) DelMeterProf(cntx context.Context, name string) error {
 	mm := &va.MeterMgr
 	if _, ok := mm.GetMeterByName(name); !ok {
 		logger.Warnw(ctx, "Meter profile does not exist", log.Fields{"Name": name})
@@ -324,7 +325,7 @@
 		return true
 	}
 	va.DevicesDisc.Range(delmeterFromDevice)
-	cfg.DelFromDb()
+	cfg.DelFromDb(cntx)
 	//Delete meter from device will be invoked by caller separately
 	mm.DelMeter(cfg)
 	return nil
diff --git a/internal/pkg/application/minor_upgrade.go b/internal/pkg/application/minor_upgrade.go
index d8e7094..a0bba15 100644
--- a/internal/pkg/application/minor_upgrade.go
+++ b/internal/pkg/application/minor_upgrade.go
@@ -17,6 +17,7 @@
 
 import (
 	"errors"
+	"context"
 	"net"
 	"voltha-go-controller/internal/pkg/types"
 
@@ -27,7 +28,7 @@
 	"voltha-go-controller/log"
 )
 
-type paramsUpdationFunc func(hash string, value interface{}) error
+type paramsUpdationFunc func(cntx context.Context, hash string, value interface{}) error
 
 //map to store conversion functions
 var updationMap = map[string]paramsUpdationFunc{
@@ -41,9 +42,9 @@
 }
 
 // UpdateDbData to update database data
-func UpdateDbData(dbPath, hash string, value interface{}) error {
+func UpdateDbData(cntx context.Context, dbPath, hash string, value interface{}) error {
 	if migrationFunc, ok := updationMap[dbPath]; ok {
-		err := migrationFunc(hash, value)
+		err := migrationFunc(cntx, hash, value)
 		if err != nil {
 			logger.Error(ctx, "Error in migrating data\n")
 			return errors.New("Error-in-migration")
@@ -54,7 +55,7 @@
 
 //This function modifyies the old data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateServices(hash string, value interface{}) error {
+func updateServices(cntx context.Context, hash string, value interface{}) error {
 	param := value.(*VoltService)
 	param.VnetID = VnetKey(param.SVlan, param.CVlan, param.UniVlan)
 	return nil
@@ -62,12 +63,12 @@
 
 //This function modifyies the old data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateVnets(hash string, value interface{}) error {
+func updateVnets(cntx context.Context, hash string, value interface{}) error {
 	param := value.(*VoltVnet)
 	newKey := VnetKey(param.SVlan, param.CVlan, param.UniVlan)
 	if newKey != hash {
 		//Delete the older key
-		_ = db.DelVnet(hash)
+		_ = db.DelVnet(cntx, hash)
 	} else {
 		//Update SVlan Tag Protocol id param with default valud if not present
 		if param.SVlanTpid == 0 {
@@ -83,7 +84,7 @@
 
 //This function modifyies the old data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateVpvs(hash string, value interface{}) error {
+func updateVpvs(cntx context.Context, hash string, value interface{}) error {
 
 	//var param VoltPortVnet
 	param := value.(*VoltPortVnet)
@@ -99,20 +100,20 @@
 	}
 
 	//Add the vpv under new path
-	param.WriteToDb()
+	param.WriteToDb(cntx)
 	//delete the older path
 	fullPath := database.BasePath + database.VpvPath + hash
-	if err := db.Del(fullPath); err != nil {
+	if err := db.Del(cntx, fullPath); err != nil {
 		logger.Errorw(ctx, "Vpv Delete from DB failed", log.Fields{"Error": err, "key": fullPath})
 	}
 	return nil
 }
 
-func updateMvlans(hash string, value interface{}) error {
+func updateMvlans(cntx context.Context, hash string, value interface{}) error {
 	param := value.(*MvlanProfile)
 	if param.DevicesList == nil || len(param.DevicesList) == 0 {
 		param.DevicesList = make(map[string]OperInProgress) //Empty OLT serial number as of now since submgr won't have proper serial num
-		if err := param.WriteToDb(); err != nil {
+		if err := param.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": param.Name})
 		}
 
@@ -125,14 +126,14 @@
 
 //This function modifyies the old Igmp Group data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateIgmpGroups(hash string, value interface{}) error {
+func updateIgmpGroups(cntx context.Context, hash string, value interface{}) error {
 
 	ig := value.(*IgmpGroup)
 	logger.Infow(ctx, "Group Data Migration", log.Fields{"ig": ig, "GroupAddr": ig.GroupAddr, "hash": hash})
 	if ig.GroupAddr == nil {
 		ig.GroupAddr = net.ParseIP("0.0.0.0")
 	}
-	if err := ig.WriteToDb(); err != nil {
+	if err := ig.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp group Write to DB failed", log.Fields{"groupName": ig.GroupName})
 	}
 
@@ -141,13 +142,13 @@
 
 //This function modifyies the old Igmp  Device data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateIgmpDevices(hash string, value interface{}) error {
+func updateIgmpDevices(cntx context.Context, hash string, value interface{}) error {
 	igd := value.(*IgmpGroupDevice)
 	logger.Infow(ctx, "Group Device Migration", log.Fields{"igd": igd, "GroupAddr": igd.GroupAddr, "hash": hash})
 	if igd.GroupAddr == nil {
 		igd.GroupAddr = net.ParseIP("0.0.0.0")
 	}
-	if err := igd.WriteToDb(); err != nil {
+	if err := igd.WriteToDb(cntx); err != nil {
 		logger.Errorw(ctx, "Igmp group device Write to DB failed", log.Fields{"Device": igd.Device,
 					"GroupName": igd.GroupName, "GroupAddr": igd.GroupAddr.String()})
 	}
@@ -157,15 +158,15 @@
 
 //This function modifyies the old Igmp  Profile data as per current version requirement and also
 //returns the new path on which the modified data has to be written
-func updateIgmpProfiles(hash string, value interface{}) error {
+func updateIgmpProfiles(cntx context.Context, hash string, value interface{}) error {
 	igmpProfile := value.(*IgmpProfile)
 	logger.Infow(ctx, "IGMP Profile Migration", log.Fields{"igmpProfile": igmpProfile, "hash": hash})
 	return nil
 }
 
-func (ig *IgmpGroup) migrateIgmpDevices() {
+func (ig *IgmpGroup) migrateIgmpDevices(cntx context.Context) {
 
-	devices, _ := db.GetPrevIgmpDevices(ig.Mvlan, ig.GroupName)
+	devices, _ := db.GetPrevIgmpDevices(cntx, ig.Mvlan, ig.GroupName)
 	logger.Infow(ctx, "Migratable Devices", log.Fields{"Devices": devices})
 	for _, device := range devices {
 		b, ok := device.Value.([]byte)
@@ -176,10 +177,10 @@
 		if igd, err := NewIgmpGroupDeviceFromBytes(b); err == nil {
 			key := database.BasePath + database.IgmpDevicePath + igd.Mvlan.String() + "/" + igd.GroupName + "/" + igd.Device
 			logger.Infow(ctx, "Deleting old entry", log.Fields{"Path": key, "igd": igd})
-			if err := db.Del(key); err != nil {
+			if err := db.Del(cntx, key); err != nil {
 				logger.Errorw(ctx, "Igmp Group Delete from DB failed", log.Fields{"Error": err, "key": key})
 			}
-			if err := UpdateDbData(database.IgmpDevicePath, key, igd); err != nil {
+			if err := UpdateDbData(cntx, database.IgmpDevicePath, key, igd); err != nil {
 				logger.Warnw(ctx, "Group Device Migration failed", log.Fields{"IGD": igd, "Error": err})
 			} else {
 				logger.Infow(ctx, "Group Device Migrated", log.Fields{"IGD": igd})
@@ -190,9 +191,9 @@
 	}
 }
 
-func (igd *IgmpGroupDevice) migrateIgmpChannels() {
+func (igd *IgmpGroupDevice) migrateIgmpChannels(cntx context.Context) {
 
-	channels, _ := db.GetPrevIgmpChannels(igd.GroupName, igd.Device)
+	channels, _ := db.GetPrevIgmpChannels(cntx, igd.GroupName, igd.Device)
 	logger.Infow(ctx, "Migratable Channels", log.Fields{"Channels": channels})
 	for _, channel := range channels {
 
@@ -204,10 +205,10 @@
 		if igc, err := NewIgmpGroupChannelFromBytes(b); err == nil {
 			key := database.BasePath + database.IgmpChannelPath + igc.GroupName + "/" + igc.Device + "/" + igc.GroupAddr.String()
 			logger.Infow(ctx, "Deleting old entry", log.Fields{"Path": key, "igc": igc})
-			if err := db.Del(key); err != nil {
+			if err := db.Del(cntx, key); err != nil {
 				logger.Errorw(ctx, "Igmp Group Delete from DB failed", log.Fields{"Error": err, "key": key})
 			}
-			if err := igc.WriteToDb(); err != nil {
+			if err := igc.WriteToDb(cntx); err != nil {
 				logger.Errorw(ctx, "Igmp group channel Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
 			}
 
@@ -218,9 +219,9 @@
 	}
 }
 
-func (igc *IgmpGroupChannel) migrateIgmpPorts() {
+func (igc *IgmpGroupChannel) migrateIgmpPorts(cntx context.Context) {
 
-	ports, _ := db.GetPrevIgmpRcvrs(igc.GroupAddr, igc.Device)
+	ports, _ := db.GetPrevIgmpRcvrs(cntx, igc.GroupAddr, igc.Device)
 	logger.Infow(ctx, "Migratable Ports", log.Fields{"Ports": ports})
 	for _, port := range ports {
 
@@ -232,10 +233,10 @@
 		if igp, err := NewIgmpGroupPortFromBytes(b); err == nil {
 			key := database.BasePath + database.IgmpPortPath + igc.GroupAddr.String() + "/" + igc.Device + "/" + igp.Port
 			logger.Infow(ctx, "Deleting old entry", log.Fields{"Key": key, "Igp": igp})
-			if err := db.Del(key); err != nil {
+			if err := db.Del(cntx, key); err != nil {
 				logger.Errorw(ctx, "Igmp Group port Delete from DB failed", log.Fields{"Error": err, "key": key})
 			}
-			if err := igp.WriteToDb(igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
+			if err := igp.WriteToDb(cntx, igc.Mvlan, igc.GroupAddr, igc.Device); err != nil {
 				logger.Errorw(ctx, "Igmp group port Write to DB failed", log.Fields{"mvlan": igc.Mvlan, "GroupAddr": igc.GroupAddr})
 			}
 
diff --git a/internal/pkg/application/pppoeia.go b/internal/pkg/application/pppoeia.go
index 7c55b79..2d50033 100644
--- a/internal/pkg/application/pppoeia.go
+++ b/internal/pkg/application/pppoeia.go
@@ -77,7 +77,7 @@
 	GetNniVlans() (uint16, uint16)
 	GetPppoeIaState() PppoeIaState
 	SetPppoeIaState(PppoeIaState)
-	SetMacAddr(net.HardwareAddr)
+	SetMacAddr(context.Context, net.HardwareAddr)
 }
 
 // PppoeIaRelayVnet : The PppoeIa relay sessions are stored in a map to be retrieved from when
@@ -280,7 +280,7 @@
 // session is derived from the list of PppoeIa sessions stored in the
 // common map. The key for retrieval includes the VLAN tags in the
 // the packet and the MAC address of the client.
-func (va *VoltApplication) ProcessDsPppoeIaPacket(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessDsPppoeIaPacket(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 
 	// Retrieve the layers to build the outgoing packet. It is not
 	// possible to add/remove layers to the existing packet and thus
@@ -319,7 +319,7 @@
 		} else if pppoe.Code == layers.PPPoECodePADT {
 			vpv.SetPppoeIaState(PppoeIaStatePADT)
 		}
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 	// Create the outgoing bufer and set the checksum in the packet
 	buff := gopacket.NewSerializeBuffer()
@@ -394,7 +394,7 @@
 
 // ProcessUsPppoeIaPacket : The US PppoeIa packet is identified the PppoeIa OP in the packet. A request is considered upstream
 // and the service associated with the packet is located by the port and VLANs in the packet
-func (va *VoltApplication) ProcessUsPppoeIaPacket(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessUsPppoeIaPacket(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// We received the packet on an access port and the service for the packet can be
 	// gotten from the port and the packet
 	vpv, svc := va.GetVnetFromPkt(device, port, pkt)
@@ -443,7 +443,7 @@
 					return
 				}
 			}
-			vpv.SetMacAddr(eth.SrcMAC)
+			vpv.SetMacAddr(cntx, eth.SrcMAC)
 		}
 
 		if pppoe.Code == layers.PPPoECodePADI {
@@ -451,7 +451,7 @@
 		} else if pppoe.Code == layers.PPPoECodePADR {
 			vpv.SetPppoeIaState(PppoeIaStatePADR)
 		}
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 
 	buff := gopacket.NewSerializeBuffer()
@@ -521,7 +521,7 @@
 }
 
 // ProcessPPPoEIaPacket to process Pppoeia packet
-func (va *VoltApplication) ProcessPPPoEIaPacket(device string, port string, pkt gopacket.Packet) {
+func (va *VoltApplication) ProcessPPPoEIaPacket(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	// Make some error checks before proceeding
 	pppoel := pkt.Layer(layers.LayerTypePPPoE)
 	if pppoel == nil {
@@ -544,10 +544,10 @@
 		// This is treated as an upstream packet in the VOLT application
 		// as VOLT serves access subscribers who use DHCP to acquire IP
 		// address and these packets go upstream to the network
-		va.ProcessUsPppoeIaPacket(device, port, pkt)
+		va.ProcessUsPppoeIaPacket(cntx, device, port, pkt)
 	} else {
 		// This is a downstream packet
-		va.ProcessDsPppoeIaPacket(device, port, pkt)
+		va.ProcessDsPppoeIaPacket(cntx, device, port, pkt)
 	}
 }
 
@@ -566,7 +566,7 @@
 }
 
 // ProcessPPPoEPacket : CallBack function registered with application to handle PPPoE packetIn
-func ProcessPPPoEPacket(device string, port string, pkt gopacket.Packet) {
+func ProcessPPPoEPacket(cntx context.Context, device string, port string, pkt gopacket.Packet) {
 	GetApplication().ProcessPPPoEPacket(device, port, pkt)
 }
 
@@ -613,6 +613,6 @@
 func (dpt *PppoeIaPacketTask) Start(ctx context.Context, taskID uint8) error {
 	dpt.taskID = taskID
 	dpt.ctx = ctx
-	GetApplication().ProcessPPPoEIaPacket(dpt.device, dpt.port, dpt.pkt)
+	GetApplication().ProcessPPPoEIaPacket(ctx, dpt.device, dpt.port, dpt.pkt)
 	return nil
 }
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index b9ff4b2..690f348 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -19,6 +19,7 @@
 	"bytes"
 	"encoding/json"
 	"errors"
+	"context"
 	"net"
 	"reflect"
 	infraerrorCodes "voltha-go-controller/internal/pkg/errorcodes"
@@ -179,7 +180,7 @@
 }
 
 // WriteToDb commit a service to the DB if service delete is not in-progress
-func (vs *VoltService) WriteToDb() {
+func (vs *VoltService) WriteToDb(cntx context.Context) {
 
 	vs.ServiceLock.RLock()
 	defer vs.ServiceLock.RUnlock()
@@ -188,18 +189,18 @@
 		logger.Warnw(ctx, "Skipping Redis Update for Service, Service delete in progress", log.Fields{"Service": vs.Name})
 		return
 	}
-	vs.ForceWriteToDb()
+	vs.ForceWriteToDb(cntx)
 }
 
 //ForceWriteToDb force commit a service to the DB
-func (vs *VoltService) ForceWriteToDb() {
+func (vs *VoltService) ForceWriteToDb(cntx context.Context) {
 	b, err := json.Marshal(vs)
 
 	if err != nil {
 		logger.Errorw(ctx, "Json Marshal Failed for Service", log.Fields{"Service": vs.Name})
 		return
 	}
-	if err1 := db.PutService(vs.Name, string(b)); err1 != nil {
+	if err1 := db.PutService(cntx, vs.Name, string(b)); err1 != nil {
 		logger.Errorw(ctx, "DB write oper failed for Service", log.Fields{"Service": vs.Name})
 	}
 }
@@ -210,12 +211,12 @@
 }
 
 // DelFromDb delete a service from DB
-func (vs *VoltService) DelFromDb() {
+func (vs *VoltService) DelFromDb(cntx context.Context) {
 	logger.Debugw(ctx, "Deleting Service from DB", log.Fields{"Name": vs.Name})
 	//TODO - Need to understand and delete the second call
 	//Calling twice has worked though don't know why
-	_ = db.DelService(vs.Name)
-	_ = db.DelService(vs.Name)
+	_ = db.DelService(cntx, vs.Name)
+	_ = db.DelService(cntx, vs.Name)
 }
 
 // MatchesVlans find the service that matches the VLANs. In this case it is
@@ -258,32 +259,32 @@
 }
 
 // AddHsiaFlows - Adds US & DS HSIA Flows for the service
-func (vs *VoltService) AddHsiaFlows() {
-	if err := vs.AddUsHsiaFlows(); err != nil {
+func (vs *VoltService) AddHsiaFlows(cntx context.Context) {
+	if err := vs.AddUsHsiaFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
-	if err := vs.AddDsHsiaFlows(); err != nil {
+	if err := vs.AddDsHsiaFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
 
 //DelHsiaFlows - Deletes US & DS HSIA Flows for the service
-func (vs *VoltService) DelHsiaFlows() {
-	if err := vs.DelUsHsiaFlows(); err != nil {
+func (vs *VoltService) DelHsiaFlows(cntx context.Context) {
+	if err := vs.DelUsHsiaFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 
-	if err := vs.DelDsHsiaFlows(); err != nil {
+	if err := vs.DelDsHsiaFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
 
 // AddUsHsiaFlows - Add US HSIA Flows for the service
-func (vs *VoltService) AddUsHsiaFlows() error {
+func (vs *VoltService) AddUsHsiaFlows(cntx context.Context) error {
 
 	if vs.DeleteInProgress || vs.UpdateInProgress {
 		logger.Errorw(ctx, "Ignoring US HSIA Flow Push, Service deleteion In-Progress", log.Fields{"Device": vs.Device, "Service": vs.Name})
@@ -322,7 +323,7 @@
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
-			if err := vs.AddFlows(device, usflows); err != nil {
+			if err := vs.AddFlows(cntx, device, usflows); err != nil {
 				logger.Errorw(ctx, "Error adding HSIA US flows", log.Fields{"Reason": err.Error()})
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
@@ -331,12 +332,12 @@
 		vs.UsHSIAFlowsApplied = true
 		logger.Infow(ctx, "Pushed US HSIA Service Flows", log.Fields{"ServiceName": vs.Name})
 	}
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 	return nil
 }
 
 // AddDsHsiaFlows - Add DS HSIA Flows for the service
-func (vs *VoltService) AddDsHsiaFlows() error {
+func (vs *VoltService) AddDsHsiaFlows(cntx context.Context) error {
 	if vs.DeleteInProgress {
 		logger.Errorw(ctx, "Ignoring DS HSIA Flow Push, Service deleteion In-Progress", log.Fields{"Device": vs.Device, "Service": vs.Name})
 		return nil
@@ -365,7 +366,7 @@
 				return err
 			}
 			dsflows.MigrateCookie = vgcRebooted
-			if err = vs.AddFlows(device, dsflows); err != nil {
+			if err = vs.AddFlows(cntx, device, dsflows); err != nil {
 				logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Reason": err})
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
@@ -380,7 +381,7 @@
 				}
 				logger.Debug(ctx, "Add-one-match-all-pbit-flow")
 				dsflows.MigrateCookie = vgcRebooted
-				if err := vs.AddFlows(device, dsflows); err != nil {
+				if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 					logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Reason": err})
 					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
@@ -395,7 +396,7 @@
 						continue
 					}
 					dsflows.MigrateCookie = vgcRebooted
-					if err := vs.AddFlows(device, dsflows); err != nil {
+					if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 						logger.Errorw(ctx, "Failed to Add HSIA DS flows", log.Fields{"Reason": err})
 						statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 						vs.triggerServiceFailureInd(statusCode, statusMessage)
@@ -406,12 +407,12 @@
 		vs.DsHSIAFlowsApplied = true
 		logger.Infow(ctx, "Pushed DS HSIA Service Flows", log.Fields{"ServiceName": vs.Name})
 	}
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 	return nil
 }
 
 // DelUsHsiaFlows - Deletes US HSIA Flows for the service
-func (vs *VoltService) DelUsHsiaFlows() error {
+func (vs *VoltService) DelUsHsiaFlows(cntx context.Context) error {
 
 	logger.Infow(ctx, "Removing US HSIA Services", log.Fields{"Services": vs.Name})
 	if vs.UsHSIAFlowsApplied || vgcRebooted {
@@ -437,19 +438,19 @@
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
-			if err = vs.DelFlows(device, usflows); err != nil {
+			if err = vs.DelFlows(cntx, device, usflows); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		}
 		vs.UsHSIAFlowsApplied = false
 	}
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 	return nil
 }
 
 // DelDsHsiaFlows - Deletes DS HSIA Flows for the service
-func (vs *VoltService) DelDsHsiaFlows() error {
+func (vs *VoltService) DelDsHsiaFlows(cntx context.Context) error {
 
 	logger.Infow(ctx, "Removing DS HSIA Services", log.Fields{"Services": vs.Name})
 	if vs.DsHSIAFlowsApplied || vgcRebooted {
@@ -469,7 +470,7 @@
 				return err
 			}
 			dsflows.MigrateCookie = vgcRebooted
-			if err = vs.DelFlows(device, dsflows); err != nil {
+			if err = vs.DelFlows(cntx, device, dsflows); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
@@ -480,7 +481,7 @@
 				return err
 			}
 			dsflows.MigrateCookie = vgcRebooted
-			if err = vs.DelFlows(device, dsflows); err != nil {
+			if err = vs.DelFlows(cntx, device, dsflows); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
@@ -494,7 +495,7 @@
 					continue
 				}
 				dsflows.MigrateCookie = vgcRebooted
-				if err = vs.DelFlows(device, dsflows); err != nil {
+				if err = vs.DelFlows(cntx, device, dsflows); err != nil {
 					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 				}
@@ -504,7 +505,7 @@
 	}
 	logger.Infow(ctx, "Deleted HSIA DS flows from DB successfuly", log.Fields{"ServiceName": vs.Name})
 	// Post HSIA configuration success indication on message bus
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 	return nil
 }
 
@@ -949,13 +950,13 @@
 }
 
 // SvcUpInd for service up indication
-func (vs *VoltService) SvcUpInd() {
-	vs.AddHsiaFlows()
+func (vs *VoltService) SvcUpInd(cntx context.Context) {
+	vs.AddHsiaFlows(cntx)
 }
 
 // SvcDownInd for service down indication
-func (vs *VoltService) SvcDownInd() {
-	vs.DelHsiaFlows()
+func (vs *VoltService) SvcDownInd(cntx context.Context) {
+	vs.DelHsiaFlows(cntx)
 }
 
 // SetIpv4Addr to set ipv4 address
@@ -987,7 +988,7 @@
 // current implementation, a service is an entity that is identified by a
 // unique L2 (MAC address + VLANs) or unique L3 (VLANs + IP address)
 // FUNC: Add Service
-func (va *VoltApplication) AddService(cfg VoltServiceCfg, oper *VoltServiceOper) error {
+func (va *VoltApplication) AddService(cntx context.Context, cfg VoltServiceCfg, oper *VoltServiceOper) error {
 	var mmUs, mmDs *VoltMeter
 	var err error
 
@@ -1059,10 +1060,10 @@
 	if vnet != nil {
 		if vpv := va.GetVnetByPort(vs.Port, cfg.SVlan, cfg.CVlan, cfg.UniVlan); vpv != nil {
 			vpv.VpvLock.Lock()
-			vpv.AddSvc(vs)
+			vpv.AddSvc(cntx, vs)
 			vpv.VpvLock.Unlock()
 		} else {
-			va.AddVnetToPort(vs.Port, vnet, vs)
+			va.AddVnetToPort(cntx, vs.Port, vnet, vs)
 		}
 	} else {
 		logger.Errorw(ctx, "VNET-does-not-exist-for-service", log.Fields{"ServiceName": cfg.Name})
@@ -1072,7 +1073,7 @@
 	vs.Version = database.PresentVersionMap[database.ServicePath]
 	// Add the service to the volt application
 	va.ServiceByName.Store(vs.Name, vs)
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 
 	if nil == oper {
 
@@ -1082,10 +1083,10 @@
 
 		//Update meter profiles service count if service is being added from northbound
 		mmDs.AssociatedServices++
-		va.UpdateMeterProf(*mmDs)
+		va.UpdateMeterProf(cntx, *mmDs)
 		if mmUs != nil {
 			mmUs.AssociatedServices++
-			va.UpdateMeterProf(*mmUs)
+			va.UpdateMeterProf(cntx, *mmUs)
 		}
 		//mmAg.AssociatedServices++
 		//va.UpdateMeterProf(*mmAg)
@@ -1098,18 +1099,18 @@
 
 //DelServiceWithPrefix - Deletes service with the provided prefix.
 // Added for DT/TT usecase with sadis replica interface
-func (va *VoltApplication) DelServiceWithPrefix(prefix string) {
+func (va *VoltApplication) DelServiceWithPrefix(cntx context.Context, prefix string) {
 	va.ServiceByName.Range(func(key, value interface{}) bool {
 		srvName := key.(string)
 		vs := value.(*VoltService)
 		if strings.Contains(srvName, prefix) {
-			va.DelService(srvName, true, nil, false)
+			va.DelService(cntx, srvName, true, nil, false)
 
 			vnetName := strconv.FormatUint(uint64(vs.SVlan), 10) + "-"
 			vnetName = vnetName + strconv.FormatUint(uint64(vs.CVlan), 10) + "-"
 			vnetName = vnetName + strconv.FormatUint(uint64(vs.UniVlan), 10)
 
-			if err := va.DelVnet(vnetName, ""); err != nil {
+			if err := va.DelVnet(cntx, vnetName, ""); err != nil {
 				logger.Warnw(ctx, "Delete Vnet Failed", log.Fields{"Name": vnetName, "Error": err})
 			}
 		}
@@ -1118,7 +1119,7 @@
 }
 
 // DelService delete a service form the application
-func (va *VoltApplication) DelService(name string, forceDelete bool, newSvc *VoltServiceCfg, serviceMigration bool) {
+func (va *VoltApplication) DelService(cntx context.Context, name string, forceDelete bool, newSvc *VoltServiceCfg, serviceMigration bool) {
 
 	AppMutex.ServiceDataMutex.Lock()
 	defer AppMutex.ServiceDataMutex.Unlock()
@@ -1141,7 +1142,7 @@
 	//Set this to avoid race-condition during flow result processing
 	vs.DeleteInProgress = true
 	vs.ForceDelete = forceDelete
-	vs.ForceWriteToDb()
+	vs.ForceWriteToDb(cntx)
 
 	if len(vs.AssociatedFlows) == 0 {
 		noFlowsPresent = true
@@ -1149,22 +1150,22 @@
 	vpv.VpvLock.Lock()
 	defer vpv.VpvLock.Unlock()
 
-	vs.DelHsiaFlows()
+	vs.DelHsiaFlows(cntx)
 
 	if vpv.IgmpEnabled {
-		va.ReceiverDownInd(vpv.Device, vpv.Port)
+		va.ReceiverDownInd(cntx, vpv.Device, vpv.Port)
 	}
 	logger.Infow(ctx, "Delete Service from VPV", log.Fields{"VPV_Port": vpv.Port, "VPV_SVlan": vpv.SVlan, "VPV_CVlan": vpv.CVlan, "VPV_UniVlan": vpv.UniVlan, "ServiceName": name})
-	vpv.DelService(vs)
+	vpv.DelService(cntx, vs)
 	if vpv.servicesCount.Load() == 0 {
-		va.DelVnetFromPort(vs.Port, vpv)
+		va.DelVnetFromPort(cntx, vs.Port, vpv)
 	}
 
 	// Delete the service immediately in case of Force Delete
 	// This will be enabled when profile reconciliation happens after restore
 	// of backedup data
 	if vs.ForceDelete {
-		vs.DelFromDb()
+		vs.DelFromDb(cntx)
 		GetApplication().ServiceByName.Delete(vs.Name)
 		logger.Warnw(ctx, "Deleted service from DB/Cache successfully", log.Fields{"serviceName": vs.Name})
 	}
@@ -1209,25 +1210,25 @@
 			meter.AssociatedServices--
 			if meter.AssociatedServices == 0 && !skipMeterDeletion {
 				logger.Infow(ctx, "Meter should be deleted now\n", log.Fields{"MeterID": meter})
-				va.UpdateMeterProf(*meter)
+				va.UpdateMeterProf(cntx, *meter)
 			}
 		}
 	}
 
 	if noFlowsPresent || vs.ForceDelete {
-		vs.CheckAndDeleteService()
+		vs.CheckAndDeleteService(cntx)
 	}
 
 	//Delete the per service counter too
 	va.ServiceCounters.Delete(name)
 	if vs.IgmpEnabled && vs.EnableMulticastKPI {
-		_ = db.DelAllServiceChannelCounter(name)
+		_ = db.DelAllServiceChannelCounter(cntx, name)
 	}
 }
 
 //AddFlows - Adds the flow to the service
 // Triggers flow addition after registering for flow indication event
-func (vs *VoltService) AddFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (vs *VoltService) AddFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
 
 	// Using locks instead of concurrent map for PendingFlows to avoid
 	// race condition during flow response indication processing
@@ -1245,12 +1246,12 @@
 		device.RegisterFlowAddEvent(cookie, fe)
 		vs.PendingFlows[cookie] = true
 	}
-	return cntlr.GetController().AddFlows(vs.Port, device.Name, flow)
+	return cntlr.GetController().AddFlows(cntx, vs.Port, device.Name, flow)
 }
 
 //FlowInstallSuccess - Called when corresponding service flow installation is success
 // If no more pending flows, HSIA indication wil be triggered
-func (vs *VoltService) FlowInstallSuccess(cookie string, bwAvailInfo of.BwAvailDetails) {
+func (vs *VoltService) FlowInstallSuccess(cntx context.Context, cookie string, bwAvailInfo of.BwAvailDetails) {
 	if vs.DeleteInProgress {
 		logger.Warnw(ctx, "Skipping Flow Add Success Notification. Service deletion in-progress", log.Fields{"Cookie": cookie, "Service": vs.Name})
 		return
@@ -1273,7 +1274,7 @@
 		vs.BwAvailInfo = prevBwAvail + "," + presentBwAvail
 		logger.Debugw(ctx, "Bandwidth-value-formed", log.Fields{"BwAvailInfo": vs.BwAvailInfo})
 	}
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 
 	if len(vs.PendingFlows) == 0 && vs.DsHSIAFlowsApplied {
 
@@ -1288,7 +1289,7 @@
 
 		if vs.Trigger == ServiceVlanUpdate {
 			vs.Trigger = NBActivate
-			defer vs.WriteToDb()
+			defer vs.WriteToDb(cntx)
 		}
 		logger.Infow(ctx, "All Flows installed for Service", log.Fields{"Service": vs.Name})
 		return
@@ -1313,7 +1314,7 @@
 
 //DelFlows - Deletes the flow from the service
 // Triggers flow deletion after registering for flow indication event
-func (vs *VoltService) DelFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (vs *VoltService) DelFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
 
 	if !vs.ForceDelete {
 		// Using locks instead of concurrent map for AssociatedFlows to avoid
@@ -1331,13 +1332,13 @@
 			device.RegisterFlowDelEvent(cookie, fe)
 		}
 	}
-	return cntlr.GetController().DelFlows(vs.Port, device.Name, flow)
+	return cntlr.GetController().DelFlows(cntx, vs.Port, device.Name, flow)
 }
 
 //CheckAndDeleteService - remove service from DB is there are no pending flows to be removed
-func (vs *VoltService) CheckAndDeleteService() {
+func (vs *VoltService) CheckAndDeleteService(cntx context.Context) {
 	if vs.DeleteInProgress && len(vs.AssociatedFlows) == 0 && !vs.DsHSIAFlowsApplied {
-		vs.DelFromDb()
+		vs.DelFromDb(cntx)
 		GetApplication().ServiceByName.Delete(vs.Name)
 		logger.Warnw(ctx, "Deleted service from DB/Cache successfully", log.Fields{"serviceName": vs.Name})
 	}
@@ -1345,7 +1346,7 @@
 
 //FlowRemoveSuccess - Called when corresponding service flow removal is success
 // If no more associated flows, DelHSIA indication wil be triggered
-func (vs *VoltService) FlowRemoveSuccess(cookie string) {
+func (vs *VoltService) FlowRemoveSuccess(cntx context.Context, cookie string) {
 
 	// if vs.DeleteInProgress {
 	// 	logger.Warnw(ctx, "Skipping Flow Remove Success Notification. Service deletion in-progress", log.Fields{"Cookie": cookie, "Service": vs.Name})
@@ -1364,7 +1365,7 @@
 
 	vs.ServiceLock.Unlock()
 
-	vs.WriteToDb()
+	vs.WriteToDb(cntx)
 
 	if len(vs.AssociatedFlows) == 0 && !vs.DsHSIAFlowsApplied {
 
@@ -1378,12 +1379,12 @@
 		}
 
 		if vs.UpdateInProgress {
-			vs.updateVnetProfile(vs.Device)
+			vs.updateVnetProfile(cntx, vs.Device)
 			//Not sending DEL_HSIA Indication since it wil be generated internally by SubMgr
 			return
 		}
 		logger.Infow(ctx, "All Flows removed for Service. Triggering Service De-activation Success indication to NB", log.Fields{"Service": vs.Name, "DeleteFlag": vs.DeleteInProgress})
-		vs.CheckAndDeleteService()
+		vs.CheckAndDeleteService(cntx)
 
 		return
 	}
@@ -1392,7 +1393,7 @@
 
 //FlowRemoveFailure - Called when corresponding service flow installation is failed
 // Trigger service failure indication to NB
-func (vs *VoltService) FlowRemoveFailure(cookie string, errorCode uint32, errReason string) {
+func (vs *VoltService) FlowRemoveFailure(cntx context.Context, cookie string, errorCode uint32, errReason string) {
 	vs.ServiceLock.RLock()
 
 	if _, ok := vs.AssociatedFlows[cookie]; !ok {
@@ -1407,7 +1408,7 @@
 	logger.Errorw(ctx, "Service Flow Remove Failure Notification", log.Fields{"uniPort": vs.Port, "Cookie": cookie, "Service": vs.Name, "ErrorCode": errorCode, "ErrorReason": errReason})
 
 	vs.triggerServiceFailureInd(errorCode, errReason)
-	vs.CheckAndDeleteService()
+	vs.CheckAndDeleteService(cntx)
 }
 
 func (vs *VoltService) triggerServiceFailureInd(errorCode uint32, errReason string) {
@@ -1422,9 +1423,9 @@
 }
 
 // RestoreSvcsFromDb read from the DB and restore all the services
-func (va *VoltApplication) RestoreSvcsFromDb() {
+func (va *VoltApplication) RestoreSvcsFromDb(cntx context.Context) {
 	// VNETS must be learnt first
-	vss, _ := db.GetServices()
+	vss, _ := db.GetServices(cntx)
 	for _, vs := range vss {
 		b, ok := vs.Value.([]byte)
 		if !ok {
@@ -1438,7 +1439,7 @@
 			continue
 		}
 		logger.Debugw(ctx, "Retrieved Service", log.Fields{"Service": vvs.VoltServiceCfg})
-		if err := va.AddService(vvs.VoltServiceCfg, &vvs.VoltServiceOper); err != nil {
+		if err := va.AddService(cntx, vvs.VoltServiceCfg, &vvs.VoltServiceOper); err != nil {
 			logger.Warnw(ctx, "Add New Service Failed", log.Fields{"Service": vvs.Name, "Error": err})
 		}
 
@@ -1551,10 +1552,10 @@
 // }
 
 //WriteToDB - writes the udpate vnet request details ot DB
-func (msr *MigrateServicesRequest) WriteToDB() {
+func (msr *MigrateServicesRequest) WriteToDB(cntx context.Context) {
 	logger.Debugw(ctx, "Adding Migrate Service Request to DB", log.Fields{"OldVnet": msr.OldVnetID, "NewVnet": msr.NewVnetID, "Device": msr.DeviceID, "RequestID": msr.ID, "ServiceCount": len(msr.ServicesList)})
 	if b, err := json.Marshal(msr); err == nil {
-		if err = db.PutMigrateServicesReq(msr.DeviceID, msr.GetMsrKey(), string(b)); err != nil {
+		if err = db.PutMigrateServicesReq(cntx, msr.DeviceID, msr.GetMsrKey(), string(b)); err != nil {
 			logger.Warnw(ctx, "PutMigrateServicesReq Failed", log.Fields{"OldVnet": msr.OldVnetID, "NewVnet": msr.NewVnetID,
 									"Device": msr.DeviceID, "Error": err})
 		}
@@ -1562,7 +1563,7 @@
 }
 
 //MigrateServices - updated vnet profile for services
-func (va *VoltApplication) MigrateServices(serialNum string, reqID string, oldVnetID, newVnetID string, serviceList []string) error {
+func (va *VoltApplication) MigrateServices(cntx context.Context, serialNum string, reqID string, oldVnetID, newVnetID string, serviceList []string) error {
 
 	logger.Warnw(ctx, "Migrate Serviec Request Received", log.Fields{"SerialNum": serialNum, "RequestID": reqID, "OldVnet": oldVnetID, "NewVnet": newVnetID, "ServiceList": serviceList})
 	if _, ok := va.VnetsByName.Load(oldVnetID); !ok {
@@ -1584,22 +1585,22 @@
 		serviceMap[service] = false
 	}
 	msr := newMigrateServicesRequest(reqID, oldVnetID, newVnetID, serviceMap, d.Name)
-	msr.WriteToDB()
+	msr.WriteToDB(cntx)
 
 	d.AddMigratingServices(msr)
-	go msr.ProcessMigrateServicesProfRequest()
+	go msr.ProcessMigrateServicesProfRequest(cntx)
 	return nil
 }
 
 //ProcessMigrateServicesProfRequest - collects all associated profiles
-func (msr *MigrateServicesRequest) ProcessMigrateServicesProfRequest() {
+func (msr *MigrateServicesRequest) ProcessMigrateServicesProfRequest(cntx context.Context) {
 	va := GetApplication()
 	for srv, processed := range msr.ServicesList {
 
 		//Indicates new service is already created and only deletion of old one is pending
 		if processed {
-			va.DelService(srv, true, nil, true)
-			msr.serviceMigrated(srv)
+			va.DelService(cntx, srv, true, nil, true)
+			msr.serviceMigrated(cntx, srv)
 			continue
 		}
 
@@ -1628,11 +1629,11 @@
 			//vpv flows will be removed when last service is removed from it and
 			// new vpv flows will be installed when new service is added
 			if vs.UsHSIAFlowsApplied {
-				vpv.DelTrapFlows()
-				vs.DelHsiaFlows()
+				vpv.DelTrapFlows(cntx)
+				vs.DelHsiaFlows(cntx)
 				logger.Infow(ctx, "Remove Service Flows Triggered", log.Fields{"Service": srv, "US": vs.UsHSIAFlowsApplied, "DS": vs.DsHSIAFlowsApplied})
 			} else {
-				vs.updateVnetProfile(msr.DeviceID)
+				vs.updateVnetProfile(cntx, msr.DeviceID)
 			}
 		} else {
 			logger.Warnw(ctx, "Migrate Service Failed: Service Not Found", log.Fields{"Service": srv, "Vnet": msr.OldVnetID})
@@ -1688,7 +1689,7 @@
 
 //updateVnetProfile - Called on flow process completion
 // Removes old service and creates new VPV & service with udpated vnet profile
-func (vs *VoltService) updateVnetProfile(deviceID string) {
+func (vs *VoltService) updateVnetProfile(cntx context.Context, deviceID string) {
 
 	logger.Infow(ctx, "Update Vnet Profile Triggering", log.Fields{"Service": vs.Name, "US": vs.UsHSIAFlowsApplied, "DS": vs.DsHSIAFlowsApplied})
 
@@ -1746,24 +1747,24 @@
 
 	//TODO:Nav Pass a copy, not the pointer
 	logger.Infow(ctx, "Add New Service Triggering", log.Fields{"Service": nvs.Name, "US": nvs.UsHSIAFlowsApplied, "DS": nvs.DsHSIAFlowsApplied, "DelFlag": nvs.DeleteInProgress})
-	if err := va.AddService(nvs.VoltServiceCfg, &nvs.VoltServiceOper); err != nil {
+	if err := va.AddService(cntx, nvs.VoltServiceCfg, &nvs.VoltServiceOper); err != nil {
 		logger.Warnw(ctx, "Add New Service Failed", log.Fields{"Service": nvs.Name, "Error": err})
 	}
 	logger.Infow(ctx, "Add New Service Triggered", log.Fields{"Service": nvs.Name, "US": nvs.UsHSIAFlowsApplied, "DS": nvs.DsHSIAFlowsApplied, "DelFlag": nvs.DeleteInProgress})
 
 	msr.ServicesList[oldSrvName] = true
 	va.updateMigrateServicesRequest(deviceID, oldVnetID, id, msr)
-	msr.WriteToDB()
+	msr.WriteToDB(cntx)
 
 	logger.Infow(ctx, "Del Old Service Triggering", log.Fields{"Service": oldSrvName, "US": vs.UsHSIAFlowsApplied, "DS": vs.DsHSIAFlowsApplied, "DelFlag": vs.DeleteInProgress})
-	va.DelService(oldSrvName, true, nil, true)
+	va.DelService(cntx, oldSrvName, true, nil, true)
 	logger.Infow(ctx, "Del Old Service Triggered", log.Fields{"Service": oldSrvName, "US": vs.UsHSIAFlowsApplied, "DS": vs.DsHSIAFlowsApplied, "DelFlag": vs.DeleteInProgress})
-	msr.serviceMigrated(oldSrvName)
+	msr.serviceMigrated(cntx, oldSrvName)
 }
 
 //serviceMigrated - called on successful service updation
 // Removes the service entry from servicelist and deletes the request on process completion
-func (msr *MigrateServicesRequest) serviceMigrated(serviceName string) {
+func (msr *MigrateServicesRequest) serviceMigrated(cntx context.Context, serviceName string) {
 
 	msr.MigrateServicesLock.Lock()
 	defer msr.MigrateServicesLock.Unlock()
@@ -1771,22 +1772,22 @@
 	delete(msr.ServicesList, serviceName)
 
 	if len(msr.ServicesList) == 0 {
-		_ = db.DelMigrateServicesReq(msr.DeviceID, msr.GetMsrKey())
+		_ = db.DelMigrateServicesReq(cntx, msr.DeviceID, msr.GetMsrKey())
 		return
 	}
-	msr.WriteToDB()
+	msr.WriteToDB(cntx)
 	//TODO:Nav - Need for any Response to SubMgr?
 }
 
 //TriggerPendingMigrateServicesReq - trigger pending service request
-func (va *VoltApplication) TriggerPendingMigrateServicesReq(device string) {
-	va.FetchAndProcessAllMigrateServicesReq(device, storeAndProcessMigrateSrvRequest)
+func (va *VoltApplication) TriggerPendingMigrateServicesReq(cntx context.Context, device string) {
+	va.FetchAndProcessAllMigrateServicesReq(cntx, device, storeAndProcessMigrateSrvRequest)
 }
 
 //FetchAndProcessAllMigrateServicesReq - fetch all pending migrate services req from DB and process based on provided func
-func (va *VoltApplication) FetchAndProcessAllMigrateServicesReq(device string, msrAction func(*MigrateServicesRequest)) {
+func (va *VoltApplication) FetchAndProcessAllMigrateServicesReq(cntx context.Context, device string, msrAction func(context.Context, *MigrateServicesRequest)) {
 
-	msrList, _ := db.GetAllMigrateServicesReq(device)
+	msrList, _ := db.GetAllMigrateServicesReq(cntx, device)
 	for _, msr := range msrList {
 		b, ok := msr.Value.([]byte)
 		if !ok {
@@ -1794,7 +1795,7 @@
 			continue
 		}
 		msr := va.createMigrateServicesFromString(b)
-		msrAction(msr)
+		msrAction(cntx, msr)
 		logger.Warnw(ctx, "Triggering Pending Migrate Services Req", log.Fields{"OldVnet": msr.OldVnetID, "NewVnet": msr.NewVnetID, "Device": device, "PendingProfiles": len(msr.ServicesList)})
 
 	}
@@ -1813,20 +1814,20 @@
 }
 
 //storeAndProcessMigrateSrvRequest - stores the msr info in device obj and triggers req
-func storeAndProcessMigrateSrvRequest(msr *MigrateServicesRequest) {
+func storeAndProcessMigrateSrvRequest(cntx context.Context, msr *MigrateServicesRequest) {
 	d := GetApplication().GetDevice(msr.DeviceID)
 	d.AddMigratingServices(msr)
-	msr.ProcessMigrateServicesProfRequest()
+	msr.ProcessMigrateServicesProfRequest(cntx)
 }
 
 //forceUpdateAllServices - force udpate services with new vnet profile
-func forceUpdateAllServices(msr *MigrateServicesRequest) {
+func forceUpdateAllServices(cntx context.Context, msr *MigrateServicesRequest) {
 	for srv := range msr.ServicesList {
 		if vsIntf, ok := GetApplication().ServiceByName.Load(srv); ok {
-			vsIntf.(*VoltService).updateVnetProfile(msr.DeviceID)
+			vsIntf.(*VoltService).updateVnetProfile(cntx, msr.DeviceID)
 		}
 	}
-	_ = db.DelMigrateServicesReq(msr.DeviceID, msr.GetMsrKey())
+	_ = db.DelMigrateServicesReq(cntx, msr.DeviceID, msr.GetMsrKey())
 }
 
 //DeepEqualServicecfg - checks if the given service cfgs are same
@@ -1929,18 +1930,18 @@
 }
 
 //TriggerAssociatedFlowDelete - re-trigger service flow delete for pending delete flows
-func (vs *VoltService) TriggerAssociatedFlowDelete() bool {
+func (vs *VoltService) TriggerAssociatedFlowDelete(cntx context.Context) bool {
 
 	//Clear the Flows flag if already set
 	//This case happens only in case of some race condition
 	if vs.UsHSIAFlowsApplied {
-		if err := vs.DelUsHsiaFlows(); err != nil {
+		if err := vs.DelUsHsiaFlows(cntx); err != nil {
 			logger.Errorw(ctx, "DelUsHsiaFlows Failed", log.Fields{"Device": vs.Device, "Service": vs.Name, "Error": err})
 		}
 	}
 
 	if vs.DsHSIAFlowsApplied {
-		if err := vs.DelDsHsiaFlows(); err != nil {
+		if err := vs.DelDsHsiaFlows(cntx); err != nil {
 			logger.Errorw(ctx, "DelDsHsiaFlows Failed", log.Fields{"Device": vs.Device, "Service": vs.Name, "Error": err})
 		}
 	}
@@ -1965,7 +1966,7 @@
 			subFlow.Cookie = cookie
 			flow.SubFlows[cookie] = subFlow
 			logger.Infow(ctx, "Retriggering Service Delete Flow", log.Fields{"Device": vs.Device, "Service": vs.Name, "Cookie": cookie})
-			if err := vs.DelFlows(vd, flow); err != nil {
+			if err := vs.DelFlows(cntx, vd, flow); err != nil {
 				logger.Errorw(ctx, "DelFlows Failed", log.Fields{"Device": vs.Device, "Service": vs.Name, "Cookie": cookie, "Error": err})
 			}
 		}
diff --git a/internal/pkg/application/timer.go b/internal/pkg/application/timer.go
index 1a80cb5..aa156a8 100644
--- a/internal/pkg/application/timer.go
+++ b/internal/pkg/application/timer.go
@@ -16,6 +16,7 @@
 package application
 
 import (
+	"context"
 	"time"
 )
 
@@ -40,7 +41,7 @@
 }
 
 // Start to start timer
-func (va *VoltApplication) Start(cfg TimerCfg, timerType TimerType) {
+func (va *VoltApplication) Start(cntx context.Context, cfg TimerCfg, timerType TimerType) {
 	if timerMap[timerType] {
 		logger.Warn(ctx, "Duplicate Timer!!! Timer already running")
 		return
@@ -54,7 +55,7 @@
 			case tickTimer:
 				va.Tick()
 			case pendingPoolTimer:
-				va.removeExpiredGroups()
+				va.removeExpiredGroups(cntx)
 			}
 		case <- timerChannels[timerType]:
 			return
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index 78fe54f..e11960c 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -18,6 +18,7 @@
 import (
 	"encoding/json"
 	"errors"
+	"context"
 	"net"
 	infraerrorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"strconv"
@@ -162,7 +163,7 @@
 }
 
 //disassociatePortFromVnet - disassociate a port from Vnet and return true if the association map is empty
-func (vv *VoltVnet) disassociatePortFromVnet(device string, port string) {
+func (vv *VoltVnet) disassociatePortFromVnet(cntx context.Context, device string, port string) {
 	vv.VnetPortLock.Lock()
 	delete(vv.AssociatedPorts, port)
 	logger.Infow(ctx, "Disassociated Port from Vnet", log.Fields{"Device": device, "Port": port, "Vnet": vv.Name, "PendingDeleteFlow": vv.PendingDeleteFlow, "AssociatedPorts": vv.AssociatedPorts, "DeleteFlag": vv.DeleteInProgress})
@@ -173,7 +174,7 @@
 			if len(vv.PendingDeleteFlow[device]) == 0 {
 				logger.Warnw(ctx, "Deleting Vnet", log.Fields{"Name": vv.Name})
 				GetApplication().deleteVnetConfig(vv)
-				_ = db.DelVnet(vv.Name)
+				_ = db.DelVnet(cntx, vv.Name)
 			} else {
 				logger.Warnw(ctx, "Skipping Del Vnet", log.Fields{"Name": vv.Name, "PendingDeleteFlow": vv.PendingDeleteFlow})
 			}
@@ -192,23 +193,23 @@
 }
 
 // WriteToDb commit the VNET to the database
-func (vv *VoltVnet) WriteToDb() {
+func (vv *VoltVnet) WriteToDb(cntx context.Context) {
 
 	if vv.DeleteInProgress {
 		logger.Warnw(ctx, "Skipping Redis Update for Vnet, Vnet delete in progress", log.Fields{"Vnet": vv.Name})
 		return
 	}
-	vv.ForceWriteToDb()
+	vv.ForceWriteToDb(cntx)
 }
 
 //ForceWriteToDb force commit a vnet to the DB
-func (vv *VoltVnet) ForceWriteToDb() {
+func (vv *VoltVnet) ForceWriteToDb(cntx context.Context) {
 	vv.VnetPortLock.RLock()
 	defer vv.VnetPortLock.RUnlock()
 	vv.Version = database.PresentVersionMap[database.VnetPath]
 	logger.Debugw(ctx, "Updating VNET....", log.Fields{"vnet": vv})
 	if b, err := json.Marshal(vv); err == nil {
-		if err:= db.PutVnet(vv.Name, string(b)); err != nil {
+		if err:= db.PutVnet(cntx, vv.Name, string(b)); err != nil {
 			logger.Warnw(ctx, "Add Vnet to DB failed", log.Fields{"vnet name": vv.Name, "Error": err})
 		}
 	}
@@ -275,7 +276,7 @@
 }
 
 // AddVnet to add a VNET to the list of VNETs configured.
-func (va *VoltApplication) AddVnet(cfg VnetConfig, oper *VnetOper) error {
+func (va *VoltApplication) AddVnet(cntx context.Context, cfg VnetConfig, oper *VnetOper) error {
 
 	AppMutex.VnetMutex.Lock()
 	var vv *VoltVnet
@@ -312,7 +313,7 @@
 	}
 
 	va.storeVnetConfig(cfg, vv)
-	vv.WriteToDb()
+	vv.WriteToDb(cntx)
 
 	logger.Infow(ctx, "Added VNET TO DB", log.Fields{"cfg": cfg, "devicesToHandle": devicesToHandle})
 
@@ -322,7 +323,7 @@
 }
 
 // DelVnet to delete a VNET from the list of VNETs configured
-func (va *VoltApplication) DelVnet(name, deviceSerialNum string) error {
+func (va *VoltApplication) DelVnet(cntx context.Context, name, deviceSerialNum string) error {
 	logger.Infow(ctx, "Deleting Vnet", log.Fields{"Vnet": name})
 	AppMutex.VnetMutex.Lock()
 	if vnetIntf, ok := va.VnetsByName.Load(name); ok {
@@ -330,23 +331,23 @@
 		//Delete from mvp list
 		vnet.DevicesList = util.RemoveFromSlice(vnet.DevicesList, deviceSerialNum)
 
-		va.DeleteDevFlowForVlanFromDevice(vnet, deviceSerialNum)
+		va.DeleteDevFlowForVlanFromDevice(cntx, vnet, deviceSerialNum)
 		if len(vnet.DevicesList) == 0 {
 			vnet.DeleteInProgress = true
 			vnet.PendingDeviceToDelete = deviceSerialNum
-			vnet.ForceWriteToDb()
+			vnet.ForceWriteToDb(cntx)
 			vnet.VnetPortLock.RLock()
 			if len(vnet.PendingDeleteFlow) == 0 && !vnet.isAssociatedPortsPresent() {
 				logger.Warnw(ctx, "Deleting Vnet", log.Fields{"Name": vnet.Name, "AssociatedPorts": vnet.AssociatedPorts, "PendingDelFlows": vnet.PendingDeleteFlow})
 				va.deleteVnetConfig(vnet)
-				_ = db.DelVnet(vnet.Name)
+				_ = db.DelVnet(cntx, vnet.Name)
 			} else {
 				logger.Warnw(ctx, "Skipping Del Vnet", log.Fields{"Name": vnet.Name, "AssociatedPorts": vnet.AssociatedPorts, "PendingDelFlows": vnet.PendingDeleteFlow})
 			}
 			vnet.VnetPortLock.RUnlock()
 		} else {
 			//Update the devicelist in db
-			vnet.WriteToDb()
+			vnet.WriteToDb(cntx)
 		}
 	}
 	//TODO: if no vnets are present on device remove icmpv6 group from device
@@ -355,9 +356,9 @@
 }
 
 // UpdateVnet to update the VNET with associated service count
-func (va *VoltApplication) UpdateVnet(vv *VoltVnet) error {
+func (va *VoltApplication) UpdateVnet(cntx context.Context, vv *VoltVnet) error {
 	va.storeVnetConfig(vv.VnetConfig, vv)
-	vv.WriteToDb()
+	vv.WriteToDb(cntx)
 	logger.Infow(ctx, "Updated VNET TO DB", log.Fields{"vv": vv.VnetConfig})
 	return nil
 }
@@ -577,13 +578,13 @@
 }
 
 // DhcpResultInd for dhcp result indication
-func (vpv *VoltPortVnet) DhcpResultInd(res *layers.DHCPv4) {
-	vpv.ProcessDhcpResult(res)
+func (vpv *VoltPortVnet) DhcpResultInd(cntx context.Context, res *layers.DHCPv4) {
+	vpv.ProcessDhcpResult(cntx, res)
 }
 
 // Dhcpv6ResultInd for dhcpv6 result indication
-func (vpv *VoltPortVnet) Dhcpv6ResultInd(ipv6Addr net.IP, leaseTime uint32) {
-	vpv.ProcessDhcpv6Result(ipv6Addr, leaseTime)
+func (vpv *VoltPortVnet) Dhcpv6ResultInd(cntx context.Context, ipv6Addr net.IP, leaseTime uint32) {
+	vpv.ProcessDhcpv6Result(cntx, ipv6Addr, leaseTime)
 }
 
 // GetNniVlans to get nni vlans
@@ -611,20 +612,20 @@
 }
 
 // AddService to add service
-func (vpv *VoltPortVnet) AddService(service *VoltService) {
+func (vpv *VoltPortVnet) AddService(cntx context.Context, service *VoltService) {
 	vpv.services.Store(service.Name, service)
 	vpv.servicesCount.Inc()
 	logger.Infow(ctx, "Service added/updated to VPV", log.Fields{"Port": vpv.Port, "SVLAN": vpv.SVlan, "CVLAN": vpv.CVlan, "UNIVlan": vpv.UniVlan, "Service": service.Name, "Count": vpv.servicesCount.Load()})
 }
 
 // DelService to delete service
-func (vpv *VoltPortVnet) DelService(service *VoltService) {
+func (vpv *VoltPortVnet) DelService(cntx context.Context, service *VoltService) {
 	vpv.services.Delete(service.Name)
 	vpv.servicesCount.Dec()
 
 	// If the only Igmp Enabled service is removed, remove the Igmp trap flow along with it
 	if service.IgmpEnabled {
-		if err := vpv.DelIgmpFlows(); err != nil {
+		if err := vpv.DelIgmpFlows(cntx); err != nil {
 			statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 			vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 		}
@@ -635,26 +636,33 @@
 }
 
 // ProcessDhcpResult to process dhcp results
-func (vpv *VoltPortVnet) ProcessDhcpResult(res *layers.DHCPv4) {
+func (vpv *VoltPortVnet) ProcessDhcpResult(cntx context.Context, res *layers.DHCPv4) {
 	msgType := DhcpMsgType(res)
 	if msgType == layers.DHCPMsgTypeAck {
-		vpv.ProcessDhcpSuccess(res)
+		vpv.ProcessDhcpSuccess(cntx, res)
 	} else if msgType == layers.DHCPMsgTypeNak {
 		vpv.DhcpStatus = DhcpStatusNacked
 	}
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
+}
+
+// RangeOnServices to call a function on all services on the vpv
+func (vpv *VoltPortVnet) RangeOnServices(cntx context.Context, callback func(cntx context.Context, key, value interface{}) bool) {
+	vpv.services.Range(func(key, value interface{}) bool {
+		return callback(cntx, key, value)
+	})
 }
 
 // ProcessDhcpSuccess : Learn the IPv4 address allocated to the services and update the
 // the services with the same. This also calls for adding flows
 // for the services as the DHCP procedure is completed
-func (vpv *VoltPortVnet) ProcessDhcpSuccess(res *layers.DHCPv4) {
+func (vpv *VoltPortVnet) ProcessDhcpSuccess(cntx context.Context, res *layers.DHCPv4) {
 	vpv.DhcpStatus = DhcpStatusAcked
 	vpv.Ipv4Addr, _ = GetIpv4Addr(res)
 	logger.Infow(ctx, "Received IPv4 Address", log.Fields{"IP Address": vpv.Ipv4Addr.String()})
 	logger.Infow(ctx, "Services Configured", log.Fields{"Count": vpv.servicesCount.Load()})
 
-	vpv.services.Range(vpv.updateIPv4AndProvisionFlows)
+	vpv.RangeOnServices(cntx, vpv.updateIPv4AndProvisionFlows)
 	vpv.ProcessDhcpv4Options(res)
 }
 
@@ -675,17 +683,17 @@
 // VNET. The same IPv6 address is also passed to the services. When a
 // service is fetched all the associated information such as MAC address,
 // IPv4 address and IPv6 addresses can be provided.
-func (vpv *VoltPortVnet) ProcessDhcpv6Result(ipv6Addr net.IP, leaseTime uint32) {
+func (vpv *VoltPortVnet) ProcessDhcpv6Result(cntx context.Context, ipv6Addr net.IP, leaseTime uint32) {
 	// TODO: Status based hanlding of flows
 	vpv.Dhcp6ExpiryTime = time.Now().Add((time.Duration(leaseTime) * time.Second))
 	vpv.Ipv6Addr = ipv6Addr
 
-	vpv.services.Range(vpv.updateIPv6AndProvisionFlows)
-	vpv.WriteToDb()
+	vpv.RangeOnServices(cntx, vpv.updateIPv6AndProvisionFlows)
+	vpv.WriteToDb(cntx)
 }
 
 // AddSvcUsMeterToDevice to add service upstream meter info to device
-func AddSvcUsMeterToDevice(key, value interface{}) bool {
+func AddSvcUsMeterToDevice(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	logger.Infow(ctx, "Adding upstream meter profile to device", log.Fields{"ServiceName": svc.Name})
 	if device, _ := GetApplication().GetDeviceFromPort(svc.Port); device != nil {
@@ -697,7 +705,7 @@
 }
 
 // PushFlowsForPortVnet - triggers flow construction and push for provided VPV
-func (vpv *VoltPortVnet) PushFlowsForPortVnet(d *VoltDevice) {
+func (vpv *VoltPortVnet) PushFlowsForPortVnet(cntx context.Context, d *VoltDevice) {
 
 	vp := d.GetPort(vpv.Port)
 
@@ -717,7 +725,7 @@
 	// vpv.DsFlowsApplied = false
 	// vpv.UsFlowsApplied = false
 	vpv.VpvLock.Lock()
-	vpv.PortUpInd(d, vpv.Port)
+	vpv.PortUpInd(cntx, d, vpv.Port)
 	vpv.VpvLock.Unlock()
 }
 
@@ -726,7 +734,7 @@
 // again here to apply the latest configuration if the configuration
 // changed. Thus, a reboot of ONT forces the new configuration to get
 // applied.
-func (vpv *VoltPortVnet) PortUpInd(device *VoltDevice, port string) {
+func (vpv *VoltPortVnet) PortUpInd(cntx context.Context, device *VoltDevice, port string) {
 
 	if vpv.DeleteInProgress {
 		logger.Errorw(ctx, "Ignoring VPV Port UP Ind, VPV deleteion In-Progress", log.Fields{"Device": device, "Port": port, "Vnet": vpv.VnetName})
@@ -760,16 +768,16 @@
 		logger.Infow(ctx, "Port Up - Trap Flows", log.Fields{"Device": device.Name, "Port": port})
 		// no HSIA flows for multicast service
 		if !vpv.McastService {
-			vpv.services.Range(AddUsHsiaFlows)
+			vpv.RangeOnServices(cntx, AddUsHsiaFlows)
 		}
-		vpv.AddTrapFlows()
+		vpv.AddTrapFlows(cntx)
 		if vpv.MacLearning == MacLearningNone || NonZeroMacAddress(vpv.MacAddr) {
 			logger.Infow(ctx, "Port Up - DS Flows", log.Fields{"Device": device.Name, "Port": port})
 			// US & DS DHCP, US HSIA flows are already installed
 			// install only DS HSIA flow here.
 			// no HSIA flows for multicast service
 			if !vpv.McastService {
-				vpv.services.Range(AddDsHsiaFlows)
+				vpv.RangeOnServices(cntx, AddDsHsiaFlows)
 			}
 		}
 
@@ -781,50 +789,50 @@
 		// however is not seen as a real use case.
 		logger.Infow(ctx, "Port Up - Service Flows", log.Fields{"Device": device.Name, "Port": port})
 		if !vpv.McastService {
-			vpv.services.Range(AddUsHsiaFlows)
+			vpv.RangeOnServices(cntx, AddUsHsiaFlows)
 		}
-		vpv.AddTrapFlows()
+		vpv.AddTrapFlows(cntx)
 		if !vpv.McastService {
-			vpv.services.Range(AddDsHsiaFlows)
+			vpv.RangeOnServices(cntx, AddDsHsiaFlows)
 		}
 	}
 
 	// Process IGMP proxy - install IGMP trap rules before DHCP trap rules
 	if vpv.IgmpEnabled {
 		logger.Infow(ctx, "Port Up - IGMP Flows", log.Fields{"Device": device.Name, "Port": port})
-		vpv.services.Range(AddSvcUsMeterToDevice)
-		if err := vpv.AddIgmpFlows(); err != nil {
+		vpv.RangeOnServices(cntx, AddSvcUsMeterToDevice)
+		if err := vpv.AddIgmpFlows(cntx); err != nil {
 			statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 			vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 		}
 
 		if vpv.McastService {
-			vpv.services.Range(PostAccessConfigSuccessInd)
+			vpv.RangeOnServices(cntx, PostAccessConfigSuccessInd)
 		}
 	}
 
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
 }
 
 // PortDownInd : When the port status changes to down, we delete all configured flows
 // The same indication is also passed to the services enqueued for them
 // to take appropriate actions
-func (vpv *VoltPortVnet) PortDownInd(device string, port string) {
+func (vpv *VoltPortVnet) PortDownInd(cntx context.Context, device string, port string) {
 
 	logger.Infow(ctx, "VPV Port DOWN Ind, deleting all flows for services",
 		log.Fields{"service count": vpv.servicesCount.Load()})
 
-	//vpv.services.Range(DelAllFlows)
-	vpv.DelTrapFlows()
-	vpv.DelHsiaFlows()
-	vpv.WriteToDb()
-	vpv.ClearServiceCounters()
+	//vpv.RangeOnServices(cntx, DelAllFlows)
+	vpv.DelTrapFlows(cntx)
+	vpv.DelHsiaFlows(cntx)
+	vpv.WriteToDb(cntx)
+	vpv.ClearServiceCounters(cntx)
 }
 
 // SetMacAddr : The MAC address is set when a MAC address is learnt through the
 // packets received from the network. Currently, DHCP packets are
 // only packets we learn the MAC address from
-func (vpv *VoltPortVnet) SetMacAddr(addr net.HardwareAddr) {
+func (vpv *VoltPortVnet) SetMacAddr(cntx context.Context, addr net.HardwareAddr) {
 
 	//Store Learnt MAC address and return if MACLearning is not enabled
 	vpv.LearntMacAddr = addr
@@ -852,15 +860,15 @@
 			// may have been changed
 			// Atleast one HSIA flow should be present in adapter to retain the TP and GEM
 			// hence delete one after the other
-			vpv.services.Range(DelUsHsiaFlows)
+			vpv.RangeOnServices(cntx, DelUsHsiaFlows)
 			vpv.MacAddr = addr
-			vpv.services.Range(vpv.setLearntMAC)
-			vpv.services.Range(AddUsHsiaFlows)
-			vpv.services.Range(DelDsHsiaFlows)
+			vpv.RangeOnServices(cntx, vpv.setLearntMAC)
+			vpv.RangeOnServices(cntx, AddUsHsiaFlows)
+			vpv.RangeOnServices(cntx, DelDsHsiaFlows)
 			GetApplication().DeleteMacInPortMap(vpv.MacAddr)
 		} else {
 			vpv.MacAddr = addr
-			vpv.services.Range(vpv.setLearntMAC)
+			vpv.RangeOnServices(cntx, vpv.setLearntMAC)
 			logger.Infow(ctx, "MAC Address learnt from DHCP or ARP", log.Fields{"Learnt MAC": addr.String(), "Port": vpv.Port})
 		}
 		GetApplication().UpdateMacInPortMap(vpv.MacAddr, vpv.Port)
@@ -879,10 +887,10 @@
 	if vpv.FlowsApplied {
 		// no HSIA flows for multicast service
 		if !vpv.McastService {
-			vpv.services.Range(AddDsHsiaFlows)
+			vpv.RangeOnServices(cntx, AddDsHsiaFlows)
 		}
 	}
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
 }
 
 // MatchesVlans : If the VNET matches both S and C VLANs, return true. Else, return false
@@ -954,10 +962,10 @@
 
 // AddSvc adds a service on the VNET on a port. The addition is
 // triggered when NB requests for service addition
-func (vpv *VoltPortVnet) AddSvc(svc *VoltService) {
+func (vpv *VoltPortVnet) AddSvc(cntx context.Context, svc *VoltService) {
 
 	//vpv.services = append(vpv.services, svc)
-	vpv.AddService(svc)
+	vpv.AddService(cntx, svc)
 	logger.Debugw(ctx, "Added Service to VPV", log.Fields{"Num of SVCs": vpv.servicesCount.Load(), "SVC": svc})
 
 	// Learn the circuit-id and remote-id from the service
@@ -1034,9 +1042,9 @@
 	//to which the serivce is associated
 	if vpv.FlowsApplied {
 		if NonZeroMacAddress(vpv.MacAddr) || svc.MacLearning == MacLearningNone {
-			svc.AddHsiaFlows()
+			svc.AddHsiaFlows(cntx)
 		} else {
-			if err:= svc.AddUsHsiaFlows(); err != nil {
+			if err:= svc.AddUsHsiaFlows(cntx); err != nil {
 				logger.Warnw(ctx, "Add US hsia flow failed", log.Fields{"service": svc.Name, "Error": err})
 			}
 		}
@@ -1047,71 +1055,71 @@
 	// service with Igmp Enabled needs to be installed
 	if svc.IgmpEnabled && vpv.FlowsApplied {
 		logger.Infow(ctx, "Add Service - IGMP Flows", log.Fields{"Device": vpv.Device, "Port": vpv.Port})
-		if err := vpv.AddIgmpFlows(); err != nil {
+		if err := vpv.AddIgmpFlows(cntx); err != nil {
 			statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 			vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 		}
 
 		if vpv.McastService {
 			//For McastService, send Service Activated indication once IGMP US flow is pushed
-			vpv.services.Range(PostAccessConfigSuccessInd)
+			vpv.RangeOnServices(cntx, PostAccessConfigSuccessInd)
 		}
 	}
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
 }
 
 // setLearntMAC to set learnt mac
-func (vpv *VoltPortVnet) setLearntMAC(key, value interface{}) bool {
+func (vpv *VoltPortVnet) setLearntMAC(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	svc.SetMacAddr(vpv.MacAddr)
-	svc.WriteToDb()
+	svc.WriteToDb(cntx)
 	return true
 }
 
 // PostAccessConfigSuccessInd for posting access config success indication
-func PostAccessConfigSuccessInd(key, value interface{}) bool {
+func PostAccessConfigSuccessInd(cntx context.Context, key, value interface{}) bool {
 	return true
 }
 
 // updateIPv4AndProvisionFlows to update ipv4 and provisional flows
-func (vpv *VoltPortVnet) updateIPv4AndProvisionFlows(key, value interface{}) bool {
+func (vpv *VoltPortVnet) updateIPv4AndProvisionFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	logger.Infow(ctx, "Updating Ipv4 address for service", log.Fields{"ServiceName": svc.Name})
 	svc.SetIpv4Addr(vpv.Ipv4Addr)
-	svc.WriteToDb()
+	svc.WriteToDb(cntx)
 
 	return true
 }
 
 // updateIPv6AndProvisionFlows to update ipv6 and provisional flow
-func (vpv *VoltPortVnet) updateIPv6AndProvisionFlows(key, value interface{}) bool {
+func (vpv *VoltPortVnet) updateIPv6AndProvisionFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	svc.SetIpv6Addr(vpv.Ipv6Addr)
-	svc.WriteToDb()
+	svc.WriteToDb(cntx)
 
 	return true
 }
 
 // AddUsHsiaFlows to add upstream hsia flows
-func AddUsHsiaFlows(key, value interface{}) bool {
+func AddUsHsiaFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
-	if err:= svc.AddUsHsiaFlows(); err != nil {
+	if err:= svc.AddUsHsiaFlows(cntx); err != nil {
 		logger.Warnw(ctx, "Add US hsia flow failed", log.Fields{"service": svc.Name, "Error": err})
 	}
 	return true
 }
 
 // AddDsHsiaFlows to add downstream hsia flows
-func AddDsHsiaFlows(key, value interface{}) bool {
+func AddDsHsiaFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
-	if err:= svc.AddDsHsiaFlows(); err != nil {
+	if err:= svc.AddDsHsiaFlows(cntx); err != nil {
 		logger.Warnw(ctx, "Add DS hsia flow failed", log.Fields{"service": svc.Name, "Error": err})
 	}
 	return true
 }
 
 // ClearFlagsInService to clear the flags used in service
-func ClearFlagsInService(key, value interface{}) bool {
+func ClearFlagsInService(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	svc.ServiceLock.Lock()
 	svc.IgmpFlowsApplied = false
@@ -1123,50 +1131,50 @@
 	svc.PendingFlows = make(map[string]bool)
 	svc.AssociatedFlows = make(map[string]bool)
 	svc.ServiceLock.Unlock()
-	svc.WriteToDb()
+	svc.WriteToDb(cntx)
 	logger.Debugw(ctx, "Cleared Flow Flags for service", log.Fields{"name": svc.Name})
 	return true
 }
 
 // DelDsHsiaFlows to delete hsia flows
-func DelDsHsiaFlows(key, value interface{}) bool {
+func DelDsHsiaFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
-	if err:= svc.DelDsHsiaFlows(); err != nil {
+	if err:= svc.DelDsHsiaFlows(cntx); err != nil {
 		logger.Warnw(ctx, "Delete DS hsia flow failed", log.Fields{"service": svc.Name, "Error": err})
 	}
 	return true
 }
 
 // DelUsHsiaFlows to delete upstream hsia flows
-func DelUsHsiaFlows(key, value interface{}) bool {
+func DelUsHsiaFlows(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
-	if err:= svc.DelUsHsiaFlows(); err != nil {
+	if err:= svc.DelUsHsiaFlows(cntx); err != nil {
 		logger.Warnw(ctx, "Delete US hsia flow failed", log.Fields{"service": svc.Name, "Error": err})
 	}
 	return true
 }
 
 // ClearServiceCounters to clear the service counters
-func ClearServiceCounters(key, value interface{}) bool {
+func ClearServiceCounters(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
 	//Delete the per service counter too
 	GetApplication().ServiceCounters.Delete(svc.Name)
 	if svc.IgmpEnabled && svc.EnableMulticastKPI {
-		_ = db.DelAllServiceChannelCounter(svc.Name)
+		_ = db.DelAllServiceChannelCounter(cntx, svc.Name)
 	}
 	return true
 }
 
 //AddTrapFlows - Adds US & DS Trap flows
-func (vpv *VoltPortVnet) AddTrapFlows() {
+func (vpv *VoltPortVnet) AddTrapFlows(cntx context.Context) {
 
 	if !vpv.FlowsApplied || vgcRebooted {
 		if vpv.DhcpRelay {
-			if err := vpv.AddUsDhcpFlows(); err != nil {
+			if err := vpv.AddUsDhcpFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
-			if err := vpv.AddDsDhcpFlows(); err != nil {
+			if err := vpv.AddDsDhcpFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
@@ -1174,85 +1182,85 @@
 				log.Fields{"port": vpv.Port})
 			//vpv.updateICMPv6McGroup(true)
 		} else if vpv.ArpRelay {
-			if err := vpv.AddUsArpFlows(); err != nil {
+			if err := vpv.AddUsArpFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
 			logger.Info(ctx, "ARP trap rules not added in downstream direction")
 
 		} else if vpv.PppoeIa {
-			if err := vpv.AddUsPppoeFlows(); err != nil {
+			if err := vpv.AddUsPppoeFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
-			if err := vpv.AddDsPppoeFlows(); err != nil {
+			if err := vpv.AddDsPppoeFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
 		}
 		vpv.FlowsApplied = true
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 }
 
 //DelTrapFlows - Removes all US & DS DHCP, IGMP trap flows.
-func (vpv *VoltPortVnet) DelTrapFlows() {
+func (vpv *VoltPortVnet) DelTrapFlows(cntx context.Context) {
 
 	// Delete HSIA & DHCP flows before deleting IGMP flows
 	if vpv.FlowsApplied || vgcRebooted {
 		if vpv.DhcpRelay {
-			if err:= vpv.DelUsDhcpFlows(); err != nil {
+			if err:= vpv.DelUsDhcpFlows(cntx); err != nil {
 				logger.Warnw(ctx, "Delete US hsia flow failed", log.Fields{"port": vpv.Port, "SVlan": vpv.SVlan, "CVlan": vpv.CVlan,
 					"UniVlan": vpv.UniVlan, "Error": err})
 			}
 			logger.Infow(ctx, "ICMPv6 MC Group modification will not be triggered to rwcore  for ",
 				log.Fields{"port": vpv.Port})
-			if err := vpv.DelDsDhcpFlows(); err != nil {
+			if err := vpv.DelDsDhcpFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
 			//vpv.updateICMPv6McGroup(false)
 		} else if vpv.ArpRelay {
-			if err := vpv.DelUsArpFlows(); err != nil {
+			if err := vpv.DelUsArpFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
 		} else if vpv.PppoeIa {
-			if err := vpv.DelUsPppoeFlows(); err != nil {
+			if err := vpv.DelUsPppoeFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
-			if err := vpv.DelDsPppoeFlows(); err != nil {
+			if err := vpv.DelDsPppoeFlows(cntx); err != nil {
 				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 				vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 			}
 		}
 		vpv.FlowsApplied = false
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
-	if err:= vpv.DelIgmpFlows(); err != nil {
+	if err:= vpv.DelIgmpFlows(cntx); err != nil {
 		logger.Warnw(ctx, "Delete igmp flow failed", log.Fields{"port": vpv.Port, "SVlan": vpv.SVlan, "CVlan": vpv.CVlan,
 			"UniVlan": vpv.UniVlan, "Error": err})
 	}
 }
 
 // DelHsiaFlows deletes the service flows
-func (vpv *VoltPortVnet) DelHsiaFlows() {
+func (vpv *VoltPortVnet) DelHsiaFlows(cntx context.Context) {
 	// no HSIA flows for multicast service
 	if !vpv.McastService {
-		vpv.services.Range(DelUsHsiaFlows)
-		vpv.services.Range(DelDsHsiaFlows)
+		vpv.RangeOnServices(cntx, DelUsHsiaFlows)
+		vpv.RangeOnServices(cntx, DelDsHsiaFlows)
 	}
 }
 
 //ClearServiceCounters - Removes all igmp counters for a service
-func (vpv *VoltPortVnet) ClearServiceCounters() {
+func (vpv *VoltPortVnet) ClearServiceCounters(cntx context.Context) {
 	//send flows deleted indication to submgr
-	vpv.services.Range(ClearServiceCounters)
+	vpv.RangeOnServices(cntx, ClearServiceCounters)
 }
 
 // AddUsDhcpFlows pushes the DHCP flows to the VOLTHA via the controller
-func (vpv *VoltPortVnet) AddUsDhcpFlows() error {
+func (vpv *VoltPortVnet) AddUsDhcpFlows(cntx context.Context) error {
 	var vd *VoltDevice
 	device := vpv.Device
 
@@ -1269,7 +1277,7 @@
 	flows, err := vpv.BuildUsDhcpFlows()
 	if err == nil {
 		logger.Debugw(ctx, "Adding US DHCP flows", log.Fields{"Device": device})
-		if err1 := vpv.PushFlows(vd, flows); err1 != nil {
+		if err1 := vpv.PushFlows(cntx, vd, flows); err1 != nil {
 			//push ind here ABHI
 			statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err1)
 			vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
@@ -1302,7 +1310,7 @@
 }
 
 // AddDsDhcpFlows function pushes the DHCP flows to the VOLTHA via the controller
-func (vpv *VoltPortVnet) AddDsDhcpFlows() error {
+func (vpv *VoltPortVnet) AddDsDhcpFlows(cntx context.Context) error {
 
 	var vd *VoltDevice
 	device := vpv.Device
@@ -1322,7 +1330,7 @@
 
 	flows, err := vpv.BuildDsDhcpFlows()
 	if err == nil {
-		if err1 := vpv.PushFlows(vd, flows); err1 != nil {
+		if err1 := vpv.PushFlows(cntx, vd, flows); err1 != nil {
 			//push ind here and procced
 			statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err1)
 			vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
@@ -1358,13 +1366,13 @@
 }
 
 // DelDhcpFlows deletes both US & DS DHCP flows applied for this Vnet instantiated on the port
-func (vpv *VoltPortVnet) DelDhcpFlows() {
-	if err := vpv.DelUsDhcpFlows(); err != nil {
+func (vpv *VoltPortVnet) DelDhcpFlows(cntx context.Context) {
+	if err := vpv.DelUsDhcpFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 	}
 
-	if err := vpv.DelDsDhcpFlows(); err != nil {
+	if err := vpv.DelDsDhcpFlows(cntx); err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
 	}
@@ -1373,13 +1381,13 @@
 // DelUsDhcpFlows delete the DHCP flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelUsDhcpFlows() error {
+func (vpv *VoltPortVnet) DelUsDhcpFlows(cntx context.Context) error {
 	device, err := GetApplication().GetDeviceFromPort(vpv.Port)
 	if err != nil {
 		return err
 	}
 
-	err = vpv.delDhcp4Flows(device)
+	err = vpv.delDhcp4Flows(cntx, device)
 	if err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
@@ -1393,10 +1401,10 @@
 	return nil
 }
 
-func (vpv *VoltPortVnet) delDhcp4Flows(device *VoltDevice) error {
+func (vpv *VoltPortVnet) delDhcp4Flows(cntx context.Context, device *VoltDevice) error {
 	flows, err := vpv.BuildUsDhcpFlows()
 	if err == nil {
-		return vpv.RemoveFlows(device, flows)
+		return vpv.RemoveFlows(cntx, device, flows)
 	}
 	logger.Errorw(ctx, "US DHCP Flow Delete Failed", log.Fields{"Reason": err.Error()})
 	return err
@@ -1415,12 +1423,12 @@
 // DelDsDhcpFlows delete the DHCP flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelDsDhcpFlows() error {
+func (vpv *VoltPortVnet) DelDsDhcpFlows(cntx context.Context) error {
 	device, err := GetApplication().GetDeviceFromPort(vpv.Port)
 	if err != nil {
 		return err
 	}
-	err = vpv.delDsDhcp4Flows(device)
+	err = vpv.delDsDhcp4Flows(cntx, device)
 	if err != nil {
 		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
 		vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
@@ -1434,10 +1442,10 @@
 	return nil
 }
 
-func (vpv *VoltPortVnet) delDsDhcp4Flows(device *VoltDevice) error {
+func (vpv *VoltPortVnet) delDsDhcp4Flows(cntx context.Context, device *VoltDevice) error {
 	flows, err := vpv.BuildDsDhcpFlows()
 	if err == nil {
-		return vpv.RemoveFlows(device, flows)
+		return vpv.RemoveFlows(cntx, device, flows)
 	}
 	logger.Errorw(ctx, "DS DHCP Flow Delete Failed", log.Fields{"Reason": err.Error()})
 	return err
@@ -1454,7 +1462,7 @@
 }*/
 
 // AddUsArpFlows pushes the ARP flows to the VOLTHA via the controller
-func (vpv *VoltPortVnet) AddUsArpFlows() error {
+func (vpv *VoltPortVnet) AddUsArpFlows(cntx context.Context) error {
 
 	var vd *VoltDevice
 	device := vpv.Device
@@ -1471,7 +1479,7 @@
 	flows, err := vpv.BuildUsArpFlows()
 	if err == nil {
 		logger.Debugw(ctx, "Adding US ARP flows", log.Fields{"Device": device})
-		if err1 := vpv.PushFlows(vd, flows); err1 != nil {
+		if err1 := vpv.PushFlows(cntx, vd, flows); err1 != nil {
 			return err1
 		}
 	} else {
@@ -1484,21 +1492,21 @@
 // DelUsArpFlows delete the ARP flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelUsArpFlows() error {
+func (vpv *VoltPortVnet) DelUsArpFlows(cntx context.Context) error {
 	device, err := GetApplication().GetDeviceFromPort(vpv.Port)
 	if err != nil {
 		return err
 	}
 	flows, err := vpv.BuildUsArpFlows()
 	if err == nil {
-		return vpv.RemoveFlows(device, flows)
+		return vpv.RemoveFlows(cntx, device, flows)
 	}
 	logger.Errorw(ctx, "US ARP Flow Delete Failed", log.Fields{"Reason": err.Error()})
 	return err
 }
 
 // AddUsPppoeFlows pushes the PPPoE flows to the VOLTHA via the controller
-func (vpv *VoltPortVnet) AddUsPppoeFlows() error {
+func (vpv *VoltPortVnet) AddUsPppoeFlows(cntx context.Context) error {
 	logger.Debugw(ctx, "Adding US PPPoE flows", log.Fields{"STAG": vpv.SVlan, "CTAG": vpv.CVlan, "Device": vpv.Device})
 
 	var vd *VoltDevice
@@ -1517,7 +1525,7 @@
 	if flows, err := vpv.BuildUsPppoeFlows(); err == nil {
 		logger.Debugw(ctx, "Adding US PPPoE flows", log.Fields{"Device": device})
 
-		if err1 := vpv.PushFlows(vd, flows); err1 != nil {
+		if err1 := vpv.PushFlows(cntx, vd, flows); err1 != nil {
 			return err1
 		}
 	} else {
@@ -1528,7 +1536,7 @@
 }
 
 // AddDsPppoeFlows to add downstream pppoe flows
-func (vpv *VoltPortVnet) AddDsPppoeFlows() error {
+func (vpv *VoltPortVnet) AddDsPppoeFlows(cntx context.Context) error {
 	logger.Debugw(ctx, "Adding DS PPPoE flows", log.Fields{"STAG": vpv.SVlan, "CTAG": vpv.CVlan, "Device": vpv.Device})
 	var vd *VoltDevice
 	device := vpv.Device
@@ -1546,7 +1554,7 @@
 	flows, err := vpv.BuildDsPppoeFlows()
 	if err == nil {
 
-		if err1 := vpv.PushFlows(vd, flows); err1 != nil {
+		if err1 := vpv.PushFlows(cntx, vd, flows); err1 != nil {
 			return err1
 		}
 	} else {
@@ -1559,7 +1567,7 @@
 // DelUsPppoeFlows delete the PPPoE flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelUsPppoeFlows() error {
+func (vpv *VoltPortVnet) DelUsPppoeFlows(cntx context.Context) error {
 	logger.Debugw(ctx, "Deleting US PPPoE flows", log.Fields{"STAG": vpv.SVlan, "CTAG": vpv.CVlan, "Device": vpv.Device})
 	device, err := GetApplication().GetDeviceFromPort(vpv.Port)
 	if err != nil {
@@ -1567,7 +1575,7 @@
 	}
 	flows, err := vpv.BuildUsPppoeFlows()
 	if err == nil {
-		return vpv.RemoveFlows(device, flows)
+		return vpv.RemoveFlows(cntx, device, flows)
 	}
 	logger.Errorw(ctx, "US PPPoE Flow Delete Failed", log.Fields{"Reason": err.Error()})
 	return err
@@ -1576,7 +1584,7 @@
 // DelDsPppoeFlows delete the PPPoE flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelDsPppoeFlows() error {
+func (vpv *VoltPortVnet) DelDsPppoeFlows(cntx context.Context) error {
 	logger.Debugw(ctx, "Deleting DS PPPoE flows", log.Fields{"STAG": vpv.SVlan, "CTAG": vpv.CVlan, "Device": vpv.Device})
 	device, err := GetApplication().GetDeviceFromPort(vpv.Port)
 	if err != nil {
@@ -1584,14 +1592,14 @@
 	}
 	flows, err := vpv.BuildDsPppoeFlows()
 	if err == nil {
-		return vpv.RemoveFlows(device, flows)
+		return vpv.RemoveFlows(cntx, device, flows)
 	}
 	logger.Errorw(ctx, "DS PPPoE Flow Delete Failed", log.Fields{"Reason": err.Error()})
 	return err
 }
 
 // AddIgmpFlows function pushes the IGMP flows to the VOLTHA via the controller
-func (vpv *VoltPortVnet) AddIgmpFlows() error {
+func (vpv *VoltPortVnet) AddIgmpFlows(cntx context.Context) error {
 
 	if !vpv.IgmpFlowsApplied || vgcRebooted {
 		if vpv.MvlanProfileName == "" {
@@ -1619,7 +1627,7 @@
 					vd.RegisterFlowAddEvent(cookie, fe)
 				}
 			}
-			if err1 := cntlr.GetController().AddFlows(vpv.Port, device.Name, flows); err1 != nil {
+			if err1 := cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flows); err1 != nil {
 				return err1
 			}
 		} else {
@@ -1627,7 +1635,7 @@
 			return err
 		}
 		vpv.IgmpFlowsApplied = true
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 	return nil
 }
@@ -1635,7 +1643,7 @@
 // DelIgmpFlows delete the IGMP flows applied for this Vnet instantiated on the port
 // Write the status of the VPV to the DB once the delete is scheduled
 // for dispatch
-func (vpv *VoltPortVnet) DelIgmpFlows() error {
+func (vpv *VoltPortVnet) DelIgmpFlows(cntx context.Context) error {
 
 	if vpv.IgmpFlowsApplied || vgcRebooted {
 		device, err := GetApplication().GetDeviceFromPort(vpv.Port)
@@ -1645,7 +1653,7 @@
 		}
 		flows, err := vpv.BuildIgmpFlows()
 		if err == nil {
-			if err1 := vpv.RemoveFlows(device, flows); err1 != nil {
+			if err1 := vpv.RemoveFlows(cntx, device, flows); err1 != nil {
 				return err1
 			}
 		} else {
@@ -1653,7 +1661,7 @@
 			return err
 		}
 		vpv.IgmpFlowsApplied = false
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 	return nil
 }
@@ -2111,21 +2119,21 @@
 }
 
 // WriteToDb for writing to database
-func (vpv *VoltPortVnet) WriteToDb() {
+func (vpv *VoltPortVnet) WriteToDb(cntx context.Context) {
 	if vpv.DeleteInProgress {
 		logger.Warnw(ctx, "Skipping Redis Update for VPV, VPV delete in progress", log.Fields{"Vnet": vpv.VnetName, "Port": vpv.Port})
 		return
 	}
-	vpv.ForceWriteToDb()
+	vpv.ForceWriteToDb(cntx)
 }
 
 //ForceWriteToDb force commit a VPV to the DB
-func (vpv *VoltPortVnet) ForceWriteToDb() {
+func (vpv *VoltPortVnet) ForceWriteToDb(cntx context.Context) {
 	vpv.PendingFlowLock.RLock()
 	defer vpv.PendingFlowLock.RUnlock()
 	vpv.Version = database.PresentVersionMap[database.VpvPath]
 	if b, err := json.Marshal(vpv); err == nil {
-		if err := db.PutVpv(vpv.Port, uint16(vpv.SVlan), uint16(vpv.CVlan), uint16(vpv.UniVlan), string(b)); err != nil {
+		if err := db.PutVpv(cntx, vpv.Port, uint16(vpv.SVlan), uint16(vpv.CVlan), uint16(vpv.UniVlan), string(b)); err != nil {
 			logger.Warnw(ctx, "VPV write to DB failed", log.Fields{"port": vpv.Port, "SVlan": vpv.SVlan, "CVlan": vpv.CVlan,
 				"UniVlan": vpv.UniVlan, "Error": err})
 		}
@@ -2133,24 +2141,24 @@
 }
 
 // DelFromDb for deleting from database
-func (vpv *VoltPortVnet) DelFromDb() {
+func (vpv *VoltPortVnet) DelFromDb(cntx context.Context) {
 	logger.Debugw(ctx, "Deleting VPV from DB", log.Fields{"Port": vpv.Port, "SVLAN": vpv.SVlan, "CVLAN": vpv.CVlan})
-	_ = db.DelVpv(vpv.Port, uint16(vpv.SVlan), uint16(vpv.CVlan), uint16(vpv.UniVlan))
+	_ = db.DelVpv(cntx, vpv.Port, uint16(vpv.SVlan), uint16(vpv.CVlan), uint16(vpv.UniVlan))
 }
 
 // ClearAllServiceFlags to clear all service flags
-func (vpv *VoltPortVnet) ClearAllServiceFlags() {
-	vpv.services.Range(ClearFlagsInService)
+func (vpv *VoltPortVnet) ClearAllServiceFlags(cntx context.Context) {
+	vpv.RangeOnServices(cntx, ClearFlagsInService)
 }
 
 // ClearAllVpvFlags to clear all vpv flags
-func (vpv *VoltPortVnet) ClearAllVpvFlags() {
+func (vpv *VoltPortVnet) ClearAllVpvFlags(cntx context.Context) {
 	vpv.PendingFlowLock.Lock()
 	vpv.FlowsApplied = false
 	vpv.IgmpFlowsApplied = false
 	vpv.PendingDeleteFlow = make(map[string]bool)
 	vpv.PendingFlowLock.Unlock()
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
 	logger.Debugw(ctx, "Cleared Flow Flags for VPV",
 		log.Fields{"device": vpv.Device, "port": vpv.Port,
 			"svlan": vpv.SVlan, "cvlan": vpv.CVlan, "univlan": vpv.UniVlan})
@@ -2183,9 +2191,9 @@
 }
 
 // RestoreVpvsFromDb to restore vpvs from database
-func (va *VoltApplication) RestoreVpvsFromDb() {
+func (va *VoltApplication) RestoreVpvsFromDb(cntx context.Context) {
 	// VNETS must be learnt first
-	vpvs, _ := db.GetVpvs()
+	vpvs, _ := db.GetVpvs(cntx)
 	for hash, vpv := range vpvs {
 		b, ok := vpv.Value.([]byte)
 		if !ok {
@@ -2214,7 +2222,7 @@
 }
 
 // AddVnetToPort to add vnet to port
-func (va *VoltApplication) AddVnetToPort(port string, vvnet *VoltVnet, vs *VoltService) *VoltPortVnet {
+func (va *VoltApplication) AddVnetToPort(cntx context.Context, port string, vvnet *VoltVnet, vs *VoltService) *VoltPortVnet {
 	// The VNET is not on the port and is to be added
 	logger.Debugw(ctx, "Adding VNET to Port", log.Fields{"Port": port, "VNET": vvnet.Name})
 	vpv := NewVoltPortVnet(vvnet)
@@ -2234,7 +2242,7 @@
 	defer vpv.VpvLock.Unlock()
 
 	// Add the service that is causing the VNET to be added to the port
-	vpv.AddSvc(vs)
+	vpv.AddSvc(cntx, vs)
 
 	// Process the PORT UP if the port is already up
 	d, err := va.GetDeviceFromPort(port)
@@ -2248,17 +2256,17 @@
 			} else {
 				logger.Infow(ctx, "Checking UNI port state", log.Fields{"State": p.State})
 				if d.State == controller.DeviceStateUP && p.State == PortStateUp {
-					vpv.PortUpInd(d, port)
+					vpv.PortUpInd(cntx, d, port)
 				}
 			}
 		}
 	}
-	vpv.WriteToDb()
+	vpv.WriteToDb(cntx)
 	return vpv
 }
 
 // DelVnetFromPort for deleting vnet from port
-func (va *VoltApplication) DelVnetFromPort(port string, vpv *VoltPortVnet) {
+func (va *VoltApplication) DelVnetFromPort(cntx context.Context, port string, vpv *VoltPortVnet) {
 
 	//Delete DHCP Session
 	delDhcpSessions(vpv.LearntMacAddr, vpv.SVlan, vpv.CVlan, vpv.DHCPv6DUID)
@@ -2283,18 +2291,18 @@
 			vpvs = append(vpvs[0:i], vpvs[i+1:]...)
 
 			vpv.DeleteInProgress = true
-			vpv.ForceWriteToDb()
+			vpv.ForceWriteToDb(cntx)
 
 			va.VnetsByPort.Store(port, vpvs)
-			vpv.DelTrapFlows()
-			vpv.DelHsiaFlows()
+			vpv.DelTrapFlows(cntx)
+			vpv.DelHsiaFlows(cntx)
 			va.DisassociateVpvsFromDevice(vpv.Device, vpv)
 			vpv.PendingFlowLock.RLock()
 			if len(vpv.PendingDeleteFlow) == 0 {
-				vpv.DelFromDb()
+				vpv.DelFromDb(cntx)
 			}
 			if vnet := va.GetVnetByName(vpv.VnetName); vnet != nil {
-				vnet.disassociatePortFromVnet(vpv.Device, vpv.Port)
+				vnet.disassociatePortFromVnet(cntx, vpv.Device, vpv.Port)
 			}
 			vpv.PendingFlowLock.RUnlock()
 			return
@@ -2303,9 +2311,9 @@
 }
 
 // RestoreVnetsFromDb to restore vnet from port
-func (va *VoltApplication) RestoreVnetsFromDb() {
+func (va *VoltApplication) RestoreVnetsFromDb(cntx context.Context) {
 	// VNETS must be learnt first
-	vnets, _ := db.GetVnets()
+	vnets, _ := db.GetVnets(cntx)
 	for _, net := range vnets {
 		b, ok := net.Value.([]byte)
 		if !ok {
@@ -2319,7 +2327,7 @@
 			continue
 		}
 		logger.Debugw(ctx, "Retrieved VNET", log.Fields{"VNET": vnet.VnetConfig})
-		if err := va.AddVnet(vnet.VnetConfig, &vnet.VnetOper); err != nil {
+		if err := va.AddVnet(cntx, vnet.VnetConfig, &vnet.VnetOper); err != nil {
 			logger.Warnw(ctx, "Add Vnet Failed", log.Fields{"Config": vnet.VnetConfig, "Error": err})
 		}
 
@@ -2454,7 +2462,7 @@
 }
 
 // PushDevFlowForVlan to push icmpv6 flows for vlan
-func (va *VoltApplication) PushDevFlowForVlan(vnet *VoltVnet) {
+func (va *VoltApplication) PushDevFlowForVlan(cntx context.Context, vnet *VoltVnet) {
 	logger.Infow(ctx, "PushDevFlowForVlan", log.Fields{"SVlan": vnet.SVlan, "CVlan": vnet.CVlan})
 	pushflow := func(key interface{}, value interface{}) bool {
 		device := value.(*VoltDevice)
@@ -2492,7 +2500,7 @@
 
 			//Pushing ICMPv6 Flow
 			flow := BuildICMPv6Flow(portID, vnet)
-			err = cntlr.GetController().AddFlows(device.NniPort, device.Name, flow)
+			err = cntlr.GetController().AddFlows(cntx, device.NniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2501,7 +2509,7 @@
 
 			// Pushing ARP Flow
 			flow = BuildDSArpFlow(portID, vnet)
-			err = cntlr.GetController().AddFlows(device.NniPort, device.Name, flow)
+			err = cntlr.GetController().AddFlows(cntx, device.NniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2518,7 +2526,7 @@
 }
 
 // PushDevFlowForDevice to push icmpv6 flows for device
-func (va *VoltApplication) PushDevFlowForDevice(device *VoltDevice) {
+func (va *VoltApplication) PushDevFlowForDevice(cntx context.Context, device *VoltDevice) {
 	logger.Infow(ctx, "PushDevFlowForDevice", log.Fields{"device": device})
 
 	logger.Debugw(ctx, "Configuring ICMPv6 Group for device ", log.Fields{"Device": device.Name})
@@ -2545,7 +2553,7 @@
 			return true
 		}
 		flow := BuildICMPv6Flow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(device.NniPort, device.Name, flow)
+		err = cntlr.GetController().AddFlows(cntx, device.NniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2553,7 +2561,7 @@
 		logger.Infow(ctx, "ICMP Flow Added to Queue", log.Fields{"flow": flow})
 
 		flow = BuildDSArpFlow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(device.NniPort, device.Name, flow)
+		err = cntlr.GetController().AddFlows(cntx, device.NniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2569,7 +2577,7 @@
 }
 
 // DeleteDevFlowForVlan to delete icmpv6 flow for vlan
-func (va *VoltApplication) DeleteDevFlowForVlan(vnet *VoltVnet) {
+func (va *VoltApplication) DeleteDevFlowForVlan(cntx context.Context, vnet *VoltVnet) {
 	logger.Infow(ctx, "DeleteDevFlowForVlan", log.Fields{"SVlan": vnet.SVlan, "CVlan": vnet.CVlan})
 	delflows := func(key interface{}, value interface{}) bool {
 		device := value.(*VoltDevice)
@@ -2591,7 +2599,7 @@
 			//Pushing ICMPv6 Flow
 			flow := BuildICMPv6Flow(portID, vnet)
 			flow.ForceAction = true
-			err := vnet.RemoveFlows(device, flow)
+			err := vnet.RemoveFlows(cntx, device, flow)
 			if err != nil {
 				logger.Warnw(ctx, "De-Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2601,7 +2609,7 @@
 			//Pushing ARP Flow
 			flow = BuildDSArpFlow(portID, vnet)
 			flow.ForceAction = true
-			err = vnet.RemoveFlows(device, flow)
+			err = vnet.RemoveFlows(cntx, device, flow)
 			if err != nil {
 				logger.Warnw(ctx, "De-Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2616,7 +2624,7 @@
 }
 
 // DeleteDevFlowForDevice to delete icmpv6 flow for device
-func (va *VoltApplication) DeleteDevFlowForDevice(device *VoltDevice) {
+func (va *VoltApplication) DeleteDevFlowForDevice(cntx context.Context, device *VoltDevice) {
 	logger.Infow(ctx, "DeleteDevFlowForDevice", log.Fields{"Device": device})
 	delicmpv6 := func(key, value interface{}) bool {
 		vnet := value.(*VoltVnet)
@@ -2638,7 +2646,7 @@
 		}
 		flow := BuildICMPv6Flow(nniPortID, vnet)
 		flow.ForceAction = true
-		err = vnet.RemoveFlows(device, flow)
+		err = vnet.RemoveFlows(cntx, device, flow)
 		if err != nil {
 			logger.Warnw(ctx, "De-Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2646,7 +2654,7 @@
 
 		flow = BuildDSArpFlow(nniPortID, vnet)
 		flow.ForceAction = true
-		err = vnet.RemoveFlows(device, flow)
+		err = vnet.RemoveFlows(cntx, device, flow)
 		if err != nil {
 			logger.Warnw(ctx, "De-Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2666,7 +2674,7 @@
 }
 
 // DeleteDevFlowForVlanFromDevice to delete icmpv6 flow for vlan from device
-func (va *VoltApplication) DeleteDevFlowForVlanFromDevice(vnet *VoltVnet, deviceSerialNum string) {
+func (va *VoltApplication) DeleteDevFlowForVlanFromDevice(cntx context.Context, vnet *VoltVnet, deviceSerialNum string) {
 	logger.Infow(ctx, "DeleteDevFlowForVlanFromDevice", log.Fields{"Device-serialNum": deviceSerialNum, "SVlan": vnet.SVlan, "CVlan": vnet.CVlan})
 	delflows := func(key interface{}, value interface{}) bool {
 		device := value.(*VoltDevice)
@@ -2701,14 +2709,14 @@
 			}
 			flow := BuildICMPv6Flow(portID, vnet)
 			flow.ForceAction = true
-			if err := vnet.RemoveFlows(device, flow); err != nil {
+			if err := vnet.RemoveFlows(cntx, device, flow); err != nil {
 				logger.Warnw(ctx, "Delete Flow Failed", log.Fields{"Device": device, "Flow": flow, "Error": err})
 			}
 			logger.Infow(ctx, "ICMP Flow Delete Added to Queue", log.Fields{"flow": flow})
 
 			flow = BuildDSArpFlow(portID, vnet)
 			flow.ForceAction = true
-			if err := vnet.RemoveFlows(device, flow); err != nil {
+			if err := vnet.RemoveFlows(cntx, device, flow); err != nil {
 				logger.Warnw(ctx, "Delete Flow Failed", log.Fields{"Device": device, "Flow": flow, "Error": err})
 			}
 			logger.Infow(ctx, "ARP Flow Delete Added to Queue", log.Fields{"flow": flow})
@@ -2859,7 +2867,7 @@
 }
 
 //PushFlows - Triggers flow addition after registering for flow indication event
-func (vpv *VoltPortVnet) PushFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (vpv *VoltPortVnet) PushFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
 
 	for cookie := range flow.SubFlows {
 		cookie := strconv.FormatUint(cookie, 10)
@@ -2870,7 +2878,7 @@
 		}
 		device.RegisterFlowAddEvent(cookie, fe)
 	}
-	return cntlr.GetController().AddFlows(vpv.Port, device.Name, flow)
+	return cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flow)
 }
 
 //FlowInstallFailure - Process flow failure indication and triggers HSIA failure for all associated services
@@ -2886,7 +2894,7 @@
 }
 
 //RemoveFlows - Triggers flow deletion after registering for flow indication event
-func (vpv *VoltPortVnet) RemoveFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (vpv *VoltPortVnet) RemoveFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
 
 	vpv.PendingFlowLock.Lock()
 	defer vpv.PendingFlowLock.Unlock()
@@ -2902,11 +2910,11 @@
 		device.RegisterFlowDelEvent(cookie, fe)
 		vpv.PendingDeleteFlow[cookie] = true
 	}
-	return cntlr.GetController().DelFlows(vpv.Port, device.Name, flow)
+	return cntlr.GetController().DelFlows(cntx, vpv.Port, device.Name, flow)
 }
 
 //CheckAndDeleteVpv - remove VPV from DB is there are no pending flows to be removed
-func (vpv *VoltPortVnet) CheckAndDeleteVpv() {
+func (vpv *VoltPortVnet) CheckAndDeleteVpv(cntx context.Context) {
 	vpv.PendingFlowLock.RLock()
 	defer vpv.PendingFlowLock.RUnlock()
 	if !vpv.DeleteInProgress {
@@ -2914,24 +2922,24 @@
 	}
 	if len(vpv.PendingDeleteFlow) == 0 && !vpv.FlowsApplied {
 		logger.Infow(ctx, "All Flows removed for VPV. Triggering VPV Deletion from DB", log.Fields{"VPV Port": vpv.Port, "Device": vpv.Device, "Vnet": vpv.VnetName})
-		vpv.DelFromDb()
+		vpv.DelFromDb(cntx)
 		logger.Infow(ctx, "Deleted VPV from DB/Cache successfully", log.Fields{"VPV Port": vpv.Port, "Device": vpv.Device, "Vnet": vpv.VnetName})
 	}
 }
 
 //FlowRemoveSuccess - Process flow success indication
-func (vpv *VoltPortVnet) FlowRemoveSuccess(cookie string, device string) {
+func (vpv *VoltPortVnet) FlowRemoveSuccess(cntx context.Context, cookie string, device string) {
 	vpv.PendingFlowLock.Lock()
 	logger.Infow(ctx, "VPV Flow Remove Success Notification", log.Fields{"Port": vpv.Port, "Cookie": cookie, "Device": device})
 
 	delete(vpv.PendingDeleteFlow, cookie)
 	vpv.PendingFlowLock.Unlock()
-	vpv.CheckAndDeleteVpv()
-	vpv.WriteToDb()
+	vpv.CheckAndDeleteVpv(cntx)
+	vpv.WriteToDb(cntx)
 }
 
 //FlowRemoveFailure - Process flow failure indication and triggers Del HSIA failure for all associated services
-func (vpv *VoltPortVnet) FlowRemoveFailure(cookie string, device string, errorCode uint32, errReason string) {
+func (vpv *VoltPortVnet) FlowRemoveFailure(cntx context.Context, cookie string, device string, errorCode uint32, errReason string) {
 	vpv.PendingFlowLock.Lock()
 
 	logger.Errorw(ctx, "VPV Flow Remove Failure Notification", log.Fields{"Port": vpv.Port, "Cookie": cookie, "ErrorCode": errorCode, "ErrorReason": errReason, "Device": device})
@@ -2947,15 +2955,15 @@
 	if vpv.DeleteInProgress {
 		delete(vpv.PendingDeleteFlow, cookie)
 		vpv.PendingFlowLock.Unlock()
-		vpv.CheckAndDeleteVpv()
+		vpv.CheckAndDeleteVpv(cntx)
 	} else {
 		vpv.PendingFlowLock.Unlock()
-		vpv.WriteToDb()
+		vpv.WriteToDb(cntx)
 	}
 }
 
 //RemoveFlows - Triggers flow deletion after registering for flow indication event
-func (vv *VoltVnet) RemoveFlows(device *VoltDevice, flow *of.VoltFlow) error {
+func (vv *VoltVnet) RemoveFlows(cntx context.Context, device *VoltDevice, flow *of.VoltFlow) error {
 
 	vv.VnetLock.Lock()
 	defer vv.VnetLock.Unlock()
@@ -2978,12 +2986,12 @@
 		flowMap[cookie] = true
 		vv.PendingDeleteFlow[device.Name] = flowMap
 	}
-	vv.WriteToDb()
-	return cntlr.GetController().DelFlows(device.NniPort, device.Name, flow)
+	vv.WriteToDb(cntx)
+	return cntlr.GetController().DelFlows(cntx, device.NniPort, device.Name, flow)
 }
 
 //CheckAndDeleteVnet - remove Vnet from DB is there are no pending flows to be removed
-func (vv *VoltVnet) CheckAndDeleteVnet(device string) {
+func (vv *VoltVnet) CheckAndDeleteVnet(cntx context.Context, device string) {
 	if !vv.DeleteInProgress {
 		return
 	}
@@ -2991,7 +2999,7 @@
 	if len(vv.PendingDeleteFlow[device]) == 0 && !vv.isAssociatedPortsPresent() {
 		logger.Warnw(ctx, "Deleting Vnet : All flows removed", log.Fields{"Name": vv.Name, "AssociatedPorts": vv.AssociatedPorts, "Device": device})
 		GetApplication().deleteVnetConfig(vv)
-		_ = db.DelVnet(vv.Name)
+		_ = db.DelVnet(cntx, vv.Name)
 		logger.Infow(ctx, "Deleted Vnet from DB/Cache successfully", log.Fields{"Device": device, "Vnet": vv.Name})
 	} else {
 		logger.Warnw(ctx, "Skipping Del Vnet", log.Fields{"Name": vv.Name, "AssociatedPorts": vv.AssociatedPorts, "PendingDelFlows": vv.PendingDeleteFlow[device]})
@@ -3000,7 +3008,7 @@
 }
 
 //FlowRemoveSuccess - Process flow success indication
-func (vv *VoltVnet) FlowRemoveSuccess(cookie string, device string) {
+func (vv *VoltVnet) FlowRemoveSuccess(cntx context.Context, cookie string, device string) {
 	vv.VnetLock.Lock()
 	defer vv.VnetLock.Unlock()
 
@@ -3014,14 +3022,14 @@
 	if d := GetApplication().GetDevice(device); d != nil {
 		_, present := d.ConfiguredVlanForDeviceFlows.Get(VnetKey(vv.SVlan, vv.CVlan, 0))
 		if !present && len(vv.PendingDeleteFlow[device]) == 0 {
-			vv.CheckAndDeleteVnet(device)
+			vv.CheckAndDeleteVnet(cntx, device)
 		}
 	}
-	vv.WriteToDb()
+	vv.WriteToDb(cntx)
 }
 
 //FlowRemoveFailure - Process flow failure indication
-func (vv *VoltVnet) FlowRemoveFailure(cookie string, device string, errorCode uint32, errReason string) {
+func (vv *VoltVnet) FlowRemoveFailure(cntx context.Context, cookie string, device string, errorCode uint32, errReason string) {
 
 	vv.VnetLock.Lock()
 	defer vv.VnetLock.Unlock()
@@ -3032,7 +3040,7 @@
 
 			if vv.DeleteInProgress {
 				delete(vv.PendingDeleteFlow[device], cookie)
-				vv.CheckAndDeleteVnet(device)
+				vv.CheckAndDeleteVnet(cntx, device)
 			}
 			return
 		}
@@ -3107,7 +3115,7 @@
 }
 
 //TriggerAssociatedFlowDelete - Re-trigger delete for pending delete flows
-func (vv *VoltVnet) TriggerAssociatedFlowDelete(device string) bool {
+func (vv *VoltVnet) TriggerAssociatedFlowDelete(cntx context.Context, device string) bool {
 	vv.VnetLock.Lock()
 	cookieList := []uint64{}
 	flowMap := vv.PendingDeleteFlow[device]
@@ -3129,7 +3137,7 @@
 			subFlow.Cookie = cookie
 			flow.SubFlows[cookie] = subFlow
 			logger.Infow(ctx, "Retriggering Vnet Delete Flow", log.Fields{"Device": device, "Vnet": vv.Name, "Cookie": cookie})
-			if err := vv.RemoveFlows(vd, flow); err != nil {
+			if err := vv.RemoveFlows(cntx, vd, flow); err != nil {
 				logger.Warnw(ctx, "Vnet Delete Flow Failed", log.Fields{"Device": device, "Vnet": vv.Name, "Cookie": cookie, "Error": err})
 			}
 		}
diff --git a/internal/pkg/controller/addflows.go b/internal/pkg/controller/addflows.go
index 0d6c27a..a4bf35c 100644
--- a/internal/pkg/controller/addflows.go
+++ b/internal/pkg/controller/addflows.go
@@ -84,7 +84,7 @@
 		logger.Infow(ctx, "Flow Mod Request", log.Fields{"Cookie": flow.Cookie, "Oper": aft.flow.Command, "Port": aft.flow.PortID})
 		if aft.flow.Command == of.CommandAdd {
 			flow.State = of.FlowAddPending
-			if err := aft.device.AddFlow(flow); err != nil {
+			if err := aft.device.AddFlow(ctx, flow); err != nil {
 				logger.Warnw(ctx, "Add Flow Error", log.Fields{"Cookie": flow.Cookie, "Reason": err.Error()})
 
 				// If flow already exists in cache, check for flow state
@@ -93,7 +93,7 @@
 				if err.Error() == ErrDuplicateFlow {
 					dbFlow, _ := aft.device.GetFlow(flow.Cookie)
 					if dbFlow.State == of.FlowAddSuccess {
-						aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+						aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 						flowsPresent++
 					}
 				}
@@ -108,7 +108,7 @@
 				// aft.device.AddFlowToDb(dbFlow)
 				flowsToProcess[flow.Cookie] = dbFlow
 			}
-			aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+			aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 		}
 	}
 
@@ -124,7 +124,7 @@
 			for _, flow := range aft.flow.SubFlows {
 				logger.Errorw(ctx, "Skip Flow Update", log.Fields{"Reason": "Port Deleted", "PortName": aft.flow.PortName, "PortNo": aft.flow.PortID, "Cookie": flow.Cookie, "Operation": aft.flow.Command})
 				if aft.flow.Command == of.CommandDel {
-					aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+					aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 				}
 			}
 			return nil
@@ -160,7 +160,7 @@
 				}
 				break
 			}
-			aft.device.triggerFlowNotification(flow.FlowMod.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+			aft.device.triggerFlowNotification(ctx, flow.FlowMod.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 
 		} else {
 			logger.Errorw(ctx, "Update Flow Table Failed: Voltha Client Unavailable", log.Fields{"Flow": flow})
diff --git a/internal/pkg/controller/auditdevice.go b/internal/pkg/controller/auditdevice.go
index 2cabffc..33be2e5 100644
--- a/internal/pkg/controller/auditdevice.go
+++ b/internal/pkg/controller/auditdevice.go
@@ -119,12 +119,12 @@
 				// This port exists in the received list and the map at
 				// VGC. This is common so delete it
 				logger.Infow(ctx, "Port State Mismatch", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
-				ad.device.ProcessPortState(ofpPort.PortNo, ofpPort.State)
+				ad.device.ProcessPortState(ctx, ofpPort.PortNo, ofpPort.State)
 			} else {
 				//To ensure the flows are in sync with port status and no mismatch due to reboot,
 				// repush/delete flows based on current port status
 				logger.Infow(ctx, "Port State Processing", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
-				ad.device.ProcessPortStateAfterReboot(ofpPort.PortNo, ofpPort.State)
+				ad.device.ProcessPortStateAfterReboot(ctx, ofpPort.PortNo, ofpPort.State)
 			}
 			delete(missingPorts, id)
 		} else {
@@ -158,15 +158,15 @@
 		logger.Errorw(ctx, "Audit Device Task Cancelled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
 		return tasks.ErrTaskCancelError
 	}
-	ad.AddMissingPorts(missingPorts)
-	ad.DelExcessPorts(excessPorts)
+	ad.AddMissingPorts(ctx, missingPorts)
+	ad.DelExcessPorts(ctx, excessPorts)
 	ad.device.deviceAuditInProgress = false
 	logger.Warnw(ctx, "Audit Device Task Completed", log.Fields{"Context": ctx, "taskId": taskID, "Device": ad.device.ID})
 	return nil
 }
 
 // AddMissingPorts to add the missing ports
-func (ad *AuditDevice) AddMissingPorts(mps map[uint32]*ofp.OfpPort) {
+func (ad *AuditDevice) AddMissingPorts(cntx context.Context, mps map[uint32]*ofp.OfpPort) {
 	logger.Debugw(ctx, "Device Audit - Add Missing Ports", log.Fields{"NumPorts": len(mps)})
 
 	addMissingPort := func(mp *ofp.OfpPort) {
@@ -174,11 +174,11 @@
 
 		// Error is ignored as it only drops duplicate ports
 		logger.Infow(ctx, "Calling AddPort", log.Fields{"No": mp.PortNo, "Name": mp.Name})
-		if err := ad.device.AddPort(mp.PortNo, mp.Name); err != nil {
+		if err := ad.device.AddPort(cntx, mp.PortNo, mp.Name); err != nil {
 			logger.Warnw(ctx, "AddPort Failed", log.Fields{"No": mp.PortNo, "Name": mp.Name, "Reason": err})
 		}
 		if mp.State == uint32(ofp.OfpPortState_OFPPS_LIVE) {
-			ad.device.ProcessPortState(mp.PortNo, mp.State)
+			ad.device.ProcessPortState(cntx, mp.PortNo, mp.State)
 		}
 		logger.Debugw(ctx, "Processed Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
 
@@ -198,12 +198,12 @@
 }
 
 // DelExcessPorts to delete the excess ports
-func (ad *AuditDevice) DelExcessPorts(eps []uint32) {
+func (ad *AuditDevice) DelExcessPorts(cntx context.Context, eps []uint32) {
 	logger.Debugw(ctx, "Device Audit - Delete Excess Ports", log.Fields{"NumPorts": len(eps)})
 	for _, id := range eps {
 		// Now delete the port from the device @ VGC
 		logger.Infow(ctx, "Device Audit - Deleting Port", log.Fields{"PortId": id})
-		if err := ad.device.DelPort(id); err != nil {
+		if err := ad.device.DelPort(cntx, id); err != nil {
 			logger.Warnw(ctx, "DelPort Failed", log.Fields{"PortId": id, "Reason": err})
 		}
 	}
diff --git a/internal/pkg/controller/audittables.go b/internal/pkg/controller/audittables.go
index 1afad05..079ff2f 100644
--- a/internal/pkg/controller/audittables.go
+++ b/internal/pkg/controller/audittables.go
@@ -97,7 +97,7 @@
 	}
 
 	// Audit the flows
-	if err = att.AuditFlows(); err != nil {
+	if err = att.AuditFlows(ctx); err != nil {
 		logger.Errorw(ctx, "Audit Flows Failed", log.Fields{"Reason": err.Error()})
 		errInfo = err
 	}
@@ -211,7 +211,7 @@
 // voltha and identifying the delta between the ones held here and the
 // ones held at VOLTHA. The delta must be cleaned up to keep both the
 // components in sync
-func (att *AuditTablesTask) AuditFlows() error {
+func (att *AuditTablesTask) AuditFlows(cntx context.Context) error {
 
 	if att.stop {
 		return tasks.ErrTaskCancelError
@@ -267,7 +267,7 @@
 			defaultSuccessFlowStatus.Cookie = strconv.FormatUint(flow.Cookie, 10)
 
 			logger.Infow(ctx, "Triggering Internal Flow Notification", log.Fields{"Flow Status": defaultSuccessFlowStatus})
-			GetController().ProcessFlowModResultIndication(defaultSuccessFlowStatus)
+			GetController().ProcessFlowModResultIndication(cntx, defaultSuccessFlowStatus)
 		} else {
 			// The flow exists at the controller but not at the device
 			// Push the flow to the device
@@ -280,9 +280,9 @@
 	if !att.stop {
 		//  The flows remaining in the received flows are the excess flows at
 		// the device. Delete those flows
-		att.DelExcessFlows(rcvdFlows)
+		att.DelExcessFlows(cntx, rcvdFlows)
 		// Add the flows missing at the device
-		att.AddMissingFlows(flowsToAdd)
+		att.AddMissingFlows(cntx, flowsToAdd)
 	} else {
 		err = tasks.ErrTaskCancelError
 	}
@@ -291,7 +291,7 @@
 
 // AddMissingFlows : The flows missing from the device are reinstalled att the audit
 // The flows are added into a VoltFlow structure.
-func (att *AuditTablesTask) AddMissingFlows(mflow *of.VoltFlow) {
+func (att *AuditTablesTask) AddMissingFlows(cntx context.Context, mflow *of.VoltFlow) {
 	logger.Debugw(ctx, "Add Missing Flows", log.Fields{"Number": len(mflow.SubFlows)})
 	mflow.Command = of.CommandAdd
 	ofFlows := of.ProcessVoltFlow(att.device.ID, mflow.Command, mflow.SubFlows)
@@ -314,12 +314,12 @@
 		if _, err = vc.UpdateLogicalDeviceFlowTable(att.ctx, flow); err != nil {
 			logger.Errorw(ctx, "Update Flow Table Failed", log.Fields{"Reason": err.Error()})
 		}
-		att.device.triggerFlowResultNotification(flow.FlowMod.Cookie, dbFlow, of.CommandAdd, bwConsumedInfo, err)
+		att.device.triggerFlowResultNotification(cntx, flow.FlowMod.Cookie, dbFlow, of.CommandAdd, bwConsumedInfo, err)
 	}
 }
 
 // DelExcessFlows delete the excess flows held at the VOLTHA
-func (att *AuditTablesTask) DelExcessFlows(flows map[uint64]*ofp.OfpFlowStats) {
+func (att *AuditTablesTask) DelExcessFlows(cntx context.Context, flows map[uint64]*ofp.OfpFlowStats) {
 	logger.Debugw(ctx, "Deleting Excess Flows", log.Fields{"Number of Flows": len(flows)})
 
 	var vc voltha.VolthaServiceClient
@@ -362,7 +362,7 @@
 		if _, err = vc.UpdateLogicalDeviceFlowTable(att.ctx, flowUpdate); err != nil {
 			logger.Errorw(ctx, "Flow Audit Delete Failed", log.Fields{"Reason": err.Error()})
 		}
-		att.device.triggerFlowResultNotification(flow.Cookie, nil, of.CommandDel, of.BwAvailDetails{}, err)
+		att.device.triggerFlowResultNotification(cntx, flow.Cookie, nil, of.CommandDel, of.BwAvailDetails{}, err)
 	}
 }
 
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index 21ed05d..46b1be5 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -74,16 +74,16 @@
 		state := status.PortStatus.Desc.State
 		logger.Infow(ctx, "Process Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
 		if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_ADD {
-			_ = cet.device.AddPort(portNo, portName)
+			_ = cet.device.AddPort(ctx, portNo, portName)
 			if state == uint32(ofp.OfpPortState_OFPPS_LIVE) {
-				cet.device.ProcessPortState(portNo, state)
+				cet.device.ProcessPortState(ctx, portNo, state)
 			}
 		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_DELETE {
-			if err := cet.device.DelPort(portNo); err != nil {
+			if err := cet.device.DelPort(ctx, portNo); err != nil {
 				logger.Warnw(ctx, "DelPort Failed", log.Fields{"Port No": portNo, "Error": err})
 			}
 		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_MODIFY {
-			cet.device.ProcessPortUpdate(portName, portNo, state)
+			cet.device.ProcessPortUpdate(ctx, portName, portNo, state)
 		}
 		logger.Infow(ctx, "Processed Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
 		return nil
diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go
index 9abbd42..f08f7e1 100644
--- a/internal/pkg/controller/controller.go
+++ b/internal/pkg/controller/controller.go
@@ -89,16 +89,16 @@
 }
 
 // AddDevice to add device
-func (v *VoltController) AddDevice(config *intf.VPClientCfg) intf.IVPClient {
+func (v *VoltController) AddDevice(cntx context.Context, config *intf.VPClientCfg) intf.IVPClient {
 
-	d := NewDevice(config.DeviceID, config.SerialNum, config.VolthaClient, config.SouthBoundID)
+	d := NewDevice(cntx, config.DeviceID, config.SerialNum, config.VolthaClient, config.SouthBoundID)
 	v.devices[config.DeviceID] = d
-	v.app.AddDevice(d.ID, d.SerialNum, config.SouthBoundID)
+	v.app.AddDevice(cntx, d.ID, d.SerialNum, config.SouthBoundID)
 
-	d.RestoreMetersFromDb()
-	d.RestoreGroupsFromDb()
-	d.RestoreFlowsFromDb()
-	d.RestorePortsFromDb()
+	d.RestoreMetersFromDb(cntx)
+	d.RestoreGroupsFromDb(cntx)
+	d.RestoreFlowsFromDb(cntx)
+	d.RestorePortsFromDb(cntx)
 	d.ConnectInd(context.TODO(), intf.DeviceDisc)
 	d.packetOutChannel = config.PacketOutChannel
 
@@ -108,13 +108,13 @@
 }
 
 // DelDevice to delete device
-func (v *VoltController) DelDevice(id string) {
+func (v *VoltController) DelDevice(cntx context.Context, id string) {
 	d, ok := v.devices[id]
 	if ok {
 		delete(v.devices, id)
 		d.Delete()
 	}
-	v.app.DelDevice(id)
+	v.app.DelDevice(cntx, id)
 	d.cancel() // To stop the device tables sync routine
 	logger.Warnw(ctx, "Deleted device", log.Fields{"Device": id})
 }
@@ -193,27 +193,27 @@
 }
 
 // DeviceRebootInd is device reboot indication
-func (v *VoltController) DeviceRebootInd(dID string, srNo string, sbID string) {
-	v.app.DeviceRebootInd(dID, srNo, sbID)
-	_ = db.DelAllRoutesForDevice(dID)
-	_ = db.DelAllGroup(dID)
-	_ = db.DelAllMeter(dID)
-	_ = db.DelAllPONCounters(dID)
+func (v *VoltController) DeviceRebootInd(cntx context.Context, dID string, srNo string, sbID string) {
+	v.app.DeviceRebootInd(cntx, dID, srNo, sbID)
+	_ = db.DelAllRoutesForDevice(cntx, dID)
+	_ = db.DelAllGroup(cntx, dID)
+	_ = db.DelAllMeter(cntx, dID)
+	_ = db.DelAllPONCounters(cntx, dID)
 }
 
 // DeviceDisableInd is device deactivation indication
-func (v *VoltController) DeviceDisableInd(dID string) {
-	v.app.DeviceDisableInd(dID)
+func (v *VoltController) DeviceDisableInd(cntx context.Context, dID string) {
+	v.app.DeviceDisableInd(cntx, dID)
 }
 
 //TriggerPendingProfileDeleteReq - trigger pending profile delete requests
-func (v *VoltController) TriggerPendingProfileDeleteReq(device string) {
-	v.app.TriggerPendingProfileDeleteReq(device)
+func (v *VoltController) TriggerPendingProfileDeleteReq(cntx context.Context, device string) {
+	v.app.TriggerPendingProfileDeleteReq(cntx, device)
 }
 
 //TriggerPendingMigrateServicesReq - trigger pending services migration requests
-func (v *VoltController) TriggerPendingMigrateServicesReq(device string) {
-	v.app.TriggerPendingMigrateServicesReq(device)
+func (v *VoltController) TriggerPendingMigrateServicesReq(cntx context.Context, device string) {
+	v.app.TriggerPendingMigrateServicesReq(cntx, device)
 }
 
 // SetAuditFlags to set the audit flags
@@ -229,8 +229,8 @@
 }
 
 //ProcessFlowModResultIndication - send flow mod result notification
-func (v *VoltController) ProcessFlowModResultIndication(flowStatus intf.FlowStatus) {
-	v.app.ProcessFlowModResultIndication(flowStatus)
+func (v *VoltController) ProcessFlowModResultIndication(cntx context.Context, flowStatus intf.FlowStatus) {
+	v.app.ProcessFlowModResultIndication(cntx, flowStatus)
 }
 
 // AddVPAgent to add the vpagent
@@ -259,7 +259,7 @@
 }
 
 // AddFlows to add flows
-func (v *VoltController) AddFlows(port string, device string, flow *of.VoltFlow) error {
+func (v *VoltController) AddFlows(cntx context.Context, port string, device string, flow *of.VoltFlow) error {
 	d, err := v.GetDevice(device)
 	if err != nil {
 		logger.Errorw(ctx, "Device Not Found", log.Fields{"Device": device})
@@ -292,10 +292,10 @@
 		// Actual flow deletion and addition at voltha will happen during flow tables audit.
 		for _, subFlow := range flow.SubFlows {
 			logger.Debugw(ctx, "Cookie Migration Required", log.Fields{"OldCookie": subFlow.OldCookie, "NewCookie": subFlow.Cookie})
-			if err := d.DelFlowWithOldCookie(subFlow); err != nil {
+			if err := d.DelFlowWithOldCookie(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "Delete flow with old cookie failed", log.Fields{"Error": err, "OldCookie": subFlow.OldCookie})
 			}
-			if err := d.AddFlow(subFlow); err != nil {
+			if err := d.AddFlow(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "Flow Add Failed", log.Fields{"Error": err, "Cookie": subFlow.Cookie})
 			}
 		}
@@ -310,7 +310,7 @@
 }
 
 // DelFlows to delete flows
-func (v *VoltController) DelFlows(port string, device string, flow *of.VoltFlow) error {
+func (v *VoltController) DelFlows(cntx context.Context, port string, device string, flow *of.VoltFlow) error {
 	d, err := v.GetDevice(device)
 	if err != nil {
 		logger.Errorw(ctx, "Device Not Found", log.Fields{"Device": device})
@@ -343,7 +343,7 @@
 		// Actual flow deletion at voltha will happen during flow tables audit.
 		for _, subFlow := range flow.SubFlows {
 			logger.Debugw(ctx, "Old Cookie delete Required", log.Fields{"OldCookie": subFlow.OldCookie})
-			if err := d.DelFlowWithOldCookie(subFlow); err != nil {
+			if err := d.DelFlowWithOldCookie(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "DelFlowWithOldCookie failed", log.Fields{"OldCookie": subFlow.OldCookie, "Error": err})
 			}
 		}
@@ -400,13 +400,13 @@
 }
 
 // PortAddInd for port add indication
-func (v *VoltController) PortAddInd(device string, id uint32, name string) {
-	v.app.PortAddInd(device, id, name)
+func (v *VoltController) PortAddInd(cntx context.Context, device string, id uint32, name string) {
+	v.app.PortAddInd(cntx, device, id, name)
 }
 
 // PortDelInd for port delete indication
-func (v *VoltController) PortDelInd(device string, port string) {
-	v.app.PortDelInd(device, port)
+func (v *VoltController) PortDelInd(cntx context.Context, device string, port string) {
+	v.app.PortDelInd(cntx, device, port)
 }
 
 // PortUpdateInd for port update indication
@@ -415,13 +415,13 @@
 }
 
 // PortUpInd for port up indication
-func (v *VoltController) PortUpInd(device string, port string) {
-	v.app.PortUpInd(device, port)
+func (v *VoltController) PortUpInd(cntx context.Context, device string, port string) {
+	v.app.PortUpInd(cntx, device, port)
 }
 
 // PortDownInd for port down indication
-func (v *VoltController) PortDownInd(device string, port string) {
-	v.app.PortDownInd(device, port)
+func (v *VoltController) PortDownInd(cntx context.Context, device string, port string) {
+	v.app.PortDownInd(cntx, device, port)
 }
 
 // DeviceUpInd for device up indication
@@ -435,8 +435,8 @@
 }
 
 // PacketInInd for packet in indication
-func (v *VoltController) PacketInInd(device string, port string, data []byte) {
-	v.app.PacketInInd(device, port, data)
+func (v *VoltController) PacketInInd(cntx context.Context, device string, port string, data []byte) {
+	v.app.PacketInInd(cntx, device, port, data)
 }
 
 // GetPortState to get port status
@@ -450,8 +450,8 @@
 }
 
 // UpdateMvlanProfiles for update mvlan profiles
-func (v *VoltController) UpdateMvlanProfiles(device string) {
-	v.app.UpdateMvlanProfilesForDevice(device)
+func (v *VoltController) UpdateMvlanProfiles(cntx context.Context, device string) {
+	v.app.UpdateMvlanProfilesForDevice(cntx, device)
 }
 
 // GetController to get controller
diff --git a/internal/pkg/controller/controllertasks.go b/internal/pkg/controller/controllertasks.go
index 50a51ee..586999c 100644
--- a/internal/pkg/controller/controllertasks.go
+++ b/internal/pkg/controller/controllertasks.go
@@ -68,7 +68,7 @@
 
 	logger.Infow(ctx, "Add Device Task Triggered", log.Fields{"Device": adt.config.DeviceID, "SerialNum": adt.config.SerialNum})
 
-	device := GetController().AddDevice(adt.config)
+	device := GetController().AddDevice(ctx, adt.config)
 	vpagent.GetVPAgent().AddClientToClientMap(adt.config.DeviceID, device)
 	logger.Infow(ctx, "Add Device Task Completed", log.Fields{"Device": adt.config.DeviceID, "SerialNum": adt.config.SerialNum})
 
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index cea6960..b410490 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -130,7 +130,7 @@
 }
 
 // NewDevice is the constructor for Device
-func NewDevice(id string, slno string, vclientHldr *holder.VolthaServiceClientHolder, southBoundID string) *Device {
+func NewDevice(cntx context.Context, id string, slno string, vclientHldr *holder.VolthaServiceClientHolder, southBoundID string) *Device {
 	var device Device
 	device.ID = id
 	device.SerialNum = slno
@@ -143,7 +143,7 @@
 	device.flowQueue = make(map[uint32]*UniIDFlowQueue)
 	//Get the flowhash from db and update the flowhash variable in the device.
 	device.SouthBoundID = southBoundID
-	flowHash, err := db.GetFlowHash(id)
+	flowHash, err := db.GetFlowHash(cntx, id)
 	if err != nil {
 		device.flowHash = DefaultMaxFlowQueues
 	} else {
@@ -177,7 +177,7 @@
 }
 
 // AddFlow - Adds the flow to the device and also to the database
-func (d *Device) AddFlow(flow *of.VoltSubFlow) error {
+func (d *Device) AddFlow(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	logger.Infow(ctx, "AddFlow to device", log.Fields{"Cookie": flow.Cookie})
@@ -185,34 +185,34 @@
 		return errors.New(ErrDuplicateFlow)
 	}
 	d.flows[flow.Cookie] = flow
-	d.AddFlowToDb(flow)
+	d.AddFlowToDb(cntx, flow)
 	return nil
 }
 
 // AddFlowToDb is the utility to add the flow to the device
-func (d *Device) AddFlowToDb(flow *of.VoltSubFlow) {
+func (d *Device) AddFlowToDb(cntx context.Context, flow *of.VoltSubFlow) {
 	if b, err := json.Marshal(flow); err == nil {
-		if err = db.PutFlow(d.ID, flow.Cookie, string(b)); err != nil {
+		if err = db.PutFlow(cntx, d.ID, flow.Cookie, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Flow to DB failed", log.Fields{"device": d.ID, "cookie": flow.Cookie, "Reason": err})
 		}
 	}
 }
 
 // DelFlow - Deletes the flow from the device and the database
-func (d *Device) DelFlow(flow *of.VoltSubFlow) error {
+func (d *Device) DelFlow(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	if _, ok := d.flows[flow.Cookie]; ok {
 		delete(d.flows, flow.Cookie)
-		d.DelFlowFromDb(flow.Cookie)
+		d.DelFlowFromDb(cntx, flow.Cookie)
 		return nil
 	}
 	return errors.New("Flow does not Exist")
 }
 
 // DelFlowFromDb is utility to delete the flow from the device
-func (d *Device) DelFlowFromDb(flowID uint64) {
-	_ = db.DelFlow(d.ID, flowID)
+func (d *Device) DelFlowFromDb(cntx context.Context, flowID uint64) {
+	_ = db.DelFlow(cntx, d.ID, flowID)
 }
 
 // IsFlowPresentWithOldCookie is to check whether there is any flow with old cookie.
@@ -231,22 +231,22 @@
 }
 
 // DelFlowWithOldCookie is to delete flow with old cookie.
-func (d *Device) DelFlowWithOldCookie(flow *of.VoltSubFlow) error {
+func (d *Device) DelFlowWithOldCookie(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	if _, ok := d.flows[flow.OldCookie]; ok {
 		logger.Infow(ctx, "Flow was added before vgc upgrade. Trying to delete with old cookie",
 			log.Fields{"OldCookie": flow.OldCookie})
 		delete(d.flows, flow.OldCookie)
-		d.DelFlowFromDb(flow.OldCookie)
+		d.DelFlowFromDb(cntx, flow.OldCookie)
 		return nil
 	}
 	return errors.New("Flow does not Exist")
 }
 
 // RestoreFlowsFromDb to restore flows from database
-func (d *Device) RestoreFlowsFromDb() {
-	flows, _ := db.GetFlows(d.ID)
+func (d *Device) RestoreFlowsFromDb(cntx context.Context) {
+	flows, _ := db.GetFlows(cntx, d.ID)
 	for _, flow := range flows {
 		b, ok := flow.Value.([]byte)
 		if !ok {
@@ -277,41 +277,41 @@
 // Group operations at the device which include update and delete
 
 // UpdateGroupEntry - Adds/Updates the group to the device and also to the database
-func (d *Device) UpdateGroupEntry(group *of.Group) {
+func (d *Device) UpdateGroupEntry(cntx context.Context, group *of.Group) {
 
 	logger.Infow(ctx, "Update Group to device", log.Fields{"ID": group.GroupID})
 	d.groups.Store(group.GroupID, group)
-	d.AddGroupToDb(group)
+	d.AddGroupToDb(cntx, group)
 }
 
 // AddGroupToDb - Utility to add the group to the device DB
-func (d *Device) AddGroupToDb(group *of.Group) {
+func (d *Device) AddGroupToDb(cntx context.Context, group *of.Group) {
 	if b, err := json.Marshal(group); err == nil {
 		logger.Infow(ctx, "Adding Group to DB", log.Fields{"grp": group, "Json": string(b)})
-		if err = db.PutGroup(d.ID, group.GroupID, string(b)); err != nil {
+		if err = db.PutGroup(cntx, d.ID, group.GroupID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Group to DB failed", log.Fields{"device": d.ID, "groupID": group.GroupID, "Reason": err})
 		}
 	}
 }
 
 // DelGroupEntry - Deletes the group from the device and the database
-func (d *Device) DelGroupEntry(group *of.Group) {
+func (d *Device) DelGroupEntry(cntx context.Context, group *of.Group) {
 
 	if _, ok := d.groups.Load(group.GroupID); ok {
 		d.groups.Delete(group.GroupID)
-		d.DelGroupFromDb(group.GroupID)
+		d.DelGroupFromDb(cntx, group.GroupID)
 	}
 }
 
 // DelGroupFromDb - Utility to delete the Group from the device
-func (d *Device) DelGroupFromDb(groupID uint32) {
-	_ = db.DelGroup(d.ID, groupID)
+func (d *Device) DelGroupFromDb(cntx context.Context, groupID uint32) {
+	_ = db.DelGroup(cntx, d.ID, groupID)
 }
 
 //RestoreGroupsFromDb - restores all groups from DB
-func (d *Device) RestoreGroupsFromDb() {
+func (d *Device) RestoreGroupsFromDb(cntx context.Context) {
 	logger.Info(ctx, "Restoring Groups")
-	groups, _ := db.GetGroups(d.ID)
+	groups, _ := db.GetGroups(cntx, d.ID)
 	for _, group := range groups {
 		b, ok := group.Value.([]byte)
 		if !ok {
@@ -338,14 +338,14 @@
 }
 
 // AddMeter to add meter
-func (d *Device) AddMeter(meter *of.Meter) error {
+func (d *Device) AddMeter(cntx context.Context, meter *of.Meter) error {
 	d.meterLock.Lock()
 	defer d.meterLock.Unlock()
 	if _, ok := d.meters[meter.ID]; ok {
 		return errors.New("Duplicate Meter")
 	}
 	d.meters[meter.ID] = meter
-	go d.AddMeterToDb(meter)
+	go d.AddMeterToDb(cntx, meter)
 	return nil
 }
 
@@ -360,34 +360,34 @@
 }
 
 // DelMeter to delete meter
-func (d *Device) DelMeter(meter *of.Meter) bool {
+func (d *Device) DelMeter(cntx context.Context, meter *of.Meter) bool {
 	d.meterLock.Lock()
 	defer d.meterLock.Unlock()
 	if _, ok := d.meters[meter.ID]; ok {
 		delete(d.meters, meter.ID)
-		go d.DelMeterFromDb(meter.ID)
+		go d.DelMeterFromDb(cntx, meter.ID)
 		return true
 	}
 	return false
 }
 
 // AddMeterToDb is utility to add the Group to the device
-func (d *Device) AddMeterToDb(meter *of.Meter) {
+func (d *Device) AddMeterToDb(cntx context.Context, meter *of.Meter) {
 	if b, err := json.Marshal(meter); err == nil {
-		if err = db.PutDeviceMeter(d.ID, meter.ID, string(b)); err != nil {
+		if err = db.PutDeviceMeter(cntx, d.ID, meter.ID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Meter to DB failed", log.Fields{"device": d.ID, "meterID": meter.ID, "Reason": err})
 		}
 	}
 }
 
 // DelMeterFromDb to delete meter from db
-func (d *Device) DelMeterFromDb(id uint32) {
-	_ = db.DelDeviceMeter(d.ID, id)
+func (d *Device) DelMeterFromDb(cntx context.Context, id uint32) {
+	_ = db.DelDeviceMeter(cntx, d.ID, id)
 }
 
 // RestoreMetersFromDb to restore meters from db
-func (d *Device) RestoreMetersFromDb() {
-	meters, _ := db.GetDeviceMeters(d.ID)
+func (d *Device) RestoreMetersFromDb(cntx context.Context) {
+	meters, _ := db.GetDeviceMeters(cntx, d.ID)
 	for _, meter := range meters {
 		b, ok := meter.Value.([]byte)
 		if !ok {
@@ -420,7 +420,7 @@
 
 // AddPort to add the port as requested by the device/VOLTHA
 // Inform the application if the port is successfully added
-func (d *Device) AddPort(id uint32, name string) error {
+func (d *Device) AddPort(cntx context.Context, id uint32, name string) error {
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
@@ -434,36 +434,36 @@
 	p := NewDevicePort(id, name)
 	d.PortsByID[id] = p
 	d.PortsByName[name] = p
-	d.WritePortToDb(p)
-	GetController().PortAddInd(d.ID, p.ID, p.Name)
+	d.WritePortToDb(cntx, p)
+	GetController().PortAddInd(cntx, d.ID, p.ID, p.Name)
 	logger.Infow(ctx, "Added Port", log.Fields{"Device": d.ID, "Port": id})
 	return nil
 }
 
 // DelPort to delete the port as requested by the device/VOLTHA
 // Inform the application if the port is successfully deleted
-func (d *Device) DelPort(id uint32) error {
+func (d *Device) DelPort(cntx context.Context, id uint32) error {
 
 	p := d.GetPortByID(id)
 	if p == nil {
 		return errors.New("Unknown Port")
 	}
 	if p.State == PortStateUp {
-		GetController().PortDownInd(d.ID, p.Name)
+		GetController().PortDownInd(cntx, d.ID, p.Name)
 	}
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
-	GetController().PortDelInd(d.ID, p.Name)
+	GetController().PortDelInd(cntx, d.ID, p.Name)
 	delete(d.PortsByID, p.ID)
 	delete(d.PortsByName, p.Name)
-	d.DelPortFromDb(p.ID)
+	d.DelPortFromDb(cntx, p.ID)
 	logger.Infow(ctx, "Deleted Port", log.Fields{"Device": d.ID, "Port": id})
 	return nil
 }
 
 // UpdatePortByName is utility to update the port by Name
-func (d *Device) UpdatePortByName(name string, port uint32) {
+func (d *Device) UpdatePortByName(cntx context.Context, name string, port uint32) {
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
@@ -474,7 +474,7 @@
 	delete(d.PortsByID, p.ID)
 	p.ID = port
 	d.PortsByID[port] = p
-	d.WritePortToDb(p)
+	d.WritePortToDb(cntx, p)
 	GetController().PortUpdateInd(d.ID, p.Name, p.ID)
 	logger.Infow(ctx, "Updated Port", log.Fields{"Device": d.ID, "Port": p.ID, "PortName": name})
 }
@@ -539,42 +539,42 @@
 }
 
 // WritePortToDb to add the port to the database
-func (d *Device) WritePortToDb(port *DevicePort) {
+func (d *Device) WritePortToDb(ctx context.Context, port *DevicePort) {
 	port.Version = database.PresentVersionMap[database.DevicePortPath]
 	if b, err := json.Marshal(port); err == nil {
-		if err = db.PutPort(d.ID, port.ID, string(b)); err != nil {
+		if err = db.PutPort(ctx, d.ID, port.ID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write port to DB failed", log.Fields{"device": d.ID, "port": port.ID, "Reason": err})
 		}
 	}
 }
 
 // DelPortFromDb to delete port from database
-func (d *Device) DelPortFromDb(id uint32) {
-	_ = db.DelPort(d.ID, id)
+func (d *Device) DelPortFromDb(cntx context.Context, id uint32) {
+	_ = db.DelPort(cntx, d.ID, id)
 }
 
 // RestorePortsFromDb to restore ports from database
-func (d *Device) RestorePortsFromDb() {
-	ports, _ := db.GetPorts(d.ID)
+func (d *Device) RestorePortsFromDb(cntx context.Context) {
+	ports, _ := db.GetPorts(cntx, d.ID)
 	for _, port := range ports {
 		b, ok := port.Value.([]byte)
 		if !ok {
 			logger.Warn(ctx, "The value type is not []byte")
 			continue
 		}
-		d.CreatePortFromString(b)
+		d.CreatePortFromString(cntx, b)
 	}
 }
 
 // CreatePortFromString to create port from string
-func (d *Device) CreatePortFromString(b []byte) {
+func (d *Device) CreatePortFromString(cntx context.Context, b []byte) {
 	var port DevicePort
 	if err := json.Unmarshal(b, &port); err == nil {
 		if _, ok := d.PortsByID[port.ID]; !ok {
 			logger.Debugw(ctx, "Adding Port From Db", log.Fields{"ID": port.ID})
 			d.PortsByID[port.ID] = &port
 			d.PortsByName[port.Name] = &port
-			GetController().PortAddInd(d.ID, port.ID, port.Name)
+			GetController().PortAddInd(cntx, d.ID, port.ID, port.Name)
 		} else {
 			logger.Warnw(ctx, "Duplicate Port", log.Fields{"ID": port.ID})
 		}
@@ -662,7 +662,7 @@
 }
 
 // DeviceRebootInd is called when the logical device is rebooted.
-func (d *Device) DeviceRebootInd() {
+func (d *Device) DeviceRebootInd(cntx context.Context) {
 	logger.Warnw(ctx, "Device State change Ind: Rebooted", log.Fields{"Device": d.ID})
 
 	if d.State == DeviceStateREBOOTED {
@@ -673,19 +673,19 @@
 
 	d.State = DeviceStateREBOOTED
 	GetController().SetRebootInProgressForDevice(d.ID)
-	GetController().DeviceRebootInd(d.ID, d.SerialNum, d.SouthBoundID)
-	d.ReSetAllPortStates()
+	GetController().DeviceRebootInd(cntx, d.ID, d.SerialNum, d.SouthBoundID)
+	d.ReSetAllPortStates(cntx)
 }
 
 // DeviceDisabledInd is called when the logical device is disabled
-func (d *Device) DeviceDisabledInd() {
+func (d *Device) DeviceDisabledInd(cntx context.Context) {
 	logger.Warnw(ctx, "Device State change Ind: Disabled", log.Fields{"Device": d.ID})
 	d.State = DeviceStateDISABLED
-	GetController().DeviceDisableInd(d.ID)
+	GetController().DeviceDisableInd(cntx, d.ID)
 }
 
 //ReSetAllPortStates - Set all logical device port status to DOWN
-func (d *Device) ReSetAllPortStates() {
+func (d *Device) ReSetAllPortStates(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN", log.Fields{"Device": d.ID, "State": d.State})
 
 	d.portLock.Lock()
@@ -694,15 +694,15 @@
 	for _, port := range d.PortsByID {
 		if port.State != PortStateDown {
 			logger.Infow(ctx, "Resetting Port State to DOWN", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, port.Name)
+			GetController().PortDownInd(cntx, d.ID, port.Name)
 			port.State = PortStateDown
-			d.WritePortToDb(port)
+			d.WritePortToDb(cntx, port)
 		}
 	}
 }
 
 //ReSetAllPortStatesInDb - Set all logical device port status to DOWN in DB and skip indication to application
-func (d *Device) ReSetAllPortStatesInDb() {
+func (d *Device) ReSetAllPortStatesInDb(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN In DB", log.Fields{"Device": d.ID, "State": d.State})
 
 	d.portLock.Lock()
@@ -712,14 +712,14 @@
 		if port.State != PortStateDown {
 			logger.Infow(ctx, "Resetting Port State to DOWN and Write to DB", log.Fields{"Device": d.ID, "Port": port})
 			port.State = PortStateDown
-			d.WritePortToDb(port)
+			d.WritePortToDb(cntx, port)
 		}
 	}
 }
 
 // ProcessPortUpdate deals with the change in port id (ONU movement) and taking action
 // to update only when the port state is DOWN
-func (d *Device) ProcessPortUpdate(portName string, port uint32, state uint32) {
+func (d *Device) ProcessPortUpdate(cntx context.Context, portName string, port uint32, state uint32) {
 	if p := d.GetPortByName(portName); p != nil {
 		if p.ID != port {
 			logger.Infow(ctx, "Port ID update indication", log.Fields{"Port": p.Name, "Old PortID": p.ID, "New Port ID": port})
@@ -727,10 +727,10 @@
 				logger.Errorw(ctx, "Port ID update failed. Port State UP", log.Fields{"Port": p})
 				return
 			}
-			d.UpdatePortByName(portName, port)
+			d.UpdatePortByName(cntx, portName, port)
 			logger.Errorw(ctx, "Port ID Updated", log.Fields{"Port": p})
 		}
-		d.ProcessPortState(port, state)
+		d.ProcessPortState(cntx, port, state)
 	}
 }
 
@@ -750,7 +750,7 @@
 
 // ProcessPortState deals with the change in port status and taking action
 // based on the new state and the old state
-func (d *Device) ProcessPortState(port uint32, state uint32) {
+func (d *Device) ProcessPortState(cntx context.Context, port uint32, state uint32) {
 	if d.State != DeviceStateUP && !util.IsNniPort(port) {
 		logger.Warnw(ctx, "Ignore Port State Processing - Device not UP", log.Fields{"Device": d.ID, "Port": port, "DeviceState": d.State})
 		return
@@ -765,15 +765,15 @@
 		if state == uint32(ofp.OfpPortState_OFPPS_LIVE) && p.State == PortStateDown {
 			// Transition from DOWN to UP
 			logger.Infow(ctx, "Port State Change to UP", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortUpInd(d.ID, p.Name)
+			GetController().PortUpInd(cntx, d.ID, p.Name)
 			p.State = PortStateUp
-			d.WritePortToDb(p)
+			d.WritePortToDb(cntx, p)
 		} else if (state != uint32(ofp.OfpPortState_OFPPS_LIVE)) && (p.State != PortStateDown) {
 			// Transition from UP to Down
 			logger.Infow(ctx, "Port State Change to Down", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, p.Name)
+			GetController().PortDownInd(cntx, d.ID, p.Name)
 			p.State = PortStateDown
-			d.WritePortToDb(p)
+			d.WritePortToDb(cntx, p)
 		} else {
 			logger.Warnw(ctx, "Dropping Port Ind: No Change in Port State", log.Fields{"PortName": p.Name, "ID": port, "Device": d.ID, "PortState": p.State, "IncomingState": state})
 		}
@@ -781,7 +781,7 @@
 }
 
 // ProcessPortStateAfterReboot - triggers the port state indication to sort out configu mismatch due to reboot
-func (d *Device) ProcessPortStateAfterReboot(port uint32, state uint32) {
+func (d *Device) ProcessPortStateAfterReboot(cntx context.Context, port uint32, state uint32) {
 	if d.State != DeviceStateUP && !util.IsNniPort(port) {
 		logger.Warnw(ctx, "Ignore Port State Processing - Device not UP", log.Fields{"Device": d.ID, "Port": port, "DeviceState": d.State})
 		return
@@ -791,10 +791,10 @@
 		p.Tasks.Initialize(d.ctx)
 		if p.State == PortStateUp {
 			logger.Infow(ctx, "Port State: UP", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortUpInd(d.ID, p.Name)
+			GetController().PortUpInd(cntx, d.ID, p.Name)
 		} else if p.State == PortStateDown {
 			logger.Infow(ctx, "Port State: Down", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, p.Name)
+			GetController().PortDownInd(cntx, d.ID, p.Name)
 		}
 	}
 }
@@ -810,7 +810,7 @@
 
 // PacketIn handle the incoming packet-in and deliver to the application for the
 // actual processing
-func (d *Device) PacketIn(pkt *ofp.PacketIn) {
+func (d *Device) PacketIn(cntx context.Context, pkt *ofp.PacketIn) {
 	logger.Debugw(ctx, "Received a Packet-In", log.Fields{"Device": d.ID})
 	if pkt.PacketIn.Reason != ofp.OfpPacketInReason_OFPR_ACTION {
 		logger.Warnw(ctx, "Unsupported PacketIn Reason", log.Fields{"Reason": pkt.PacketIn.Reason})
@@ -819,7 +819,7 @@
 	data := pkt.PacketIn.Data
 	port := PacketInGetPort(pkt.PacketIn)
 	if pName, err := d.GetPortName(port); err == nil {
-		GetController().PacketInInd(d.ID, pName, data)
+		GetController().PacketInInd(cntx, d.ID, pName, data)
 	} else {
 		logger.Warnw(ctx, "Unknown Port", log.Fields{"Reason": err.Error()})
 	}
@@ -954,21 +954,21 @@
 }
 
 // SetFlowHash sets the device flow hash and writes to the DB.
-func (d *Device) SetFlowHash(hash uint32) {
+func (d *Device) SetFlowHash(cntx context.Context, hash uint32) {
 	d.flowQueueLock.Lock()
 	defer d.flowQueueLock.Unlock()
 
 	d.flowHash = hash
-	d.writeFlowHashToDB()
+	d.writeFlowHashToDB(cntx)
 }
 
-func (d *Device) writeFlowHashToDB() {
+func (d *Device) writeFlowHashToDB(cntx context.Context) {
 	hash, err := json.Marshal(d.flowHash)
 	if err != nil {
 		logger.Errorw(ctx, "failed to marshal flow hash", log.Fields{"hash": d.flowHash})
 		return
 	}
-	if err := db.PutFlowHash(d.ID, string(hash)); err != nil {
+	if err := db.PutFlowHash(cntx, d.ID, string(hash)); err != nil {
 		logger.Errorw(ctx, "Failed to add flow hash to DB", log.Fields{"device": d.ID, "hash": d.flowHash})
 	}
 }
@@ -987,12 +987,12 @@
 	return false
 }
 
-func (d *Device) triggerFlowNotification(cookie uint64, oper of.Command, bwDetails of.BwAvailDetails, err error) {
+func (d *Device) triggerFlowNotification(cntx context.Context, cookie uint64, oper of.Command, bwDetails of.BwAvailDetails, err error) {
 	flow, _ := d.GetFlow(cookie)
-	d.triggerFlowResultNotification(cookie, flow, oper, bwDetails, err)
+	d.triggerFlowResultNotification(cntx, cookie, flow, oper, bwDetails, err)
 }
 
-func (d *Device) triggerFlowResultNotification(cookie uint64, flow *of.VoltSubFlow, oper of.Command, bwDetails of.BwAvailDetails, err error) {
+func (d *Device) triggerFlowResultNotification(cntx context.Context, cookie uint64, flow *of.VoltSubFlow, oper of.Command, bwDetails of.BwAvailDetails, err error) {
 
 	statusCode, statusMsg := infraerror.GetErrorInfo(err)
 	success := isFlowOperSuccess(statusCode, oper)
@@ -1001,7 +1001,7 @@
 		if dbFlow, ok := d.GetFlow(cookie); ok {
 			dbFlow.State = uint8(state)
 			dbFlow.ErrorReason = reason
-			d.AddFlowToDb(dbFlow)
+			d.AddFlowToDb(cntx, dbFlow)
 		}
 	}
 
@@ -1019,7 +1019,7 @@
 		logger.Debugw(ctx, "Updated Flow to DB", log.Fields{"Cookie": cookie, "State": state})
 	} else {
 		if success && flow != nil {
-			if err := d.DelFlow(flow); err != nil {
+			if err := d.DelFlow(cntx, flow); err != nil {
 				logger.Warnw(ctx, "Delete Flow Error", log.Fields{"Cookie": flow.Cookie, "Reason": err.Error()})
 			}
 		} else if !success {
@@ -1038,5 +1038,5 @@
 	}
 
 	logger.Infow(ctx, "Sending Flow Notification", log.Fields{"Cookie": cookie, "Error Code": statusCode, "FlowOp": oper})
-	GetController().ProcessFlowModResultIndication(flowResult)
+	GetController().ProcessFlowModResultIndication(cntx, flowResult)
 }
diff --git a/internal/pkg/controller/modgroup.go b/internal/pkg/controller/modgroup.go
index e51a347..065c161 100644
--- a/internal/pkg/controller/modgroup.go
+++ b/internal/pkg/controller/modgroup.go
@@ -95,9 +95,9 @@
 
 	if grp.group.Command != of.GroupCommandDel {
 		grp.group.State = of.GroupOperPending
-		grp.device.UpdateGroupEntry(grp.group)
+		grp.device.UpdateGroupEntry(ctx, grp.group)
 	} else {
-		grp.device.DelGroupEntry(grp.group)
+		grp.device.DelGroupEntry(ctx, grp.group)
 	}
 
 	if !grp.device.isSBOperAllowed(grp.group.ForceAction) {
diff --git a/internal/pkg/controller/modmeter.go b/internal/pkg/controller/modmeter.go
index b5ce86c..62d2f40 100644
--- a/internal/pkg/controller/modmeter.go
+++ b/internal/pkg/controller/modmeter.go
@@ -89,12 +89,12 @@
 	// First add/delete the flows first locally before passing them to actual device
 	if mmt.command == of.MeterCommandAdd {
 		mmt.meter.State = of.MeterOperPending
-		if err := mmt.device.AddMeter(mmt.meter); err != nil {
+		if err := mmt.device.AddMeter(ctx, mmt.meter); err != nil {
 			// Meter already exists so we dont have to do anything here
 			return nil
 		}
 	} else {
-		if !mmt.device.DelMeter(mmt.meter) {
+		if !mmt.device.DelMeter(ctx, mmt.meter) {
 			// Meter doesn't exist so we dont have to do anything here
 			return nil
 		}
diff --git a/internal/pkg/controller/pendingprofiles.go b/internal/pkg/controller/pendingprofiles.go
index a97cdfa..97bb238 100644
--- a/internal/pkg/controller/pendingprofiles.go
+++ b/internal/pkg/controller/pendingprofiles.go
@@ -69,19 +69,19 @@
 
 	//Trigger Pending Service Delete Tasks
 	logger.Warnw(ctx, "Pending Service Delete Task Triggered", log.Fields{"Device": ppt.device.ID})
-	GetController().TriggerPendingProfileDeleteReq(ppt.device.ID)
+	GetController().TriggerPendingProfileDeleteReq(ctx, ppt.device.ID)
 	logger.Warnw(ctx, "Pending Service Delete Task Completed", log.Fields{"Device": ppt.device.ID})
 
 	//Trigger Pending Migrate Services Tasks
 	logger.Warnw(ctx, "Pending Migrate Services Task Triggered", log.Fields{"Device": ppt.device.ID})
-	GetController().TriggerPendingMigrateServicesReq(ppt.device.ID)
+	GetController().TriggerPendingMigrateServicesReq(ctx, ppt.device.ID)
 	logger.Warnw(ctx, "Pending Migrate Services Task Completed", log.Fields{"Device": ppt.device.ID})
 
 	GetController().ResetAuditFlags(ppt.device)
 
 	// Updating Mvlan Profile
 	logger.Warnw(ctx, "Pending Update Mvlan Task Triggered", log.Fields{"Device": ppt.device.ID})
-	if err := ppt.UpdateMvlanProfiles(); err != nil {
+	if err := ppt.UpdateMvlanProfiles(ctx); err != nil {
 		logger.Errorw(ctx, "Update Mvlan Profile Failed", log.Fields{"Reason": err.Error()})
 		errInfo = err
 	}
@@ -92,7 +92,7 @@
 }
 
 // UpdateMvlanProfiles to update the mvlan profiles
-func (ppt *PendingProfilesTask) UpdateMvlanProfiles() error {
-	GetController().UpdateMvlanProfiles(ppt.device.ID)
+func (ppt *PendingProfilesTask) UpdateMvlanProfiles(cntx context.Context) error {
+	GetController().UpdateMvlanProfiles(cntx, ppt.device.ID)
 	return nil
 }
diff --git a/internal/pkg/intf/appif.go b/internal/pkg/intf/appif.go
index 76ea4d4..8ad364e 100644
--- a/internal/pkg/intf/appif.go
+++ b/internal/pkg/intf/appif.go
@@ -15,23 +15,25 @@
 
 package intf
 
+import "context"
+
 // App Interface
 type App interface {
-	PortAddInd(string, uint32, string)
-	PortDelInd(string, string)
+	PortAddInd(context.Context, string, uint32, string)
+	PortDelInd(context.Context, string, string)
 	PortUpdateInd(string, string, uint32)
-	PacketInInd(string, string, []byte)
-	PortUpInd(string, string)
-	PortDownInd(string, string)
-	AddDevice(string, string, string)
+	PacketInInd(context.Context, string, string, []byte)
+	PortUpInd(context.Context, string, string)
+	PortDownInd(context.Context, string, string)
+	AddDevice(context.Context, string, string, string)
 	DeviceUpInd(string)
 	DeviceDownInd(string)
-	DelDevice(string)
+	DelDevice(context.Context, string)
 	SetRebootFlag(bool)
-	ProcessFlowModResultIndication(FlowStatus)
-	DeviceRebootInd(string, string, string)
-	DeviceDisableInd(string)
-	UpdateMvlanProfilesForDevice(string)
-	TriggerPendingProfileDeleteReq(string)
-	TriggerPendingMigrateServicesReq(string)
+	ProcessFlowModResultIndication(context.Context, FlowStatus)
+	DeviceRebootInd(context.Context, string, string, string)
+	DeviceDisableInd(context.Context, string)
+	UpdateMvlanProfilesForDevice(context.Context, string)
+	TriggerPendingProfileDeleteReq(context.Context, string)
+	TriggerPendingMigrateServicesReq(context.Context, string)
 }
diff --git a/internal/pkg/intf/vpagent.go b/internal/pkg/intf/vpagent.go
index f255d13..094c58b 100644
--- a/internal/pkg/intf/vpagent.go
+++ b/internal/pkg/intf/vpagent.go
@@ -45,7 +45,7 @@
 // IVPClient interface
 type IVPClient interface {
 	ChangeEvent(*ofp.ChangeEvent) error
-	PacketIn(*ofp.PacketIn)
+	PacketIn(context.Context, *ofp.PacketIn)
 	ConnectInd(cxt context.Context, DiscType DiscoveryType)
 	Stop()
 }
@@ -59,7 +59,7 @@
 // IVPClientAgent interface
 type IVPClientAgent interface {
 	AddNewDevice(cfg *VPClientCfg)
-	DelDevice(id string)
+	DelDevice(cntx context.Context, id string)
 	IsRebootInProgressForDevice(device string) bool
 	// RebootInd(string, string, string)
 	IsBlockedDevice(string) bool
diff --git a/internal/pkg/vpagent/packetIn.go b/internal/pkg/vpagent/packetIn.go
index 81f6ff2..33a63b4 100644
--- a/internal/pkg/vpagent/packetIn.go
+++ b/internal/pkg/vpagent/packetIn.go
@@ -88,7 +88,7 @@
 			break top
 		case packet := <-vpa.packetInChannel:
 			if vpc := vpa.getVPClient(packet.Id); vpc != nil {
-				vpc.PacketIn(packet)
+				vpc.PacketIn(ctx, packet)
 			}
 		}
 	}
diff --git a/internal/pkg/vpagent/refresh.go b/internal/pkg/vpagent/refresh.go
index 83792d0..2761408 100644
--- a/internal/pkg/vpagent/refresh.go
+++ b/internal/pkg/vpagent/refresh.go
@@ -33,7 +33,7 @@
 	}
 
 	// Refresh once to get everything started
-	vpa.refreshDeviceList()
+	vpa.refreshDeviceList(ctx)
 
 	tick := time.NewTicker(vpa.DeviceListRefreshInterval)
 loop:
@@ -43,13 +43,13 @@
 			logger.Errorw(ctx, "Context Done", log.Fields{"Context": ctx})
 			break loop
 		case <-tick.C:
-			vpa.refreshDeviceList()
+			vpa.refreshDeviceList(ctx)
 		}
 	}
 	tick.Stop()
 }
 
-func (vpa *VPAgent) refreshDeviceList() {
+func (vpa *VPAgent) refreshDeviceList(cntx context.Context) {
 	// If we exit, assume disconnected
 	if vpa.volthaClient == nil {
 		logger.Error(ctx, "no-voltha-connection")
@@ -93,7 +93,7 @@
 	}
 
 	for i := 0; i < len(toDel); i++ {
-		vpa.VPClientAgent.DelDevice(toDel[i])
+		vpa.VPClientAgent.DelDevice(cntx, toDel[i])
 		vpa.mapLock.Lock()
 		delete(vpa.clientMap, toDel[i])
 		vpa.mapLock.Unlock()
diff --git a/voltha-go-controller/main.go b/voltha-go-controller/main.go
index 59424e7..91327ef 100644
--- a/voltha-go-controller/main.go
+++ b/voltha-go-controller/main.go
@@ -115,6 +115,10 @@
 	if config.Banner {
 		printBanner()
 	}
+	// Create a context adding the status update channel
+	p := &probe.Probe{}
+	ctx := context.WithValue(context.Background(), probe.ProbeContextKey, p)
+
 
 	pc.Init()
 
@@ -140,7 +144,7 @@
 		logger.Errorw(ctx, "KVClient Establishment Failure", log.Fields{"Reason": err})
 	}
 
-	if dbHandler, err = db.Initialize(config.KVStoreType, config.KVStoreEndPoint, config.KVStoreTimeout); err != nil {
+	if dbHandler, err = db.Initialize(ctx, config.KVStoreType, config.KVStoreEndPoint, config.KVStoreTimeout); err != nil {
 		logger.Errorw(ctx, "unable-to-connect-to-db", log.Fields{"error": err})
 		return
 	}
@@ -150,10 +154,6 @@
 		"port": config.KVStorePort, "retries": config.ConnectionMaxRetries,
 		"retryInterval": config.ConnectionRetryDelay})
 
-	// Create a context adding the status update channel
-	p := &probe.Probe{}
-	ctx := context.WithValue(context.Background(), probe.ProbeContextKey, p)
-
 	err = waitUntilKVStoreReachableOrMaxTries(ctx, config)
 	if err != nil {
 		logger.Fatalw(ctx, "Unable-to-connect-to-KV-store", log.Fields{"KVStoreType": config.KVStoreType, "Address": config.KVStoreEndPoint})
@@ -161,7 +161,7 @@
 
 	logger.Info(ctx, "KV-store-reachable")
 	//Read if log-level is stored in DB
-	if logLevel, err := dbHandler.Get(db.GetKeyPath(db.LogLevelPath)); err == nil {
+	if logLevel, err := dbHandler.Get(ctx, db.GetKeyPath(db.LogLevelPath)); err == nil {
 		logger.Infow(ctx, "Read log-level from db", log.Fields{"logLevel": logLevel})
 		storedLogLevel, _ := log.StringToLogLevel(logLevel)
 		log.SetAllLogLevel(int(storedLogLevel))
@@ -191,7 +191,7 @@
 	 */
 	go p.ListenAndServe(ctx, config.ProbeEndPoint)
 
-	app.GetApplication().ReadAllFromDb()
+	app.GetApplication().ReadAllFromDb(ctx)
 	app.GetApplication().InitStaticConfig()
 	app.GetApplication().SetVendorID(config.VendorID)
 	ofca := controller.NewController(ctx, app.GetApplication())
diff --git a/voltha-go-controller/nbi/flow_hash.go b/voltha-go-controller/nbi/flow_hash.go
index a3a6115..75b3e8b 100644
--- a/voltha-go-controller/nbi/flow_hash.go
+++ b/voltha-go-controller/nbi/flow_hash.go
@@ -54,7 +54,7 @@
 			logger.Errorw(ctx, "Failed to get device", log.Fields{"device": id})
 			return
 		}
-		device.SetFlowHash(uint32(flowhash))
+		device.SetFlowHash(ctx, uint32(flowhash))
 	}
 
 	logger.Debugw(ctx, "flowhash data is ", log.Fields{"vars": vars, "value": string(reqBody)})
diff --git a/voltha-go-controller/nbi/sadisbwprofile.go b/voltha-go-controller/nbi/sadisbwprofile.go
index d0f404b..2cf4cb5 100644
--- a/voltha-go-controller/nbi/sadisbwprofile.go
+++ b/voltha-go-controller/nbi/sadisbwprofile.go
@@ -17,6 +17,7 @@
 
 import (
 	"bytes"
+	"context"
 	"encoding/json"
 	"net/http"
 
@@ -51,18 +52,18 @@
 	logger.Infow(ctx, "Received-northbound-request", log.Fields{"Method": r.Method, "URL": r.URL})
 	switch r.Method {
 	case "GET":
-		mh.GetProfile(w, r)
+		mh.GetProfile(context.Background(), w, r)
 	case "POST":
-		mh.AddProfile(w, r)
+		mh.AddProfile(context.Background(), w, r)
 	case "DELETE":
-		mh.DelProfile(w, r)
+		mh.DelProfile(context.Background(), w, r)
 	default:
 		logger.Warnw(ctx, "Unsupported Method", log.Fields{"Method": r.Method})
 	}
 }
 
 // AddProfile to add meter
-func (mh *ProfileHandle) AddProfile(w http.ResponseWriter, r *http.Request) {
+func (mh *ProfileHandle) AddProfile(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 	// Get the payload to process the request
 	d := new(bytes.Buffer)
 	if _, err := d.ReadFrom(r.Body);  err != nil {
@@ -89,16 +90,16 @@
 		Eir:  req.ExceededInformationRate,
 		Ebs:  req.ExceededBurstSize,
 	}
-	app.GetApplication().AddMeterProf(metercfg)
+	app.GetApplication().AddMeterProf(cntx, metercfg)
 	logger.Debugw(ctx, "northbound-add-meter-successful", log.Fields{"req": req})
 }
 
 // GetProfile to get meter
-func (mh *ProfileHandle) GetProfile(w http.ResponseWriter, r *http.Request) {
+func (mh *ProfileHandle) GetProfile(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 }
 
 // DelProfile to delete meter
-func (mh *ProfileHandle) DelProfile(w http.ResponseWriter, r *http.Request) {
+func (mh *ProfileHandle) DelProfile(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 	//TODO : Change the URL and Mux to fetch meter id from the request
 	d := new(bytes.Buffer)
 	if _, err := d.ReadFrom(r.Body);  err != nil {
@@ -115,7 +116,7 @@
 	logger.Debugw(ctx, "Received-northbound-del-meter-request", log.Fields{"req": req})
 
 	meterName := req.ID
-	if err := app.GetApplication().DelMeterProf(meterName); err != nil {
+	if err := app.GetApplication().DelMeterProf(cntx, meterName); err != nil {
 		logger.Errorw(ctx, "northbound-del-meter-failed", log.Fields{"req": req})
 		http.Error(w, err.Error(), http.StatusConflict)
 		return
diff --git a/voltha-go-controller/nbi/sadisigmpproxy.go b/voltha-go-controller/nbi/sadisigmpproxy.go
index 6c8f27d..5d07229 100644
--- a/voltha-go-controller/nbi/sadisigmpproxy.go
+++ b/voltha-go-controller/nbi/sadisigmpproxy.go
@@ -17,6 +17,7 @@
 
 import (
         "bytes"
+	"context"
         "encoding/json"
         "net/http"
 	"strings"
@@ -56,16 +57,16 @@
         logger.Infow(ctx, "Received-northbound-request", log.Fields{"Method": r.Method, "URL": r.URL})
         switch r.Method {
         case "POST":
-                iph.AddIgmpProxyInfo(w, r)
+                iph.AddIgmpProxyInfo(context.Background(), w, r)
         case "DELETE":
-                iph.DelIgmpProxyInfo(w, r)
+                iph.DelIgmpProxyInfo(context.Background(), w, r)
         default:
                 logger.Warnw(ctx, "Unsupported Method", log.Fields{"Method": r.Method})
         }
 }
 
 // AddIgmpProxyInfo to add igmp proxy info
-func (iph *IgmpProxyHandle) AddIgmpProxyInfo(w http.ResponseWriter, r *http.Request) {
+func (iph *IgmpProxyHandle) AddIgmpProxyInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
         // Get the payload to process the request
         d := new(bytes.Buffer)
@@ -88,15 +89,15 @@
         }
         logger.Debugw(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
 
-        go iph.addIgmpProxy(w, req)
+        go iph.addIgmpProxy(cntx, w, req)
 }
 
 // DelIgmpProxyInfo to delete igmp proxy info
-func (iph *IgmpProxyHandle) DelIgmpProxyInfo(w http.ResponseWriter, r *http.Request) {
+func (iph *IgmpProxyHandle) DelIgmpProxyInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
 }
 
-func (iph *IgmpProxyHandle) addIgmpProxy(w http.ResponseWriter, req *IgmpProxy) {
+func (iph *IgmpProxyHandle) addIgmpProxy(cntx context.Context, w http.ResponseWriter, req *IgmpProxy) {
 	var config McastConfig
 
 	config.OltSerialNum = req.SourceDeviceAndPort
@@ -109,7 +110,7 @@
 
 	logger.Errorw(ctx, "IgmpProxy", log.Fields{"config":config})
 
-        if err := app.GetApplication().AddMcastConfig(config.MvlanProfileID, config.IgmpProfileID,
+        if err := app.GetApplication().AddMcastConfig(cntx, config.MvlanProfileID, config.IgmpProfileID,
                 config.IgmpProxyIP, config.OltSerialNum); err != nil {
                 logger.Errorw(ctx, "northbound-add-mcast-config-failed", log.Fields{"config": config, "Error": err})
                 http.Error(w, err.Error(), http.StatusConflict)
diff --git a/voltha-go-controller/nbi/sadismvlan.go b/voltha-go-controller/nbi/sadismvlan.go
index 28fa1d5..2242188 100644
--- a/voltha-go-controller/nbi/sadismvlan.go
+++ b/voltha-go-controller/nbi/sadismvlan.go
@@ -17,6 +17,7 @@
 
 import (
         "bytes"
+	"context"
         "encoding/json"
         "net/http"
         "strconv"
@@ -76,16 +77,16 @@
         logger.Infow(ctx, "Received-northbound-request", log.Fields{"Method": r.Method, "URL": r.URL})
         switch r.Method {
         case "POST":
-                iph.AddMvlanInfo(w, r)
+                iph.AddMvlanInfo(context.Background(), w, r)
         case "DELETE":
-                iph.DelMvlanInfo(w, r)
+                iph.DelMvlanInfo(context.Background(), w, r)
         default:
                 logger.Warnw(ctx, "Unsupported Method", log.Fields{"Method": r.Method})
         }
 }
 
 // AddMvlanInfo to add igmp proxy info
-func (iph *MulticastHandle) AddMvlanInfo(w http.ResponseWriter, r *http.Request) {
+func (iph *MulticastHandle) AddMvlanInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
         // Get the payload to process the request
         d := new(bytes.Buffer)
@@ -104,15 +105,15 @@
         }
         logger.Debugw(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
 
-        go iph.addMvlan(w, req)
+        go iph.addMvlan(cntx, w, req)
 }
 
 // DelMvlanInfo to delete igmp proxy info
-func (iph *MulticastHandle) DelMvlanInfo(w http.ResponseWriter, r *http.Request) {
+func (iph *MulticastHandle) DelMvlanInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
 }
 
-func (iph *MulticastHandle) addMvlan(w http.ResponseWriter, req *Mvlan) {
+func (iph *MulticastHandle) addMvlan(cntx context.Context, w http.ResponseWriter, req *Mvlan) {
 	var config MvlanProfile
 	var groups []string
 
@@ -123,7 +124,7 @@
 	config.Groups = make(map[string][]string)
 	config.Groups["default"] = groups
 
-	if err := app.GetApplication().AddMvlanProfile(config.Name, config.Mvlan, config.PonVlan, config.Groups,
+	if err := app.GetApplication().AddMvlanProfile(cntx, config.Name, config.Mvlan, config.PonVlan, config.Groups,
 							config.IsChannelBasedGroup, config.OLTSerialNum,
 							255, config.Proxy); err != nil {
                 logger.Errorw(ctx, "northbound-add-mvlan-failed", log.Fields{"mvlan": config.Name, "Reason": err.Error()})
diff --git a/voltha-go-controller/nbi/sadissubscriber.go b/voltha-go-controller/nbi/sadissubscriber.go
index 86d9b2b..db27a95 100644
--- a/voltha-go-controller/nbi/sadissubscriber.go
+++ b/voltha-go-controller/nbi/sadissubscriber.go
@@ -17,6 +17,7 @@
 
 import (
 	"bytes"
+	"context"
 	"encoding/json"
 	"net"
 	"net/http"
@@ -75,16 +76,16 @@
 	logger.Infow(ctx, "Received-northbound-request", log.Fields{"Method": r.Method, "URL": r.URL})
 	switch r.Method {
 	case "POST":
-		sh.AddSubscriberInfo(w, r)
+		sh.AddSubscriberInfo(context.Background(), w, r)
 	case "DELETE":
-		sh.DelSubscriberInfo(w, r)
+		sh.DelSubscriberInfo(context.Background(), w, r)
 	default:
 		logger.Warnw(ctx, "Unsupported Method", log.Fields{"Method": r.Method})
 	}
 }
 
 // AddSubscriberInfo to add service
-func (sh *SubscriberHandle) AddSubscriberInfo(w http.ResponseWriter, r *http.Request) {
+func (sh *SubscriberHandle) AddSubscriberInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
 	// Get the payload to process the request
 	d := new(bytes.Buffer)
@@ -104,10 +105,10 @@
 
 	//vsCfgList := getVoltServiceFromSrvInfo(req)
 
-	go addAllService(req)
+	go addAllService(cntx, req)
 }
 
-func addAllService(srvInfo *SubscriberDeviceInfo) {
+func addAllService(cntx context.Context, srvInfo *SubscriberDeviceInfo) {
 
 	//vsCfgList := getVoltServiceFromSrvInfo(srvInfo)
 
@@ -178,10 +179,10 @@
 			vnetcfg.VlanControl = app.OLTSVlan
 		}
 
-		if err := app.GetApplication().AddVnet(vnetcfg, nil); err != nil {
+		if err := app.GetApplication().AddVnet(cntx, vnetcfg, nil); err != nil {
 			logger.Errorw(ctx, "AddVnet Failed", log.Fields{"VnetName": vnetName, "Error": err})
 		}
-		if err := app.GetApplication().AddService(vs, nil); err != nil {
+		if err := app.GetApplication().AddService(cntx, vs, nil); err != nil {
 			logger.Errorw(ctx, "AddService Failed", log.Fields{"Service": vs.Name, "Error": err})
 		}
 
@@ -189,7 +190,7 @@
 }
 
 // DelSubscriberInfo to delete service
-func (sh *SubscriberHandle) DelSubscriberInfo(w http.ResponseWriter, r *http.Request) {
+func (sh *SubscriberHandle) DelSubscriberInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
 
 	vars := mux.Vars(r)
 	id := vars["id"]
@@ -200,5 +201,5 @@
 	w.WriteHeader(http.StatusAccepted)
 
 	logger.Warnw(ctx, "northbound-del-service-req", log.Fields{"ServiceName": id})
-	go app.GetApplication().DelServiceWithPrefix(id)
+	go app.GetApplication().DelServiceWithPrefix(cntx, id)
 }
