summaryrefslogtreecommitdiffstats
path: root/examples
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 /examples
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>
Diffstat (limited to 'examples')
-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
9 files changed, 287 insertions, 1 deletions
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 {