SEBA-940 added rest endpoint for alarms
Change-Id: I16159933d7090cf1319e09210bdf9968515ef099
diff --git a/api/bbsim/bbsim.pb.go b/api/bbsim/bbsim.pb.go
index 6ffddb2..b63f5c7 100644
--- a/api/bbsim/bbsim.pb.go
+++ b/api/bbsim/bbsim.pb.go
@@ -565,7 +565,7 @@
// plus an optional list of AlarmParemter list that can be used
// to set additional fields in alarms that support them.
type AlarmRequest struct {
- AlarmType AlarmType_Types `protobuf:"varint,1,opt,name=AlarmType,proto3,enum=bbsim.AlarmType_Types" json:"AlarmType,omitempty"`
+ AlarmType string `protobuf:"bytes,1,opt,name=AlarmType,proto3" json:"AlarmType,omitempty"`
SerialNumber string `protobuf:"bytes,2,opt,name=SerialNumber,proto3" json:"SerialNumber,omitempty"`
Status string `protobuf:"bytes,3,opt,name=Status,proto3" json:"Status,omitempty"`
Parameters []*AlarmParameter `protobuf:"bytes,4,rep,name=Parameters,proto3" json:"Parameters,omitempty"`
@@ -599,11 +599,11 @@
var xxx_messageInfo_AlarmRequest proto.InternalMessageInfo
-func (m *AlarmRequest) GetAlarmType() AlarmType_Types {
+func (m *AlarmRequest) GetAlarmType() string {
if m != nil {
return m.AlarmType
}
- return AlarmType_LOS
+ return ""
}
func (m *AlarmRequest) GetSerialNumber() string {
@@ -884,85 +884,85 @@
func init() { proto.RegisterFile("api/bbsim/bbsim.proto", fileDescriptor_ef7750073d18011b) }
var fileDescriptor_ef7750073d18011b = []byte{
- // 1097 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcd, 0x4e, 0xe3, 0x56,
- 0x14, 0x4e, 0x48, 0x9c, 0x9f, 0x93, 0x10, 0xcc, 0x99, 0x19, 0x6a, 0x21, 0xd4, 0x22, 0x6b, 0xa6,
- 0x62, 0x46, 0x2d, 0xd3, 0xc2, 0x54, 0xa5, 0x52, 0x37, 0x26, 0x31, 0xc1, 0x9d, 0x60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 0xbf, 0x19, 0xff, 0x1b, 0x68, 0x12, 0x3a, 0x0e, 0x82, 0x78, 0x23, 0xf6, 0xd7,
- 0x50, 0x67, 0x25, 0xb3, 0x7d, 0xbe, 0xce, 0x6d, 0xad, 0x0e, 0x23, 0x92, 0x4b, 0xec, 0xac, 0x52,
- 0x1e, 0x3e, 0x3d, 0xa5, 0xfd, 0xc2, 0xea, 0x97, 0x4b, 0xf8, 0x3d, 0xb4, 0x4c, 0x1a, 0xe7, 0x37,
- 0x2d, 0x4b, 0x9a, 0x01, 0xfb, 0x8f, 0x01, 0xb9, 0x84, 0xa7, 0x85, 0x1e, 0x9f, 0x4f, 0xf1, 0x4c,
- 0xe9, 0x27, 0xab, 0x39, 0x6e, 0xac, 0xf9, 0x00, 0x6d, 0x42, 0xa3, 0xd8, 0x09, 0x63, 0xd5, 0x59,
- 0x04, 0xde, 0x86, 0xaa, 0x53, 0x68, 0x71, 0x55, 0xef, 0x6e, 0xb2, 0xd8, 0x50, 0xf4, 0x33, 0xa0,
- 0x49, 0xe3, 0x64, 0x2d, 0x68, 0xf3, 0xa9, 0x3b, 0x71, 0xd8, 0xbd, 0xc3, 0x17, 0xc5, 0x75, 0xf1,
- 0x2f, 0xea, 0x33, 0xd8, 0xe9, 0xde, 0x39, 0xf3, 0x19, 0x65, 0x0f, 0x26, 0xfd, 0xcd, 0x47, 0xce,
- 0x2a, 0x3c, 0xa1, 0x67, 0x94, 0xe3, 0x5a, 0xf2, 0x2f, 0xdf, 0xe9, 0x3f, 0x01, 0x00, 0x00, 0xff,
- 0xff, 0xef, 0x83, 0x18, 0x5d, 0x0b, 0x0a, 0x00, 0x00,
+ // 1090 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6e, 0xdb, 0xc6,
+ 0x13, 0x96, 0x2c, 0x51, 0x7f, 0x46, 0xb2, 0x4c, 0x4f, 0x12, 0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0xe1, 0x1d, 0x8b, 0xc2, 0xf9, 0x63, 0xe6, 0x9e, 0xb0, 0xf2,
+ 0x6e, 0xab, 0x25, 0x7c, 0x0b, 0x2d, 0xeb, 0x76, 0x99, 0x4c, 0xc3, 0xbb, 0xed, 0xf8, 0x5f, 0x41,
+ 0x93, 0xb2, 0x71, 0x18, 0x26, 0x5b, 0xb1, 0xbf, 0x84, 0x3a, 0x4f, 0x99, 0xcf, 0xed, 0x4d, 0x6e,
+ 0x6b, 0x75, 0x18, 0xb1, 0x5a, 0xe2, 0x67, 0x95, 0xf1, 0xf0, 0xf1, 0x29, 0x1d, 0xae, 0x8d, 0x78,
+ 0xb5, 0x84, 0xdf, 0x42, 0xcb, 0x62, 0x49, 0x71, 0xd3, 0xf2, 0x4d, 0x73, 0xe0, 0xf0, 0x21, 0xa0,
+ 0x96, 0xf0, 0xfd, 0x5a, 0x8d, 0x4f, 0x6f, 0xf1, 0x44, 0xea, 0xa7, 0xab, 0x3e, 0x6e, 0xad, 0xf9,
+ 0x0e, 0xda, 0x94, 0xc5, 0x89, 0x1b, 0x25, 0xba, 0xbb, 0x08, 0xfd, 0x2d, 0x55, 0xef, 0xa1, 0x25,
+ 0x54, 0xbd, 0xdb, 0xc9, 0x62, 0x4b, 0xd1, 0x4f, 0x80, 0x16, 0x4b, 0xd2, 0xb1, 0x60, 0xcc, 0xa7,
+ 0xde, 0xc4, 0xe5, 0xf7, 0x0e, 0x9f, 0xad, 0x8f, 0x8b, 0x7f, 0x50, 0x7f, 0x80, 0xbd, 0xee, 0xad,
+ 0x3b, 0x9f, 0x31, 0xfe, 0x60, 0xb2, 0x6f, 0x3b, 0x0a, 0xd6, 0xda, 0x13, 0x7a, 0x42, 0x39, 0xae,
+ 0xa5, 0x7f, 0xed, 0xde, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x89, 0x62, 0x0e, 0x33, 0xf3, 0x09,
+ 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
-var _ grpc.ClientConn
+var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
+const _ = grpc.SupportPackageIsVersion6
// BBSimClient is the client API for BBSim service.
//
@@ -985,10 +985,10 @@
}
type bBSimClient struct {
- cc *grpc.ClientConn
+ cc grpc.ClientConnInterface
}
-func NewBBSimClient(cc *grpc.ClientConn) BBSimClient {
+func NewBBSimClient(cc grpc.ClientConnInterface) BBSimClient {
return &bBSimClient{cc}
}
diff --git a/api/bbsim/bbsim.pb.gw.go b/api/bbsim/bbsim.pb.gw.go
index c5a423d..51ead9a 100644
--- a/api/bbsim/bbsim.pb.gw.go
+++ b/api/bbsim/bbsim.pb.gw.go
@@ -265,6 +265,119 @@
}
+var (
+ filter_BBSim_SetAlarmIndication_0 = &utilities.DoubleArray{Encoding: map[string]int{"SerialNumber": 0, "AlarmType": 1, "Status": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
+)
+
+func request_BBSim_SetAlarmIndication_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq AlarmRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["SerialNumber"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+ }
+
+ protoReq.SerialNumber, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+ }
+
+ val, ok = pathParams["AlarmType"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "AlarmType")
+ }
+
+ protoReq.AlarmType, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "AlarmType", err)
+ }
+
+ val, ok = pathParams["Status"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "Status")
+ }
+
+ protoReq.Status, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "Status", err)
+ }
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BBSim_SetAlarmIndication_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.SetAlarmIndication(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_BBSim_SetAlarmIndication_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq AlarmRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["SerialNumber"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "SerialNumber")
+ }
+
+ protoReq.SerialNumber, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "SerialNumber", err)
+ }
+
+ val, ok = pathParams["AlarmType"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "AlarmType")
+ }
+
+ protoReq.AlarmType, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "AlarmType", err)
+ }
+
+ val, ok = pathParams["Status"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "Status")
+ }
+
+ protoReq.Status, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "Status", err)
+ }
+
+ if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSim_SetAlarmIndication_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.SetAlarmIndication(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
// RegisterBBSimHandlerServer registers the http handlers for service BBSim to "mux".
// UnaryRPC :call BBSimServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -410,6 +523,26 @@
})
+ mux.Handle("POST", pattern_BBSim_SetAlarmIndication_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_BBSim_SetAlarmIndication_0(rctx, inboundMarshaler, server, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_BBSim_SetAlarmIndication_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -591,6 +724,26 @@
})
+ mux.Handle("POST", pattern_BBSim_SetAlarmIndication_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_BBSim_SetAlarmIndication_0(rctx, inboundMarshaler, client, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_BBSim_SetAlarmIndication_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -608,6 +761,8 @@
pattern_BBSim_ShutdownONU_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "olt", "onus", "SerialNumber"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_BBSim_PoweronONU_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "olt", "onus", "SerialNumber"}, "", runtime.AssumeColonVerbOpt(true)))
+
+ pattern_BBSim_SetAlarmIndication_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "olt", "onus", "SerialNumber", "alarms", "AlarmType", "Status"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@@ -624,4 +779,6 @@
forward_BBSim_ShutdownONU_0 = runtime.ForwardResponseMessage
forward_BBSim_PoweronONU_0 = runtime.ForwardResponseMessage
+
+ forward_BBSim_SetAlarmIndication_0 = runtime.ForwardResponseMessage
)
diff --git a/api/bbsim/bbsim.proto b/api/bbsim/bbsim.proto
index 86f9b48..8fff209 100644
--- a/api/bbsim/bbsim.proto
+++ b/api/bbsim/bbsim.proto
@@ -98,7 +98,7 @@
// plus an optional list of AlarmParemter list that can be used
// to set additional fields in alarms that support them.
message AlarmRequest {
- AlarmType.Types AlarmType = 1; // name of alarm to raise
+ string AlarmType = 1; // name of alarm to raise
string SerialNumber = 2; // serial number of ONU
string Status = 3; // status of Alarm
repeated AlarmParameter Parameters = 4; // optional list of additional parameters
diff --git a/api/bbsim/bbsim.yaml b/api/bbsim/bbsim.yaml
index edb78bd..fa30479 100644
--- a/api/bbsim/bbsim.yaml
+++ b/api/bbsim/bbsim.yaml
@@ -31,3 +31,5 @@
delete: "/v1/olt/onus/{SerialNumber}"
- selector: bbsim.BBSim.PoweronONU
post: "/v1/olt/onus/{SerialNumber}"
+ - selector: bbsim.BBSim.SetAlarmIndication
+ post: "/v1/olt/onus/{SerialNumber}/alarms/{AlarmType}/{Status}"
diff --git a/internal/bbsim/alarmsim/alarmsim.go b/internal/bbsim/alarmsim/alarmsim.go
index 57c7fe5..9607526 100644
--- a/internal/bbsim/alarmsim/alarmsim.go
+++ b/internal/bbsim/alarmsim/alarmsim.go
@@ -25,6 +25,40 @@
"strconv"
)
+// AlarmNameMap string to enum map
+var AlarmNameMap = map[string]bbsim.AlarmType_Types{
+ "DyingGasp": bbsim.AlarmType_DYING_GASP,
+ "StartupFailure": bbsim.AlarmType_ONU_STARTUP_FAILURE,
+ "SignalDegrade": bbsim.AlarmType_ONU_SIGNAL_DEGRADE,
+ "DriftOfWindow": bbsim.AlarmType_ONU_DRIFT_OF_WINDOW,
+ "LossOfOmciChannel": bbsim.AlarmType_ONU_LOSS_OF_OMCI_CHANNEL,
+ "SignalsFailure": bbsim.AlarmType_ONU_SIGNALS_FAILURE,
+ "TransmissionInterference": bbsim.AlarmType_ONU_TRANSMISSION_INTERFERENCE_WARNING,
+ "ActivationFailure": bbsim.AlarmType_ONU_ACTIVATION_FAILURE,
+ "ProcessingError": bbsim.AlarmType_ONU_PROCESSING_ERROR,
+ "LossOfKeySyncFailure": bbsim.AlarmType_ONU_LOSS_OF_KEY_SYNC_FAILURE,
+
+ // Break out OnuAlarm into its subcases.
+ "LossOfSignal": bbsim.AlarmType_ONU_ALARM_LOS,
+ "LossOfBurst": bbsim.AlarmType_ONU_ALARM_LOB,
+ "LOPC_MISS": bbsim.AlarmType_ONU_ALARM_LOPC_MISS,
+ "LOPC_MIC_ERROR": bbsim.AlarmType_ONU_ALARM_LOPC_MIC_ERROR,
+ "LossOfFrame": bbsim.AlarmType_ONU_ALARM_LOFI,
+ "LossOfPloam": bbsim.AlarmType_ONU_ALARM_LOAMI,
+
+ // Whole-PON / Non-onu-specific
+ "PonLossOfSignal": bbsim.AlarmType_LOS,
+}
+
+func AlarmNameToEnum(name string) (*bbsim.AlarmType_Types, error) {
+ v, okay := AlarmNameMap[name]
+ if !okay {
+ return nil, fmt.Errorf("Unknown Alarm Name: %v", name)
+ }
+
+ return &v, nil
+}
+
// Find a key in the optional AlarmParameters, convert it to an integer,
// return 'def' if no key exists or it cannot be converted.
func extractInt(params []*bbsim.AlarmParameter, name string, def int) int {
@@ -39,12 +73,18 @@
return def
}
+// BuildAlarmIndication function forms openolt alarmIndication as per AlarmRequest
func BuildAlarmIndication(req *bbsim.AlarmRequest, o *devices.OltDevice) (*openolt.AlarmIndication, error) {
var alarm *openolt.AlarmIndication
var onu *devices.Onu
var err error
- if req.AlarmType != bbsim.AlarmType_LOS {
+ alarmType, err := AlarmNameToEnum(req.AlarmType)
+ if err != nil {
+ return nil, err
+ }
+
+ if *alarmType != bbsim.AlarmType_LOS {
// No ONU Id for LOS
onu, err = o.FindOnuBySn(req.SerialNumber)
if err != nil {
@@ -52,7 +92,7 @@
}
}
- switch req.AlarmType {
+ switch *alarmType {
case bbsim.AlarmType_LOS:
alarm = &openolt.AlarmIndication{
Data: &openolt.AlarmIndication_LosInd{&openolt.LosIndication{
@@ -208,6 +248,7 @@
return alarm, nil
}
+// SimulateAlarm accept request for alarms and send proper alarmIndication to openolt stream
func SimulateAlarm(ctx context.Context, req *bbsim.AlarmRequest, o *devices.OltDevice) error {
alarmIndication, err := BuildAlarmIndication(req, o)
if err != nil {
diff --git a/internal/bbsimctl/commands/alarms.go b/internal/bbsimctl/commands/alarms.go
index eb4813c..a1c7113 100755
--- a/internal/bbsimctl/commands/alarms.go
+++ b/internal/bbsimctl/commands/alarms.go
@@ -23,6 +23,7 @@
"github.com/jessevdk/go-flags"
pb "github.com/opencord/bbsim/api/bbsim"
"github.com/opencord/bbsim/internal/bbsimctl/config"
+ "github.com/opencord/bbsim/internal/bbsim/alarmsim"
"github.com/opencord/cordctl/pkg/format"
log "github.com/sirupsen/logrus"
"os"
@@ -63,38 +64,6 @@
List AlarmList `command:"list"`
}
-var AlarmNameMap = map[string]pb.AlarmType_Types{"DyingGasp": pb.AlarmType_DYING_GASP,
- "StartupFailure": pb.AlarmType_ONU_STARTUP_FAILURE,
- "SignalDegrade": pb.AlarmType_ONU_SIGNAL_DEGRADE,
- "DriftOfWindow": pb.AlarmType_ONU_DRIFT_OF_WINDOW,
- "LossOfOmciChannel": pb.AlarmType_ONU_LOSS_OF_OMCI_CHANNEL,
- "SignalsFailure": pb.AlarmType_ONU_SIGNALS_FAILURE,
- "TransmissionInterference": pb.AlarmType_ONU_TRANSMISSION_INTERFERENCE_WARNING,
- "ActivationFailure": pb.AlarmType_ONU_ACTIVATION_FAILURE,
- "ProcessingError": pb.AlarmType_ONU_PROCESSING_ERROR,
- "LossOfKeySyncFailure": pb.AlarmType_ONU_LOSS_OF_KEY_SYNC_FAILURE,
-
- // Break out OnuAlarm into its subcases.
- "LossOfSignal": pb.AlarmType_ONU_ALARM_LOS,
- "LossOfBurst": pb.AlarmType_ONU_ALARM_LOB,
- "LOPC_MISS": pb.AlarmType_ONU_ALARM_LOPC_MISS,
- "LOPC_MIC_ERROR": pb.AlarmType_ONU_ALARM_LOPC_MIC_ERROR,
- "LossOfFrame": pb.AlarmType_ONU_ALARM_LOFI,
- "LossOfPloam": pb.AlarmType_ONU_ALARM_LOAMI,
-
- // Whole-PON / Non-onu-specific
- "PonLossOfSignal": pb.AlarmType_LOS,
-}
-
-func alarmNameToEnum(name string) (*pb.AlarmType_Types, error) {
- v, okay := AlarmNameMap[name]
- if !okay {
- return nil, fmt.Errorf("Unknown Alarm Name: %v", name)
- }
-
- return &v, nil
-}
-
// add optional parameters from the command-line to the AlarmRequest
func addParameters(parameters []string, req *pb.AlarmRequest) error {
req.Parameters = make([]*pb.AlarmParameter, len(parameters))
@@ -112,29 +81,24 @@
parser.AddCommand("alarm", "Alarm Commands", "Commands to raise and clear alarms", &AlarmOptions{})
}
+// Execute alarm raise
func (o *AlarmRaise) Execute(args []string) error {
- alarmType, err := alarmNameToEnum(string(o.Args.Name))
- if err != nil {
- return err
- }
-
client, conn := connect()
defer conn.Close()
ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
defer cancel()
- req := pb.AlarmRequest{AlarmType: *alarmType,
+ req := pb.AlarmRequest{AlarmType: string(o.Args.Name),
SerialNumber: string(o.Args.SerialNumber),
Status: "on"}
- err = addParameters(o.Parameters, &req)
+ err := addParameters(o.Parameters, &req)
if err != nil {
return err
}
res, err := client.SetAlarmIndication(ctx, &req)
-
if err != nil {
log.Fatalf("Cannot raise alarm: %v", err)
return err
@@ -144,23 +108,19 @@
return nil
}
+// Execute alarm clear
func (o *AlarmClear) Execute(args []string) error {
- alarmType, err := alarmNameToEnum(string(o.Args.Name))
- if err != nil {
- return err
- }
-
client, conn := connect()
defer conn.Close()
ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
defer cancel()
- req := pb.AlarmRequest{AlarmType: *alarmType,
+ req := pb.AlarmRequest{AlarmType: string(o.Args.Name),
SerialNumber: string(o.Args.SerialNumber),
Status: "off"}
- err = addParameters(o.Parameters, &req)
+ err := addParameters(o.Parameters, &req)
if err != nil {
return err
}
@@ -176,10 +136,11 @@
return nil
}
+// Execute alarm list
func (o *AlarmList) Execute(args []string) error {
- alarmNames := make([]AlarmListOutput, len(AlarmNameMap))
+ alarmNames := make([]AlarmListOutput, len(alarmsim.AlarmNameMap))
i := 0
- for k := range AlarmNameMap {
+ for k := range alarmsim.AlarmNameMap {
alarmNames[i] = AlarmListOutput{Name: k}
i++
}
@@ -191,7 +152,7 @@
func (onuSn *AlarmNameString) Complete(match string) []flags.Completion {
list := make([]flags.Completion, 0)
- for k := range AlarmNameMap {
+ for k := range alarmsim.AlarmNameMap {
if strings.HasPrefix(k, match) {
list = append(list, flags.Completion{Item: k})
}