From ef471318d66dd2832df4dc929d312f7cd5f7009a Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Wed, 26 Jun 2019 16:28:20 +0200 Subject: Improvements for binapi-generator and support VPP 19.04 in statsclient - RPC service client implementation for dumps requests now streams responses - RPC service generation is now enabled by default - examples now allow setting binapi socket address - input dir flag for binapi-generator will recursively look into dirs to support core/plugins in /usr/share/vpp/api - minor improvements in debug logs - add support for VPP 19.04 for statsclient Change-Id: I0939ee3aa6e9f850d073fc5c87aff4ccc56b0d70 Signed-off-by: Ondrej Fabry --- examples/binapi/vpe/vpe.ba.go | 116 +++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'examples/binapi/vpe/vpe.ba.go') diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go index c475a70..cff53cd 100644 --- a/examples/binapi/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -1,34 +1,24 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. // source: /usr/share/vpp/api/core/vpe.api.json /* -Package vpe is a generated from VPP binary API module 'vpe'. +Package vpe is a generated VPP binary API for 'vpe' module. - The vpe module consists of: +It consists of: 1 type 18 messages 9 services */ package vpe -import api "git.fd.io/govpp.git/api" -import bytes "bytes" -import context "context" -import strconv "strconv" -import struc "github.com/lunixbochs/struc" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = bytes.NewBuffer -var _ = context.Background -var _ = strconv.Itoa -var _ = struc.Pack - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) const ( // ModuleName is the name of this module. @@ -39,9 +29,7 @@ const ( VersionCrc = 0x2cc8d629 ) -/* Types */ - -// ThreadData represents VPP binary API type 'thread_data': +// ThreadData represents VPP binary API type 'thread_data'. type ThreadData struct { ID uint32 Name []byte `struc:"[64]byte"` @@ -59,9 +47,7 @@ func (*ThreadData) GetCrcString() string { return "0f57094e" } -/* Messages */ - -// AddNodeNext represents VPP binary API message 'add_node_next': +// AddNodeNext represents VPP binary API message 'add_node_next'. type AddNodeNext struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -77,7 +63,7 @@ func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } -// AddNodeNextReply represents VPP binary API message 'add_node_next_reply': +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. type AddNodeNextReply struct { Retval int32 NextIndex uint32 @@ -93,7 +79,7 @@ func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Cli represents VPP binary API message 'cli': +// Cli represents VPP binary API message 'cli'. type Cli struct { CmdInShmem uint64 } @@ -108,7 +94,7 @@ func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInband represents VPP binary API message 'cli_inband': +// CliInband represents VPP binary API message 'cli_inband'. type CliInband struct { XXX_CmdLen uint32 `struc:"sizeof=Cmd"` Cmd string @@ -124,7 +110,7 @@ func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInbandReply represents VPP binary API message 'cli_inband_reply': +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. type CliInbandReply struct { Retval int32 XXX_ReplyLen uint32 `struc:"sizeof=Reply"` @@ -141,7 +127,7 @@ func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CliReply represents VPP binary API message 'cli_reply': +// CliReply represents VPP binary API message 'cli_reply'. type CliReply struct { Retval int32 ReplyInShmem uint64 @@ -157,7 +143,7 @@ func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ControlPing represents VPP binary API message 'control_ping': +// ControlPing represents VPP binary API message 'control_ping'. type ControlPing struct{} func (*ControlPing) GetMessageName() string { @@ -170,7 +156,7 @@ func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// ControlPingReply represents VPP binary API message 'control_ping_reply': +// ControlPingReply represents VPP binary API message 'control_ping_reply'. type ControlPingReply struct { Retval int32 ClientIndex uint32 @@ -187,7 +173,7 @@ func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNextIndex represents VPP binary API message 'get_next_index': +// GetNextIndex represents VPP binary API message 'get_next_index'. type GetNextIndex struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -203,7 +189,7 @@ func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNextIndexReply represents VPP binary API message 'get_next_index_reply': +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. type GetNextIndexReply struct { Retval int32 NextIndex uint32 @@ -219,7 +205,7 @@ func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeGraph represents VPP binary API message 'get_node_graph': +// GetNodeGraph represents VPP binary API message 'get_node_graph'. type GetNodeGraph struct{} func (*GetNodeGraph) GetMessageName() string { @@ -232,7 +218,7 @@ func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply': +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. type GetNodeGraphReply struct { Retval int32 ReplyInShmem uint64 @@ -248,7 +234,7 @@ func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeIndex represents VPP binary API message 'get_node_index': +// GetNodeIndex represents VPP binary API message 'get_node_index'. type GetNodeIndex struct { NodeName []byte `struc:"[64]byte"` } @@ -263,7 +249,7 @@ func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply': +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. type GetNodeIndexReply struct { Retval int32 NodeIndex uint32 @@ -279,7 +265,7 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowThreads represents VPP binary API message 'show_threads': +// ShowThreads represents VPP binary API message 'show_threads'. type ShowThreads struct{} func (*ShowThreads) GetMessageName() string { @@ -292,7 +278,7 @@ func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowThreadsReply represents VPP binary API message 'show_threads_reply': +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. type ShowThreadsReply struct { Retval int32 Count uint32 `struc:"sizeof=ThreadData"` @@ -309,7 +295,7 @@ func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowVersion represents VPP binary API message 'show_version': +// ShowVersion represents VPP binary API message 'show_version'. type ShowVersion struct{} func (*ShowVersion) GetMessageName() string { @@ -322,7 +308,7 @@ func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowVersionReply represents VPP binary API message 'show_version_reply': +// ShowVersionReply represents VPP binary API message 'show_version_reply'. type ShowVersionReply struct { Retval int32 XXX_ProgramLen uint32 `struc:"sizeof=Program"` @@ -390,8 +376,8 @@ func AllMessages() []api.Message { } } -// Service represents VPP binary API services in vpe module. -type Service interface { +// RPCService represents RPC service API for vpe module. +type RPCService interface { AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) Cli(ctx context.Context, in *Cli) (*CliReply, error) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) @@ -403,15 +389,15 @@ type Service interface { ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) } -type service struct { +type serviceClient struct { ch api.Channel } -func NewService(ch api.Channel) Service { - return &service{ch} +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} } -func (c *service) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { out := new(AddNodeNextReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -420,7 +406,7 @@ func (c *service) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNex return out, nil } -func (c *service) Cli(ctx context.Context, in *Cli) (*CliReply, error) { +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { out := new(CliReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -429,7 +415,7 @@ func (c *service) Cli(ctx context.Context, in *Cli) (*CliReply, error) { return out, nil } -func (c *service) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { out := new(CliInbandReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -438,7 +424,7 @@ func (c *service) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply return out, nil } -func (c *service) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { out := new(ControlPingReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -447,7 +433,7 @@ func (c *service) ControlPing(ctx context.Context, in *ControlPing) (*ControlPin return out, nil } -func (c *service) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { out := new(GetNextIndexReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -456,7 +442,7 @@ func (c *service) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextI return out, nil } -func (c *service) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { out := new(GetNodeGraphReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -465,7 +451,7 @@ func (c *service) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeG return out, nil } -func (c *service) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { out := new(GetNodeIndexReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -474,7 +460,7 @@ func (c *service) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeI return out, nil } -func (c *service) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { out := new(ShowThreadsReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -483,7 +469,7 @@ func (c *service) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThread return out, nil } -func (c *service) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { out := new(ShowVersionReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -491,3 +477,17 @@ func (c *service) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersio } return out, nil } + +// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack -- cgit 1.2.3-korg