Add various generator improvements
[govpp.git] / examples / binapi / interfaces / interfaces.ba.go
similarity index 69%
rename from examples/bin_api/interfaces/interfaces.ba.go
rename to examples/binapi/interfaces/interfaces.ba.go
index dfdea00..1f369de 100644 (file)
@@ -1,53 +1,43 @@
 // Code generated by GoVPP binapi-generator. DO NOT EDIT.
-//  source: interface.api.json
+// source: /usr/share/vpp/api/core/interface.api.json
 
 /*
- Package interfaces is a generated from VPP binary API module 'interface'.
+Package interfaces is a generated from VPP binary API module 'interface'.
 
- It contains following objects:
-        25 services
+ The interface module consists of:
          1 alias
         51 messages
+        25 services
 */
 package interfaces
 
 import api "git.fd.io/govpp.git/api"
-import struc "github.com/lunixbochs/struc"
 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 _ = struc.Pack
 var _ = bytes.NewBuffer
+var _ = context.Background
+var _ = strconv.Itoa
+var _ = struc.Pack
 
-// Services represents VPP binary API services:
-type Services interface {
-       DumpSwInterface(*SwInterfaceDump) ([]*SwInterfaceDetails, error)
-       DumpSwInterfaceRxPlacement(*SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error)
-       CollectDetailedInterfaceStats(*CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error)
-       CreateLoopback(*CreateLoopback) (*CreateLoopbackReply, error)
-       CreateLoopbackInstance(*CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error)
-       CreateSubif(*CreateSubif) (*CreateSubifReply, error)
-       CreateVlanSubif(*CreateVlanSubif) (*CreateVlanSubifReply, error)
-       DeleteLoopback(*DeleteLoopback) (*DeleteLoopbackReply, error)
-       DeleteSubif(*DeleteSubif) (*DeleteSubifReply, error)
-       HwInterfaceSetMtu(*HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error)
-       InterfaceNameRenumber(*InterfaceNameRenumber) (*InterfaceNameRenumberReply, error)
-       SwInterfaceAddDelAddress(*SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error)
-       SwInterfaceClearStats(*SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error)
-       SwInterfaceGetMacAddress(*SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error)
-       SwInterfaceGetTable(*SwInterfaceGetTable) (*SwInterfaceGetTableReply, error)
-       SwInterfaceSetFlags(*SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error)
-       SwInterfaceSetIPDirectedBroadcast(*SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error)
-       SwInterfaceSetMacAddress(*SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error)
-       SwInterfaceSetMtu(*SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error)
-       SwInterfaceSetRxMode(*SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error)
-       SwInterfaceSetRxPlacement(*SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error)
-       SwInterfaceSetTable(*SwInterfaceSetTable) (*SwInterfaceSetTableReply, error)
-       SwInterfaceSetUnnumbered(*SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error)
-       SwInterfaceTagAddDel(*SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error)
-       WantInterfaceEvents(*WantInterfaceEvents) (*WantInterfaceEventsReply, error)
-}
+// 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
+
+const (
+       // ModuleName is the name of this module.
+       ModuleName = "interface"
+       // APIVersion is the API version of this module.
+       APIVersion = "2.2.0"
+       // VersionCrc is the CRC of this module.
+       VersionCrc = 0x672de521
+)
 
 /* Aliases */
 
@@ -959,56 +949,337 @@ func init() {
        api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply")
 }
 
-var Messages = []api.Message{
-       (*CollectDetailedInterfaceStats)(nil),
-       (*CollectDetailedInterfaceStatsReply)(nil),
-       (*CreateLoopback)(nil),
-       (*CreateLoopbackInstance)(nil),
-       (*CreateLoopbackInstanceReply)(nil),
-       (*CreateLoopbackReply)(nil),
-       (*CreateSubif)(nil),
-       (*CreateSubifReply)(nil),
-       (*CreateVlanSubif)(nil),
-       (*CreateVlanSubifReply)(nil),
-       (*DeleteLoopback)(nil),
-       (*DeleteLoopbackReply)(nil),
-       (*DeleteSubif)(nil),
-       (*DeleteSubifReply)(nil),
-       (*HwInterfaceSetMtu)(nil),
-       (*HwInterfaceSetMtuReply)(nil),
-       (*InterfaceNameRenumber)(nil),
-       (*InterfaceNameRenumberReply)(nil),
-       (*SwInterfaceAddDelAddress)(nil),
-       (*SwInterfaceAddDelAddressReply)(nil),
-       (*SwInterfaceClearStats)(nil),
-       (*SwInterfaceClearStatsReply)(nil),
-       (*SwInterfaceDetails)(nil),
-       (*SwInterfaceDump)(nil),
-       (*SwInterfaceEvent)(nil),
-       (*SwInterfaceGetMacAddress)(nil),
-       (*SwInterfaceGetMacAddressReply)(nil),
-       (*SwInterfaceGetTable)(nil),
-       (*SwInterfaceGetTableReply)(nil),
-       (*SwInterfaceRxPlacementDetails)(nil),
-       (*SwInterfaceRxPlacementDump)(nil),
-       (*SwInterfaceSetFlags)(nil),
-       (*SwInterfaceSetFlagsReply)(nil),
-       (*SwInterfaceSetIPDirectedBroadcast)(nil),
-       (*SwInterfaceSetIPDirectedBroadcastReply)(nil),
-       (*SwInterfaceSetMacAddress)(nil),
-       (*SwInterfaceSetMacAddressReply)(nil),
-       (*SwInterfaceSetMtu)(nil),
-       (*SwInterfaceSetMtuReply)(nil),
-       (*SwInterfaceSetRxMode)(nil),
-       (*SwInterfaceSetRxModeReply)(nil),
-       (*SwInterfaceSetRxPlacement)(nil),
-       (*SwInterfaceSetRxPlacementReply)(nil),
-       (*SwInterfaceSetTable)(nil),
-       (*SwInterfaceSetTableReply)(nil),
-       (*SwInterfaceSetUnnumbered)(nil),
-       (*SwInterfaceSetUnnumberedReply)(nil),
-       (*SwInterfaceTagAddDel)(nil),
-       (*SwInterfaceTagAddDelReply)(nil),
-       (*WantInterfaceEvents)(nil),
-       (*WantInterfaceEventsReply)(nil),
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+       return []api.Message{
+               (*CollectDetailedInterfaceStats)(nil),
+               (*CollectDetailedInterfaceStatsReply)(nil),
+               (*CreateLoopback)(nil),
+               (*CreateLoopbackInstance)(nil),
+               (*CreateLoopbackInstanceReply)(nil),
+               (*CreateLoopbackReply)(nil),
+               (*CreateSubif)(nil),
+               (*CreateSubifReply)(nil),
+               (*CreateVlanSubif)(nil),
+               (*CreateVlanSubifReply)(nil),
+               (*DeleteLoopback)(nil),
+               (*DeleteLoopbackReply)(nil),
+               (*DeleteSubif)(nil),
+               (*DeleteSubifReply)(nil),
+               (*HwInterfaceSetMtu)(nil),
+               (*HwInterfaceSetMtuReply)(nil),
+               (*InterfaceNameRenumber)(nil),
+               (*InterfaceNameRenumberReply)(nil),
+               (*SwInterfaceAddDelAddress)(nil),
+               (*SwInterfaceAddDelAddressReply)(nil),
+               (*SwInterfaceClearStats)(nil),
+               (*SwInterfaceClearStatsReply)(nil),
+               (*SwInterfaceDetails)(nil),
+               (*SwInterfaceDump)(nil),
+               (*SwInterfaceEvent)(nil),
+               (*SwInterfaceGetMacAddress)(nil),
+               (*SwInterfaceGetMacAddressReply)(nil),
+               (*SwInterfaceGetTable)(nil),
+               (*SwInterfaceGetTableReply)(nil),
+               (*SwInterfaceRxPlacementDetails)(nil),
+               (*SwInterfaceRxPlacementDump)(nil),
+               (*SwInterfaceSetFlags)(nil),
+               (*SwInterfaceSetFlagsReply)(nil),
+               (*SwInterfaceSetIPDirectedBroadcast)(nil),
+               (*SwInterfaceSetIPDirectedBroadcastReply)(nil),
+               (*SwInterfaceSetMacAddress)(nil),
+               (*SwInterfaceSetMacAddressReply)(nil),
+               (*SwInterfaceSetMtu)(nil),
+               (*SwInterfaceSetMtuReply)(nil),
+               (*SwInterfaceSetRxMode)(nil),
+               (*SwInterfaceSetRxModeReply)(nil),
+               (*SwInterfaceSetRxPlacement)(nil),
+               (*SwInterfaceSetRxPlacementReply)(nil),
+               (*SwInterfaceSetTable)(nil),
+               (*SwInterfaceSetTableReply)(nil),
+               (*SwInterfaceSetUnnumbered)(nil),
+               (*SwInterfaceSetUnnumberedReply)(nil),
+               (*SwInterfaceTagAddDel)(nil),
+               (*SwInterfaceTagAddDelReply)(nil),
+               (*WantInterfaceEvents)(nil),
+               (*WantInterfaceEventsReply)(nil),
+       }
+}
+
+// Service represents services in VPP binary API.
+type Service interface {
+       DumpSwInterface(ctx context.Context, in *SwInterfaceDump) ([]*SwInterfaceDetails, error)
+       DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error)
+       CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error)
+       CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error)
+       CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error)
+       CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error)
+       CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error)
+       DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error)
+       DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error)
+       HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error)
+       InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error)
+       SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error)
+       SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error)
+       SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error)
+       SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error)
+       SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error)
+       SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error)
+       SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error)
+       SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error)
+       SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error)
+       SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error)
+       SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error)
+       SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error)
+       SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error)
+       WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error)
+}
+
+type service struct {
+       ch api.Channel
+}
+
+func NewService(ch api.Channel) Service {
+       return &service{ch}
+}
+
+func (c *service) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) ([]*SwInterfaceDetails, error) {
+       var dump []*SwInterfaceDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(SwInterfaceDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) {
+       var dump []*SwInterfaceRxPlacementDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(SwInterfaceRxPlacementDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) {
+       out := new(CollectDetailedInterfaceStatsReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) {
+       out := new(CreateLoopbackReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) {
+       out := new(CreateLoopbackInstanceReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) {
+       out := new(CreateSubifReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) {
+       out := new(CreateVlanSubifReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) {
+       out := new(DeleteLoopbackReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) {
+       out := new(DeleteSubifReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) {
+       out := new(HwInterfaceSetMtuReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) {
+       out := new(InterfaceNameRenumberReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) {
+       out := new(SwInterfaceAddDelAddressReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) {
+       out := new(SwInterfaceClearStatsReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) {
+       out := new(SwInterfaceGetMacAddressReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) {
+       out := new(SwInterfaceGetTableReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) {
+       out := new(SwInterfaceSetFlagsReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) {
+       out := new(SwInterfaceSetIPDirectedBroadcastReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) {
+       out := new(SwInterfaceSetMacAddressReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) {
+       out := new(SwInterfaceSetMtuReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) {
+       out := new(SwInterfaceSetRxModeReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) {
+       out := new(SwInterfaceSetRxPlacementReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) {
+       out := new(SwInterfaceSetTableReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) {
+       out := new(SwInterfaceSetUnnumberedReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) {
+       out := new(SwInterfaceTagAddDelReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) {
+       out := new(WantInterfaceEventsReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
 }