VOL-2474 Implement Alarm Simulation in bbsim and bbsimctl;
Release 0.0.12
Change-Id: I65e51729d4fdfd1daf386b1ea1732ff40bf31db7
diff --git a/VERSION b/VERSION
index 2f80b8d..8cbf02c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.0.12-dev
+0.0.12
diff --git a/api/bbsim/bbsim.pb.go b/api/bbsim/bbsim.pb.go
index 2f2f647..3b4d99a 100644
--- a/api/bbsim/bbsim.pb.go
+++ b/api/bbsim/bbsim.pb.go
@@ -8,8 +8,6 @@
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
math "math"
)
@@ -24,6 +22,86 @@
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+// These types correspond to the messages permitted in the oneof
+// in AlarmIndication in the openolt protos
+type AlarmType_Types int32
+
+const (
+ AlarmType_LOS AlarmType_Types = 0
+ AlarmType_DYING_GASP AlarmType_Types = 1
+ AlarmType_ONU_ALARM AlarmType_Types = 2
+ AlarmType_ONU_STARTUP_FAILURE AlarmType_Types = 3
+ AlarmType_ONU_SIGNAL_DEGRADE AlarmType_Types = 4
+ AlarmType_ONU_DRIFT_OF_WINDOW AlarmType_Types = 5
+ AlarmType_ONU_LOSS_OF_OMCI_CHANNEL AlarmType_Types = 6
+ AlarmType_ONU_SIGNALS_FAILURE AlarmType_Types = 7
+ AlarmType_ONU_TRANSMISSION_INTERFERENCE_WARNING AlarmType_Types = 8
+ AlarmType_ONU_ACTIVATION_FAILURE AlarmType_Types = 9
+ AlarmType_ONU_PROCESSING_ERROR AlarmType_Types = 10
+ AlarmType_ONU_LOSS_OF_KEY_SYNC_FAILURE AlarmType_Types = 11
+ AlarmType_ONU_ITU_PON_STATS AlarmType_Types = 12
+ // These break out ONU_ALARM, which is a single message, but
+ // includes statuses for these six alarms.
+ AlarmType_ONU_ALARM_LOS AlarmType_Types = 13
+ AlarmType_ONU_ALARM_LOB AlarmType_Types = 14
+ AlarmType_ONU_ALARM_LOPC_MISS AlarmType_Types = 15
+ AlarmType_ONU_ALARM_LOPC_MIC_ERROR AlarmType_Types = 16
+ AlarmType_ONU_ALARM_LOFI AlarmType_Types = 17
+ AlarmType_ONU_ALARM_LOAMI AlarmType_Types = 18
+)
+
+var AlarmType_Types_name = map[int32]string{
+ 0: "LOS",
+ 1: "DYING_GASP",
+ 2: "ONU_ALARM",
+ 3: "ONU_STARTUP_FAILURE",
+ 4: "ONU_SIGNAL_DEGRADE",
+ 5: "ONU_DRIFT_OF_WINDOW",
+ 6: "ONU_LOSS_OF_OMCI_CHANNEL",
+ 7: "ONU_SIGNALS_FAILURE",
+ 8: "ONU_TRANSMISSION_INTERFERENCE_WARNING",
+ 9: "ONU_ACTIVATION_FAILURE",
+ 10: "ONU_PROCESSING_ERROR",
+ 11: "ONU_LOSS_OF_KEY_SYNC_FAILURE",
+ 12: "ONU_ITU_PON_STATS",
+ 13: "ONU_ALARM_LOS",
+ 14: "ONU_ALARM_LOB",
+ 15: "ONU_ALARM_LOPC_MISS",
+ 16: "ONU_ALARM_LOPC_MIC_ERROR",
+ 17: "ONU_ALARM_LOFI",
+ 18: "ONU_ALARM_LOAMI",
+}
+
+var AlarmType_Types_value = map[string]int32{
+ "LOS": 0,
+ "DYING_GASP": 1,
+ "ONU_ALARM": 2,
+ "ONU_STARTUP_FAILURE": 3,
+ "ONU_SIGNAL_DEGRADE": 4,
+ "ONU_DRIFT_OF_WINDOW": 5,
+ "ONU_LOSS_OF_OMCI_CHANNEL": 6,
+ "ONU_SIGNALS_FAILURE": 7,
+ "ONU_TRANSMISSION_INTERFERENCE_WARNING": 8,
+ "ONU_ACTIVATION_FAILURE": 9,
+ "ONU_PROCESSING_ERROR": 10,
+ "ONU_LOSS_OF_KEY_SYNC_FAILURE": 11,
+ "ONU_ITU_PON_STATS": 12,
+ "ONU_ALARM_LOS": 13,
+ "ONU_ALARM_LOB": 14,
+ "ONU_ALARM_LOPC_MISS": 15,
+ "ONU_ALARM_LOPC_MIC_ERROR": 16,
+ "ONU_ALARM_LOFI": 17,
+ "ONU_ALARM_LOAMI": 18,
+}
+
+func (x AlarmType_Types) String() string {
+ return proto.EnumName(AlarmType_Types_name, int32(x))
+}
+
+func (AlarmType_Types) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_ef7750073d18011b, []int{6, 0}
+}
+
type PONPort struct {
ID int32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
OperState string `protobuf:"bytes,2,opt,name=OperState,proto3" json:"OperState,omitempty"`
@@ -378,6 +456,150 @@
return ""
}
+type AlarmType struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *AlarmType) Reset() { *m = AlarmType{} }
+func (m *AlarmType) String() string { return proto.CompactTextString(m) }
+func (*AlarmType) ProtoMessage() {}
+func (*AlarmType) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ef7750073d18011b, []int{6}
+}
+
+func (m *AlarmType) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_AlarmType.Unmarshal(m, b)
+}
+func (m *AlarmType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_AlarmType.Marshal(b, m, deterministic)
+}
+func (m *AlarmType) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AlarmType.Merge(m, src)
+}
+func (m *AlarmType) XXX_Size() int {
+ return xxx_messageInfo_AlarmType.Size(m)
+}
+func (m *AlarmType) XXX_DiscardUnknown() {
+ xxx_messageInfo_AlarmType.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AlarmType proto.InternalMessageInfo
+
+type AlarmParameter struct {
+ Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
+ Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *AlarmParameter) Reset() { *m = AlarmParameter{} }
+func (m *AlarmParameter) String() string { return proto.CompactTextString(m) }
+func (*AlarmParameter) ProtoMessage() {}
+func (*AlarmParameter) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ef7750073d18011b, []int{7}
+}
+
+func (m *AlarmParameter) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_AlarmParameter.Unmarshal(m, b)
+}
+func (m *AlarmParameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_AlarmParameter.Marshal(b, m, deterministic)
+}
+func (m *AlarmParameter) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AlarmParameter.Merge(m, src)
+}
+func (m *AlarmParameter) XXX_Size() int {
+ return xxx_messageInfo_AlarmParameter.Size(m)
+}
+func (m *AlarmParameter) XXX_DiscardUnknown() {
+ xxx_messageInfo_AlarmParameter.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AlarmParameter proto.InternalMessageInfo
+
+func (m *AlarmParameter) GetKey() string {
+ if m != nil {
+ return m.Key
+ }
+ return ""
+}
+
+func (m *AlarmParameter) GetValue() string {
+ if m != nil {
+ return m.Value
+ }
+ return ""
+}
+
+// AlarmRequest includes fields common to every alarm,
+// 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"`
+ 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"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *AlarmRequest) Reset() { *m = AlarmRequest{} }
+func (m *AlarmRequest) String() string { return proto.CompactTextString(m) }
+func (*AlarmRequest) ProtoMessage() {}
+func (*AlarmRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ef7750073d18011b, []int{8}
+}
+
+func (m *AlarmRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_AlarmRequest.Unmarshal(m, b)
+}
+func (m *AlarmRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_AlarmRequest.Marshal(b, m, deterministic)
+}
+func (m *AlarmRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AlarmRequest.Merge(m, src)
+}
+func (m *AlarmRequest) XXX_Size() int {
+ return xxx_messageInfo_AlarmRequest.Size(m)
+}
+func (m *AlarmRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_AlarmRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AlarmRequest proto.InternalMessageInfo
+
+func (m *AlarmRequest) GetAlarmType() AlarmType_Types {
+ if m != nil {
+ return m.AlarmType
+ }
+ return AlarmType_LOS
+}
+
+func (m *AlarmRequest) GetSerialNumber() string {
+ if m != nil {
+ return m.SerialNumber
+ }
+ return ""
+}
+
+func (m *AlarmRequest) GetStatus() string {
+ if m != nil {
+ return m.Status
+ }
+ return ""
+}
+
+func (m *AlarmRequest) GetParameters() []*AlarmParameter {
+ if m != nil {
+ return m.Parameters
+ }
+ return nil
+}
+
type VersionNumber struct {
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
BuildTime string `protobuf:"bytes,2,opt,name=buildTime,proto3" json:"buildTime,omitempty"`
@@ -392,7 +614,7 @@
func (m *VersionNumber) String() string { return proto.CompactTextString(m) }
func (*VersionNumber) ProtoMessage() {}
func (*VersionNumber) Descriptor() ([]byte, []int) {
- return fileDescriptor_ef7750073d18011b, []int{6}
+ return fileDescriptor_ef7750073d18011b, []int{9}
}
func (m *VersionNumber) XXX_Unmarshal(b []byte) error {
@@ -453,7 +675,7 @@
func (m *LogLevel) String() string { return proto.CompactTextString(m) }
func (*LogLevel) ProtoMessage() {}
func (*LogLevel) Descriptor() ([]byte, []int) {
- return fileDescriptor_ef7750073d18011b, []int{7}
+ return fileDescriptor_ef7750073d18011b, []int{10}
}
func (m *LogLevel) XXX_Unmarshal(b []byte) error {
@@ -500,7 +722,7 @@
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) {
- return fileDescriptor_ef7750073d18011b, []int{8}
+ return fileDescriptor_ef7750073d18011b, []int{11}
}
func (m *Response) XXX_Unmarshal(b []byte) error {
@@ -545,7 +767,7 @@
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
- return fileDescriptor_ef7750073d18011b, []int{9}
+ return fileDescriptor_ef7750073d18011b, []int{12}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
@@ -567,12 +789,16 @@
var xxx_messageInfo_Empty proto.InternalMessageInfo
func init() {
+ proto.RegisterEnum("bbsim.AlarmType_Types", AlarmType_Types_name, AlarmType_Types_value)
proto.RegisterType((*PONPort)(nil), "bbsim.PONPort")
proto.RegisterType((*NNIPort)(nil), "bbsim.NNIPort")
proto.RegisterType((*Olt)(nil), "bbsim.Olt")
proto.RegisterType((*ONU)(nil), "bbsim.ONU")
proto.RegisterType((*ONUs)(nil), "bbsim.ONUs")
proto.RegisterType((*ONURequest)(nil), "bbsim.ONURequest")
+ proto.RegisterType((*AlarmType)(nil), "bbsim.AlarmType")
+ proto.RegisterType((*AlarmParameter)(nil), "bbsim.AlarmParameter")
+ proto.RegisterType((*AlarmRequest)(nil), "bbsim.AlarmRequest")
proto.RegisterType((*VersionNumber)(nil), "bbsim.VersionNumber")
proto.RegisterType((*LogLevel)(nil), "bbsim.LogLevel")
proto.RegisterType((*Response)(nil), "bbsim.Response")
@@ -582,46 +808,71 @@
func init() { proto.RegisterFile("api/bbsim/bbsim.proto", fileDescriptor_ef7750073d18011b) }
var fileDescriptor_ef7750073d18011b = []byte{
- // 617 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xd1, 0x8e, 0xd2, 0x4c,
- 0x18, 0x6d, 0x81, 0x52, 0xf8, 0xca, 0xee, 0x9f, 0x7f, 0xb2, 0x9a, 0x86, 0x6c, 0x94, 0x4c, 0x36,
- 0x06, 0x8d, 0xb2, 0x0a, 0x26, 0x7a, 0xeb, 0x2e, 0xc4, 0x25, 0xd9, 0x14, 0xd2, 0x2e, 0xde, 0x9a,
- 0x96, 0x4e, 0xa0, 0x49, 0xdb, 0xa9, 0x9d, 0x61, 0x89, 0x0f, 0xe0, 0xa3, 0xf9, 0x08, 0x3e, 0x8c,
- 0x77, 0x66, 0xda, 0x69, 0xa1, 0xcb, 0x5e, 0x10, 0x6f, 0xbc, 0x21, 0x73, 0xce, 0x9c, 0x33, 0xf3,
- 0x7d, 0x67, 0x3e, 0x52, 0x78, 0xe2, 0x26, 0xc1, 0xa5, 0xe7, 0xb1, 0x20, 0xca, 0x7f, 0x07, 0x49,
- 0x4a, 0x39, 0x45, 0x5a, 0x06, 0xf0, 0x07, 0xd0, 0xe7, 0x33, 0x6b, 0x4e, 0x53, 0x8e, 0x4e, 0xa1,
- 0x36, 0x1d, 0x9b, 0x6a, 0x4f, 0xed, 0x6b, 0x76, 0x6d, 0x3a, 0x46, 0xe7, 0xd0, 0x9e, 0x25, 0x24,
- 0x75, 0xb8, 0xcb, 0x89, 0x59, 0xeb, 0xa9, 0xfd, 0xb6, 0xbd, 0x23, 0x84, 0xd1, 0xb2, 0xa6, 0x7f,
- 0x61, 0xfc, 0xa5, 0x42, 0x7d, 0x16, 0x1e, 0xba, 0x30, 0x74, 0x1c, 0x92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 0xa2, 0x64, 0x31, 0x5e, 0x55, 0xad, 0xb1, 0x9b, 0x2e,
- 0x86, 0x15, 0xf4, 0x32, 0x6f, 0xcd, 0x5a, 0xa0, 0xff, 0xf7, 0xc6, 0x2e, 0x1f, 0xb4, 0xee, 0xde,
- 0x24, 0x62, 0x05, 0xbd, 0x03, 0xc3, 0x21, 0xbc, 0x7c, 0xcd, 0xe2, 0xd2, 0x82, 0xe8, 0x3e, 0x24,
- 0xb0, 0x82, 0x46, 0x7b, 0x3d, 0x3e, 0x7e, 0xc5, 0x23, 0xa5, 0x0f, 0x77, 0x39, 0x1e, 0xed, 0x79,
- 0x0f, 0x1d, 0x9b, 0x30, 0xee, 0xa6, 0x7c, 0xe2, 0x26, 0x34, 0x3c, 0xd2, 0x35, 0x02, 0x43, 0xba,
- 0xc6, 0xeb, 0x65, 0x72, 0x9c, 0xc9, 0x6b, 0x66, 0x5f, 0x82, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff,
- 0xff, 0x57, 0x53, 0xc7, 0x05, 0x22, 0x06, 0x00, 0x00,
+ // 1009 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4d, 0x4f, 0xeb, 0x56,
+ 0x13, 0x4e, 0x08, 0xce, 0xc7, 0x04, 0x82, 0x19, 0x3e, 0x5e, 0x0b, 0xa1, 0xb7, 0xc8, 0xba, 0xad,
+ 0xb8, 0x55, 0xcb, 0x6d, 0xe1, 0x56, 0xbd, 0x8b, 0x6e, 0x4c, 0x62, 0x82, 0x75, 0xc3, 0x71, 0x74,
+ 0xec, 0x80, 0x58, 0x59, 0x4e, 0x72, 0x04, 0x96, 0xec, 0x38, 0xb5, 0x9d, 0x8b, 0x58, 0x57, 0xfd,
+ 0x4d, 0xfd, 0x1b, 0xdd, 0x74, 0xdb, 0xff, 0xd1, 0x5d, 0x75, 0xec, 0x63, 0xc7, 0x81, 0x5b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, 0x3f, 0x01, 0x5a, 0x2c, 0x49, 0x9f, 0x9e,
+ 0x31, 0x9b, 0x7a, 0x13, 0x37, 0xe1, 0x83, 0xb4, 0x57, 0x7e, 0x92, 0xff, 0xcc, 0x1e, 0xd7, 0xd3,
+ 0x1f, 0x47, 0x17, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x83, 0x0f, 0x4c, 0x7d, 0x35, 0x09, 0x00,
+ 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -648,6 +899,7 @@
PoweronONU(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
RestartEapol(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
RestartDhcp(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
+ SetAlarmIndication(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*Response, error)
}
type bBSimClient struct {
@@ -766,6 +1018,15 @@
return out, nil
}
+func (c *bBSimClient) SetAlarmIndication(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*Response, error) {
+ out := new(Response)
+ err := c.cc.Invoke(ctx, "/bbsim.BBSim/SetAlarmIndication", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// BBSimServer is the server API for BBSim service.
type BBSimServer interface {
Version(context.Context, *Empty) (*VersionNumber, error)
@@ -780,47 +1041,7 @@
PoweronONU(context.Context, *ONURequest) (*Response, error)
RestartEapol(context.Context, *ONURequest) (*Response, error)
RestartDhcp(context.Context, *ONURequest) (*Response, error)
-}
-
-// UnimplementedBBSimServer can be embedded to have forward compatible implementations.
-type UnimplementedBBSimServer struct {
-}
-
-func (*UnimplementedBBSimServer) Version(ctx context.Context, req *Empty) (*VersionNumber, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
-}
-func (*UnimplementedBBSimServer) GetOlt(ctx context.Context, req *Empty) (*Olt, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetOlt not implemented")
-}
-func (*UnimplementedBBSimServer) PoweronOlt(ctx context.Context, req *Empty) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method PoweronOlt not implemented")
-}
-func (*UnimplementedBBSimServer) ShutdownOlt(ctx context.Context, req *Empty) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ShutdownOlt not implemented")
-}
-func (*UnimplementedBBSimServer) RebootOlt(ctx context.Context, req *Empty) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method RebootOlt not implemented")
-}
-func (*UnimplementedBBSimServer) GetONUs(ctx context.Context, req *Empty) (*ONUs, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetONUs not implemented")
-}
-func (*UnimplementedBBSimServer) GetONU(ctx context.Context, req *ONURequest) (*ONU, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetONU not implemented")
-}
-func (*UnimplementedBBSimServer) SetLogLevel(ctx context.Context, req *LogLevel) (*LogLevel, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SetLogLevel not implemented")
-}
-func (*UnimplementedBBSimServer) ShutdownONU(ctx context.Context, req *ONURequest) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ShutdownONU not implemented")
-}
-func (*UnimplementedBBSimServer) PoweronONU(ctx context.Context, req *ONURequest) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method PoweronONU not implemented")
-}
-func (*UnimplementedBBSimServer) RestartEapol(ctx context.Context, req *ONURequest) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method RestartEapol not implemented")
-}
-func (*UnimplementedBBSimServer) RestartDhcp(ctx context.Context, req *ONURequest) (*Response, error) {
- return nil, status.Errorf(codes.Unimplemented, "method RestartDhcp not implemented")
+ SetAlarmIndication(context.Context, *AlarmRequest) (*Response, error)
}
func RegisterBBSimServer(s *grpc.Server, srv BBSimServer) {
@@ -1043,6 +1264,24 @@
return interceptor(ctx, in, info, handler)
}
+func _BBSim_SetAlarmIndication_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(AlarmRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BBSimServer).SetAlarmIndication(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/bbsim.BBSim/SetAlarmIndication",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BBSimServer).SetAlarmIndication(ctx, req.(*AlarmRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _BBSim_serviceDesc = grpc.ServiceDesc{
ServiceName: "bbsim.BBSim",
HandlerType: (*BBSimServer)(nil),
@@ -1095,6 +1334,10 @@
MethodName: "RestartDhcp",
Handler: _BBSim_RestartDhcp_Handler,
},
+ {
+ MethodName: "SetAlarmIndication",
+ Handler: _BBSim_SetAlarmIndication_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "api/bbsim/bbsim.proto",
diff --git a/api/bbsim/bbsim.pb.gw.go b/api/bbsim/bbsim.pb.gw.go
index 9c7f8cb..0f0500b 100644
--- a/api/bbsim/bbsim.pb.gw.go
+++ b/api/bbsim/bbsim.pb.gw.go
@@ -13,7 +13,6 @@
"io"
"net/http"
- "github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
@@ -23,13 +22,11 @@
"google.golang.org/grpc/status"
)
-// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
-var _ = descriptor.ForMessage
func request_BBSim_Version_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
@@ -40,15 +37,6 @@
}
-func local_request_BBSim_Version_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.Version(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSim_GetOlt_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
var metadata runtime.ServerMetadata
@@ -58,15 +46,6 @@
}
-func local_request_BBSim_GetOlt_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.GetOlt(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSim_GetOlt_1(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
var metadata runtime.ServerMetadata
@@ -76,15 +55,6 @@
}
-func local_request_BBSim_GetOlt_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.GetOlt(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSim_GetONUs_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
var metadata runtime.ServerMetadata
@@ -94,15 +64,6 @@
}
-func local_request_BBSim_GetONUs_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.GetONUs(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSim_GetONU_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ONURequest
var metadata runtime.ServerMetadata
@@ -130,141 +91,6 @@
}
-func local_request_BBSim_GetONU_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- 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)
- }
-
- msg, err := server.GetONU(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.
-func RegisterBBSimHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BBSimServer) error {
-
- mux.Handle("GET", pattern_BBSim_Version_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_Version_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_Version_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSim_GetOlt_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_GetOlt_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_GetOlt_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSim_GetOlt_1, 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_GetOlt_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSim_GetOlt_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSim_GetONUs_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_GetONUs_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_GetONUs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSim_GetONU_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_GetONU_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_GetONU_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
// RegisterBBSimHandlerFromEndpoint is same as RegisterBBSimHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBBSimHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
diff --git a/api/bbsim/bbsim.proto b/api/bbsim/bbsim.proto
index e147bb5..3cd7336 100644
--- a/api/bbsim/bbsim.proto
+++ b/api/bbsim/bbsim.proto
@@ -58,6 +58,52 @@
string SerialNumber = 1;
}
+// Alarms
+
+message AlarmType {
+ // These types correspond to the messages permitted in the oneof
+ // in AlarmIndication in the openolt protos
+ enum Types {
+ LOS = 0; // LOS is an OLT alarm for an entire PON
+ DYING_GASP = 1;
+ ONU_ALARM = 2;
+ ONU_STARTUP_FAILURE = 3;
+ ONU_SIGNAL_DEGRADE = 4;
+ ONU_DRIFT_OF_WINDOW = 5;
+ ONU_LOSS_OF_OMCI_CHANNEL = 6;
+ ONU_SIGNALS_FAILURE = 7;
+ ONU_TRANSMISSION_INTERFERENCE_WARNING = 8;
+ ONU_ACTIVATION_FAILURE = 9;
+ ONU_PROCESSING_ERROR = 10;
+ ONU_LOSS_OF_KEY_SYNC_FAILURE = 11;
+ ONU_ITU_PON_STATS = 12;
+
+ // These break out ONU_ALARM, which is a single message, but
+ // includes statuses for these six alarms.
+ ONU_ALARM_LOS = 13;
+ ONU_ALARM_LOB = 14;
+ ONU_ALARM_LOPC_MISS = 15;
+ ONU_ALARM_LOPC_MIC_ERROR = 16;
+ ONU_ALARM_LOFI = 17;
+ ONU_ALARM_LOAMI = 18;
+ }
+}
+
+message AlarmParameter {
+ string Key = 1;
+ string Value = 2;
+}
+
+// AlarmRequest includes fields common to every alarm,
+// 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 SerialNumber = 2; // serial number of ONU
+ string Status = 3; // status of Alarm
+ repeated AlarmParameter Parameters = 4; // optional list of additional parameters
+}
+
// Utils
message VersionNumber {
@@ -92,4 +138,5 @@
rpc PoweronONU (ONURequest) returns (Response) {}
rpc RestartEapol (ONURequest) returns (Response) {}
rpc RestartDhcp (ONURequest) returns (Response) {}
+ rpc SetAlarmIndication (AlarmRequest) returns (Response) {}
}
\ No newline at end of file
diff --git a/api/legacy/bbsim.pb.go b/api/legacy/bbsim.pb.go
index 060760b..ad35c64 100644
--- a/api/legacy/bbsim.pb.go
+++ b/api/legacy/bbsim.pb.go
@@ -12,8 +12,6 @@
tech_profile "github.com/opencord/voltha-protos/v2/go/tech_profile"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
math "math"
)
@@ -1047,38 +1045,6 @@
GetFlows(context.Context, *ONUInfo) (*Flows, error)
}
-// UnimplementedBBSimServiceServer can be embedded to have forward compatible implementations.
-type UnimplementedBBSimServiceServer struct {
-}
-
-func (*UnimplementedBBSimServiceServer) OLTStatus(ctx context.Context, req *Empty) (*OLTStatusResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method OLTStatus not implemented")
-}
-func (*UnimplementedBBSimServiceServer) PortStatus(ctx context.Context, req *PortInfo) (*Ports, error) {
- return nil, status.Errorf(codes.Unimplemented, "method PortStatus not implemented")
-}
-func (*UnimplementedBBSimServiceServer) ONUStatus(ctx context.Context, req *ONURequest) (*ONUs, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ONUStatus not implemented")
-}
-func (*UnimplementedBBSimServiceServer) ONUActivate(ctx context.Context, req *ONURequest) (*BBSimResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ONUActivate not implemented")
-}
-func (*UnimplementedBBSimServiceServer) ONUDeactivate(ctx context.Context, req *ONURequest) (*BBSimResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ONUDeactivate not implemented")
-}
-func (*UnimplementedBBSimServiceServer) GenerateONUAlarm(ctx context.Context, req *ONUAlarmRequest) (*BBSimResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GenerateONUAlarm not implemented")
-}
-func (*UnimplementedBBSimServiceServer) GenerateOLTAlarm(ctx context.Context, req *OLTAlarmRequest) (*BBSimResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GenerateOLTAlarm not implemented")
-}
-func (*UnimplementedBBSimServiceServer) PerformDeviceAction(ctx context.Context, req *DeviceAction) (*BBSimResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method PerformDeviceAction not implemented")
-}
-func (*UnimplementedBBSimServiceServer) GetFlows(ctx context.Context, req *ONUInfo) (*Flows, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetFlows not implemented")
-}
-
func RegisterBBSimServiceServer(s *grpc.Server, srv BBSimServiceServer) {
s.RegisterService(&_BBSimService_serviceDesc, srv)
}
diff --git a/api/legacy/bbsim.pb.gw.go b/api/legacy/bbsim.pb.gw.go
index d56438c..c3667c0 100644
--- a/api/legacy/bbsim.pb.gw.go
+++ b/api/legacy/bbsim.pb.gw.go
@@ -13,7 +13,6 @@
"io"
"net/http"
- "github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
@@ -23,13 +22,11 @@
"google.golang.org/grpc/status"
)
-// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
-var _ = descriptor.ForMessage
func request_BBSimService_OLTStatus_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
@@ -40,15 +37,6 @@
}
-func local_request_BBSimService_OLTStatus_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.OLTStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSimService_OLTStatus_1(ctx context.Context, marshaler runtime.Marshaler, client BBSimServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Empty
var metadata runtime.ServerMetadata
@@ -58,15 +46,6 @@
}
-func local_request_BBSimService_OLTStatus_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Empty
- var metadata runtime.ServerMetadata
-
- msg, err := server.OLTStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_PortStatus_0 = &utilities.DoubleArray{Encoding: map[string]int{"port_type": 0, "port_id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
)
@@ -116,48 +95,6 @@
}
-func local_request_BBSimService_PortStatus_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq PortInfo
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["port_type"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_type")
- }
-
- protoReq.PortType, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_type", err)
- }
-
- val, ok = pathParams["port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id")
- }
-
- protoReq.PortId, err = runtime.Uint32(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_PortStatus_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.PortStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUStatus_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@@ -178,19 +115,6 @@
}
-func local_request_BBSimService_ONUStatus_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUStatus_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUStatus_1 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "onu_serial": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
)
@@ -229,37 +153,6 @@
}
-func local_request_BBSimService_ONUStatus_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.onu_serial"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.onu_serial")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.onu_serial", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.onu_serial", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUStatus_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUStatus_2 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1, "onu_id": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 2, 2, 3, 4}}
)
@@ -309,48 +202,6 @@
}
-func local_request_BBSimService_ONUStatus_2(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- val, ok = pathParams["onu.onu_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.onu_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.onu_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.onu_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUStatus_2); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUStatus_3 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
)
@@ -389,37 +240,6 @@
}
-func local_request_BBSimService_ONUStatus_3(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUStatus_3); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUStatus(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUActivate_0 = &utilities.DoubleArray{Encoding: map[string]int{"onus_batch": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
@@ -448,27 +268,6 @@
}
-func local_request_BBSimService_ONUActivate_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.OnusBatch); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUActivate_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUActivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUActivate_1 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
)
@@ -507,37 +306,6 @@
}
-func local_request_BBSimService_ONUActivate_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUActivate_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUActivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUActivate_2 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1, "onu_serial": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 2, 2, 3, 4}}
)
@@ -587,48 +355,6 @@
}
-func local_request_BBSimService_ONUActivate_2(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- val, ok = pathParams["onu.onu_serial"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.onu_serial")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.onu_serial", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.onu_serial", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUActivate_2); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUActivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUDeactivate_0 = &utilities.DoubleArray{Encoding: map[string]int{"onus_batch": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
@@ -657,27 +383,6 @@
}
-func local_request_BBSimService_ONUDeactivate_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.OnusBatch); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUDeactivate_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUDeactivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUDeactivate_1 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "onu_serial": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
)
@@ -716,37 +421,6 @@
}
-func local_request_BBSimService_ONUDeactivate_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.onu_serial"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.onu_serial")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.onu_serial", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.onu_serial", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUDeactivate_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUDeactivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUDeactivate_2 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
)
@@ -785,37 +459,6 @@
}
-func local_request_BBSimService_ONUDeactivate_2(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUDeactivate_2); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUDeactivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_ONUDeactivate_3 = &utilities.DoubleArray{Encoding: map[string]int{"onu": 0, "pon_port_id": 1, "onu_id": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 2, 2, 3, 4}}
)
@@ -865,48 +508,6 @@
}
-func local_request_BBSimService_ONUDeactivate_3(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONURequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu.pon_port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.pon_port_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.pon_port_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.pon_port_id", err)
- }
-
- val, ok = pathParams["onu.onu_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu.onu_id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "onu.onu_id", val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu.onu_id", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_ONUDeactivate_3); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ONUDeactivate(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSimService_GenerateONUAlarm_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ONUAlarmRequest
var metadata runtime.ServerMetadata
@@ -956,55 +557,6 @@
}
-func local_request_BBSimService_GenerateONUAlarm_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONUAlarmRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu_serial"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu_serial")
- }
-
- protoReq.OnuSerial, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu_serial", err)
- }
-
- val, ok = pathParams["alarm_type"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "alarm_type")
- }
-
- protoReq.AlarmType, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "alarm_type", 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)
- }
-
- msg, err := server.GenerateONUAlarm(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSimService_GenerateOLTAlarm_0(ctx context.Context, marshaler runtime.Marshaler, client BBSimServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq OLTAlarmRequest
var metadata runtime.ServerMetadata
@@ -1054,55 +606,6 @@
}
-func local_request_BBSimService_GenerateOLTAlarm_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq OLTAlarmRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["port_type"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_type")
- }
-
- protoReq.PortType, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_type", err)
- }
-
- val, ok = pathParams["port_id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id")
- }
-
- protoReq.PortId, err = runtime.Uint32(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", 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)
- }
-
- msg, err := server.GenerateOLTAlarm(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_PerformDeviceAction_0 = &utilities.DoubleArray{Encoding: map[string]int{"device_type": 0, "action": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
)
@@ -1152,48 +655,6 @@
}
-func local_request_BBSimService_PerformDeviceAction_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DeviceAction
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["device_type"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "device_type")
- }
-
- protoReq.DeviceType, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "device_type", err)
- }
-
- val, ok = pathParams["action"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "action")
- }
-
- protoReq.Action, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "action", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_PerformDeviceAction_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.PerformDeviceAction(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_BBSimService_PerformDeviceAction_1(ctx context.Context, marshaler runtime.Marshaler, client BBSimServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeviceAction
var metadata runtime.ServerMetadata
@@ -1243,55 +704,6 @@
}
-func local_request_BBSimService_PerformDeviceAction_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DeviceAction
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["device_type"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "device_type")
- }
-
- protoReq.DeviceType, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "device_type", err)
- }
-
- val, ok = pathParams["serial_number"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serial_number")
- }
-
- protoReq.SerialNumber, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serial_number", err)
- }
-
- val, ok = pathParams["action"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "action")
- }
-
- protoReq.Action, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "action", err)
- }
-
- msg, err := server.PerformDeviceAction(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_GetFlows_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@@ -1312,19 +724,6 @@
}
-func local_request_BBSimService_GetFlows_0(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONUInfo
- var metadata runtime.ServerMetadata
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_GetFlows_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.GetFlows(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
var (
filter_BBSimService_GetFlows_1 = &utilities.DoubleArray{Encoding: map[string]int{"onu_serial": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
@@ -1363,445 +762,6 @@
}
-func local_request_BBSimService_GetFlows_1(ctx context.Context, marshaler runtime.Marshaler, server BBSimServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ONUInfo
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["onu_serial"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "onu_serial")
- }
-
- protoReq.OnuSerial, err = runtime.String(val)
-
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "onu_serial", err)
- }
-
- if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BBSimService_GetFlows_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.GetFlows(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-// RegisterBBSimServiceHandlerServer registers the http handlers for service BBSimService to "mux".
-// UnaryRPC :call BBSimServiceServer directly.
-// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-func RegisterBBSimServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BBSimServiceServer) error {
-
- mux.Handle("GET", pattern_BBSimService_OLTStatus_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_BBSimService_OLTStatus_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_OLTStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_OLTStatus_1, 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_BBSimService_OLTStatus_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_OLTStatus_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_PortStatus_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_BBSimService_PortStatus_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_PortStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_ONUStatus_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_BBSimService_ONUStatus_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_ONUStatus_1, 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_BBSimService_ONUStatus_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUStatus_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_ONUStatus_2, 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_BBSimService_ONUStatus_2(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUStatus_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_ONUStatus_3, 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_BBSimService_ONUStatus_3(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUStatus_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_BBSimService_ONUActivate_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_BBSimService_ONUActivate_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUActivate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_BBSimService_ONUActivate_1, 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_BBSimService_ONUActivate_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUActivate_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_BBSimService_ONUActivate_2, 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_BBSimService_ONUActivate_2(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUActivate_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_BBSimService_ONUDeactivate_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_BBSimService_ONUDeactivate_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUDeactivate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_BBSimService_ONUDeactivate_1, 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_BBSimService_ONUDeactivate_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUDeactivate_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_BBSimService_ONUDeactivate_2, 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_BBSimService_ONUDeactivate_2(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUDeactivate_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_BBSimService_ONUDeactivate_3, 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_BBSimService_ONUDeactivate_3(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_ONUDeactivate_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_BBSimService_GenerateONUAlarm_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_BBSimService_GenerateONUAlarm_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_GenerateONUAlarm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_BBSimService_GenerateOLTAlarm_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_BBSimService_GenerateOLTAlarm_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_GenerateOLTAlarm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("PATCH", pattern_BBSimService_PerformDeviceAction_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_BBSimService_PerformDeviceAction_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_PerformDeviceAction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("PATCH", pattern_BBSimService_PerformDeviceAction_1, 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_BBSimService_PerformDeviceAction_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_PerformDeviceAction_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_GetFlows_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_BBSimService_GetFlows_0(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_GetFlows_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_BBSimService_GetFlows_1, 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_BBSimService_GetFlows_1(rctx, inboundMarshaler, server, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_BBSimService_GetFlows_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
// RegisterBBSimServiceHandlerFromEndpoint is same as RegisterBBSimServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBBSimServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
diff --git a/cmd/bbsimctl/bbsimctl.go b/cmd/bbsimctl/bbsimctl.go
index 6371d83..f82cd64 100644
--- a/cmd/bbsimctl/bbsimctl.go
+++ b/cmd/bbsimctl/bbsimctl.go
@@ -39,6 +39,7 @@
commands.RegisterONUCommands(parser)
commands.RegisterCompletionCommands(parser)
commands.RegisterLoggingCommands(parser)
+ commands.RegisterAlarmCommands(parser)
_, err = parser.ParseArgs(os.Args[1:])
if err != nil {
diff --git a/go.sum b/go.sum
index 2c08395..7ba09a0 100644
--- a/go.sum
+++ b/go.sum
@@ -43,10 +43,12 @@
github.com/looplab/fsm v0.1.0/go.mod h1:m2VaOfDHxqXBBMgc26m6yUOwkFn8H2AlJDE+jd/uafI=
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4 h1:Odib2px8tyALzdbyztAAqdxmpmQ/pJahJ7uz8kN/rvk=
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4/go.mod h1:/+3S0pwQUy7HeKnH0KfKp5W6hmh/LdZzuZTNT/m7vA4=
-github.com/opencord/omci-sim v0.0.1 h1:kME5SsHxoayQGyY4UYe4eUxaWJJoCflAVul0vy8JBr8=
-github.com/opencord/omci-sim v0.0.1/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
+github.com/opencord/omci-sim v0.0.2 h1:ojEWzeiAgD8Yg7EISYTUD/6vaFk0wzQ6QMtMBYFbIh0=
+github.com/opencord/omci-sim v0.0.2/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
github.com/opencord/voltha-protos/v2 v2.1.2 h1:/eX+kXhANbzxTpBHgC6vjwBUGRKKvGUOQRDdDgROp9E=
github.com/opencord/voltha-protos/v2 v2.1.2/go.mod h1:6kOcfYi1CadWowFxI2SH5wLfHrsRECZLZlD2MFK6WDI=
+github.com/opencord/voltha-protos/v3 v3.1.0 h1:jPBizpoIRlVIy8ZzTpC+cyQQL2esjJgIPvNcilWMDLA=
+github.com/opencord/voltha-protos/v3 v3.1.0/go.mod h1:n60tmoNSjgDGxEH7YGqDhIeiCpQETpnF5wOcNepHvWU=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
diff --git a/internal/bbsim/alarmsim/alarmsim.go b/internal/bbsim/alarmsim/alarmsim.go
new file mode 100644
index 0000000..3c81265
--- /dev/null
+++ b/internal/bbsim/alarmsim/alarmsim.go
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package alarmsim
+
+import (
+ "context"
+ "fmt"
+ "github.com/opencord/bbsim/api/bbsim"
+ "github.com/opencord/bbsim/internal/bbsim/devices"
+ "github.com/opencord/voltha-protos/v2/go/openolt"
+ "strconv"
+)
+
+// 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 {
+ for _, kv := range params {
+ if kv.Key == name {
+ i, err := strconv.Atoi(kv.Value)
+ if err == nil {
+ return i
+ }
+ }
+ }
+ return def
+}
+
+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 {
+ // No ONU Id for LOS
+ onu, err = o.FindOnuBySn(req.SerialNumber)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ switch req.AlarmType {
+ case bbsim.AlarmType_LOS:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_LosInd{&openolt.LosIndication{
+ // No ONU Id for LOS
+ Status: req.Status,
+ IntfId: uint32(extractInt(req.Parameters, "InterfaceId", 0)),
+ }},
+ }
+ case bbsim.AlarmType_DYING_GASP:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_DyingGaspInd{&openolt.DyingGaspIndication{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_STARTUP_FAILURE:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuStartupFailInd{&openolt.OnuStartupFailureIndication{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_SIGNAL_DEGRADE:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuSignalDegradeInd{&openolt.OnuSignalDegradeIndication{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ InverseBitErrorRate: uint32(extractInt(req.Parameters, "InverseBitErrorRate", 0)),
+ }},
+ }
+ case bbsim.AlarmType_ONU_DRIFT_OF_WINDOW:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuDriftOfWindowInd{&openolt.OnuDriftOfWindowIndication{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ Drift: uint32(extractInt(req.Parameters, "Drift", 0)),
+ NewEqd: uint32(extractInt(req.Parameters, "NewEqd", 0)),
+ }},
+ }
+ case bbsim.AlarmType_ONU_LOSS_OF_OMCI_CHANNEL:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuLossOmciInd{&openolt.OnuLossOfOmciChannelIndication{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_TRANSMISSION_INTERFERENCE_WARNING:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuTiwiInd{&openolt.OnuTransmissionInterferenceWarning{
+ Status: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ Drift: uint32(extractInt(req.Parameters, "Drift", 0)),
+ }},
+ }
+ case bbsim.AlarmType_ONU_ACTIVATION_FAILURE:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuActivationFailInd{&openolt.OnuActivationFailureIndication{
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ FailReason: uint32(extractInt(req.Parameters, "FailReason", 0)),
+ }},
+ }
+ case bbsim.AlarmType_ONU_PROCESSING_ERROR:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuProcessingErrorInd{&openolt.OnuProcessingErrorIndication{
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_LOSS_OF_KEY_SYNC_FAILURE:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuLossOfSyncFailInd{&openolt.OnuLossOfKeySyncFailureIndication{
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ Status: req.Status,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ITU_PON_STATS:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuItuPonStatsInd{&openolt.OnuItuPonStatsIndication{
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ RdiErrors: uint32(extractInt(req.Parameters, "RdiErrors", 0)),
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOS:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LosStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOB:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LobStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOPC_MISS:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LopcMissStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOPC_MIC_ERROR:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LopcMicErrorStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOFI:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LofiStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ case bbsim.AlarmType_ONU_ALARM_LOAMI:
+ alarm = &openolt.AlarmIndication{
+ Data: &openolt.AlarmIndication_OnuAlarmInd{&openolt.OnuAlarmIndication{
+ LoamiStatus: req.Status,
+ OnuId: onu.ID,
+ IntfId: onu.PonPortID,
+ }},
+ }
+ default:
+ return nil, fmt.Errorf("Unknown alarm type %v", req.AlarmType)
+ }
+
+ return alarm, nil
+}
+
+func SimulateAlarm(ctx context.Context, req *bbsim.AlarmRequest, o *devices.OltDevice) error {
+ alarmIndication, err := BuildAlarmIndication(req, o)
+ if err != nil {
+ return err
+ }
+
+ err = o.SendAlarmIndication(ctx, alarmIndication)
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/internal/bbsim/api/grpc_api_server.go b/internal/bbsim/api/grpc_api_server.go
index 09e4080..ca311ce 100644
--- a/internal/bbsim/api/grpc_api_server.go
+++ b/internal/bbsim/api/grpc_api_server.go
@@ -21,6 +21,7 @@
"fmt"
"github.com/opencord/bbsim/api/bbsim"
+ "github.com/opencord/bbsim/internal/bbsim/alarmsim"
"github.com/opencord/bbsim/internal/bbsim/devices"
"github.com/opencord/bbsim/internal/common"
log "github.com/sirupsen/logrus"
@@ -129,3 +130,16 @@
Caller: log.StandardLogger().ReportCaller,
}, nil
}
+
+func (s BBSimServer) SetAlarmIndication(ctx context.Context, req *bbsim.AlarmRequest) (*bbsim.Response, error) {
+ o := devices.GetOLT()
+ err := alarmsim.SimulateAlarm(ctx, req, o)
+ if err != nil {
+ return nil, err
+ }
+
+ res := &bbsim.Response{}
+ res.StatusCode = int32(codes.OK)
+ res.Message = fmt.Sprintf("Alarm Indication Sent.")
+ return res, nil
+}
diff --git a/internal/bbsim/devices/messageTypes.go b/internal/bbsim/devices/messageTypes.go
index acfd832..fd1d4dc 100644
--- a/internal/bbsim/devices/messageTypes.go
+++ b/internal/bbsim/devices/messageTypes.go
@@ -42,6 +42,8 @@
SendEapolFlow MessageType = 12
SendDhcpFlow MessageType = 13
OnuPacketIn MessageType = 14
+
+ AlarmIndication MessageType = 15 // message data is an openolt.AlarmIndication
)
func (m MessageType) String() string {
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index b16e405..e5ed6bc 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -411,6 +411,18 @@
return nil, errors.New(fmt.Sprintf("Cannot find NniPort with id %d in OLT %d", id, o.ID))
}
+func (o *OltDevice) sendAlarmIndication(alarmInd *openolt.AlarmIndication, stream openolt.Openolt_EnableIndicationServer) {
+ data := &openolt.Indication_AlarmInd{AlarmInd: alarmInd}
+ if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
+ oltLogger.Errorf("Failed to send Alarm Indication: %v", err)
+ return
+ }
+
+ oltLogger.WithFields(log.Fields{
+ "AlarmIndication": alarmInd,
+ }).Debug("Sent Indication_AlarmInd")
+}
+
func (o *OltDevice) sendOltIndication(msg OltIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
data := &openolt.Indication_OltInd{OltInd: &openolt.OltIndication{OperState: msg.OperState.String()}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
@@ -546,6 +558,9 @@
o.OperState.Event("disable")
}
o.sendOltIndication(msg, stream)
+ case AlarmIndication:
+ alarmInd, _ := message.Data.(*openolt.AlarmIndication)
+ o.sendAlarmIndication(alarmInd, stream)
case NniIndication:
msg, _ := message.Data.(NniIndicationMessage)
o.sendNniIndication(msg, stream)
@@ -1016,3 +1031,14 @@
oltLogger.Info("received RemoveTrafficSchedulers")
return new(openolt.Empty), nil
}
+
+// assumes caller has properly formulated an openolt.AlarmIndication
+func (o OltDevice) SendAlarmIndication(context context.Context, ind *openolt.AlarmIndication) error {
+ msg := Message{
+ Type: AlarmIndication,
+ Data: ind,
+ }
+
+ o.channel <- msg
+ return nil
+}
diff --git a/internal/bbsimctl/commands/alarms.go b/internal/bbsimctl/commands/alarms.go
new file mode 100755
index 0000000..3e3efec
--- /dev/null
+++ b/internal/bbsimctl/commands/alarms.go
@@ -0,0 +1,188 @@
+/*
+ * Portions copyright 2019-present Open Networking Foundation
+ * Original copyright 2019-present Ciena Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package commands
+
+import (
+ "context"
+ "fmt"
+ "github.com/jessevdk/go-flags"
+ pb "github.com/opencord/bbsim/api/bbsim"
+ "github.com/opencord/bbsim/internal/bbsimctl/config"
+ "github.com/opencord/cordctl/pkg/format"
+ log "github.com/sirupsen/logrus"
+ "os"
+ "strings"
+)
+
+const (
+ DEFAULT_ALARM_LIST_FORMAT = "table{{ .Name }}"
+)
+
+type AlarmListOutput struct {
+ Name string
+}
+
+type AlarmRaise struct {
+ Parameters []string `short:"p" description:"Additional Alarm Parameter in name=value form"`
+ Args struct {
+ Name string
+ SerialNumber string
+ } `positional-args:"yes" required:"yes"`
+}
+
+type AlarmClear struct {
+ Parameters []string `short:"p" description:"Additional Alarm Parameter in name=value form"`
+ Args struct {
+ Name string
+ SerialNumber string
+ } `positional-args:"yes" required:"yes"`
+}
+
+type AlarmList struct{}
+
+type AlarmOptions struct {
+ Raise AlarmRaise `command:"raise"`
+ Clear AlarmClear `command:"clear"`
+ 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))
+ for i, kv := range parameters {
+ parts := strings.Split(kv, "=")
+ if len(parts) != 2 {
+ return fmt.Errorf("Invalid parameter %v", kv)
+ }
+ req.Parameters[i] = &pb.AlarmParameter{Key: parts[0], Value: parts[1]}
+ }
+ return nil
+}
+
+func RegisterAlarmCommands(parser *flags.Parser) {
+ parser.AddCommand("alarm", "Alarm Commands", "Commands to raise and clear alarms", &AlarmOptions{})
+}
+
+func (o *AlarmRaise) Execute(args []string) error {
+ alarmType, err := alarmNameToEnum(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,
+ SerialNumber: o.Args.SerialNumber,
+ Status: "on"}
+
+ 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
+ }
+
+ fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
+ return nil
+}
+
+func (o *AlarmClear) Execute(args []string) error {
+ alarmType, err := alarmNameToEnum(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,
+ SerialNumber: o.Args.SerialNumber,
+ Status: "off"}
+
+ err = addParameters(o.Parameters, &req)
+ if err != nil {
+ return err
+ }
+
+ res, err := client.SetAlarmIndication(ctx, &req)
+
+ if err != nil {
+ log.Fatalf("Cannot clear alarm: %v", err)
+ return err
+ }
+
+ fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
+ return nil
+}
+
+func (o *AlarmList) Execute(args []string) error {
+ alarmNames := make([]AlarmListOutput, len(AlarmNameMap))
+ i := 0
+ for k := range AlarmNameMap {
+ alarmNames[i] = AlarmListOutput{Name: k}
+ i++
+ }
+ // print out
+ tableFormat := format.Format(DEFAULT_ALARM_LIST_FORMAT)
+ tableFormat.Execute(os.Stdout, true, alarmNames)
+ return nil
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 8a7dff5..5d59038 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,6 @@
# github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1
-github.com/aead/cmac
github.com/aead/cmac/aes
+github.com/aead/cmac
# github.com/cboling/omci v0.1.0
github.com/cboling/omci
github.com/cboling/omci/generated
@@ -12,21 +12,21 @@
github.com/golang/glog
# github.com/golang/protobuf v1.3.2
github.com/golang/protobuf/descriptor
-github.com/golang/protobuf/jsonpb
github.com/golang/protobuf/proto
github.com/golang/protobuf/protoc-gen-go
github.com/golang/protobuf/protoc-gen-go/descriptor
-github.com/golang/protobuf/protoc-gen-go/generator
-github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
-github.com/golang/protobuf/protoc-gen-go/grpc
-github.com/golang/protobuf/protoc-gen-go/plugin
-github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/jsonpb
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
-github.com/golang/protobuf/ptypes/empty
-github.com/golang/protobuf/ptypes/struct
github.com/golang/protobuf/ptypes/timestamp
github.com/golang/protobuf/ptypes/wrappers
+github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/ptypes/struct
+github.com/golang/protobuf/ptypes/empty
+github.com/golang/protobuf/protoc-gen-go/generator
+github.com/golang/protobuf/protoc-gen-go/grpc
+github.com/golang/protobuf/protoc-gen-go/plugin
+github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
# github.com/google/go-cmp v0.2.0
github.com/google/go-cmp/cmp
github.com/google/go-cmp/cmp/internal/diff
@@ -39,74 +39,77 @@
# github.com/gorilla/mux v1.7.3
github.com/gorilla/mux
# github.com/grpc-ecosystem/grpc-gateway v1.11.3
-github.com/grpc-ecosystem/grpc-gateway/codegenerator
-github.com/grpc-ecosystem/grpc-gateway/internal
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
github.com/grpc-ecosystem/grpc-gateway/runtime
github.com/grpc-ecosystem/grpc-gateway/utilities
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
+github.com/grpc-ecosystem/grpc-gateway/internal
+github.com/grpc-ecosystem/grpc-gateway/codegenerator
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
# github.com/jessevdk/go-flags v1.4.0
github.com/jessevdk/go-flags
# github.com/jhump/protoreflect v1.5.0
-github.com/jhump/protoreflect/codec
github.com/jhump/protoreflect/desc
-github.com/jhump/protoreflect/desc/internal
github.com/jhump/protoreflect/dynamic
+github.com/jhump/protoreflect/desc/internal
github.com/jhump/protoreflect/internal
+github.com/jhump/protoreflect/codec
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/konsorten/go-windows-terminal-sequences
# github.com/looplab/fsm v0.1.0
github.com/looplab/fsm
# github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4
github.com/opencord/cordctl/pkg/format
-# github.com/opencord/omci-sim v0.0.1
+# github.com/opencord/omci-sim v0.0.2
github.com/opencord/omci-sim
# github.com/opencord/voltha-protos/v2 v2.1.2
github.com/opencord/voltha-protos/v2/go/openolt
github.com/opencord/voltha-protos/v2/go/tech_profile
+# github.com/opencord/voltha-protos/v3 v3.1.0
+github.com/opencord/voltha-protos/v3/go/openolt
+github.com/opencord/voltha-protos/v3/go/tech_profile
# github.com/pkg/errors v0.8.1
github.com/pkg/errors
# github.com/sirupsen/logrus v1.4.2
github.com/sirupsen/logrus
# golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
-golang.org/x/net/context
-golang.org/x/net/http/httpguts
+golang.org/x/net/trace
+golang.org/x/net/internal/timeseries
golang.org/x/net/http2
golang.org/x/net/http2/hpack
+golang.org/x/net/context
+golang.org/x/net/http/httpguts
golang.org/x/net/idna
-golang.org/x/net/internal/timeseries
-golang.org/x/net/trace
# golang.org/x/sys v0.0.0-20190422165155-953cdadca894
golang.org/x/sys/unix
# golang.org/x/text v0.3.0
golang.org/x/text/secure/bidirule
-golang.org/x/text/transform
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
+golang.org/x/text/transform
# google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610
google.golang.org/genproto/googleapis/api/annotations
google.golang.org/genproto/googleapis/api/httpbody
-google.golang.org/genproto/googleapis/rpc/status
google.golang.org/genproto/protobuf/field_mask
+google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.22.1
google.golang.org/grpc
-google.golang.org/grpc/balancer
-google.golang.org/grpc/balancer/base
-google.golang.org/grpc/balancer/roundrobin
-google.golang.org/grpc/binarylog/grpc_binarylog_v1
google.golang.org/grpc/codes
+google.golang.org/grpc/grpclog
+google.golang.org/grpc/status
+google.golang.org/grpc/reflection
+google.golang.org/grpc/metadata
+google.golang.org/grpc/balancer
+google.golang.org/grpc/balancer/roundrobin
google.golang.org/grpc/connectivity
google.golang.org/grpc/credentials
-google.golang.org/grpc/credentials/internal
google.golang.org/grpc/encoding
google.golang.org/grpc/encoding/proto
-google.golang.org/grpc/grpclog
google.golang.org/grpc/internal
google.golang.org/grpc/internal/backoff
google.golang.org/grpc/internal/balancerload
@@ -115,26 +118,26 @@
google.golang.org/grpc/internal/envconfig
google.golang.org/grpc/internal/grpcrand
google.golang.org/grpc/internal/grpcsync
-google.golang.org/grpc/internal/syscall
google.golang.org/grpc/internal/transport
google.golang.org/grpc/keepalive
-google.golang.org/grpc/metadata
google.golang.org/grpc/naming
google.golang.org/grpc/peer
-google.golang.org/grpc/reflection
-google.golang.org/grpc/reflection/grpc_reflection_v1alpha
google.golang.org/grpc/resolver
google.golang.org/grpc/resolver/dns
google.golang.org/grpc/resolver/passthrough
google.golang.org/grpc/serviceconfig
google.golang.org/grpc/stats
-google.golang.org/grpc/status
google.golang.org/grpc/tap
+google.golang.org/grpc/reflection/grpc_reflection_v1alpha
+google.golang.org/grpc/balancer/base
+google.golang.org/grpc/credentials/internal
+google.golang.org/grpc/binarylog/grpc_binarylog_v1
+google.golang.org/grpc/internal/syscall
# gopkg.in/yaml.v2 v2.2.2
gopkg.in/yaml.v2
# gotest.tools v2.2.0+incompatible
gotest.tools/assert
gotest.tools/assert/cmp
-gotest.tools/internal/difflib
gotest.tools/internal/format
gotest.tools/internal/source
+gotest.tools/internal/difflib