diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bin_api/acl.api.json | 16 | ||||
-rw-r--r-- | examples/bin_api/acl/acl.go | 105 | ||||
-rw-r--r-- | examples/bin_api/af_packet.api.json | 2 | ||||
-rw-r--r-- | examples/bin_api/af_packet/af_packet.go | 4 | ||||
-rw-r--r-- | examples/bin_api/interface.api.json | 37 | ||||
-rw-r--r-- | examples/bin_api/interfaces/interfaces.go | 186 | ||||
-rw-r--r-- | examples/bin_api/ip.api.json | 74 | ||||
-rw-r--r-- | examples/bin_api/ip/ip.go | 291 | ||||
-rw-r--r-- | examples/bin_api/memif.api.json | 15 | ||||
-rw-r--r-- | examples/bin_api/memif/memif.go | 40 | ||||
-rw-r--r-- | examples/bin_api/tap.api.json | 2 | ||||
-rw-r--r-- | examples/bin_api/tap/tap.go | 4 | ||||
-rw-r--r-- | examples/cmd/perf-bench/perf-bench.go | 162 | ||||
-rw-r--r-- | examples/cmd/stats-client/stats_client.go | 76 |
14 files changed, 860 insertions, 154 deletions
diff --git a/examples/bin_api/acl.api.json b/examples/bin_api/acl.api.json index 1c2e2bf..431f623 100644 --- a/examples/bin_api/acl.api.json +++ b/examples/bin_api/acl.api.json @@ -40,6 +40,20 @@ ["u32", "minor"], {"crc" : "0x43eb59a5"} ], + ["acl_plugin_control_ping", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xfc22c86e"} + ], + ["acl_plugin_control_ping_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "client_index"], + ["u32", "vpe_pid"], + {"crc" : "0xe07e9231"} + ], ["acl_add_replace", ["u16", "_vl_msg_id"], ["u32", "client_index"], @@ -208,5 +222,5 @@ {"crc" : "0x6c86a56c"} ] ], -"vl_api_version" :"0x3cd02d84" +"vl_api_version" :"0x1fd77287" } diff --git a/examples/bin_api/acl/acl.go b/examples/bin_api/acl/acl.go index e13fb18..accdd3f 100644 --- a/examples/bin_api/acl/acl.go +++ b/examples/bin_api/acl/acl.go @@ -1,11 +1,11 @@ // Package acl represents the VPP binary API of the 'acl' VPP module. -// DO NOT EDIT. Generated from 'bin_api/acl.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/acl.api.json' package acl import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0x3cd02d84 +const VlAPIVersion = 0x1fd77287 // ACLRule represents the VPP binary API data type 'acl_rule'. // Generated from 'bin_api/acl.api.json', line 3: @@ -134,9 +134,66 @@ func NewACLPluginGetVersionReply() api.Message { return &ACLPluginGetVersionReply{} } -// ACLAddReplace represents the VPP binary API message 'acl_add_replace'. +// ACLPluginControlPing represents the VPP binary API message 'acl_plugin_control_ping'. // Generated from 'bin_api/acl.api.json', line 43: // +// ["acl_plugin_control_ping", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xfc22c86e"} +// ], +// +type ACLPluginControlPing struct { +} + +func (*ACLPluginControlPing) GetMessageName() string { + return "acl_plugin_control_ping" +} +func (*ACLPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLPluginControlPing) GetCrcString() string { + return "fc22c86e" +} +func NewACLPluginControlPing() api.Message { + return &ACLPluginControlPing{} +} + +// ACLPluginControlPingReply represents the VPP binary API message 'acl_plugin_control_ping_reply'. +// Generated from 'bin_api/acl.api.json', line 49: +// +// ["acl_plugin_control_ping_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "client_index"], +// ["u32", "vpe_pid"], +// {"crc" : "0xe07e9231"} +// ], +// +type ACLPluginControlPingReply struct { + Retval int32 + ClientIndex uint32 + VpePid uint32 +} + +func (*ACLPluginControlPingReply) GetMessageName() string { + return "acl_plugin_control_ping_reply" +} +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLPluginControlPingReply) GetCrcString() string { + return "e07e9231" +} +func NewACLPluginControlPingReply() api.Message { + return &ACLPluginControlPingReply{} +} + +// ACLAddReplace represents the VPP binary API message 'acl_add_replace'. +// Generated from 'bin_api/acl.api.json', line 57: +// // ["acl_add_replace", // ["u16", "_vl_msg_id"], // ["u32", "client_index"], @@ -169,7 +226,7 @@ func NewACLAddReplace() api.Message { } // ACLAddReplaceReply represents the VPP binary API message 'acl_add_replace_reply'. -// Generated from 'bin_api/acl.api.json', line 53: +// Generated from 'bin_api/acl.api.json', line 67: // // ["acl_add_replace_reply", // ["u16", "_vl_msg_id"], @@ -198,7 +255,7 @@ func NewACLAddReplaceReply() api.Message { } // ACLDel represents the VPP binary API message 'acl_del'. -// Generated from 'bin_api/acl.api.json', line 60: +// Generated from 'bin_api/acl.api.json', line 74: // // ["acl_del", // ["u16", "_vl_msg_id"], @@ -226,7 +283,7 @@ func NewACLDel() api.Message { } // ACLDelReply represents the VPP binary API message 'acl_del_reply'. -// Generated from 'bin_api/acl.api.json', line 67: +// Generated from 'bin_api/acl.api.json', line 81: // // ["acl_del_reply", // ["u16", "_vl_msg_id"], @@ -253,7 +310,7 @@ func NewACLDelReply() api.Message { } // ACLInterfaceAddDel represents the VPP binary API message 'acl_interface_add_del'. -// Generated from 'bin_api/acl.api.json', line 73: +// Generated from 'bin_api/acl.api.json', line 87: // // ["acl_interface_add_del", // ["u16", "_vl_msg_id"], @@ -287,7 +344,7 @@ func NewACLInterfaceAddDel() api.Message { } // ACLInterfaceAddDelReply represents the VPP binary API message 'acl_interface_add_del_reply'. -// Generated from 'bin_api/acl.api.json', line 83: +// Generated from 'bin_api/acl.api.json', line 97: // // ["acl_interface_add_del_reply", // ["u16", "_vl_msg_id"], @@ -314,7 +371,7 @@ func NewACLInterfaceAddDelReply() api.Message { } // ACLInterfaceSetACLList represents the VPP binary API message 'acl_interface_set_acl_list'. -// Generated from 'bin_api/acl.api.json', line 89: +// Generated from 'bin_api/acl.api.json', line 103: // // ["acl_interface_set_acl_list", // ["u16", "_vl_msg_id"], @@ -348,7 +405,7 @@ func NewACLInterfaceSetACLList() api.Message { } // ACLInterfaceSetACLListReply represents the VPP binary API message 'acl_interface_set_acl_list_reply'. -// Generated from 'bin_api/acl.api.json', line 99: +// Generated from 'bin_api/acl.api.json', line 113: // // ["acl_interface_set_acl_list_reply", // ["u16", "_vl_msg_id"], @@ -375,7 +432,7 @@ func NewACLInterfaceSetACLListReply() api.Message { } // ACLDump represents the VPP binary API message 'acl_dump'. -// Generated from 'bin_api/acl.api.json', line 105: +// Generated from 'bin_api/acl.api.json', line 119: // // ["acl_dump", // ["u16", "_vl_msg_id"], @@ -403,7 +460,7 @@ func NewACLDump() api.Message { } // ACLDetails represents the VPP binary API message 'acl_details'. -// Generated from 'bin_api/acl.api.json', line 112: +// Generated from 'bin_api/acl.api.json', line 126: // // ["acl_details", // ["u16", "_vl_msg_id"], @@ -436,7 +493,7 @@ func NewACLDetails() api.Message { } // ACLInterfaceListDump represents the VPP binary API message 'acl_interface_list_dump'. -// Generated from 'bin_api/acl.api.json', line 121: +// Generated from 'bin_api/acl.api.json', line 135: // // ["acl_interface_list_dump", // ["u16", "_vl_msg_id"], @@ -464,7 +521,7 @@ func NewACLInterfaceListDump() api.Message { } // ACLInterfaceListDetails represents the VPP binary API message 'acl_interface_list_details'. -// Generated from 'bin_api/acl.api.json', line 128: +// Generated from 'bin_api/acl.api.json', line 142: // // ["acl_interface_list_details", // ["u16", "_vl_msg_id"], @@ -497,7 +554,7 @@ func NewACLInterfaceListDetails() api.Message { } // MacipACLAdd represents the VPP binary API message 'macip_acl_add'. -// Generated from 'bin_api/acl.api.json', line 137: +// Generated from 'bin_api/acl.api.json', line 151: // // ["macip_acl_add", // ["u16", "_vl_msg_id"], @@ -529,7 +586,7 @@ func NewMacipACLAdd() api.Message { } // MacipACLAddReply represents the VPP binary API message 'macip_acl_add_reply'. -// Generated from 'bin_api/acl.api.json', line 146: +// Generated from 'bin_api/acl.api.json', line 160: // // ["macip_acl_add_reply", // ["u16", "_vl_msg_id"], @@ -558,7 +615,7 @@ func NewMacipACLAddReply() api.Message { } // MacipACLDel represents the VPP binary API message 'macip_acl_del'. -// Generated from 'bin_api/acl.api.json', line 153: +// Generated from 'bin_api/acl.api.json', line 167: // // ["macip_acl_del", // ["u16", "_vl_msg_id"], @@ -586,7 +643,7 @@ func NewMacipACLDel() api.Message { } // MacipACLDelReply represents the VPP binary API message 'macip_acl_del_reply'. -// Generated from 'bin_api/acl.api.json', line 160: +// Generated from 'bin_api/acl.api.json', line 174: // // ["macip_acl_del_reply", // ["u16", "_vl_msg_id"], @@ -613,7 +670,7 @@ func NewMacipACLDelReply() api.Message { } // MacipACLInterfaceAddDel represents the VPP binary API message 'macip_acl_interface_add_del'. -// Generated from 'bin_api/acl.api.json', line 166: +// Generated from 'bin_api/acl.api.json', line 180: // // ["macip_acl_interface_add_del", // ["u16", "_vl_msg_id"], @@ -645,7 +702,7 @@ func NewMacipACLInterfaceAddDel() api.Message { } // MacipACLInterfaceAddDelReply represents the VPP binary API message 'macip_acl_interface_add_del_reply'. -// Generated from 'bin_api/acl.api.json', line 175: +// Generated from 'bin_api/acl.api.json', line 189: // // ["macip_acl_interface_add_del_reply", // ["u16", "_vl_msg_id"], @@ -672,7 +729,7 @@ func NewMacipACLInterfaceAddDelReply() api.Message { } // MacipACLDump represents the VPP binary API message 'macip_acl_dump'. -// Generated from 'bin_api/acl.api.json', line 181: +// Generated from 'bin_api/acl.api.json', line 195: // // ["macip_acl_dump", // ["u16", "_vl_msg_id"], @@ -700,7 +757,7 @@ func NewMacipACLDump() api.Message { } // MacipACLDetails represents the VPP binary API message 'macip_acl_details'. -// Generated from 'bin_api/acl.api.json', line 188: +// Generated from 'bin_api/acl.api.json', line 202: // // ["macip_acl_details", // ["u16", "_vl_msg_id"], @@ -733,7 +790,7 @@ func NewMacipACLDetails() api.Message { } // MacipACLInterfaceGet represents the VPP binary API message 'macip_acl_interface_get'. -// Generated from 'bin_api/acl.api.json', line 197: +// Generated from 'bin_api/acl.api.json', line 211: // // ["macip_acl_interface_get", // ["u16", "_vl_msg_id"], @@ -759,7 +816,7 @@ func NewMacipACLInterfaceGet() api.Message { } // MacipACLInterfaceGetReply represents the VPP binary API message 'macip_acl_interface_get_reply'. -// Generated from 'bin_api/acl.api.json', line 203: +// Generated from 'bin_api/acl.api.json', line 217: // // ["macip_acl_interface_get_reply", // ["u16", "_vl_msg_id"], diff --git a/examples/bin_api/af_packet.api.json b/examples/bin_api/af_packet.api.json index 211fc3e..b0c8e7d 100644 --- a/examples/bin_api/af_packet.api.json +++ b/examples/bin_api/af_packet.api.json @@ -33,5 +33,5 @@ {"crc" : "0x1a80431a"} ] ], -"vl_api_version" :"0x4ca71f33" +"vl_api_version" :"0xd4ce9f85" } diff --git a/examples/bin_api/af_packet/af_packet.go b/examples/bin_api/af_packet/af_packet.go index c8b60f9..58db69d 100644 --- a/examples/bin_api/af_packet/af_packet.go +++ b/examples/bin_api/af_packet/af_packet.go @@ -1,11 +1,11 @@ // Package af_packet represents the VPP binary API of the 'af_packet' VPP module. -// DO NOT EDIT. Generated from 'bin_api/af_packet.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/af_packet.api.json' package af_packet import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0x4ca71f33 +const VlAPIVersion = 0xd4ce9f85 // AfPacketCreate represents the VPP binary API message 'af_packet_create'. // Generated from 'bin_api/af_packet.api.json', line 6: diff --git a/examples/bin_api/interface.api.json b/examples/bin_api/interface.api.json index 81f81bd..21511fa 100644 --- a/examples/bin_api/interface.api.json +++ b/examples/bin_api/interface.api.json @@ -1,6 +1,10 @@ { "types" : [ - + ["vlib_counter", + ["u64", "packets"], + ["u64", "bytes"], + {"crc" : "0x62db67f0"} + ] ], "messages" : [ ["sw_interface_set_flags", @@ -138,14 +142,21 @@ ["u32", "vrf_id"], {"crc" : "0xab44111d"} ], - ["vnet_interface_counters", + ["vnet_interface_simple_counters", + ["u16", "_vl_msg_id"], + ["u8", "vnet_counter_type"], + ["u32", "first_sw_if_index"], + ["u32", "count"], + ["u64", "data", 0, "count"], + {"crc" : "0x302f0983"} + ], + ["vnet_interface_combined_counters", ["u16", "_vl_msg_id"], ["u8", "vnet_counter_type"], - ["u8", "is_combined"], ["u32", "first_sw_if_index"], ["u32", "count"], - ["u8", "data", 0, "count"], - {"crc" : "0x312082b4"} + ["vl_api_vlib_counter_t", "data", 0, "count"], + {"crc" : "0xd82426e3"} ], ["sw_interface_set_unnumbered", ["u16", "_vl_msg_id"], @@ -189,7 +200,21 @@ ["u32", "context"], ["i32", "retval"], {"crc" : "0x761cbcb0"} + ], + ["sw_interface_set_mac_address", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "mac_address", 6], + {"crc" : "0xe4f22660"} + ], + ["sw_interface_set_mac_address_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x9dc8a452"} ] ], -"vl_api_version" :"0x6857f668" +"vl_api_version" :"0xcdfdf626" } diff --git a/examples/bin_api/interfaces/interfaces.go b/examples/bin_api/interfaces/interfaces.go index a83b517..7d89f09 100644 --- a/examples/bin_api/interfaces/interfaces.go +++ b/examples/bin_api/interfaces/interfaces.go @@ -1,14 +1,35 @@ // Package interfaces represents the VPP binary API of the 'interfaces' VPP module. -// DO NOT EDIT. Generated from 'bin_api/interface.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/interface.api.json' package interfaces import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0x6857f668 +const VlAPIVersion = 0xcdfdf626 + +// VlibCounter represents the VPP binary API data type 'vlib_counter'. +// Generated from 'bin_api/interface.api.json', line 3: +// +// ["vlib_counter", +// ["u64", "packets"], +// ["u64", "bytes"], +// {"crc" : "0x62db67f0"} +// ] +// +type VlibCounter struct { + Packets uint64 + Bytes uint64 +} + +func (*VlibCounter) GetTypeName() string { + return "vlib_counter" +} +func (*VlibCounter) GetCrcString() string { + return "62db67f0" +} // SwInterfaceSetFlags represents the VPP binary API message 'sw_interface_set_flags'. -// Generated from 'bin_api/interface.api.json', line 6: +// Generated from 'bin_api/interface.api.json', line 10: // // ["sw_interface_set_flags", // ["u16", "_vl_msg_id"], @@ -42,7 +63,7 @@ func NewSwInterfaceSetFlags() api.Message { } // SwInterfaceSetFlagsReply represents the VPP binary API message 'sw_interface_set_flags_reply'. -// Generated from 'bin_api/interface.api.json', line 16: +// Generated from 'bin_api/interface.api.json', line 20: // // ["sw_interface_set_flags_reply", // ["u16", "_vl_msg_id"], @@ -69,7 +90,7 @@ func NewSwInterfaceSetFlagsReply() api.Message { } // SwInterfaceSetMtu represents the VPP binary API message 'sw_interface_set_mtu'. -// Generated from 'bin_api/interface.api.json', line 22: +// Generated from 'bin_api/interface.api.json', line 26: // // ["sw_interface_set_mtu", // ["u16", "_vl_msg_id"], @@ -99,7 +120,7 @@ func NewSwInterfaceSetMtu() api.Message { } // SwInterfaceSetMtuReply represents the VPP binary API message 'sw_interface_set_mtu_reply'. -// Generated from 'bin_api/interface.api.json', line 30: +// Generated from 'bin_api/interface.api.json', line 34: // // ["sw_interface_set_mtu_reply", // ["u16", "_vl_msg_id"], @@ -126,7 +147,7 @@ func NewSwInterfaceSetMtuReply() api.Message { } // WantInterfaceEvents represents the VPP binary API message 'want_interface_events'. -// Generated from 'bin_api/interface.api.json', line 36: +// Generated from 'bin_api/interface.api.json', line 40: // // ["want_interface_events", // ["u16", "_vl_msg_id"], @@ -156,7 +177,7 @@ func NewWantInterfaceEvents() api.Message { } // WantInterfaceEventsReply represents the VPP binary API message 'want_interface_events_reply'. -// Generated from 'bin_api/interface.api.json', line 44: +// Generated from 'bin_api/interface.api.json', line 48: // // ["want_interface_events_reply", // ["u16", "_vl_msg_id"], @@ -183,7 +204,7 @@ func NewWantInterfaceEventsReply() api.Message { } // SwInterfaceDetails represents the VPP binary API message 'sw_interface_details'. -// Generated from 'bin_api/interface.api.json', line 50: +// Generated from 'bin_api/interface.api.json', line 54: // // ["sw_interface_details", // ["u16", "_vl_msg_id"], @@ -268,7 +289,7 @@ func NewSwInterfaceDetails() api.Message { } // SwInterfaceDump represents the VPP binary API message 'sw_interface_dump'. -// Generated from 'bin_api/interface.api.json', line 85: +// Generated from 'bin_api/interface.api.json', line 89: // // ["sw_interface_dump", // ["u16", "_vl_msg_id"], @@ -298,7 +319,7 @@ func NewSwInterfaceDump() api.Message { } // SwInterfaceAddDelAddress represents the VPP binary API message 'sw_interface_add_del_address'. -// Generated from 'bin_api/interface.api.json', line 93: +// Generated from 'bin_api/interface.api.json', line 97: // // ["sw_interface_add_del_address", // ["u16", "_vl_msg_id"], @@ -336,7 +357,7 @@ func NewSwInterfaceAddDelAddress() api.Message { } // SwInterfaceAddDelAddressReply represents the VPP binary API message 'sw_interface_add_del_address_reply'. -// Generated from 'bin_api/interface.api.json', line 105: +// Generated from 'bin_api/interface.api.json', line 109: // // ["sw_interface_add_del_address_reply", // ["u16", "_vl_msg_id"], @@ -363,7 +384,7 @@ func NewSwInterfaceAddDelAddressReply() api.Message { } // SwInterfaceSetTable represents the VPP binary API message 'sw_interface_set_table'. -// Generated from 'bin_api/interface.api.json', line 111: +// Generated from 'bin_api/interface.api.json', line 115: // // ["sw_interface_set_table", // ["u16", "_vl_msg_id"], @@ -395,7 +416,7 @@ func NewSwInterfaceSetTable() api.Message { } // SwInterfaceSetTableReply represents the VPP binary API message 'sw_interface_set_table_reply'. -// Generated from 'bin_api/interface.api.json', line 120: +// Generated from 'bin_api/interface.api.json', line 124: // // ["sw_interface_set_table_reply", // ["u16", "_vl_msg_id"], @@ -422,7 +443,7 @@ func NewSwInterfaceSetTableReply() api.Message { } // SwInterfaceGetTable represents the VPP binary API message 'sw_interface_get_table'. -// Generated from 'bin_api/interface.api.json', line 126: +// Generated from 'bin_api/interface.api.json', line 130: // // ["sw_interface_get_table", // ["u16", "_vl_msg_id"], @@ -452,7 +473,7 @@ func NewSwInterfaceGetTable() api.Message { } // SwInterfaceGetTableReply represents the VPP binary API message 'sw_interface_get_table_reply'. -// Generated from 'bin_api/interface.api.json', line 134: +// Generated from 'bin_api/interface.api.json', line 138: // // ["sw_interface_get_table_reply", // ["u16", "_vl_msg_id"], @@ -480,42 +501,72 @@ func NewSwInterfaceGetTableReply() api.Message { return &SwInterfaceGetTableReply{} } -// VnetInterfaceCounters represents the VPP binary API message 'vnet_interface_counters'. -// Generated from 'bin_api/interface.api.json', line 141: +// VnetInterfaceSimpleCounters represents the VPP binary API message 'vnet_interface_simple_counters'. +// Generated from 'bin_api/interface.api.json', line 145: // -// ["vnet_interface_counters", +// ["vnet_interface_simple_counters", // ["u16", "_vl_msg_id"], // ["u8", "vnet_counter_type"], -// ["u8", "is_combined"], // ["u32", "first_sw_if_index"], // ["u32", "count"], -// ["u8", "data", 0, "count"], -// {"crc" : "0x312082b4"} +// ["u64", "data", 0, "count"], +// {"crc" : "0x302f0983"} // ], // -type VnetInterfaceCounters struct { +type VnetInterfaceSimpleCounters struct { VnetCounterType uint8 - IsCombined uint8 FirstSwIfIndex uint32 Count uint32 `struc:"sizeof=Data"` - Data []byte + Data []uint64 } -func (*VnetInterfaceCounters) GetMessageName() string { - return "vnet_interface_counters" +func (*VnetInterfaceSimpleCounters) GetMessageName() string { + return "vnet_interface_simple_counters" } -func (*VnetInterfaceCounters) GetMessageType() api.MessageType { +func (*VnetInterfaceSimpleCounters) GetMessageType() api.MessageType { return api.OtherMessage } -func (*VnetInterfaceCounters) GetCrcString() string { - return "312082b4" +func (*VnetInterfaceSimpleCounters) GetCrcString() string { + return "302f0983" } -func NewVnetInterfaceCounters() api.Message { - return &VnetInterfaceCounters{} +func NewVnetInterfaceSimpleCounters() api.Message { + return &VnetInterfaceSimpleCounters{} +} + +// VnetInterfaceCombinedCounters represents the VPP binary API message 'vnet_interface_combined_counters'. +// Generated from 'bin_api/interface.api.json', line 153: +// +// ["vnet_interface_combined_counters", +// ["u16", "_vl_msg_id"], +// ["u8", "vnet_counter_type"], +// ["u32", "first_sw_if_index"], +// ["u32", "count"], +// ["vl_api_vlib_counter_t", "data", 0, "count"], +// {"crc" : "0xd82426e3"} +// ], +// +type VnetInterfaceCombinedCounters struct { + VnetCounterType uint8 + FirstSwIfIndex uint32 + Count uint32 `struc:"sizeof=Data"` + Data []VlibCounter +} + +func (*VnetInterfaceCombinedCounters) GetMessageName() string { + return "vnet_interface_combined_counters" +} +func (*VnetInterfaceCombinedCounters) GetMessageType() api.MessageType { + return api.OtherMessage +} +func (*VnetInterfaceCombinedCounters) GetCrcString() string { + return "d82426e3" +} +func NewVnetInterfaceCombinedCounters() api.Message { + return &VnetInterfaceCombinedCounters{} } // SwInterfaceSetUnnumbered represents the VPP binary API message 'sw_interface_set_unnumbered'. -// Generated from 'bin_api/interface.api.json', line 150: +// Generated from 'bin_api/interface.api.json', line 161: // // ["sw_interface_set_unnumbered", // ["u16", "_vl_msg_id"], @@ -547,7 +598,7 @@ func NewSwInterfaceSetUnnumbered() api.Message { } // SwInterfaceSetUnnumberedReply represents the VPP binary API message 'sw_interface_set_unnumbered_reply'. -// Generated from 'bin_api/interface.api.json', line 159: +// Generated from 'bin_api/interface.api.json', line 170: // // ["sw_interface_set_unnumbered_reply", // ["u16", "_vl_msg_id"], @@ -574,7 +625,7 @@ func NewSwInterfaceSetUnnumberedReply() api.Message { } // SwInterfaceClearStats represents the VPP binary API message 'sw_interface_clear_stats'. -// Generated from 'bin_api/interface.api.json', line 165: +// Generated from 'bin_api/interface.api.json', line 176: // // ["sw_interface_clear_stats", // ["u16", "_vl_msg_id"], @@ -602,7 +653,7 @@ func NewSwInterfaceClearStats() api.Message { } // SwInterfaceClearStatsReply represents the VPP binary API message 'sw_interface_clear_stats_reply'. -// Generated from 'bin_api/interface.api.json', line 172: +// Generated from 'bin_api/interface.api.json', line 183: // // ["sw_interface_clear_stats_reply", // ["u16", "_vl_msg_id"], @@ -629,7 +680,7 @@ func NewSwInterfaceClearStatsReply() api.Message { } // SwInterfaceTagAddDel represents the VPP binary API message 'sw_interface_tag_add_del'. -// Generated from 'bin_api/interface.api.json', line 178: +// Generated from 'bin_api/interface.api.json', line 189: // // ["sw_interface_tag_add_del", // ["u16", "_vl_msg_id"], @@ -661,14 +712,14 @@ func NewSwInterfaceTagAddDel() api.Message { } // SwInterfaceTagAddDelReply represents the VPP binary API message 'sw_interface_tag_add_del_reply'. -// Generated from 'bin_api/interface.api.json', line 187: +// Generated from 'bin_api/interface.api.json', line 198: // // ["sw_interface_tag_add_del_reply", // ["u16", "_vl_msg_id"], // ["u32", "context"], // ["i32", "retval"], // {"crc" : "0x761cbcb0"} -// ] +// ], // type SwInterfaceTagAddDelReply struct { Retval int32 @@ -686,3 +737,60 @@ func (*SwInterfaceTagAddDelReply) GetCrcString() string { func NewSwInterfaceTagAddDelReply() api.Message { return &SwInterfaceTagAddDelReply{} } + +// SwInterfaceSetMacAddress represents the VPP binary API message 'sw_interface_set_mac_address'. +// Generated from 'bin_api/interface.api.json', line 204: +// +// ["sw_interface_set_mac_address", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "mac_address", 6], +// {"crc" : "0xe4f22660"} +// ], +// +type SwInterfaceSetMacAddress struct { + SwIfIndex uint32 + MacAddress []byte `struc:"[6]byte"` +} + +func (*SwInterfaceSetMacAddress) GetMessageName() string { + return "sw_interface_set_mac_address" +} +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceSetMacAddress) GetCrcString() string { + return "e4f22660" +} +func NewSwInterfaceSetMacAddress() api.Message { + return &SwInterfaceSetMacAddress{} +} + +// SwInterfaceSetMacAddressReply represents the VPP binary API message 'sw_interface_set_mac_address_reply'. +// Generated from 'bin_api/interface.api.json', line 212: +// +// ["sw_interface_set_mac_address_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x9dc8a452"} +// ] +// +type SwInterfaceSetMacAddressReply struct { + Retval int32 +} + +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { + return "9dc8a452" +} +func NewSwInterfaceSetMacAddressReply() api.Message { + return &SwInterfaceSetMacAddressReply{} +} diff --git a/examples/bin_api/ip.api.json b/examples/bin_api/ip.api.json index 970ec4b..805e56f 100644 --- a/examples/bin_api/ip.api.json +++ b/examples/bin_api/ip.api.json @@ -66,14 +66,14 @@ ["u16", "_vl_msg_id"], ["u32", "client_index"], ["u32", "context"], - ["u32", "vrf_id"], ["u32", "sw_if_index"], ["u8", "is_add"], ["u8", "is_ipv6"], ["u8", "is_static"], + ["u8", "is_no_adj_fib"], ["u8", "mac_address", 6], ["u8", "dst_address", 16], - {"crc" : "0x66f2112c"} + {"crc" : "0x5a0d070b"} ], ["ip_neighbor_add_del_reply", ["u16", "_vl_msg_id"], @@ -150,6 +150,35 @@ ["i32", "retval"], {"crc" : "0x8050adb3"} ], + ["ip6nd_proxy_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_del"], + ["u8", "address", 16], + {"crc" : "0xc56f802d"} + ], + ["ip6nd_proxy_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x00ddc2d5"} + ], + ["ip6nd_proxy_details", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "address", 16], + {"crc" : "0xf805ccc1"} + ], + ["ip6nd_proxy_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x21597d88"} + ], ["sw_interface_ip6_enable_disable", ["u16", "_vl_msg_id"], ["u32", "client_index"], @@ -221,6 +250,7 @@ ["u32", "table_id"], ["u32", "entry_flags"], ["u32", "itf_flags"], + ["u32", "rpf_id"], ["u16", "grp_address_length"], ["u8", "create_vrf_if_needed"], ["u8", "is_add"], @@ -228,7 +258,7 @@ ["u8", "is_local"], ["u8", "grp_address", 16], ["u8", "src_address", 16], - {"crc" : "0x8312830f"} + {"crc" : "0x8f5f21a8"} ], ["ip_mroute_add_del_reply", ["u16", "_vl_msg_id"], @@ -236,6 +266,42 @@ ["i32", "retval"], {"crc" : "0x8cabe02c"} ], + ["ip_mfib_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xee61390e"} + ], + ["ip_mfib_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "table_id"], + ["u32", "entry_flags"], + ["u32", "rpf_id"], + ["u8", "address_length"], + ["u8", "grp_address", 4], + ["u8", "src_address", 4], + ["u32", "count"], + ["vl_api_fib_path_t", "path", 0, "count"], + {"crc" : "0x395e5699"} + ], + ["ip6_mfib_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x0839e143"} + ], + ["ip6_mfib_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "table_id"], + ["u8", "address_length"], + ["u8", "grp_address", 16], + ["u8", "src_address", 16], + ["u32", "count"], + ["vl_api_fib_path_t", "path", 0, "count"], + {"crc" : "0x921b153f"} + ], ["ip_address_details", ["u16", "_vl_msg_id"], ["u32", "client_index"], @@ -288,5 +354,5 @@ {"crc" : "0x6ba92c72"} ] ], -"vl_api_version" :"0x6a819870" +"vl_api_version" :"0x50fe2434" } diff --git a/examples/bin_api/ip/ip.go b/examples/bin_api/ip/ip.go index 1db05d4..884e218 100644 --- a/examples/bin_api/ip/ip.go +++ b/examples/bin_api/ip/ip.go @@ -1,11 +1,11 @@ // Package ip represents the VPP binary API of the 'ip' VPP module. -// DO NOT EDIT. Generated from 'bin_api/ip.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/ip.api.json' package ip import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0x6a819870 +const VlAPIVersion = 0x50fe2434 // FibPath represents the VPP binary API data type 'fib_path'. // Generated from 'bin_api/ip.api.json', line 3: @@ -232,22 +232,22 @@ func NewIPNeighborDetails() api.Message { // ["u16", "_vl_msg_id"], // ["u32", "client_index"], // ["u32", "context"], -// ["u32", "vrf_id"], // ["u32", "sw_if_index"], // ["u8", "is_add"], // ["u8", "is_ipv6"], // ["u8", "is_static"], +// ["u8", "is_no_adj_fib"], // ["u8", "mac_address", 6], // ["u8", "dst_address", 16], -// {"crc" : "0x66f2112c"} +// {"crc" : "0x5a0d070b"} // ], // type IPNeighborAddDel struct { - VrfID uint32 SwIfIndex uint32 IsAdd uint8 IsIpv6 uint8 IsStatic uint8 + IsNoAdjFib uint8 MacAddress []byte `struc:"[6]byte"` DstAddress []byte `struc:"[16]byte"` } @@ -259,7 +259,7 @@ func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (*IPNeighborAddDel) GetCrcString() string { - return "66f2112c" + return "5a0d070b" } func NewIPNeighborAddDel() api.Message { return &IPNeighborAddDel{} @@ -517,9 +517,124 @@ func NewSwInterfaceIP6ndRaPrefixReply() api.Message { return &SwInterfaceIP6ndRaPrefixReply{} } -// SwInterfaceIP6EnableDisable represents the VPP binary API message 'sw_interface_ip6_enable_disable'. +// IP6ndProxyAddDel represents the VPP binary API message 'ip6nd_proxy_add_del'. // Generated from 'bin_api/ip.api.json', line 153: // +// ["ip6nd_proxy_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_del"], +// ["u8", "address", 16], +// {"crc" : "0xc56f802d"} +// ], +// +type IP6ndProxyAddDel struct { + SwIfIndex uint32 + IsDel uint8 + Address []byte `struc:"[16]byte"` +} + +func (*IP6ndProxyAddDel) GetMessageName() string { + return "ip6nd_proxy_add_del" +} +func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IP6ndProxyAddDel) GetCrcString() string { + return "c56f802d" +} +func NewIP6ndProxyAddDel() api.Message { + return &IP6ndProxyAddDel{} +} + +// IP6ndProxyAddDelReply represents the VPP binary API message 'ip6nd_proxy_add_del_reply'. +// Generated from 'bin_api/ip.api.json', line 162: +// +// ["ip6nd_proxy_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x00ddc2d5"} +// ], +// +type IP6ndProxyAddDelReply struct { + Retval int32 +} + +func (*IP6ndProxyAddDelReply) GetMessageName() string { + return "ip6nd_proxy_add_del_reply" +} +func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IP6ndProxyAddDelReply) GetCrcString() string { + return "00ddc2d5" +} +func NewIP6ndProxyAddDelReply() api.Message { + return &IP6ndProxyAddDelReply{} +} + +// IP6ndProxyDetails represents the VPP binary API message 'ip6nd_proxy_details'. +// Generated from 'bin_api/ip.api.json', line 168: +// +// ["ip6nd_proxy_details", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "address", 16], +// {"crc" : "0xf805ccc1"} +// ], +// +type IP6ndProxyDetails struct { + SwIfIndex uint32 + Address []byte `struc:"[16]byte"` +} + +func (*IP6ndProxyDetails) GetMessageName() string { + return "ip6nd_proxy_details" +} +func (*IP6ndProxyDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IP6ndProxyDetails) GetCrcString() string { + return "f805ccc1" +} +func NewIP6ndProxyDetails() api.Message { + return &IP6ndProxyDetails{} +} + +// IP6ndProxyDump represents the VPP binary API message 'ip6nd_proxy_dump'. +// Generated from 'bin_api/ip.api.json', line 176: +// +// ["ip6nd_proxy_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x21597d88"} +// ], +// +type IP6ndProxyDump struct { +} + +func (*IP6ndProxyDump) GetMessageName() string { + return "ip6nd_proxy_dump" +} +func (*IP6ndProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IP6ndProxyDump) GetCrcString() string { + return "21597d88" +} +func NewIP6ndProxyDump() api.Message { + return &IP6ndProxyDump{} +} + +// SwInterfaceIP6EnableDisable represents the VPP binary API message 'sw_interface_ip6_enable_disable'. +// Generated from 'bin_api/ip.api.json', line 182: +// // ["sw_interface_ip6_enable_disable", // ["u16", "_vl_msg_id"], // ["u32", "client_index"], @@ -548,7 +663,7 @@ func NewSwInterfaceIP6EnableDisable() api.Message { } // SwInterfaceIP6EnableDisableReply represents the VPP binary API message 'sw_interface_ip6_enable_disable_reply'. -// Generated from 'bin_api/ip.api.json', line 161: +// Generated from 'bin_api/ip.api.json', line 190: // // ["sw_interface_ip6_enable_disable_reply", // ["u16", "_vl_msg_id"], @@ -575,7 +690,7 @@ func NewSwInterfaceIP6EnableDisableReply() api.Message { } // SwInterfaceIP6SetLinkLocalAddress represents the VPP binary API message 'sw_interface_ip6_set_link_local_address'. -// Generated from 'bin_api/ip.api.json', line 167: +// Generated from 'bin_api/ip.api.json', line 196: // // ["sw_interface_ip6_set_link_local_address", // ["u16", "_vl_msg_id"], @@ -605,7 +720,7 @@ func NewSwInterfaceIP6SetLinkLocalAddress() api.Message { } // SwInterfaceIP6SetLinkLocalAddressReply represents the VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. -// Generated from 'bin_api/ip.api.json', line 175: +// Generated from 'bin_api/ip.api.json', line 204: // // ["sw_interface_ip6_set_link_local_address_reply", // ["u16", "_vl_msg_id"], @@ -632,7 +747,7 @@ func NewSwInterfaceIP6SetLinkLocalAddressReply() api.Message { } // IPAddDelRoute represents the VPP binary API message 'ip_add_del_route'. -// Generated from 'bin_api/ip.api.json', line 181: +// Generated from 'bin_api/ip.api.json', line 210: // // ["ip_add_del_route", // ["u16", "_vl_msg_id"], @@ -704,7 +819,7 @@ func NewIPAddDelRoute() api.Message { } // IPAddDelRouteReply represents the VPP binary API message 'ip_add_del_route_reply'. -// Generated from 'bin_api/ip.api.json', line 210: +// Generated from 'bin_api/ip.api.json', line 239: // // ["ip_add_del_route_reply", // ["u16", "_vl_msg_id"], @@ -731,7 +846,7 @@ func NewIPAddDelRouteReply() api.Message { } // IPMrouteAddDel represents the VPP binary API message 'ip_mroute_add_del'. -// Generated from 'bin_api/ip.api.json', line 216: +// Generated from 'bin_api/ip.api.json', line 245: // // ["ip_mroute_add_del", // ["u16", "_vl_msg_id"], @@ -741,6 +856,7 @@ func NewIPAddDelRouteReply() api.Message { // ["u32", "table_id"], // ["u32", "entry_flags"], // ["u32", "itf_flags"], +// ["u32", "rpf_id"], // ["u16", "grp_address_length"], // ["u8", "create_vrf_if_needed"], // ["u8", "is_add"], @@ -748,7 +864,7 @@ func NewIPAddDelRouteReply() api.Message { // ["u8", "is_local"], // ["u8", "grp_address", 16], // ["u8", "src_address", 16], -// {"crc" : "0x8312830f"} +// {"crc" : "0x8f5f21a8"} // ], // type IPMrouteAddDel struct { @@ -756,6 +872,7 @@ type IPMrouteAddDel struct { TableID uint32 EntryFlags uint32 ItfFlags uint32 + RpfID uint32 GrpAddressLength uint16 CreateVrfIfNeeded uint8 IsAdd uint8 @@ -772,14 +889,14 @@ func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (*IPMrouteAddDel) GetCrcString() string { - return "8312830f" + return "8f5f21a8" } func NewIPMrouteAddDel() api.Message { return &IPMrouteAddDel{} } // IPMrouteAddDelReply represents the VPP binary API message 'ip_mroute_add_del_reply'. -// Generated from 'bin_api/ip.api.json', line 233: +// Generated from 'bin_api/ip.api.json', line 263: // // ["ip_mroute_add_del_reply", // ["u16", "_vl_msg_id"], @@ -805,8 +922,138 @@ func NewIPMrouteAddDelReply() api.Message { return &IPMrouteAddDelReply{} } +// IPMfibDump represents the VPP binary API message 'ip_mfib_dump'. +// Generated from 'bin_api/ip.api.json', line 269: +// +// ["ip_mfib_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xee61390e"} +// ], +// +type IPMfibDump struct { +} + +func (*IPMfibDump) GetMessageName() string { + return "ip_mfib_dump" +} +func (*IPMfibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPMfibDump) GetCrcString() string { + return "ee61390e" +} +func NewIPMfibDump() api.Message { + return &IPMfibDump{} +} + +// IPMfibDetails represents the VPP binary API message 'ip_mfib_details'. +// Generated from 'bin_api/ip.api.json', line 275: +// +// ["ip_mfib_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "table_id"], +// ["u32", "entry_flags"], +// ["u32", "rpf_id"], +// ["u8", "address_length"], +// ["u8", "grp_address", 4], +// ["u8", "src_address", 4], +// ["u32", "count"], +// ["vl_api_fib_path_t", "path", 0, "count"], +// {"crc" : "0x395e5699"} +// ], +// +type IPMfibDetails struct { + TableID uint32 + EntryFlags uint32 + RpfID uint32 + AddressLength uint8 + GrpAddress []byte `struc:"[4]byte"` + SrcAddress []byte `struc:"[4]byte"` + Count uint32 `struc:"sizeof=Path"` + Path []FibPath +} + +func (*IPMfibDetails) GetMessageName() string { + return "ip_mfib_details" +} +func (*IPMfibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPMfibDetails) GetCrcString() string { + return "395e5699" +} +func NewIPMfibDetails() api.Message { + return &IPMfibDetails{} +} + +// IP6MfibDump represents the VPP binary API message 'ip6_mfib_dump'. +// Generated from 'bin_api/ip.api.json', line 288: +// +// ["ip6_mfib_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x0839e143"} +// ], +// +type IP6MfibDump struct { +} + +func (*IP6MfibDump) GetMessageName() string { + return "ip6_mfib_dump" +} +func (*IP6MfibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IP6MfibDump) GetCrcString() string { + return "0839e143" +} +func NewIP6MfibDump() api.Message { + return &IP6MfibDump{} +} + +// IP6MfibDetails represents the VPP binary API message 'ip6_mfib_details'. +// Generated from 'bin_api/ip.api.json', line 294: +// +// ["ip6_mfib_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "table_id"], +// ["u8", "address_length"], +// ["u8", "grp_address", 16], +// ["u8", "src_address", 16], +// ["u32", "count"], +// ["vl_api_fib_path_t", "path", 0, "count"], +// {"crc" : "0x921b153f"} +// ], +// +type IP6MfibDetails struct { + TableID uint32 + AddressLength uint8 + GrpAddress []byte `struc:"[16]byte"` + SrcAddress []byte `struc:"[16]byte"` + Count uint32 `struc:"sizeof=Path"` + Path []FibPath +} + +func (*IP6MfibDetails) GetMessageName() string { + return "ip6_mfib_details" +} +func (*IP6MfibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IP6MfibDetails) GetCrcString() string { + return "921b153f" +} +func NewIP6MfibDetails() api.Message { + return &IP6MfibDetails{} +} + // IPAddressDetails represents the VPP binary API message 'ip_address_details'. -// Generated from 'bin_api/ip.api.json', line 239: +// Generated from 'bin_api/ip.api.json', line 305: // // ["ip_address_details", // ["u16", "_vl_msg_id"], @@ -840,7 +1087,7 @@ func NewIPAddressDetails() api.Message { } // IPAddressDump represents the VPP binary API message 'ip_address_dump'. -// Generated from 'bin_api/ip.api.json', line 249: +// Generated from 'bin_api/ip.api.json', line 315: // // ["ip_address_dump", // ["u16", "_vl_msg_id"], @@ -870,7 +1117,7 @@ func NewIPAddressDump() api.Message { } // IPDetails represents the VPP binary API message 'ip_details'. -// Generated from 'bin_api/ip.api.json', line 257: +// Generated from 'bin_api/ip.api.json', line 323: // // ["ip_details", // ["u16", "_vl_msg_id"], @@ -900,7 +1147,7 @@ func NewIPDetails() api.Message { } // IPDump represents the VPP binary API message 'ip_dump'. -// Generated from 'bin_api/ip.api.json', line 264: +// Generated from 'bin_api/ip.api.json', line 330: // // ["ip_dump", // ["u16", "_vl_msg_id"], @@ -928,7 +1175,7 @@ func NewIPDump() api.Message { } // MfibSignalDump represents the VPP binary API message 'mfib_signal_dump'. -// Generated from 'bin_api/ip.api.json', line 271: +// Generated from 'bin_api/ip.api.json', line 337: // // ["mfib_signal_dump", // ["u16", "_vl_msg_id"], @@ -954,7 +1201,7 @@ func NewMfibSignalDump() api.Message { } // MfibSignalDetails represents the VPP binary API message 'mfib_signal_details'. -// Generated from 'bin_api/ip.api.json', line 277: +// Generated from 'bin_api/ip.api.json', line 343: // // ["mfib_signal_details", // ["u16", "_vl_msg_id"], diff --git a/examples/bin_api/memif.api.json b/examples/bin_api/memif.api.json index e41c82d..fd38316 100644 --- a/examples/bin_api/memif.api.json +++ b/examples/bin_api/memif.api.json @@ -8,12 +8,16 @@ ["u32", "client_index"], ["u32", "context"], ["u8", "role"], - ["u64", "key"], + ["u8", "mode"], + ["u8", "rx_queues"], + ["u8", "tx_queues"], + ["u32", "id"], ["u8", "socket_filename", 128], + ["u8", "secret", 24], ["u32", "ring_size"], ["u16", "buffer_size"], ["u8", "hw_addr", 6], - {"crc" : "0x23fe3309"} + {"crc" : "0xc809c235"} ], ["memif_create_reply", ["u16", "_vl_msg_id"], @@ -41,14 +45,15 @@ ["u32", "sw_if_index"], ["u8", "if_name", 64], ["u8", "hw_addr", 6], - ["u64", "key"], + ["u32", "id"], ["u8", "role"], + ["u8", "mode"], ["u8", "socket_filename", 128], ["u32", "ring_size"], ["u16", "buffer_size"], ["u8", "admin_up_down"], ["u8", "link_up_down"], - {"crc" : "0xcf105583"} + {"crc" : "0x4d74fd96"} ], ["memif_dump", ["u16", "_vl_msg_id"], @@ -57,5 +62,5 @@ {"crc" : "0x68d39e95"} ] ], -"vl_api_version" :"0xadb63e82" +"vl_api_version" :"0xed3def5d" } diff --git a/examples/bin_api/memif/memif.go b/examples/bin_api/memif/memif.go index c7c27f4..aa847e4 100644 --- a/examples/bin_api/memif/memif.go +++ b/examples/bin_api/memif/memif.go @@ -1,11 +1,11 @@ // Package memif represents the VPP binary API of the 'memif' VPP module. -// DO NOT EDIT. Generated from 'bin_api/memif.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/memif.api.json' package memif import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0xadb63e82 +const VlAPIVersion = 0xed3def5d // MemifCreate represents the VPP binary API message 'memif_create'. // Generated from 'bin_api/memif.api.json', line 6: @@ -15,18 +15,26 @@ const VlAPIVersion = 0xadb63e82 // ["u32", "client_index"], // ["u32", "context"], // ["u8", "role"], -// ["u64", "key"], +// ["u8", "mode"], +// ["u8", "rx_queues"], +// ["u8", "tx_queues"], +// ["u32", "id"], // ["u8", "socket_filename", 128], +// ["u8", "secret", 24], // ["u32", "ring_size"], // ["u16", "buffer_size"], // ["u8", "hw_addr", 6], -// {"crc" : "0x23fe3309"} +// {"crc" : "0xc809c235"} // ], // type MemifCreate struct { Role uint8 - Key uint64 + Mode uint8 + RxQueues uint8 + TxQueues uint8 + ID uint32 SocketFilename []byte `struc:"[128]byte"` + Secret []byte `struc:"[24]byte"` RingSize uint32 BufferSize uint16 HwAddr []byte `struc:"[6]byte"` @@ -39,14 +47,14 @@ func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } func (*MemifCreate) GetCrcString() string { - return "23fe3309" + return "c809c235" } func NewMemifCreate() api.Message { return &MemifCreate{} } // MemifCreateReply represents the VPP binary API message 'memif_create_reply'. -// Generated from 'bin_api/memif.api.json', line 18: +// Generated from 'bin_api/memif.api.json', line 22: // // ["memif_create_reply", // ["u16", "_vl_msg_id"], @@ -75,7 +83,7 @@ func NewMemifCreateReply() api.Message { } // MemifDelete represents the VPP binary API message 'memif_delete'. -// Generated from 'bin_api/memif.api.json', line 25: +// Generated from 'bin_api/memif.api.json', line 29: // // ["memif_delete", // ["u16", "_vl_msg_id"], @@ -103,7 +111,7 @@ func NewMemifDelete() api.Message { } // MemifDeleteReply represents the VPP binary API message 'memif_delete_reply'. -// Generated from 'bin_api/memif.api.json', line 32: +// Generated from 'bin_api/memif.api.json', line 36: // // ["memif_delete_reply", // ["u16", "_vl_msg_id"], @@ -130,7 +138,7 @@ func NewMemifDeleteReply() api.Message { } // MemifDetails represents the VPP binary API message 'memif_details'. -// Generated from 'bin_api/memif.api.json', line 38: +// Generated from 'bin_api/memif.api.json', line 42: // // ["memif_details", // ["u16", "_vl_msg_id"], @@ -138,22 +146,24 @@ func NewMemifDeleteReply() api.Message { // ["u32", "sw_if_index"], // ["u8", "if_name", 64], // ["u8", "hw_addr", 6], -// ["u64", "key"], +// ["u32", "id"], // ["u8", "role"], +// ["u8", "mode"], // ["u8", "socket_filename", 128], // ["u32", "ring_size"], // ["u16", "buffer_size"], // ["u8", "admin_up_down"], // ["u8", "link_up_down"], -// {"crc" : "0xcf105583"} +// {"crc" : "0x4d74fd96"} // ], // type MemifDetails struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` HwAddr []byte `struc:"[6]byte"` - Key uint64 + ID uint32 Role uint8 + Mode uint8 SocketFilename []byte `struc:"[128]byte"` RingSize uint32 BufferSize uint16 @@ -168,14 +178,14 @@ func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (*MemifDetails) GetCrcString() string { - return "cf105583" + return "4d74fd96" } func NewMemifDetails() api.Message { return &MemifDetails{} } // MemifDump represents the VPP binary API message 'memif_dump'. -// Generated from 'bin_api/memif.api.json', line 53: +// Generated from 'bin_api/memif.api.json', line 58: // // ["memif_dump", // ["u16", "_vl_msg_id"], diff --git a/examples/bin_api/tap.api.json b/examples/bin_api/tap.api.json index 7143010..43432c9 100644 --- a/examples/bin_api/tap.api.json +++ b/examples/bin_api/tap.api.json @@ -74,5 +74,5 @@ {"crc" : "0x0df07bc3"} ] ], -"vl_api_version" :"0x1aedb9f2" +"vl_api_version" :"0x4eaa2b5a" } diff --git a/examples/bin_api/tap/tap.go b/examples/bin_api/tap/tap.go index a3d6df7..451bce2 100644 --- a/examples/bin_api/tap/tap.go +++ b/examples/bin_api/tap/tap.go @@ -1,11 +1,11 @@ // Package tap represents the VPP binary API of the 'tap' VPP module. -// DO NOT EDIT. Generated from 'bin_api/tap.api.json' on Thu, 04 May 2017 13:11:57 CEST. +// DO NOT EDIT. Generated from 'bin_api/tap.api.json' package tap import "git.fd.io/govpp.git/api" // VlApiVersion contains version of the API. -const VlAPIVersion = 0x1aedb9f2 +const VlAPIVersion = 0x4eaa2b5a // TapConnect represents the VPP binary API message 'tap_connect'. // Generated from 'bin_api/tap.api.json', line 6: diff --git a/examples/cmd/perf-bench/perf-bench.go b/examples/cmd/perf-bench/perf-bench.go new file mode 100644 index 0000000..e414b20 --- /dev/null +++ b/examples/cmd/perf-bench/perf-bench.go @@ -0,0 +1,162 @@ +// Copyright (c) 2017 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Binary simple-client is an example VPP management application that exercises the +// govpp API on real-world use-cases. +package main + +import ( + "flag" + "fmt" + "log" + "os" + "sync" + "time" + + "github.com/Sirupsen/logrus" + "github.com/pkg/profile" + + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/core" + "git.fd.io/govpp.git/core/bin_api/vpe" +) + +const ( + defaultSyncRequestCount = 1000 + defaultAsyncRequestCount = 1000000 +) + +func main() { + // parse optional flags + var sync, prof bool + var cnt int + flag.BoolVar(&sync, "sync", false, "run synchronous perf test") + flag.IntVar(&cnt, "cnt", 0, "count of requests to be sent to VPP") + flag.BoolVar(&prof, "prof", false, "generate profile data") + flag.Parse() + + if cnt == 0 { + // no specific count defined - use defaults + if sync { + cnt = defaultSyncRequestCount + } else { + cnt = defaultAsyncRequestCount + } + } + + if prof { + defer profile.Start().Stop() + } + + // log only errors + core.SetLogger(&logrus.Logger{Level: logrus.ErrorLevel}) + + // connect to VPP + conn, err := govpp.Connect() + if err != nil { + log.Println("Error:", err) + os.Exit(1) + } + defer conn.Disconnect() + + // create an API channel + ch, err := conn.NewAPIChannelBuffered(cnt, cnt) + if err != nil { + log.Println("Error:", err) + os.Exit(1) + } + defer ch.Close() + + // run the test & measure the time + start := time.Now() + + if sync { + // run synchronous test + syncTest(ch, cnt) + } else { + // run asynchronous test + asyncTest(ch, cnt) + } + + elapsed := time.Since(start) + fmt.Println("Test took:", elapsed) + fmt.Printf("Requests per second: %.0f\n", float64(cnt)/elapsed.Seconds()) +} + +func syncTest(ch *api.Channel, cnt int) { + fmt.Printf("Running synchronous perf test with %d requests...\n", cnt) + + for i := 0; i < cnt; i++ { + req := &vpe.ControlPing{} + reply := &vpe.ControlPingReply{} + + err := ch.SendRequest(req).ReceiveReply(reply) + if err != nil { + log.Println("Error in reply:", err) + os.Exit(1) + } + } +} + +func asyncTest(ch *api.Channel, cnt int) { + fmt.Printf("Running asynchronous perf test with %d requests...\n", cnt) + + // start a new go routine that reads the replies + var wg sync.WaitGroup + wg.Add(1) + go readAsyncReplies(ch, cnt, &wg) + + // send asynchronous requests + sendAsyncRequests(ch, cnt) + + // wait until all replies are recieved + wg.Wait() +} + +func sendAsyncRequests(ch *api.Channel, cnt int) { + for i := 0; i < cnt; i++ { + ch.ReqChan <- &api.VppRequest{ + Message: &vpe.ControlPing{}, + } + } +} + +func readAsyncReplies(ch *api.Channel, expectedCnt int, wg *sync.WaitGroup) { + cnt := 0 + + for { + // receive a reply + reply := <-ch.ReplyChan + if reply.Error != nil { + log.Println("Error in reply:", reply.Error) + os.Exit(1) + } + + // decode the message + msg := &vpe.ControlPingReply{} + err := ch.MsgDecoder.DecodeMsg(reply.Data, msg) + if reply.Error != nil { + log.Println("Error by decoding:", err) + os.Exit(1) + } + + // count and return if done + cnt++ + if cnt >= expectedCnt { + wg.Done() + return + } + } +} diff --git a/examples/cmd/stats-client/stats_client.go b/examples/cmd/stats-client/stats_client.go index fc40b24..ac2176d 100644 --- a/examples/cmd/stats-client/stats_client.go +++ b/examples/cmd/stats-client/stats_client.go @@ -26,7 +26,6 @@ import ( "git.fd.io/govpp.git" "git.fd.io/govpp.git/api" - "git.fd.io/govpp.git/api/ifcounters" "git.fd.io/govpp.git/core" "git.fd.io/govpp.git/core/bin_api/vpe" "git.fd.io/govpp.git/examples/bin_api/interfaces" @@ -55,7 +54,8 @@ func main() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, os.Interrupt) - var subs *api.NotifSubscription + var simpleCountersSubs *api.NotifSubscription + var combinedCountersSubs *api.NotifSubscription var notifChan chan api.Message // loop until Interrupt signal is received @@ -68,8 +68,8 @@ loop: switch connEvent.State { case core.Connected: fmt.Println("VPP connected.") - if subs == nil { - subs, notifChan = subscribeNotification(ch) + if simpleCountersSubs == nil { + simpleCountersSubs, combinedCountersSubs, notifChan = subscribeNotifications(ch) } requestStatistics(ch) @@ -77,9 +77,17 @@ loop: fmt.Println("VPP disconnected.") } - case notifMsg := <-notifChan: - // counter notification received - processCounters(notifMsg.(*interfaces.VnetInterfaceCounters)) + case msg := <-notifChan: + switch notif := msg.(type) { + case *interfaces.VnetInterfaceSimpleCounters: + // simple counter notification received + processSimpleCounters(notif) + case *interfaces.VnetInterfaceCombinedCounters: + // combined counter notification received + processCombinedCounters(notif) + default: + fmt.Println("Ignoring unknown VPP notification") + } case <-sigChan: // interrupt received @@ -88,16 +96,18 @@ loop: } } - ch.UnsubscribeNotification(subs) + ch.UnsubscribeNotification(simpleCountersSubs) + ch.UnsubscribeNotification(combinedCountersSubs) } -// subscribeNotification subscribes for interface counters notifications. -func subscribeNotification(ch *api.Channel) (*api.NotifSubscription, chan api.Message) { +// subscribeNotifications subscribes for interface counters notifications. +func subscribeNotifications(ch *api.Channel) (*api.NotifSubscription, *api.NotifSubscription, chan api.Message) { notifChan := make(chan api.Message, 100) - subs, _ := ch.SubscribeNotification(notifChan, interfaces.NewVnetInterfaceCounters) + simpleCountersSubs, _ := ch.SubscribeNotification(notifChan, interfaces.NewVnetInterfaceSimpleCounters) + combinedCountersSubs, _ := ch.SubscribeNotification(notifChan, interfaces.NewVnetInterfaceCombinedCounters) - return subs, notifChan + return simpleCountersSubs, combinedCountersSubs, notifChan } // requestStatistics requests interface counters notifications from VPP. @@ -108,25 +118,27 @@ func requestStatistics(ch *api.Channel) { }).ReceiveReply(&vpe.WantStatsReply{}) } -// processCounters processes a counter message received from VPP. -func processCounters(msg *interfaces.VnetInterfaceCounters) { - fmt.Printf("%+v\n", msg) - - if msg.IsCombined == 0 { - // simple counter - counters, err := ifcounters.DecodeCounters(ifcounters.VnetInterfaceCounters(*msg)) - if err != nil { - fmt.Println("Error:", err) - } else { - fmt.Printf("%+v\n", counters) - } - } else { - // combined counter - counters, err := ifcounters.DecodeCombinedCounters(ifcounters.VnetInterfaceCounters(*msg)) - if err != nil { - fmt.Println("Error:", err) - } else { - fmt.Printf("%+v\n", counters) - } +// processSimpleCounters processes simple counters received from VPP. +func processSimpleCounters(counters *interfaces.VnetInterfaceSimpleCounters) { + fmt.Printf("%+v\n", counters) + + counterNames := []string{"Drop", "Punt", "IPv4", "IPv6", "RxNoBuf", "RxMiss", "RxError", "TxError", "MPLS"} + + for i := uint32(0); i < counters.Count; i++ { + fmt.Printf("Interface '%d': %s = %d\n", + counters.FirstSwIfIndex+i, counterNames[counters.VnetCounterType], counters.Data[i]) + } +} + +// processCombinedCounters processes combined counters received from VPP. +func processCombinedCounters(counters *interfaces.VnetInterfaceCombinedCounters) { + fmt.Printf("%+v\n", counters) + + counterNames := []string{"Rx", "Tx"} + + for i := uint32(0); i < counters.Count; i++ { + fmt.Printf("Interface '%d': %s packets = %d, %s bytes = %d\n", + counters.FirstSwIfIndex+i, counterNames[counters.VnetCounterType], counters.Data[i].Packets, + counterNames[counters.VnetCounterType], counters.Data[i].Bytes) } } |