From e9567fa8c853dda16c54afbd2ba99b7263fa37f1 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Mon, 30 May 2022 17:18:34 +0200 Subject: binapi: remove internal/testbinapi This patch is a proposal to remove the necessity to version two versions of the generated api. We would rely on `./binapi/` for 'internal' logic, making the dependancy on VPP a bit stronger, but removing a folder and a .json file we don't upgrade regularly. Signed-off-by: Nathan Skrzypczak Change-Id: I99063ed571eb193271b3cda805d692155ac90f61 --- internal/testbinapi/binapi2001/span/span.ba.go | 207 --------------------- internal/testbinapi/binapi2001/span/span_rpc.ba.go | 78 -------- 2 files changed, 285 deletions(-) delete mode 100644 internal/testbinapi/binapi2001/span/span.ba.go delete mode 100644 internal/testbinapi/binapi2001/span/span_rpc.ba.go (limited to 'internal/testbinapi/binapi2001/span') diff --git a/internal/testbinapi/binapi2001/span/span.ba.go b/internal/testbinapi/binapi2001/span/span.ba.go deleted file mode 100644 index f7ef2a3..0000000 --- a/internal/testbinapi/binapi2001/span/span.ba.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.5.0-dev -// VPP: 20.01 -// source: .vppapi/core/span.api.json - -// Package span contains generated bindings for API file span.api. -// -// Contents: -// 4 messages -// -package span - -import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "span" - APIVersion = "1.0.0" - VersionCrc = 0x10769b5 -) - -// SwInterfaceSpanDetails defines message 'sw_interface_span_details'. -type SwInterfaceSpanDetails struct { - SwIfIndexFrom uint32 `binapi:"u32,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` - SwIfIndexTo uint32 `binapi:"u32,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` - State uint8 `binapi:"u8,name=state" json:"state,omitempty"` - IsL2 uint8 `binapi:"u8,name=is_l2" json:"is_l2,omitempty"` -} - -func (m *SwInterfaceSpanDetails) Reset() { *m = SwInterfaceSpanDetails{} } -func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" } -func (*SwInterfaceSpanDetails) GetCrcString() string { return "23966371" } -func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceSpanDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndexFrom - size += 4 // m.SwIfIndexTo - size += 1 // m.State - size += 1 // m.IsL2 - return size -} -func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.SwIfIndexFrom) - buf.EncodeUint32(m.SwIfIndexTo) - buf.EncodeUint8(m.State) - buf.EncodeUint8(m.IsL2) - return buf.Bytes(), nil -} -func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndexFrom = buf.DecodeUint32() - m.SwIfIndexTo = buf.DecodeUint32() - m.State = buf.DecodeUint8() - m.IsL2 = buf.DecodeUint8() - return nil -} - -// SwInterfaceSpanDump defines message 'sw_interface_span_dump'. -type SwInterfaceSpanDump struct { - IsL2 uint8 `binapi:"u8,name=is_l2" json:"is_l2,omitempty"` -} - -func (m *SwInterfaceSpanDump) Reset() { *m = SwInterfaceSpanDump{} } -func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" } -func (*SwInterfaceSpanDump) GetCrcString() string { return "67c54650" } -func (*SwInterfaceSpanDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *SwInterfaceSpanDump) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsL2 - return size -} -func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(m.IsL2) - return buf.Bytes(), nil -} -func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsL2 = buf.DecodeUint8() - return nil -} - -// SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'. -type SwInterfaceSpanEnableDisable struct { - SwIfIndexFrom uint32 `binapi:"u32,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` - SwIfIndexTo uint32 `binapi:"u32,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` - State uint8 `binapi:"u8,name=state" json:"state,omitempty"` - IsL2 uint8 `binapi:"u8,name=is_l2" json:"is_l2,omitempty"` -} - -func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} } -func (*SwInterfaceSpanEnableDisable) GetMessageName() string { - return "sw_interface_span_enable_disable" -} -func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "7216258d" } -func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *SwInterfaceSpanEnableDisable) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndexFrom - size += 4 // m.SwIfIndexTo - size += 1 // m.State - size += 1 // m.IsL2 - return size -} -func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.SwIfIndexFrom) - buf.EncodeUint32(m.SwIfIndexTo) - buf.EncodeUint8(m.State) - buf.EncodeUint8(m.IsL2) - return buf.Bytes(), nil -} -func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndexFrom = buf.DecodeUint32() - m.SwIfIndexTo = buf.DecodeUint32() - m.State = buf.DecodeUint8() - m.IsL2 = buf.DecodeUint8() - return nil -} - -// SwInterfaceSpanEnableDisableReply defines message 'sw_interface_span_enable_disable_reply'. -type SwInterfaceSpanEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSpanEnableDisableReply) Reset() { *m = SwInterfaceSpanEnableDisableReply{} } -func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string { - return "sw_interface_span_enable_disable_reply" -} -func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceSpanEnableDisableReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -func init() { file_span_binapi_init() } -func file_span_binapi_init() { - api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_23966371") - api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_67c54650") - api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_7216258d") - api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*SwInterfaceSpanDetails)(nil), - (*SwInterfaceSpanDump)(nil), - (*SwInterfaceSpanEnableDisable)(nil), - (*SwInterfaceSpanEnableDisableReply)(nil), - } -} diff --git a/internal/testbinapi/binapi2001/span/span_rpc.ba.go b/internal/testbinapi/binapi2001/span/span_rpc.ba.go deleted file mode 100644 index bea9950..0000000 --- a/internal/testbinapi/binapi2001/span/span_rpc.ba.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package span - -import ( - "context" - "fmt" - "io" - - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" -) - -// RPCService defines RPC service span. -type RPCService interface { - SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) - SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_SwInterfaceSpanDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_SwInterfaceSpanDumpClient interface { - Recv() (*SwInterfaceSpanDetails, error) - api.Stream -} - -type serviceClient_SwInterfaceSpanDumpClient struct { - api.Stream -} - -func (c *serviceClient_SwInterfaceSpanDumpClient) Recv() (*SwInterfaceSpanDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *SwInterfaceSpanDetails: - return m, nil - case *vpe.ControlPingReply: - err = c.Stream.Close() - if err != nil { - return nil, err - } - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) { - out := new(SwInterfaceSpanEnableDisableReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} -- cgit