aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-02-08 08:38:56 +0100
committerOndrej Fabry <ofabry@cisco.com>2019-02-08 10:04:56 +0100
commitdf05a70f90a1486a86a4156b1b0d68c94f2098b4 (patch)
tree45577756efc2ec766430ed17daa9ddcf9c5709b2
parentfa21c9d726ebb807895a8571af9a16dab5cd8d6e (diff)
Add support for using multiple generated versions
- added CheckCompatibility for checking if given messages are compatible - generating Messages global for easier usage of compatibility check - added ReconnectInterval and MaxReconnectAttempts for reconnecting - added Failed state that is sent after exceeding max reconnect attempts Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
-rw-r--r--api/api.go10
-rw-r--r--cmd/binapi-generator/generate.go8
-rw-r--r--core/channel.go10
-rw-r--r--core/connection.go166
-rw-r--r--core/control_ping.go15
-rw-r--r--core/request_handler.go2
-rw-r--r--examples/bin_api/acl/acl.ba.go39
-rw-r--r--examples/bin_api/af_packet/af_packet.ba.go11
-rw-r--r--examples/bin_api/interfaces/interfaces.ba.go54
-rw-r--r--examples/bin_api/ip/ip.ba.go94
-rw-r--r--examples/bin_api/maps/maps.ba.go35
-rw-r--r--examples/bin_api/memif/memif.ba.go13
-rw-r--r--examples/bin_api/tap/tap.ba.go11
-rw-r--r--examples/bin_api/vpe/vpe.ba.go21
-rw-r--r--examples/simple-client/simple_client.go10
15 files changed, 411 insertions, 88 deletions
diff --git a/api/api.go b/api/api.go
index 3e4eb0b..ac9f8a4 100644
--- a/api/api.go
+++ b/api/api.go
@@ -15,7 +15,6 @@
package api
import (
- "fmt"
"time"
)
@@ -89,6 +88,10 @@ type Channel interface {
// from VPP before returning an error.
SetReplyTimeout(timeout time.Duration)
+ // CheckCompatibility checks the compatiblity for the given messages.
+ // It will return an error if any of the given messages are not compatible.
+ CheckCompatiblity(msgs ...Message) error
+
// Close closes the API channel and releases all API channel-related resources in the ChannelProvider.
Close()
}
@@ -119,9 +122,10 @@ var registeredMessages = make(map[string]Message)
// RegisterMessage is called from generated code to register message.
func RegisterMessage(x Message, name string) {
- if _, ok := registeredMessages[name]; ok {
+ name = x.GetMessageName() + "_" + x.GetCrcString()
+ /*if _, ok := registeredMessages[name]; ok {
panic(fmt.Errorf("govpp: duplicate message registered: %s (%s)", name, x.GetCrcString()))
- }
+ }*/
registeredMessages[name] = x
}
diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go
index f2da08a..f22a035 100644
--- a/cmd/binapi-generator/generate.go
+++ b/cmd/binapi-generator/generate.go
@@ -152,6 +152,14 @@ func generatePackage(ctx *context, w *bufio.Writer) error {
fmt.Fprintf(w, "\tapi.RegisterMessage((*%s)(nil), \"%s\")\n", name, ctx.moduleName+"."+name)
}
fmt.Fprintln(w, "}")
+ fmt.Fprintln(w)
+
+ fmt.Fprintln(w, "var Messages = []api.Message{")
+ for _, msg := range ctx.packageData.Messages {
+ name := camelCaseName(msg.Name)
+ fmt.Fprintf(w, "\t(*%s)(nil),\n", name)
+ }
+ fmt.Fprintln(w, "}")
}
// flush the data:
diff --git a/core/channel.go b/core/channel.go
index 5b69eab..bf27b73 100644
--- a/core/channel.go
+++ b/core/channel.go
@@ -142,10 +142,14 @@ func (ch *Channel) SendMultiRequest(msg api.Message) api.MultiRequestCtx {
return &multiRequestCtx{ch: ch, seqNum: seqNum}
}
-func getMsgFactory(msg api.Message) func() api.Message {
- return func() api.Message {
- return reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
+func (ch *Channel) CheckCompatiblity(msgs ...api.Message) error {
+ for _, msg := range msgs {
+ _, err := ch.msgIdentifier.GetMessageID(msg)
+ if err != nil {
+ return err
+ }
}
+ return nil
}
func (ch *Channel) SubscribeNotification(notifChan chan api.Message, event api.Message) (api.SubscriptionCtx, error) {
diff --git a/core/connection.go b/core/connection.go
index 08f08f5..14b0af4 100644
--- a/core/connection.go
+++ b/core/connection.go
@@ -40,6 +40,8 @@ var (
HealthCheckReplyTimeout = time.Millisecond * 100 // timeout for reply to a health check probe
HealthCheckThreshold = 1 // number of failed health checks until the error is reported
DefaultReplyTimeout = time.Second * 1 // default timeout for replies from VPP
+ ReconnectInterval = time.Second * 1 // default interval for reconnect attempts
+ MaxReconnectAttempts = 10 // maximum number of reconnect attempts
)
// ConnectionState represents the current state of the connection to VPP.
@@ -51,6 +53,9 @@ const (
// Disconnected represents state in which the connection has been dropped.
Disconnected
+
+ // Failed represents state in which the reconnecting failed after exceeding maximum number of attempts.
+ Failed
)
// ConnectionEvent is a notification about change in the VPP connection state.
@@ -213,88 +218,11 @@ func (c *Connection) releaseAPIChannel(ch *Channel) {
c.channelsLock.Unlock()
}
-// GetMessageID returns message identifier of given API message.
-func (c *Connection) GetMessageID(msg api.Message) (uint16, error) {
- if c == nil {
- return 0, errors.New("nil connection passed in")
- }
-
- if msgID, ok := c.msgIDs[getMsgNameWithCrc(msg)]; ok {
- return msgID, nil
- }
-
- return 0, fmt.Errorf("unknown message: %s (%s)", msg.GetMessageName(), msg.GetCrcString())
-}
-
-// LookupByID looks up message name and crc by ID.
-func (c *Connection) LookupByID(msgID uint16) (api.Message, error) {
- if c == nil {
- return nil, errors.New("nil connection passed in")
- }
-
- if msg, ok := c.msgMap[msgID]; ok {
- return msg, nil
- }
-
- return nil, fmt.Errorf("unknown message ID: %d", msgID)
-}
-
-// retrieveMessageIDs retrieves IDs for all registered messages and stores them in map
-func (c *Connection) retrieveMessageIDs() (err error) {
- t := time.Now()
-
- var addMsg = func(msgID uint16, msg api.Message) {
- c.msgIDs[getMsgNameWithCrc(msg)] = msgID
- c.msgMap[msgID] = msg
- }
-
- msgs := api.GetRegisteredMessages()
-
- for name, msg := range msgs {
- msgID, err := c.vppClient.GetMsgID(msg.GetMessageName(), msg.GetCrcString())
- if err != nil {
- return err
- }
-
- addMsg(msgID, msg)
-
- if msg.GetMessageName() == msgControlPing.GetMessageName() {
- c.pingReqID = msgID
- msgControlPing = reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
- } else if msg.GetMessageName() == msgControlPingReply.GetMessageName() {
- c.pingReplyID = msgID
- msgControlPingReply = reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
- }
-
- if debugMsgIDs {
- log.Debugf("message %q (%s) has ID: %d", name, getMsgNameWithCrc(msg), msgID)
- }
- }
-
- log.Debugf("retrieving %d message IDs took %s", len(msgs), time.Since(t))
-
- // fallback for control ping when vpe package is not imported
- if c.pingReqID == 0 {
- c.pingReqID, err = c.vppClient.GetMsgID(msgControlPing.GetMessageName(), msgControlPing.GetCrcString())
- if err != nil {
- return err
- }
- addMsg(c.pingReqID, msgControlPing)
- }
- if c.pingReplyID == 0 {
- c.pingReplyID, err = c.vppClient.GetMsgID(msgControlPingReply.GetMessageName(), msgControlPingReply.GetCrcString())
- if err != nil {
- return err
- }
- addMsg(c.pingReplyID, msgControlPingReply)
- }
-
- return nil
-}
-
// connectLoop attempts to connect to VPP until it succeeds.
// Then it continues with healthCheckLoop.
func (c *Connection) connectLoop(connChan chan ConnectionEvent) {
+ reconnectAttempts := 0
+
// loop until connected
for {
if err := c.vppClient.WaitReady(); err != nil {
@@ -304,9 +232,13 @@ func (c *Connection) connectLoop(connChan chan ConnectionEvent) {
// signal connected event
connChan <- ConnectionEvent{Timestamp: time.Now(), State: Connected}
break
+ } else if reconnectAttempts < MaxReconnectAttempts {
+ reconnectAttempts++
+ log.Errorf("connecting failed (attempt %d/%d): %v", reconnectAttempts, MaxReconnectAttempts, err)
+ time.Sleep(ReconnectInterval)
} else {
- log.Errorf("connecting to VPP failed: %v", err)
- time.Sleep(time.Second)
+ connChan <- ConnectionEvent{Timestamp: time.Now(), State: Failed, Error: err}
+ return
}
}
@@ -405,3 +337,75 @@ func (c *Connection) healthCheckLoop(connChan chan ConnectionEvent) {
func getMsgNameWithCrc(x api.Message) string {
return x.GetMessageName() + "_" + x.GetCrcString()
}
+
+func getMsgFactory(msg api.Message) func() api.Message {
+ return func() api.Message {
+ return reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
+ }
+}
+
+// GetMessageID returns message identifier of given API message.
+func (c *Connection) GetMessageID(msg api.Message) (uint16, error) {
+ if c == nil {
+ return 0, errors.New("nil connection passed in")
+ }
+
+ if msgID, ok := c.msgIDs[getMsgNameWithCrc(msg)]; ok {
+ return msgID, nil
+ }
+
+ msgID, err := c.vppClient.GetMsgID(msg.GetMessageName(), msg.GetCrcString())
+ if err != nil {
+ return 0, err
+ }
+
+ c.msgIDs[getMsgNameWithCrc(msg)] = msgID
+ c.msgMap[msgID] = msg
+
+ return msgID, nil
+}
+
+// LookupByID looks up message name and crc by ID.
+func (c *Connection) LookupByID(msgID uint16) (api.Message, error) {
+ if c == nil {
+ return nil, errors.New("nil connection passed in")
+ }
+
+ if msg, ok := c.msgMap[msgID]; ok {
+ return msg, nil
+ }
+
+ return nil, fmt.Errorf("unknown message ID: %d", msgID)
+}
+
+// retrieveMessageIDs retrieves IDs for all registered messages and stores them in map
+func (c *Connection) retrieveMessageIDs() (err error) {
+ t := time.Now()
+
+ msgs := api.GetRegisteredMessages()
+
+ var n int
+ for name, msg := range msgs {
+ msgID, err := c.GetMessageID(msg)
+ if err != nil {
+ log.Debugf("retrieving msgID for %s failed: %v", name, err)
+ continue
+ }
+ n++
+
+ if c.pingReqID == 0 && msg.GetMessageName() == msgControlPing.GetMessageName() {
+ c.pingReqID = msgID
+ msgControlPing = reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
+ } else if c.pingReplyID == 0 && msg.GetMessageName() == msgControlPingReply.GetMessageName() {
+ c.pingReplyID = msgID
+ msgControlPingReply = reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message)
+ }
+
+ if debugMsgIDs {
+ log.Debugf("message %q (%s) has ID: %d", name, getMsgNameWithCrc(msg), msgID)
+ }
+ }
+ log.Debugf("retrieved %d/%d msgIDs (took %s)", n, len(msgs), time.Since(t))
+
+ return nil
+}
diff --git a/core/control_ping.go b/core/control_ping.go
index 904068a..cd447b7 100644
--- a/core/control_ping.go
+++ b/core/control_ping.go
@@ -7,6 +7,16 @@ var (
msgControlPingReply api.Message = new(ControlPingReply)
)
+// SetControlPing sets the control ping message used by core.
+func SetControlPing(m api.Message) {
+ msgControlPing = m
+}
+
+// SetControlPingReply sets the control ping reply message used by core.
+func SetControlPingReply(m api.Message) {
+ msgControlPingReply = m
+}
+
type ControlPing struct{}
func (*ControlPing) GetMessageName() string {
@@ -34,3 +44,8 @@ func (*ControlPingReply) GetCrcString() string {
func (*ControlPingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
+
+func init() {
+ api.RegisterMessage((*ControlPing)(nil), "ControlPing")
+ api.RegisterMessage((*ControlPingReply)(nil), "ControlPingReply")
+}
diff --git a/core/request_handler.go b/core/request_handler.go
index 4004d15..dc90747 100644
--- a/core/request_handler.go
+++ b/core/request_handler.go
@@ -91,6 +91,7 @@ func (c *Connection) processRequest(ch *Channel, req *vppRequest) error {
"msg_name": req.msg.GetMessageName(),
"msg_size": len(data),
"seq_num": req.seqNum,
+ "msg_crc": req.msg.GetCrcString(),
}).Debug(" -> Sending a message to VPP.")
}
@@ -163,6 +164,7 @@ func (c *Connection) msgCallback(msgID uint16, data []byte) {
"channel": chanID,
"is_multi": isMulti,
"seq_num": seqNum,
+ "msg_crc": msg.GetCrcString(),
}).Debug(" <- Received a message from VPP.")
}
diff --git a/examples/bin_api/acl/acl.ba.go b/examples/bin_api/acl/acl.ba.go
index b37fd76..54fe26d 100644
--- a/examples/bin_api/acl/acl.ba.go
+++ b/examples/bin_api/acl/acl.ba.go
@@ -697,3 +697,42 @@ func init() {
api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails")
api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump")
}
+
+var Messages = []api.Message{
+ (*ACLAddReplace)(nil),
+ (*ACLAddReplaceReply)(nil),
+ (*ACLDel)(nil),
+ (*ACLDelReply)(nil),
+ (*ACLDetails)(nil),
+ (*ACLDump)(nil),
+ (*ACLInterfaceAddDel)(nil),
+ (*ACLInterfaceAddDelReply)(nil),
+ (*ACLInterfaceEtypeWhitelistDetails)(nil),
+ (*ACLInterfaceEtypeWhitelistDump)(nil),
+ (*ACLInterfaceListDetails)(nil),
+ (*ACLInterfaceListDump)(nil),
+ (*ACLInterfaceSetACLList)(nil),
+ (*ACLInterfaceSetACLListReply)(nil),
+ (*ACLInterfaceSetEtypeWhitelist)(nil),
+ (*ACLInterfaceSetEtypeWhitelistReply)(nil),
+ (*ACLPluginControlPing)(nil),
+ (*ACLPluginControlPingReply)(nil),
+ (*ACLPluginGetConnTableMaxEntries)(nil),
+ (*ACLPluginGetConnTableMaxEntriesReply)(nil),
+ (*ACLPluginGetVersion)(nil),
+ (*ACLPluginGetVersionReply)(nil),
+ (*MacipACLAdd)(nil),
+ (*MacipACLAddReplace)(nil),
+ (*MacipACLAddReplaceReply)(nil),
+ (*MacipACLAddReply)(nil),
+ (*MacipACLDel)(nil),
+ (*MacipACLDelReply)(nil),
+ (*MacipACLDetails)(nil),
+ (*MacipACLDump)(nil),
+ (*MacipACLInterfaceAddDel)(nil),
+ (*MacipACLInterfaceAddDelReply)(nil),
+ (*MacipACLInterfaceGet)(nil),
+ (*MacipACLInterfaceGetReply)(nil),
+ (*MacipACLInterfaceListDetails)(nil),
+ (*MacipACLInterfaceListDump)(nil),
+}
diff --git a/examples/bin_api/af_packet/af_packet.ba.go b/examples/bin_api/af_packet/af_packet.ba.go
index 5177b7d..5197a5b 100644
--- a/examples/bin_api/af_packet/af_packet.ba.go
+++ b/examples/bin_api/af_packet/af_packet.ba.go
@@ -162,3 +162,14 @@ func init() {
api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload")
api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply")
}
+
+var Messages = []api.Message{
+ (*AfPacketCreate)(nil),
+ (*AfPacketCreateReply)(nil),
+ (*AfPacketDelete)(nil),
+ (*AfPacketDeleteReply)(nil),
+ (*AfPacketDetails)(nil),
+ (*AfPacketDump)(nil),
+ (*AfPacketSetL4CksumOffload)(nil),
+ (*AfPacketSetL4CksumOffloadReply)(nil),
+}
diff --git a/examples/bin_api/interfaces/interfaces.ba.go b/examples/bin_api/interfaces/interfaces.ba.go
index 5f949df..dfdea00 100644
--- a/examples/bin_api/interfaces/interfaces.ba.go
+++ b/examples/bin_api/interfaces/interfaces.ba.go
@@ -958,3 +958,57 @@ func init() {
api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents")
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),
+}
diff --git a/examples/bin_api/ip/ip.ba.go b/examples/bin_api/ip/ip.ba.go
index bedb5c9..b566608 100644
--- a/examples/bin_api/ip/ip.ba.go
+++ b/examples/bin_api/ip/ip.ba.go
@@ -1959,3 +1959,97 @@ func init() {
api.RegisterMessage((*WantIP6RaEvents)(nil), "ip.WantIP6RaEvents")
api.RegisterMessage((*WantIP6RaEventsReply)(nil), "ip.WantIP6RaEventsReply")
}
+
+var Messages = []api.Message{
+ (*IoamDisable)(nil),
+ (*IoamDisableReply)(nil),
+ (*IoamEnable)(nil),
+ (*IoamEnableReply)(nil),
+ (*IP4ArpEvent)(nil),
+ (*IP6FibDetails)(nil),
+ (*IP6FibDump)(nil),
+ (*IP6MfibDetails)(nil),
+ (*IP6MfibDump)(nil),
+ (*IP6NdEvent)(nil),
+ (*IP6RaEvent)(nil),
+ (*IP6ndProxyAddDel)(nil),
+ (*IP6ndProxyAddDelReply)(nil),
+ (*IP6ndProxyDetails)(nil),
+ (*IP6ndProxyDump)(nil),
+ (*IP6ndSendRouterSolicitation)(nil),
+ (*IP6ndSendRouterSolicitationReply)(nil),
+ (*IPAddDelRoute)(nil),
+ (*IPAddDelRouteReply)(nil),
+ (*IPAddressDetails)(nil),
+ (*IPAddressDump)(nil),
+ (*IPContainerProxyAddDel)(nil),
+ (*IPContainerProxyAddDelReply)(nil),
+ (*IPContainerProxyDetails)(nil),
+ (*IPContainerProxyDump)(nil),
+ (*IPDetails)(nil),
+ (*IPDump)(nil),
+ (*IPFibDetails)(nil),
+ (*IPFibDump)(nil),
+ (*IPMfibDetails)(nil),
+ (*IPMfibDump)(nil),
+ (*IPMrouteAddDel)(nil),
+ (*IPMrouteAddDelReply)(nil),
+ (*IPNeighborAddDel)(nil),
+ (*IPNeighborAddDelReply)(nil),
+ (*IPNeighborDetails)(nil),
+ (*IPNeighborDump)(nil),
+ (*IPProbeNeighbor)(nil),
+ (*IPProbeNeighborReply)(nil),
+ (*IPPuntPolice)(nil),
+ (*IPPuntPoliceReply)(nil),
+ (*IPPuntRedirect)(nil),
+ (*IPPuntRedirectDetails)(nil),
+ (*IPPuntRedirectDump)(nil),
+ (*IPPuntRedirectReply)(nil),
+ (*IPReassemblyEnableDisable)(nil),
+ (*IPReassemblyEnableDisableReply)(nil),
+ (*IPReassemblyGet)(nil),
+ (*IPReassemblyGetReply)(nil),
+ (*IPReassemblySet)(nil),
+ (*IPReassemblySetReply)(nil),
+ (*IPScanNeighborEnableDisable)(nil),
+ (*IPScanNeighborEnableDisableReply)(nil),
+ (*IPSourceAndPortRangeCheckAddDel)(nil),
+ (*IPSourceAndPortRangeCheckAddDelReply)(nil),
+ (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil),
+ (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil),
+ (*IPSourceCheckInterfaceAddDel)(nil),
+ (*IPSourceCheckInterfaceAddDelReply)(nil),
+ (*IPTableAddDel)(nil),
+ (*IPTableAddDelReply)(nil),
+ (*IPUnnumberedDetails)(nil),
+ (*IPUnnumberedDump)(nil),
+ (*MfibSignalDetails)(nil),
+ (*MfibSignalDump)(nil),
+ (*ProxyArpAddDel)(nil),
+ (*ProxyArpAddDelReply)(nil),
+ (*ProxyArpDetails)(nil),
+ (*ProxyArpDump)(nil),
+ (*ProxyArpIntfcDetails)(nil),
+ (*ProxyArpIntfcDump)(nil),
+ (*ProxyArpIntfcEnableDisable)(nil),
+ (*ProxyArpIntfcEnableDisableReply)(nil),
+ (*ResetFib)(nil),
+ (*ResetFibReply)(nil),
+ (*SetArpNeighborLimit)(nil),
+ (*SetArpNeighborLimitReply)(nil),
+ (*SetIPFlowHash)(nil),
+ (*SetIPFlowHashReply)(nil),
+ (*SwInterfaceIP6EnableDisable)(nil),
+ (*SwInterfaceIP6EnableDisableReply)(nil),
+ (*SwInterfaceIP6ndRaConfig)(nil),
+ (*SwInterfaceIP6ndRaConfigReply)(nil),
+ (*SwInterfaceIP6ndRaPrefix)(nil),
+ (*SwInterfaceIP6ndRaPrefixReply)(nil),
+ (*WantIP4ArpEvents)(nil),
+ (*WantIP4ArpEventsReply)(nil),
+ (*WantIP6NdEvents)(nil),
+ (*WantIP6NdEventsReply)(nil),
+ (*WantIP6RaEvents)(nil),
+ (*WantIP6RaEventsReply)(nil),
+}
diff --git a/examples/bin_api/maps/maps.ba.go b/examples/bin_api/maps/maps.ba.go
index e4fea90..366b822 100644
--- a/examples/bin_api/maps/maps.ba.go
+++ b/examples/bin_api/maps/maps.ba.go
@@ -741,3 +741,38 @@ func init() {
api.RegisterMessage((*MapSummaryStats)(nil), "map.MapSummaryStats")
api.RegisterMessage((*MapSummaryStatsReply)(nil), "map.MapSummaryStatsReply")
}
+
+var Messages = []api.Message{
+ (*MapAddDelRule)(nil),
+ (*MapAddDelRuleReply)(nil),
+ (*MapAddDomain)(nil),
+ (*MapAddDomainReply)(nil),
+ (*MapDelDomain)(nil),
+ (*MapDelDomainReply)(nil),
+ (*MapDomainDetails)(nil),
+ (*MapDomainDump)(nil),
+ (*MapIfEnableDisable)(nil),
+ (*MapIfEnableDisableReply)(nil),
+ (*MapParamAddDelPreResolve)(nil),
+ (*MapParamAddDelPreResolveReply)(nil),
+ (*MapParamGet)(nil),
+ (*MapParamGetReply)(nil),
+ (*MapParamSetFragmentation)(nil),
+ (*MapParamSetFragmentationReply)(nil),
+ (*MapParamSetICMP)(nil),
+ (*MapParamSetICMP6)(nil),
+ (*MapParamSetICMP6Reply)(nil),
+ (*MapParamSetICMPReply)(nil),
+ (*MapParamSetReassembly)(nil),
+ (*MapParamSetReassemblyReply)(nil),
+ (*MapParamSetSecurityCheck)(nil),
+ (*MapParamSetSecurityCheckReply)(nil),
+ (*MapParamSetTCP)(nil),
+ (*MapParamSetTCPReply)(nil),
+ (*MapParamSetTrafficClass)(nil),
+ (*MapParamSetTrafficClassReply)(nil),
+ (*MapRuleDetails)(nil),
+ (*MapRuleDump)(nil),
+ (*MapSummaryStats)(nil),
+ (*MapSummaryStatsReply)(nil),
+}
diff --git a/examples/bin_api/memif/memif.ba.go b/examples/bin_api/memif/memif.ba.go
index 800b64c..58c466e 100644
--- a/examples/bin_api/memif/memif.ba.go
+++ b/examples/bin_api/memif/memif.ba.go
@@ -211,3 +211,16 @@ func init() {
api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
}
+
+var Messages = []api.Message{
+ (*MemifCreate)(nil),
+ (*MemifCreateReply)(nil),
+ (*MemifDelete)(nil),
+ (*MemifDeleteReply)(nil),
+ (*MemifDetails)(nil),
+ (*MemifDump)(nil),
+ (*MemifSocketFilenameAddDel)(nil),
+ (*MemifSocketFilenameAddDelReply)(nil),
+ (*MemifSocketFilenameDetails)(nil),
+ (*MemifSocketFilenameDump)(nil),
+}
diff --git a/examples/bin_api/tap/tap.ba.go b/examples/bin_api/tap/tap.ba.go
index aafd206..04ae411 100644
--- a/examples/bin_api/tap/tap.ba.go
+++ b/examples/bin_api/tap/tap.ba.go
@@ -176,3 +176,14 @@ func init() {
api.RegisterMessage((*TapModify)(nil), "tap.TapModify")
api.RegisterMessage((*TapModifyReply)(nil), "tap.TapModifyReply")
}
+
+var Messages = []api.Message{
+ (*SwInterfaceTapDetails)(nil),
+ (*SwInterfaceTapDump)(nil),
+ (*TapConnect)(nil),
+ (*TapConnectReply)(nil),
+ (*TapDelete)(nil),
+ (*TapDeleteReply)(nil),
+ (*TapModify)(nil),
+ (*TapModifyReply)(nil),
+}
diff --git a/examples/bin_api/vpe/vpe.ba.go b/examples/bin_api/vpe/vpe.ba.go
index 7dc718d..486f1a0 100644
--- a/examples/bin_api/vpe/vpe.ba.go
+++ b/examples/bin_api/vpe/vpe.ba.go
@@ -359,3 +359,24 @@ func init() {
api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion")
api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply")
}
+
+var Messages = []api.Message{
+ (*AddNodeNext)(nil),
+ (*AddNodeNextReply)(nil),
+ (*Cli)(nil),
+ (*CliInband)(nil),
+ (*CliInbandReply)(nil),
+ (*CliReply)(nil),
+ (*ControlPing)(nil),
+ (*ControlPingReply)(nil),
+ (*GetNextIndex)(nil),
+ (*GetNextIndexReply)(nil),
+ (*GetNodeGraph)(nil),
+ (*GetNodeGraphReply)(nil),
+ (*GetNodeIndex)(nil),
+ (*GetNodeIndexReply)(nil),
+ (*ShowThreads)(nil),
+ (*ShowThreadsReply)(nil),
+ (*ShowVersion)(nil),
+ (*ShowVersionReply)(nil),
+}
diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go
index 08d4da6..6429c35 100644
--- a/examples/simple-client/simple_client.go
+++ b/examples/simple-client/simple_client.go
@@ -25,6 +25,7 @@ import (
"git.fd.io/govpp.git"
"git.fd.io/govpp.git/api"
+ "git.fd.io/govpp.git/core"
"git.fd.io/govpp.git/examples/bin_api/acl"
"git.fd.io/govpp.git/examples/bin_api/interfaces"
"git.fd.io/govpp.git/examples/bin_api/ip"
@@ -34,12 +35,19 @@ func main() {
fmt.Println("Starting simple VPP client...")
// connect to VPP
- conn, err := govpp.Connect("")
+ conn, conev, err := govpp.AsyncConnect("")
if err != nil {
log.Fatalln("ERROR:", err)
}
defer conn.Disconnect()
+ select {
+ case e := <-conev:
+ if e.State != core.Connected {
+ log.Fatalf("failed to connect: %v", e.Error)
+ }
+ }
+
// create an API channel that will be used in the examples
ch, err := conn.NewAPIChannel()
if err != nil {