diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/vpe')
-rw-r--r-- | internal/testbinapi/binapi2001/vpe/vpe.ba.go | 37 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go | 33 |
2 files changed, 54 insertions, 16 deletions
diff --git a/internal/testbinapi/binapi2001/vpe/vpe.ba.go b/internal/testbinapi/binapi2001/vpe/vpe.ba.go index f970104..34842fb 100644 --- a/internal/testbinapi/binapi2001/vpe/vpe.ba.go +++ b/internal/testbinapi/binapi2001/vpe/vpe.ba.go @@ -1,6 +1,6 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev +// binapi-generator: v0.5.0-dev // VPP: 20.01 // source: .vppapi/core/vpe.api.json @@ -15,9 +15,11 @@ package vpe import ( + "strconv" + "time" + api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" - "strconv" ) // This is a compile-time assertion to ensure that this generated file @@ -86,6 +88,37 @@ type Timedelta float64 // Timestamp defines alias 'timestamp'. type Timestamp float64 +func NewTimestamp(t time.Time) Timestamp { + sec := int64(t.Unix()) + nsec := int32(t.Nanosecond()) + ns := float64(sec) + float64(nsec/1e9) + return Timestamp(ns) +} + +func (x Timestamp) ToTime() time.Time { + ns := int64(x * 1e9) + sec := ns / 1e9 + nsec := ns % 1e9 + return time.Unix(sec, nsec) +} + +func (x Timestamp) String() string { + return x.ToTime().String() +} + +func (x *Timestamp) MarshalText() ([]byte, error) { + return []byte(x.ToTime().Format(time.RFC3339Nano)), nil +} + +func (x *Timestamp) UnmarshalText(text []byte) error { + t, err := time.Parse(time.RFC3339Nano, string(text)) + if err != nil { + return err + } + *x = NewTimestamp(t) + return nil +} + // ThreadData defines type 'thread_data'. type ThreadData struct { ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` diff --git a/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go b/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go index dfa669f..557a397 100644 --- a/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go +++ b/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go @@ -5,11 +5,12 @@ package vpe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" "io" + + api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service vpe. +// RPCService defines RPC service vpe. type RPCService interface { AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) Cli(ctx context.Context, in *Cli) (*CliReply, error) @@ -40,7 +41,7 @@ func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { @@ -49,7 +50,7 @@ func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { @@ -58,7 +59,7 @@ func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInban if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { @@ -67,7 +68,7 @@ func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*Cont if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { @@ -76,7 +77,7 @@ func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(int32(out.Retval)) } func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { @@ -85,7 +86,7 @@ func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64Incr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(int32(out.Retval)) } func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { @@ -94,7 +95,7 @@ func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { @@ -103,7 +104,7 @@ func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { @@ -112,7 +113,7 @@ func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) { @@ -148,6 +149,10 @@ func (c *serviceClient_LogDumpClient) Recv() (*LogDetails, error) { case *LogDetails: return m, nil case *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) @@ -160,7 +165,7 @@ func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { @@ -169,7 +174,7 @@ func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { @@ -178,5 +183,5 @@ func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystem if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } |