diff --git a/core/alarms.go b/core/alarms.go
index 2261b55..c48c493 100644
--- a/core/alarms.go
+++ b/core/alarms.go
@@ -19,9 +19,10 @@
 import (
 	"strconv"
 
-	pb "github.com/opencord/voltha-bbsim/api"
+	api "github.com/opencord/voltha-bbsim/api"
 	"github.com/opencord/voltha-bbsim/common/logger"
 	"github.com/opencord/voltha-bbsim/device"
+	flowHandler "github.com/opencord/voltha-bbsim/flow"
 	openolt "github.com/opencord/voltha-protos/go/openolt"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
@@ -40,49 +41,49 @@
 	AlarmOff = "off"
 )
 
-func (s *Server) handleOnuAlarm(in *pb.ONUAlarmRequest) (*pb.BBSimResponse, error) {
+func (s *Server) handleOnuAlarm(in *api.ONUAlarmRequest) (*api.BBSimResponse, error) {
+	logger.Trace("handleOnuAlarm() invoked")
 	value, ok := s.SNmap.Load(in.OnuSerial)
-	onu := value.(*device.Onu)
 	if !ok {
-		return &pb.BBSimResponse{}, status.Errorf(codes.NotFound, "no active or discovered onu found with serial number "+in.OnuSerial)
+		return &api.BBSimResponse{}, status.Errorf(codes.NotFound, "no active or discovered onu found with serial number "+in.OnuSerial)
 	}
 
-	if (onu.InternalState == device.ONU_LOS_RAISED || onu.InternalState == device.ONU_LOS_ON_OLT_PON_LOS) &&
+	onu := value.(*device.Onu)
+	if (onu.InternalState == device.OnuLosRaised || onu.InternalState == device.OnuLosOnOltPonLos) &&
 		(in.AlarmType != OnuLossOfPloam) {
-		return &pb.BBSimResponse{}, status.Errorf(codes.Aborted, in.OnuSerial+" is not reachable, can not send onu alarm")
+		return &api.BBSimResponse{}, status.Errorf(codes.Aborted, in.OnuSerial+" is not reachable, can not send onu alarm")
 	}
 
 	if s.Olt.PonIntfs[onu.IntfID].AlarmState == device.PonLosRaised && (in.AlarmType != OnuLossOfPloam) {
 		// Don't send onu alarm as OLT-PON is down
-		return &pb.BBSimResponse{}, status.Errorf(codes.Aborted, "pon-port down, can not send onu alarm")
+		return &api.BBSimResponse{}, status.Errorf(codes.Aborted, "pon-port down, can not send onu alarm")
 	}
 	switch in.AlarmType {
 	case OnuLossOfOmciChannel:
 		Ind := formulateLossOfOmciChannelAlarm(in.Status, onu)
 		if in.Status == AlarmOn {
-			onu.UpdateIntState(device.ONU_OMCI_CHANNEL_LOS_RAISED)
+			onu.UpdateIntState(device.OnuOmciChannelLosRaised)
 		} else {
-			onu.UpdateIntState(device.ONU_ACTIVE)
+			onu.UpdateIntState(device.OnuActive)
 		}
 		s.alarmCh <- Ind
-		return &pb.BBSimResponse{StatusMsg: RequestAccepted}, nil
+		return &api.BBSimResponse{StatusMsg: RequestAccepted}, nil
 
 	case OnuSignalDegrade:
 		Ind := formulateSignalDegradeAlarm(in.Status, onu)
 		s.alarmCh <- Ind
-		return &pb.BBSimResponse{StatusMsg: RequestAccepted}, nil
+		return &api.BBSimResponse{StatusMsg: RequestAccepted}, nil
 
 	case OnuLossOfPloam:
 		if in.Status == AlarmOn {
-			onu.UpdateIntState(device.ONU_LOS_RAISED)
+			onu.UpdateIntState(device.OnuLosRaised)
 			device.UpdateOnusOpStatus(onu.IntfID, onu, "down")
 		} else {
-			onu.UpdateIntState(device.ONU_ACTIVE)
+			onu.UpdateIntState(device.OnuActive)
 			device.UpdateOnusOpStatus(onu.IntfID, onu, "up")
-			// TODO is it required to check onu state?
 			err := sendOnuDiscInd(*s.EnableServer, onu)
 			if err != nil {
-				logger.Error("Error: %v", err.Error())
+				logger.Error("Error: %s", err.Error())
 			}
 		}
 		Ind := formulateLossOfPLOAM(in.Status, onu)
@@ -100,17 +101,18 @@
 
 	default:
 		logger.Debug("Unhandled alarm type")
-		return &pb.BBSimResponse{}, status.Errorf(codes.Unimplemented, "Unhandled alarm type")
+		return &api.BBSimResponse{}, status.Errorf(codes.Unimplemented, "Unhandled alarm type")
 	}
 
 }
 
-func (s *Server) handleOltAlarm(in *pb.OLTAlarmRequest) (*pb.BBSimResponse, error) {
+func (s *Server) handleOltAlarm(in *api.OLTAlarmRequest) (*api.BBSimResponse, error) {
+	logger.Trace("handleOltAlarm() invoked")
 	switch in.PortType {
 	case device.IntfNni:
 
 		if !s.isNniIntfPresentInOlt(in.PortId) {
-			return &pb.BBSimResponse{}, status.Errorf(codes.NotFound, strconv.Itoa(int(in.PortId))+" NNI not present in olt")
+			return &api.BBSimResponse{}, status.Errorf(codes.NotFound, strconv.Itoa(int(in.PortId))+" NNI not present in olt")
 		}
 
 		Ind := formulateOLTLOSAlarm(in.Status, in.PortId, device.IntfNni)
@@ -119,13 +121,13 @@
 
 	case device.IntfPon:
 		if !s.isPonIntfPresentInOlt(in.PortId) {
-			return &pb.BBSimResponse{}, status.Errorf(codes.NotFound, strconv.Itoa(int(in.PortId))+" PON not present in olt")
+			return &api.BBSimResponse{}, status.Errorf(codes.NotFound, strconv.Itoa(int(in.PortId))+" PON not present in olt")
 		}
 		Ind := formulateOLTLOSAlarm(in.Status, in.PortId, in.PortType)
 		s.alarmCh <- Ind
 		onusOperstat := s.setPONPortState(in.PortId, in.Status)
 		for _, onu := range s.Onumap[in.PortId] {
-			if onu.InternalState == device.ONU_LOS_RAISED || onu.InternalState == device.ONU_FREE {
+			if onu.InternalState == device.OnuLosRaised || onu.InternalState == device.OnuFree {
 				continue // Skip for onus which have independently raised onu los
 			}
 
@@ -136,23 +138,33 @@
 			s.sendOnuLosOnOltPonLos(onu, in.Status)
 		}
 	default:
-		return &pb.BBSimResponse{}, status.Errorf(codes.Internal, "invalid interface type provided")
+		return &api.BBSimResponse{}, status.Errorf(codes.InvalidArgument, "invalid interface type provided")
 	}
 
-	return &pb.BBSimResponse{StatusMsg: RequestAccepted}, nil
+	return &api.BBSimResponse{StatusMsg: RequestAccepted}, nil
 }
 
 func (s *Server) setNNIPortState(portID uint32, alarmstatus string) {
+	logger.Trace("setNNIPortState() invoked")
 	switch alarmstatus {
 	case AlarmOn:
 		s.Olt.UpdateNniPortState(portID, device.NniLosRaised, "down")
+		err := flowHandler.PortDown(0)
+		if err != nil {
+			logger.Error("Failed in port down %v", err)
+		}
 
 	case AlarmOff:
 		s.Olt.UpdateNniPortState(portID, device.NniLosCleared, "up")
+		err := flowHandler.PortUp(0)
+		if err != nil {
+			logger.Error("Failed in port up %v", err)
+		}
 	}
 }
 
 func (s *Server) setPONPortState(portID uint32, alarmstatus string) string {
+	logger.Trace("setPONPortState() invoked")
 	switch alarmstatus {
 	case AlarmOn:
 		s.Olt.UpdatePonPortState(portID, device.PonLosRaised, "down")
@@ -166,12 +178,13 @@
 }
 
 func (s *Server) sendOnuLosOnOltPonLos(onu *device.Onu, status string) {
-	var internalState device.DeviceState
+	logger.Trace("sendOnuLosOnOltPonLos() invoked")
+	var internalState device.State
 
 	if status == AlarmOn {
-		internalState = device.ONU_LOS_ON_OLT_PON_LOS
+		internalState = device.OnuLosOnOltPonLos
 	} else if status == AlarmOff {
-		internalState = device.ONU_ACTIVE
+		internalState = device.OnuActive
 	}
 
 	Ind := formulateLossOfPLOAM(status, onu)
@@ -189,7 +202,7 @@
 }
 
 func formulateLossOfOmciChannelAlarm(status string, onu *device.Onu) *openolt.Indication {
-	logger.Debug("formulateLossofOmciChannelAlarm() invoked")
+	logger.Trace("formulateLossofOmciChannelAlarm() invoked")
 
 	alarmIndication := &openolt.AlarmIndication_OnuLossOmciInd{
 		OnuLossOmciInd: &openolt.OnuLossOfOmciChannelIndication{
@@ -209,7 +222,7 @@
 }
 
 func formulateSignalDegradeAlarm(status string, onu *device.Onu) *openolt.Indication {
-	logger.Debug("formulateSignalDegrade() invoked")
+	logger.Trace("formulateSignalDegrade() invoked")
 	alarmIndication := &openolt.AlarmIndication_OnuSignalDegradeInd{
 		OnuSignalDegradeInd: &openolt.OnuSignalDegradeIndication{
 			IntfId:              onu.IntfID,
@@ -227,7 +240,7 @@
 }
 
 func formulateLossOfPLOAM(status string, onu *device.Onu) *openolt.Indication {
-	logger.Debug("formulateLossOfPLOAM() invoked")
+	logger.Trace("formulateLossOfPLOAM() invoked")
 
 	alarmIndication := &openolt.AlarmIndication_OnuAlarmInd{OnuAlarmInd: &openolt.OnuAlarmIndication{
 		IntfId:             onu.IntfID,
@@ -258,12 +271,17 @@
 	return Ind
 }
 
-func (s *Server) checkAndSendOltPonLos(serial string, status string, intfType string) (*pb.BBSimResponse, error) {
-	value, _ := s.SNmap.Load(serial)
+func (s *Server) checkAndSendOltPonLos(serial string, status string, intfType string) (*api.BBSimResponse, error) {
+	value, ok := s.SNmap.Load(serial)
+	if !ok {
+		logger.Debug(serial + " not found in OLT-" + strconv.Itoa(int(s.Olt.ID)))
+		return &api.BBSimResponse{}, nil
+	}
+
 	onu := value.(*device.Onu)
 	if s.getNoOfActiveOnuByPortID(onu.IntfID) == 0 {
 		logger.Warn("Warning: Sending OLT-LOS, as all onus on pon-port %v raised los", onu.IntfID)
-		request := &pb.OLTAlarmRequest{PortId: onu.IntfID, Status: AlarmOn, PortType: device.IntfPon}
+		request := &api.OLTAlarmRequest{PortId: onu.IntfID, Status: AlarmOn, PortType: device.IntfPon}
 		resp, err := s.handleOltAlarm(request)
 		return resp, err
 	}
@@ -273,11 +291,12 @@
 		s.alarmCh <- Ind
 	}
 
-	return &pb.BBSimResponse{StatusMsg: RequestAccepted}, nil
+	return &api.BBSimResponse{StatusMsg: RequestAccepted}, nil
 }
 
 func interfaceIDToPortNo(intfid uint32, intfType string) uint32 {
-	// Converts interface-id to port-numbers that can be understood by the voltha
+	logger.Trace("interfaceIDToPortNo() invoked")
+	// Converts interface-id to port-numbers that can be understood by the VOLTHA
 	if intfType == device.IntfNni {
 		// nni at voltha starts with 65536
 		// nni = 65536 + interface_id
