diff options
Diffstat (limited to 'binapi')
335 files changed, 33433 insertions, 22200 deletions
diff --git a/binapi/abf/abf.ba.go b/binapi/abf/abf.ba.go index 2b28afe..e523e8f 100644 --- a/binapi/abf/abf.ba.go +++ b/binapi/abf/abf.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/abf.api.json // Package abf contains generated bindings for API file abf.api. @@ -13,11 +13,11 @@ package abf import ( - api "git.fd.io/govpp.git/api" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - _ "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + fib_types "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "abf" APIVersion = "1.0.0" - VersionCrc = 0x460b09b9 + VersionCrc = 0xf2367b47 ) // AbfItfAttach defines type 'abf_itf_attach'. @@ -49,6 +49,7 @@ type AbfPolicy struct { } // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'. +// InProgress: the message form may change in the future versions type AbfItfAttachAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` @@ -95,6 +96,7 @@ func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error { } // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'. +// InProgress: the message form may change in the future versions type AbfItfAttachAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -128,6 +130,7 @@ func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error { } // AbfItfAttachDetails defines message 'abf_itf_attach_details'. +// InProgress: the message form may change in the future versions type AbfItfAttachDetails struct { Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` } @@ -170,6 +173,7 @@ func (m *AbfItfAttachDetails) Unmarshal(b []byte) error { } // AbfItfAttachDump defines message 'abf_itf_attach_dump'. +// InProgress: the message form may change in the future versions type AbfItfAttachDump struct{} func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} } @@ -197,6 +201,7 @@ func (m *AbfItfAttachDump) Unmarshal(b []byte) error { } // AbfPluginGetVersion defines message 'abf_plugin_get_version'. +// InProgress: the message form may change in the future versions type AbfPluginGetVersion struct{} func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} } @@ -224,6 +229,7 @@ func (m *AbfPluginGetVersion) Unmarshal(b []byte) error { } // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'. +// InProgress: the message form may change in the future versions type AbfPluginGetVersionReply struct { Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` @@ -261,6 +267,7 @@ func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error { } // AbfPolicyAddDel defines message 'abf_policy_add_del'. +// InProgress: the message form may change in the future versions type AbfPolicyAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` @@ -268,7 +275,7 @@ type AbfPolicyAddDel struct { func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} } func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" } -func (*AbfPolicyAddDel) GetCrcString() string { return "ee66f93e" } +func (*AbfPolicyAddDel) GetCrcString() string { return "c6131197" } func (*AbfPolicyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -377,6 +384,7 @@ func (m *AbfPolicyAddDel) Unmarshal(b []byte) error { } // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'. +// InProgress: the message form may change in the future versions type AbfPolicyAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -410,13 +418,14 @@ func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error { } // AbfPolicyDetails defines message 'abf_policy_details'. +// InProgress: the message form may change in the future versions type AbfPolicyDetails struct { Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` } func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} } func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" } -func (*AbfPolicyDetails) GetCrcString() string { return "6769e504" } +func (*AbfPolicyDetails) GetCrcString() string { return "b7487fa4" } func (*AbfPolicyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -522,6 +531,7 @@ func (m *AbfPolicyDetails) Unmarshal(b []byte) error { } // AbfPolicyDump defines message 'abf_policy_dump'. +// InProgress: the message form may change in the future versions type AbfPolicyDump struct{} func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} } @@ -556,9 +566,9 @@ func file_abf_binapi_init() { api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14") api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14") api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86") - api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e") + api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_c6131197") api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804") - api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504") + api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_b7487fa4") api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14") } diff --git a/binapi/abf/abf_rest.ba.go b/binapi/abf/abf_rest.ba.go deleted file mode 100644 index e05e834..0000000 --- a/binapi/abf/abf_rest.ba.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package abf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/abf_itf_attach_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfItfAttachAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AbfItfAttachAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/abf_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfPluginGetVersion) - reply, err := rpc.AbfPluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/abf_policy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfPolicyAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AbfPolicyAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/abf/abf_rpc.ba.go b/binapi/abf/abf_rpc.ba.go index 76a88c6..d6e7738 100644 --- a/binapi/abf/abf_rpc.ba.go +++ b/binapi/abf/abf_rpc.ba.go @@ -5,12 +5,13 @@ package abf import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service abf. +// RPCService defines RPC service abf. type RPCService interface { AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) @@ -33,7 +34,7 @@ func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttach if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) { @@ -45,7 +46,7 @@ func (c *serviceClient) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -68,7 +69,11 @@ func (c *serviceClient_AbfItfAttachDumpClient) Recv() (*AbfItfAttachDetails, err switch m := msg.(type) { case *AbfItfAttachDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -90,7 +95,7 @@ func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) { @@ -102,7 +107,7 @@ func (c *serviceClient) AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -125,7 +130,11 @@ func (c *serviceClient_AbfPolicyDumpClient) Recv() (*AbfPolicyDetails, error) { switch m := msg.(type) { case *AbfPolicyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/acl/acl.ba.go b/binapi/acl/acl.ba.go index 1f47a01..958593f 100644 --- a/binapi/acl/acl.ba.go +++ b/binapi/acl/acl.ba.go @@ -1,23 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/acl.api.json // Package acl contains generated bindings for API file acl.api. // // Contents: -// 38 messages +// 42 messages // package acl import ( - api "git.fd.io/govpp.git/api" - acl_types "git.fd.io/govpp.git/binapi/acl_types" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + acl_types "go.fd.io/govpp/binapi/acl_types" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,8 +28,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "acl" - APIVersion = "2.0.0" - VersionCrc = 0x68c4cb37 + APIVersion = "2.0.1" + VersionCrc = 0x5133bba0 ) // ACLAddReplace defines message 'acl_add_replace'. @@ -42,7 +42,7 @@ type ACLAddReplace struct { func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } -func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } +func (*ACLAddReplace) GetCrcString() string { return "ee5c2f18" } func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } @@ -245,7 +245,7 @@ type ACLDetails struct { func (m *ACLDetails) Reset() { *m = ACLDetails{} } func (*ACLDetails) GetMessageName() string { return "acl_details" } -func (*ACLDetails) GetCrcString() string { return "7a97f21c" } +func (*ACLDetails) GetCrcString() string { return "95babae0" } func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1000,6 +1000,140 @@ func (m *ACLPluginGetVersionReply) Unmarshal(b []byte) error { return nil } +// ACLPluginUseHashLookupGet defines message 'acl_plugin_use_hash_lookup_get'. +// InProgress: the message form may change in the future versions +type ACLPluginUseHashLookupGet struct{} + +func (m *ACLPluginUseHashLookupGet) Reset() { *m = ACLPluginUseHashLookupGet{} } +func (*ACLPluginUseHashLookupGet) GetMessageName() string { return "acl_plugin_use_hash_lookup_get" } +func (*ACLPluginUseHashLookupGet) GetCrcString() string { return "51077d14" } +func (*ACLPluginUseHashLookupGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginUseHashLookupGet) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *ACLPluginUseHashLookupGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *ACLPluginUseHashLookupGet) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginUseHashLookupGetReply defines message 'acl_plugin_use_hash_lookup_get_reply'. +// InProgress: the message form may change in the future versions +type ACLPluginUseHashLookupGetReply struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLPluginUseHashLookupGetReply) Reset() { *m = ACLPluginUseHashLookupGetReply{} } +func (*ACLPluginUseHashLookupGetReply) GetMessageName() string { + return "acl_plugin_use_hash_lookup_get_reply" +} +func (*ACLPluginUseHashLookupGetReply) GetCrcString() string { return "5392ad31" } +func (*ACLPluginUseHashLookupGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginUseHashLookupGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Enable + return size +} +func (m *ACLPluginUseHashLookupGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ACLPluginUseHashLookupGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// ACLPluginUseHashLookupSet defines message 'acl_plugin_use_hash_lookup_set'. +// InProgress: the message form may change in the future versions +type ACLPluginUseHashLookupSet struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLPluginUseHashLookupSet) Reset() { *m = ACLPluginUseHashLookupSet{} } +func (*ACLPluginUseHashLookupSet) GetMessageName() string { return "acl_plugin_use_hash_lookup_set" } +func (*ACLPluginUseHashLookupSet) GetCrcString() string { return "b3e225d2" } +func (*ACLPluginUseHashLookupSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginUseHashLookupSet) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Enable + return size +} +func (m *ACLPluginUseHashLookupSet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ACLPluginUseHashLookupSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// ACLPluginUseHashLookupSetReply defines message 'acl_plugin_use_hash_lookup_set_reply'. +// InProgress: the message form may change in the future versions +type ACLPluginUseHashLookupSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLPluginUseHashLookupSetReply) Reset() { *m = ACLPluginUseHashLookupSetReply{} } +func (*ACLPluginUseHashLookupSetReply) GetMessageName() string { + return "acl_plugin_use_hash_lookup_set_reply" +} +func (*ACLPluginUseHashLookupSetReply) GetCrcString() string { return "e8d4e804" } +func (*ACLPluginUseHashLookupSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginUseHashLookupSetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *ACLPluginUseHashLookupSetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *ACLPluginUseHashLookupSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // ACLStatsIntfCountersEnable defines message 'acl_stats_intf_counters_enable'. type ACLStatsIntfCountersEnable struct { Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` @@ -1077,7 +1211,7 @@ type MacipACLAdd struct { func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } -func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } +func (*MacipACLAdd) GetCrcString() string { return "ce6fbad0" } func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1150,7 +1284,7 @@ type MacipACLAddReplace struct { func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } -func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } +func (*MacipACLAddReplace) GetCrcString() string { return "2a461dd4" } func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1366,7 +1500,7 @@ type MacipACLDetails struct { func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } -func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } +func (*MacipACLDetails) GetCrcString() string { return "27135b59" } func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1701,11 +1835,11 @@ func (m *MacipACLInterfaceListDump) Unmarshal(b []byte) error { func init() { file_acl_binapi_init() } func file_acl_binapi_init() { - api.RegisterMessage((*ACLAddReplace)(nil), "acl_add_replace_1cabdeab") + api.RegisterMessage((*ACLAddReplace)(nil), "acl_add_replace_ee5c2f18") api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl_add_replace_reply_ac407b0c") api.RegisterMessage((*ACLDel)(nil), "acl_del_ef34fea4") api.RegisterMessage((*ACLDelReply)(nil), "acl_del_reply_e8d4e804") - api.RegisterMessage((*ACLDetails)(nil), "acl_details_7a97f21c") + api.RegisterMessage((*ACLDetails)(nil), "acl_details_95babae0") api.RegisterMessage((*ACLDump)(nil), "acl_dump_ef34fea4") api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl_interface_add_del_4b54bebd") api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl_interface_add_del_reply_e8d4e804") @@ -1723,15 +1857,19 @@ func file_acl_binapi_init() { api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl_plugin_get_conn_table_max_entries_reply_7a096d3d") api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl_plugin_get_version_51077d14") api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*ACLPluginUseHashLookupGet)(nil), "acl_plugin_use_hash_lookup_get_51077d14") + api.RegisterMessage((*ACLPluginUseHashLookupGetReply)(nil), "acl_plugin_use_hash_lookup_get_reply_5392ad31") + api.RegisterMessage((*ACLPluginUseHashLookupSet)(nil), "acl_plugin_use_hash_lookup_set_b3e225d2") + api.RegisterMessage((*ACLPluginUseHashLookupSetReply)(nil), "acl_plugin_use_hash_lookup_set_reply_e8d4e804") api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl_stats_intf_counters_enable_b3e225d2") api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl_stats_intf_counters_enable_reply_e8d4e804") - api.RegisterMessage((*MacipACLAdd)(nil), "macip_acl_add_d648fd0a") - api.RegisterMessage((*MacipACLAddReplace)(nil), "macip_acl_add_replace_e34402a7") + api.RegisterMessage((*MacipACLAdd)(nil), "macip_acl_add_ce6fbad0") + api.RegisterMessage((*MacipACLAddReplace)(nil), "macip_acl_add_replace_2a461dd4") api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "macip_acl_add_replace_reply_ac407b0c") api.RegisterMessage((*MacipACLAddReply)(nil), "macip_acl_add_reply_ac407b0c") api.RegisterMessage((*MacipACLDel)(nil), "macip_acl_del_ef34fea4") api.RegisterMessage((*MacipACLDelReply)(nil), "macip_acl_del_reply_e8d4e804") - api.RegisterMessage((*MacipACLDetails)(nil), "macip_acl_details_57c7482f") + api.RegisterMessage((*MacipACLDetails)(nil), "macip_acl_details_27135b59") api.RegisterMessage((*MacipACLDump)(nil), "macip_acl_dump_ef34fea4") api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "macip_acl_interface_add_del_4b8690b1") api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "macip_acl_interface_add_del_reply_e8d4e804") @@ -1766,6 +1904,10 @@ func AllMessages() []api.Message { (*ACLPluginGetConnTableMaxEntriesReply)(nil), (*ACLPluginGetVersion)(nil), (*ACLPluginGetVersionReply)(nil), + (*ACLPluginUseHashLookupGet)(nil), + (*ACLPluginUseHashLookupGetReply)(nil), + (*ACLPluginUseHashLookupSet)(nil), + (*ACLPluginUseHashLookupSetReply)(nil), (*ACLStatsIntfCountersEnable)(nil), (*ACLStatsIntfCountersEnableReply)(nil), (*MacipACLAdd)(nil), diff --git a/binapi/acl/acl_rest.ba.go b/binapi/acl/acl_rest.ba.go deleted file mode 100644 index 0dd8c94..0000000 --- a/binapi/acl/acl_rest.ba.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package acl - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/acl_add_replace", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLAddReplace) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLAddReplace(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLInterfaceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_interface_set_acl_list", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceSetACLList) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLInterfaceSetACLList(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_interface_set_etype_whitelist", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceSetEtypeWhitelist) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLInterfaceSetEtypeWhitelist(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginControlPing) - reply, err := rpc.ACLPluginControlPing(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_plugin_get_conn_table_max_entries", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginGetConnTableMaxEntries) - reply, err := rpc.ACLPluginGetConnTableMaxEntries(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginGetVersion) - reply, err := rpc.ACLPluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/acl_stats_intf_counters_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLStatsIntfCountersEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ACLStatsIntfCountersEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/macip_acl_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MacipACLAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/macip_acl_add_replace", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLAddReplace) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MacipACLAddReplace(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/macip_acl_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MacipACLDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/macip_acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLInterfaceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MacipACLInterfaceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/macip_acl_interface_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLInterfaceGet) - reply, err := rpc.MacipACLInterfaceGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/acl/acl_rpc.ba.go b/binapi/acl/acl_rpc.ba.go index a69df27..2269ba8 100644 --- a/binapi/acl/acl_rpc.ba.go +++ b/binapi/acl/acl_rpc.ba.go @@ -5,12 +5,13 @@ package acl import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service acl. +// RPCService defines RPC service acl. type RPCService interface { ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) @@ -23,6 +24,8 @@ type RPCService interface { ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLPluginUseHashLookupGet(ctx context.Context, in *ACLPluginUseHashLookupGet) (*ACLPluginUseHashLookupGetReply, error) + ACLPluginUseHashLookupSet(ctx context.Context, in *ACLPluginUseHashLookupSet) (*ACLPluginUseHashLookupSetReply, error) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) @@ -47,7 +50,7 @@ func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { @@ -56,7 +59,7 @@ func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, e if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) { @@ -68,7 +71,7 @@ func (c *serviceClient) ACLDump(ctx context.Context, in *ACLDump) (RPCService_AC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -91,7 +94,11 @@ func (c *serviceClient_ACLDumpClient) Recv() (*ACLDetails, error) { switch m := msg.(type) { case *ACLDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -104,7 +111,7 @@ func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) { @@ -116,7 +123,7 @@ func (c *serviceClient) ACLInterfaceEtypeWhitelistDump(ctx context.Context, in * if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -139,7 +146,11 @@ func (c *serviceClient_ACLInterfaceEtypeWhitelistDumpClient) Recv() (*ACLInterfa switch m := msg.(type) { case *ACLInterfaceEtypeWhitelistDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -155,7 +166,7 @@ func (c *serviceClient) ACLInterfaceListDump(ctx context.Context, in *ACLInterfa if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -178,7 +189,11 @@ func (c *serviceClient_ACLInterfaceListDumpClient) Recv() (*ACLInterfaceListDeta switch m := msg.(type) { case *ACLInterfaceListDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -191,7 +206,7 @@ func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { @@ -200,7 +215,7 @@ func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { @@ -209,7 +224,7 @@ func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { @@ -230,13 +245,31 @@ func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGe return out, nil } +func (c *serviceClient) ACLPluginUseHashLookupGet(ctx context.Context, in *ACLPluginUseHashLookupGet) (*ACLPluginUseHashLookupGetReply, error) { + out := new(ACLPluginUseHashLookupGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginUseHashLookupSet(ctx context.Context, in *ACLPluginUseHashLookupSet) (*ACLPluginUseHashLookupSetReply, error) { + out := new(ACLPluginUseHashLookupSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { out := new(ACLStatsIntfCountersEnableReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { @@ -245,7 +278,7 @@ func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*Maci if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { @@ -254,7 +287,7 @@ func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddR if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { @@ -263,7 +296,7 @@ func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*Maci if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) { @@ -275,7 +308,7 @@ func (c *serviceClient) MacipACLDump(ctx context.Context, in *MacipACLDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -298,7 +331,11 @@ func (c *serviceClient_MacipACLDumpClient) Recv() (*MacipACLDetails, error) { switch m := msg.(type) { case *MacipACLDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -311,7 +348,7 @@ func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipAC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { @@ -332,7 +369,7 @@ func (c *serviceClient) MacipACLInterfaceListDump(ctx context.Context, in *Macip if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -355,7 +392,11 @@ func (c *serviceClient_MacipACLInterfaceListDumpClient) Recv() (*MacipACLInterfa switch m := msg.(type) { case *MacipACLInterfaceListDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/acl_types/acl_types.ba.go b/binapi/acl_types/acl_types.ba.go index 5371e22..0953447 100644 --- a/binapi/acl_types/acl_types.ba.go +++ b/binapi/acl_types/acl_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/acl_types.api.json // Package acl_types contains generated bindings for API file acl_types.api. @@ -13,10 +13,11 @@ package acl_types import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + ip_types "go.fd.io/govpp/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -25,6 +26,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "acl_types" + APIVersion = "1.0.0" + VersionCrc = 0x878da4fa +) + // ACLAction defines enum 'acl_action'. type ACLAction uint8 diff --git a/binapi/adl/adl.ba.go b/binapi/adl/adl.ba.go new file mode 100644 index 0000000..0446c88 --- /dev/null +++ b/binapi/adl/adl.ba.go @@ -0,0 +1,208 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/adl.api.json + +// Package adl contains generated bindings for API file adl.api. +// +// Contents: +// 4 messages +// +package adl + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "adl" + APIVersion = "0.0.1" + VersionCrc = 0xb752b7a2 +) + +// AdlAllowlistEnableDisable defines message 'adl_allowlist_enable_disable'. +// InProgress: the message form may change in the future versions +type AdlAllowlistEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + FibID uint32 `binapi:"u32,name=fib_id" json:"fib_id,omitempty"` + IP4 bool `binapi:"bool,name=ip4" json:"ip4,omitempty"` + IP6 bool `binapi:"bool,name=ip6" json:"ip6,omitempty"` + DefaultAdl bool `binapi:"bool,name=default_adl" json:"default_adl,omitempty"` +} + +func (m *AdlAllowlistEnableDisable) Reset() { *m = AdlAllowlistEnableDisable{} } +func (*AdlAllowlistEnableDisable) GetMessageName() string { return "adl_allowlist_enable_disable" } +func (*AdlAllowlistEnableDisable) GetCrcString() string { return "ea88828d" } +func (*AdlAllowlistEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AdlAllowlistEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.FibID + size += 1 // m.IP4 + size += 1 // m.IP6 + size += 1 // m.DefaultAdl + return size +} +func (m *AdlAllowlistEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.FibID) + buf.EncodeBool(m.IP4) + buf.EncodeBool(m.IP6) + buf.EncodeBool(m.DefaultAdl) + return buf.Bytes(), nil +} +func (m *AdlAllowlistEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.FibID = buf.DecodeUint32() + m.IP4 = buf.DecodeBool() + m.IP6 = buf.DecodeBool() + m.DefaultAdl = buf.DecodeBool() + return nil +} + +// AdlAllowlistEnableDisableReply defines message 'adl_allowlist_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type AdlAllowlistEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AdlAllowlistEnableDisableReply) Reset() { *m = AdlAllowlistEnableDisableReply{} } +func (*AdlAllowlistEnableDisableReply) GetMessageName() string { + return "adl_allowlist_enable_disable_reply" +} +func (*AdlAllowlistEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*AdlAllowlistEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AdlAllowlistEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *AdlAllowlistEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *AdlAllowlistEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// AdlInterfaceEnableDisable defines message 'adl_interface_enable_disable'. +// InProgress: the message form may change in the future versions +type AdlInterfaceEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *AdlInterfaceEnableDisable) Reset() { *m = AdlInterfaceEnableDisable{} } +func (*AdlInterfaceEnableDisable) GetMessageName() string { return "adl_interface_enable_disable" } +func (*AdlInterfaceEnableDisable) GetCrcString() string { return "5501adee" } +func (*AdlInterfaceEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AdlInterfaceEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *AdlInterfaceEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *AdlInterfaceEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// AdlInterfaceEnableDisableReply defines message 'adl_interface_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type AdlInterfaceEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AdlInterfaceEnableDisableReply) Reset() { *m = AdlInterfaceEnableDisableReply{} } +func (*AdlInterfaceEnableDisableReply) GetMessageName() string { + return "adl_interface_enable_disable_reply" +} +func (*AdlInterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*AdlInterfaceEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AdlInterfaceEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *AdlInterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *AdlInterfaceEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_adl_binapi_init() } +func file_adl_binapi_init() { + api.RegisterMessage((*AdlAllowlistEnableDisable)(nil), "adl_allowlist_enable_disable_ea88828d") + api.RegisterMessage((*AdlAllowlistEnableDisableReply)(nil), "adl_allowlist_enable_disable_reply_e8d4e804") + api.RegisterMessage((*AdlInterfaceEnableDisable)(nil), "adl_interface_enable_disable_5501adee") + api.RegisterMessage((*AdlInterfaceEnableDisableReply)(nil), "adl_interface_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AdlAllowlistEnableDisable)(nil), + (*AdlAllowlistEnableDisableReply)(nil), + (*AdlInterfaceEnableDisable)(nil), + (*AdlInterfaceEnableDisableReply)(nil), + } +} diff --git a/binapi/adl/adl_rpc.ba.go b/binapi/adl/adl_rpc.ba.go new file mode 100644 index 0000000..4ccc936 --- /dev/null +++ b/binapi/adl/adl_rpc.ba.go @@ -0,0 +1,41 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package adl + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service adl. +type RPCService interface { + AdlAllowlistEnableDisable(ctx context.Context, in *AdlAllowlistEnableDisable) (*AdlAllowlistEnableDisableReply, error) + AdlInterfaceEnableDisable(ctx context.Context, in *AdlInterfaceEnableDisable) (*AdlInterfaceEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AdlAllowlistEnableDisable(ctx context.Context, in *AdlAllowlistEnableDisable) (*AdlAllowlistEnableDisableReply, error) { + out := new(AdlAllowlistEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AdlInterfaceEnableDisable(ctx context.Context, in *AdlInterfaceEnableDisable) (*AdlInterfaceEnableDisableReply, error) { + out := new(AdlInterfaceEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go index 750e2ce..fb8ff38 100644 --- a/binapi/af_packet/af_packet.ba.go +++ b/binapi/af_packet/af_packet.ba.go @@ -1,21 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/af_packet.api.json // Package af_packet contains generated bindings for API file af_packet.api. // // Contents: -// 8 messages +// 10 messages // package af_packet import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "af_packet" APIVersion = "2.0.0" - VersionCrc = 0xe0b6c022 + VersionCrc = 0x589bd50e ) // AfPacketCreate defines message 'af_packet_create'. @@ -108,6 +108,108 @@ func (m *AfPacketCreateReply) Unmarshal(b []byte) error { return nil } +// AfPacketCreateV2 defines message 'af_packet_create_v2'. +type AfPacketCreateV2 struct { + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` + RxFrameSize uint32 `binapi:"u32,name=rx_frame_size" json:"rx_frame_size,omitempty"` + TxFrameSize uint32 `binapi:"u32,name=tx_frame_size" json:"tx_frame_size,omitempty"` + RxFramesPerBlock uint32 `binapi:"u32,name=rx_frames_per_block" json:"rx_frames_per_block,omitempty"` + TxFramesPerBlock uint32 `binapi:"u32,name=tx_frames_per_block" json:"tx_frames_per_block,omitempty"` + Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` + NumRxQueues uint16 `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` +} + +func (m *AfPacketCreateV2) Reset() { *m = AfPacketCreateV2{} } +func (*AfPacketCreateV2) GetMessageName() string { return "af_packet_create_v2" } +func (*AfPacketCreateV2) GetCrcString() string { return "4aff0436" } +func (*AfPacketCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketCreateV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 6 // m.HwAddr + size += 1 // m.UseRandomHwAddr + size += 64 // m.HostIfName + size += 4 // m.RxFrameSize + size += 4 // m.TxFrameSize + size += 4 // m.RxFramesPerBlock + size += 4 // m.TxFramesPerBlock + size += 4 // m.Flags + size += 2 // m.NumRxQueues + return size +} +func (m *AfPacketCreateV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeBool(m.UseRandomHwAddr) + buf.EncodeString(m.HostIfName, 64) + buf.EncodeUint32(m.RxFrameSize) + buf.EncodeUint32(m.TxFrameSize) + buf.EncodeUint32(m.RxFramesPerBlock) + buf.EncodeUint32(m.TxFramesPerBlock) + buf.EncodeUint32(m.Flags) + buf.EncodeUint16(m.NumRxQueues) + return buf.Bytes(), nil +} +func (m *AfPacketCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.UseRandomHwAddr = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + m.RxFrameSize = buf.DecodeUint32() + m.TxFrameSize = buf.DecodeUint32() + m.RxFramesPerBlock = buf.DecodeUint32() + m.TxFramesPerBlock = buf.DecodeUint32() + m.Flags = buf.DecodeUint32() + m.NumRxQueues = buf.DecodeUint16() + return nil +} + +// AfPacketCreateV2Reply defines message 'af_packet_create_v2_reply'. +type AfPacketCreateV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfPacketCreateV2Reply) Reset() { *m = AfPacketCreateV2Reply{} } +func (*AfPacketCreateV2Reply) GetMessageName() string { return "af_packet_create_v2_reply" } +func (*AfPacketCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketCreateV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfPacketCreateV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfPacketCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // AfPacketDelete defines message 'af_packet_delete'. type AfPacketDelete struct { HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` @@ -314,6 +416,8 @@ func init() { file_af_packet_binapi_init() } func file_af_packet_binapi_init() { api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f") api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f") + api.RegisterMessage((*AfPacketCreateV2)(nil), "af_packet_create_v2_4aff0436") + api.RegisterMessage((*AfPacketCreateV2Reply)(nil), "af_packet_create_v2_reply_5383d31f") api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648") api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804") api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042") @@ -327,6 +431,8 @@ func AllMessages() []api.Message { return []api.Message{ (*AfPacketCreate)(nil), (*AfPacketCreateReply)(nil), + (*AfPacketCreateV2)(nil), + (*AfPacketCreateV2Reply)(nil), (*AfPacketDelete)(nil), (*AfPacketDeleteReply)(nil), (*AfPacketDetails)(nil), diff --git a/binapi/af_packet/af_packet_rest.ba.go b/binapi/af_packet/af_packet_rest.ba.go deleted file mode 100644 index e6c498c..0000000 --- a/binapi/af_packet/af_packet_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package af_packet - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/af_packet_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AfPacketCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/af_packet_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AfPacketDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/af_packet_set_l4_cksum_offload", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketSetL4CksumOffload) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AfPacketSetL4CksumOffload(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/af_packet/af_packet_rpc.ba.go b/binapi/af_packet/af_packet_rpc.ba.go index 72fea67..de21ce0 100644 --- a/binapi/af_packet/af_packet_rpc.ba.go +++ b/binapi/af_packet/af_packet_rpc.ba.go @@ -5,14 +5,16 @@ package af_packet import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service af_packet. +// RPCService defines RPC service af_packet. type RPCService interface { AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketCreateV2(ctx context.Context, in *AfPacketCreateV2) (*AfPacketCreateV2Reply, error) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) @@ -32,7 +34,16 @@ func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AfPacketCreateV2(ctx context.Context, in *AfPacketCreateV2) (*AfPacketCreateV2Reply, error) { + out := new(AfPacketCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { @@ -41,7 +52,7 @@ func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) { @@ -53,7 +64,7 @@ func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -76,7 +87,11 @@ func (c *serviceClient_AfPacketDumpClient) Recv() (*AfPacketDetails, error) { switch m := msg.(type) { case *AfPacketDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -89,5 +104,5 @@ func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/af_xdp/af_xdp.ba.go b/binapi/af_xdp/af_xdp.ba.go new file mode 100644 index 0000000..c5a7a05 --- /dev/null +++ b/binapi/af_xdp/af_xdp.ba.go @@ -0,0 +1,394 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/af_xdp.api.json + +// Package af_xdp contains generated bindings for API file af_xdp.api. +// +// Contents: +// 2 enums +// 6 messages +// +package af_xdp + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "af_xdp" + APIVersion = "1.0.0" + VersionCrc = 0x346626ce +) + +// AfXdpMode defines enum 'af_xdp_mode'. +type AfXdpMode uint32 + +const ( + AF_XDP_API_MODE_AUTO AfXdpMode = 0 + AF_XDP_API_MODE_COPY AfXdpMode = 1 + AF_XDP_API_MODE_ZERO_COPY AfXdpMode = 2 +) + +var ( + AfXdpMode_name = map[uint32]string{ + 0: "AF_XDP_API_MODE_AUTO", + 1: "AF_XDP_API_MODE_COPY", + 2: "AF_XDP_API_MODE_ZERO_COPY", + } + AfXdpMode_value = map[string]uint32{ + "AF_XDP_API_MODE_AUTO": 0, + "AF_XDP_API_MODE_COPY": 1, + "AF_XDP_API_MODE_ZERO_COPY": 2, + } +) + +func (x AfXdpMode) String() string { + s, ok := AfXdpMode_name[uint32(x)] + if ok { + return s + } + return "AfXdpMode(" + strconv.Itoa(int(x)) + ")" +} + +// AfXdpFlag defines enum 'af_xdp_flag'. +type AfXdpFlag uint8 + +const ( + AF_XDP_API_FLAGS_NO_SYSCALL_LOCK AfXdpFlag = 1 +) + +var ( + AfXdpFlag_name = map[uint8]string{ + 1: "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK", + } + AfXdpFlag_value = map[string]uint8{ + "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK": 1, + } +) + +func (x AfXdpFlag) String() string { + s, ok := AfXdpFlag_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := AfXdpFlag_name[uint8(n)] + if ok { + return s + } + return "AfXdpFlag(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// AfXdpCreate defines message 'af_xdp_create'. +type AfXdpCreate struct { + HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"` + Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"` + Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"` + Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"` +} + +func (m *AfXdpCreate) Reset() { *m = AfXdpCreate{} } +func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" } +func (*AfXdpCreate) GetCrcString() string { return "21226c99" } +func (*AfXdpCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfXdpCreate) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.HostIf + size += 64 // m.Name + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + size += 4 // m.Mode + size += 1 // m.Flags + size += 256 // m.Prog + return size +} +func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.HostIf, 64) + buf.EncodeString(m.Name, 64) + buf.EncodeUint16(m.RxqNum) + buf.EncodeUint16(m.RxqSize) + buf.EncodeUint16(m.TxqSize) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeString(m.Prog, 256) + return buf.Bytes(), nil +} +func (m *AfXdpCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIf = buf.DecodeString(64) + m.Name = buf.DecodeString(64) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.Mode = AfXdpMode(buf.DecodeUint32()) + m.Flags = AfXdpFlag(buf.DecodeUint8()) + m.Prog = buf.DecodeString(256) + return nil +} + +// AfXdpCreateReply defines message 'af_xdp_create_reply'. +type AfXdpCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfXdpCreateReply) Reset() { *m = AfXdpCreateReply{} } +func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" } +func (*AfXdpCreateReply) GetCrcString() string { return "5383d31f" } +func (*AfXdpCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfXdpCreateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfXdpCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AfXdpCreateV2 defines message 'af_xdp_create_v2'. +type AfXdpCreateV2 struct { + HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"` + Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"` + Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"` + Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"` + Namespace string `binapi:"string[64],name=namespace" json:"namespace,omitempty"` +} + +func (m *AfXdpCreateV2) Reset() { *m = AfXdpCreateV2{} } +func (*AfXdpCreateV2) GetMessageName() string { return "af_xdp_create_v2" } +func (*AfXdpCreateV2) GetCrcString() string { return "e17ec2eb" } +func (*AfXdpCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfXdpCreateV2) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.HostIf + size += 64 // m.Name + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + size += 4 // m.Mode + size += 1 // m.Flags + size += 256 // m.Prog + size += 64 // m.Namespace + return size +} +func (m *AfXdpCreateV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.HostIf, 64) + buf.EncodeString(m.Name, 64) + buf.EncodeUint16(m.RxqNum) + buf.EncodeUint16(m.RxqSize) + buf.EncodeUint16(m.TxqSize) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeString(m.Prog, 256) + buf.EncodeString(m.Namespace, 64) + return buf.Bytes(), nil +} +func (m *AfXdpCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIf = buf.DecodeString(64) + m.Name = buf.DecodeString(64) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.Mode = AfXdpMode(buf.DecodeUint32()) + m.Flags = AfXdpFlag(buf.DecodeUint8()) + m.Prog = buf.DecodeString(256) + m.Namespace = buf.DecodeString(64) + return nil +} + +// AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'. +type AfXdpCreateV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfXdpCreateV2Reply) Reset() { *m = AfXdpCreateV2Reply{} } +func (*AfXdpCreateV2Reply) GetMessageName() string { return "af_xdp_create_v2_reply" } +func (*AfXdpCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*AfXdpCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfXdpCreateV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfXdpCreateV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AfXdpDelete defines message 'af_xdp_delete'. +type AfXdpDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfXdpDelete) Reset() { *m = AfXdpDelete{} } +func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" } +func (*AfXdpDelete) GetCrcString() string { return "f9e6675e" } +func (*AfXdpDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfXdpDelete) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfXdpDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AfXdpDeleteReply defines message 'af_xdp_delete_reply'. +type AfXdpDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfXdpDeleteReply) Reset() { *m = AfXdpDeleteReply{} } +func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" } +func (*AfXdpDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AfXdpDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfXdpDeleteReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *AfXdpDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_af_xdp_binapi_init() } +func file_af_xdp_binapi_init() { + api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99") + api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f") + api.RegisterMessage((*AfXdpCreateV2)(nil), "af_xdp_create_v2_e17ec2eb") + api.RegisterMessage((*AfXdpCreateV2Reply)(nil), "af_xdp_create_v2_reply_5383d31f") + api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e") + api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfXdpCreate)(nil), + (*AfXdpCreateReply)(nil), + (*AfXdpCreateV2)(nil), + (*AfXdpCreateV2Reply)(nil), + (*AfXdpDelete)(nil), + (*AfXdpDeleteReply)(nil), + } +} diff --git a/binapi/af_xdp/af_xdp_rpc.ba.go b/binapi/af_xdp/af_xdp_rpc.ba.go new file mode 100644 index 0000000..32ee634 --- /dev/null +++ b/binapi/af_xdp/af_xdp_rpc.ba.go @@ -0,0 +1,51 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_xdp + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service af_xdp. +type RPCService interface { + AfXdpCreate(ctx context.Context, in *AfXdpCreate) (*AfXdpCreateReply, error) + AfXdpCreateV2(ctx context.Context, in *AfXdpCreateV2) (*AfXdpCreateV2Reply, error) + AfXdpDelete(ctx context.Context, in *AfXdpDelete) (*AfXdpDeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AfXdpCreate(ctx context.Context, in *AfXdpCreate) (*AfXdpCreateReply, error) { + out := new(AfXdpCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AfXdpCreateV2(ctx context.Context, in *AfXdpCreateV2) (*AfXdpCreateV2Reply, error) { + out := new(AfXdpCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AfXdpDelete(ctx context.Context, in *AfXdpDelete) (*AfXdpDeleteReply, error) { + out := new(AfXdpDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/arp/arp.ba.go b/binapi/arp/arp.ba.go index 90ff55b..2f86d31 100644 --- a/binapi/arp/arp.ba.go +++ b/binapi/arp/arp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/arp.api.json // Package arp contains generated bindings for API file arp.api. @@ -13,11 +13,11 @@ package arp import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "arp" APIVersion = "1.0.0" - VersionCrc = 0x79ca86f2 + VersionCrc = 0xb57796ae ) // ProxyArp defines type 'proxy_arp'. @@ -47,7 +47,7 @@ type ProxyArpAddDel struct { func (m *ProxyArpAddDel) Reset() { *m = ProxyArpAddDel{} } func (*ProxyArpAddDel) GetMessageName() string { return "proxy_arp_add_del" } -func (*ProxyArpAddDel) GetCrcString() string { return "85486cbd" } +func (*ProxyArpAddDel) GetCrcString() string { return "1823c3e7" } func (*ProxyArpAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -122,7 +122,7 @@ type ProxyArpDetails struct { func (m *ProxyArpDetails) Reset() { *m = ProxyArpDetails{} } func (*ProxyArpDetails) GetMessageName() string { return "proxy_arp_details" } -func (*ProxyArpDetails) GetCrcString() string { return "9228c150" } +func (*ProxyArpDetails) GetCrcString() string { return "5b948673" } func (*ProxyArpDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -315,9 +315,9 @@ func (m *ProxyArpIntfcEnableDisableReply) Unmarshal(b []byte) error { func init() { file_arp_binapi_init() } func file_arp_binapi_init() { - api.RegisterMessage((*ProxyArpAddDel)(nil), "proxy_arp_add_del_85486cbd") + api.RegisterMessage((*ProxyArpAddDel)(nil), "proxy_arp_add_del_1823c3e7") api.RegisterMessage((*ProxyArpAddDelReply)(nil), "proxy_arp_add_del_reply_e8d4e804") - api.RegisterMessage((*ProxyArpDetails)(nil), "proxy_arp_details_9228c150") + api.RegisterMessage((*ProxyArpDetails)(nil), "proxy_arp_details_5b948673") api.RegisterMessage((*ProxyArpDump)(nil), "proxy_arp_dump_51077d14") api.RegisterMessage((*ProxyArpIntfcDetails)(nil), "proxy_arp_intfc_details_f6458e5f") api.RegisterMessage((*ProxyArpIntfcDump)(nil), "proxy_arp_intfc_dump_51077d14") diff --git a/binapi/arp/arp_rest.ba.go b/binapi/arp/arp_rest.ba.go deleted file mode 100644 index 71a07d9..0000000 --- a/binapi/arp/arp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package arp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/proxy_arp_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ProxyArpAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ProxyArpAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/proxy_arp_intfc_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ProxyArpIntfcEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ProxyArpIntfcEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/arp/arp_rpc.ba.go b/binapi/arp/arp_rpc.ba.go index 8ccfa75..cff3850 100644 --- a/binapi/arp/arp_rpc.ba.go +++ b/binapi/arp/arp_rpc.ba.go @@ -5,12 +5,13 @@ package arp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service arp. +// RPCService defines RPC service arp. type RPCService interface { ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) @@ -32,7 +33,7 @@ func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) { @@ -44,7 +45,7 @@ func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -67,7 +68,11 @@ func (c *serviceClient_ProxyArpDumpClient) Recv() (*ProxyArpDetails, error) { switch m := msg.(type) { case *ProxyArpDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -83,7 +88,7 @@ func (c *serviceClient) ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfc if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -106,7 +111,11 @@ func (c *serviceClient_ProxyArpIntfcDumpClient) Recv() (*ProxyArpIntfcDetails, e switch m := msg.(type) { case *ProxyArpIntfcDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -119,5 +128,5 @@ func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *Prox if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/arping/arping.ba.go b/binapi/arping/arping.ba.go new file mode 100644 index 0000000..9bee956 --- /dev/null +++ b/binapi/arping/arping.ba.go @@ -0,0 +1,134 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/arping.api.json + +// Package arping contains generated bindings for API file arping.api. +// +// Contents: +// 2 messages +// +package arping + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "arping" + APIVersion = "1.0.0" + VersionCrc = 0x666f91cc +) + +// Arping defines message 'arping'. +type Arping struct { + Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsGarp bool `binapi:"bool,name=is_garp" json:"is_garp,omitempty"` + Repeat uint32 `binapi:"u32,name=repeat,default=1" json:"repeat,omitempty"` + Interval float64 `binapi:"f64,name=interval,default=1" json:"interval,omitempty"` +} + +func (m *Arping) Reset() { *m = Arping{} } +func (*Arping) GetMessageName() string { return "arping" } +func (*Arping) GetCrcString() string { return "48817482" } +func (*Arping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Arping) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Address.Af + size += 1 * 16 // m.Address.Un + size += 4 // m.SwIfIndex + size += 1 // m.IsGarp + size += 4 // m.Repeat + size += 8 // m.Interval + return size +} +func (m *Arping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Address.Af)) + buf.EncodeBytes(m.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsGarp) + buf.EncodeUint32(m.Repeat) + buf.EncodeFloat64(m.Interval) + return buf.Bytes(), nil +} +func (m *Arping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsGarp = buf.DecodeBool() + m.Repeat = buf.DecodeUint32() + m.Interval = buf.DecodeFloat64() + return nil +} + +// ArpingReply defines message 'arping_reply'. +type ArpingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyCount uint32 `binapi:"u32,name=reply_count" json:"reply_count,omitempty"` +} + +func (m *ArpingReply) Reset() { *m = ArpingReply{} } +func (*ArpingReply) GetMessageName() string { return "arping_reply" } +func (*ArpingReply) GetCrcString() string { return "bb9d1cbd" } +func (*ArpingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ArpingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.ReplyCount + return size +} +func (m *ArpingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.ReplyCount) + return buf.Bytes(), nil +} +func (m *ArpingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ReplyCount = buf.DecodeUint32() + return nil +} + +func init() { file_arping_binapi_init() } +func file_arping_binapi_init() { + api.RegisterMessage((*Arping)(nil), "arping_48817482") + api.RegisterMessage((*ArpingReply)(nil), "arping_reply_bb9d1cbd") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Arping)(nil), + (*ArpingReply)(nil), + } +} diff --git a/binapi/l2e/l2e_rpc.ba.go b/binapi/arping/arping_rpc.ba.go index e589d28..feda4c1 100644 --- a/binapi/l2e/l2e_rpc.ba.go +++ b/binapi/arping/arping_rpc.ba.go @@ -1,15 +1,16 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. -package l2e +package arping import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service l2e. +// RPCService defines RPC service arping. type RPCService interface { - L2Emulation(ctx context.Context, in *L2Emulation) (*L2EmulationReply, error) + Arping(ctx context.Context, in *Arping) (*ArpingReply, error) } type serviceClient struct { @@ -20,11 +21,11 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } -func (c *serviceClient) L2Emulation(ctx context.Context, in *L2Emulation) (*L2EmulationReply, error) { - out := new(L2EmulationReply) +func (c *serviceClient) Arping(ctx context.Context, in *Arping) (*ArpingReply, error) { + out := new(ArpingReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/avf/avf.ba.go b/binapi/avf/avf.ba.go index edfa26e..e677d59 100644 --- a/binapi/avf/avf.ba.go +++ b/binapi/avf/avf.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/avf.api.json // Package avf contains generated bindings for API file avf.api. @@ -12,9 +12,9 @@ package avf import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "avf" APIVersion = "1.0.0" - VersionCrc = 0xbaaa7124 + VersionCrc = 0x9f5a6a20 ) // AvfCreate defines message 'avf_create'. diff --git a/binapi/avf/avf_rest.ba.go b/binapi/avf/avf_rest.ba.go deleted file mode 100644 index 1a9d7f3..0000000 --- a/binapi/avf/avf_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package avf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/avf_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(AvfCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AvfCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/avf_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(AvfDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AvfDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/avf/avf_rpc.ba.go b/binapi/avf/avf_rpc.ba.go index 90f854e..3e87ffd 100644 --- a/binapi/avf/avf_rpc.ba.go +++ b/binapi/avf/avf_rpc.ba.go @@ -4,10 +4,11 @@ package avf import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service avf. +// RPCService defines RPC service avf. type RPCService interface { AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDelet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/bfd/bfd.ba.go b/binapi/bfd/bfd.ba.go index b8b2820..01cca50 100644 --- a/binapi/bfd/bfd.ba.go +++ b/binapi/bfd/bfd.ba.go @@ -1,23 +1,24 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/bfd.api.json // Package bfd contains generated bindings for API file bfd.api. // // Contents: // 1 enum -// 28 messages +// 29 messages // package bfd import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +30,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "bfd" APIVersion = "2.0.0" - VersionCrc = 0xc92fd028 + VersionCrc = 0xa8eb4aac ) // BfdState defines enum 'bfd_state'. @@ -293,7 +294,7 @@ type BfdUDPAdd struct { func (m *BfdUDPAdd) Reset() { *m = BfdUDPAdd{} } func (*BfdUDPAdd) GetMessageName() string { return "bfd_udp_add" } -func (*BfdUDPAdd) GetCrcString() string { return "7a6d1185" } +func (*BfdUDPAdd) GetCrcString() string { return "939cd26a" } func (*BfdUDPAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -394,7 +395,7 @@ type BfdUDPAuthActivate struct { func (m *BfdUDPAuthActivate) Reset() { *m = BfdUDPAuthActivate{} } func (*BfdUDPAuthActivate) GetMessageName() string { return "bfd_udp_auth_activate" } -func (*BfdUDPAuthActivate) GetCrcString() string { return "493ee0ec" } +func (*BfdUDPAuthActivate) GetCrcString() string { return "21fd1bdb" } func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -484,7 +485,7 @@ type BfdUDPAuthDeactivate struct { func (m *BfdUDPAuthDeactivate) Reset() { *m = BfdUDPAuthDeactivate{} } func (*BfdUDPAuthDeactivate) GetMessageName() string { return "bfd_udp_auth_deactivate" } -func (*BfdUDPAuthDeactivate) GetCrcString() string { return "99978c32" } +func (*BfdUDPAuthDeactivate) GetCrcString() string { return "9a05e2e0" } func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -567,7 +568,7 @@ type BfdUDPDel struct { func (m *BfdUDPDel) Reset() { *m = BfdUDPDel{} } func (*BfdUDPDel) GetMessageName() string { return "bfd_udp_del" } -func (*BfdUDPDel) GetCrcString() string { return "8096514d" } +func (*BfdUDPDel) GetCrcString() string { return "dcb13a89" } func (*BfdUDPDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -738,7 +739,7 @@ type BfdUDPGetEchoSourceReply struct { func (m *BfdUDPGetEchoSourceReply) Reset() { *m = BfdUDPGetEchoSourceReply{} } func (*BfdUDPGetEchoSourceReply) GetMessageName() string { return "bfd_udp_get_echo_source_reply" } -func (*BfdUDPGetEchoSourceReply) GetCrcString() string { return "1e00cfce" } +func (*BfdUDPGetEchoSourceReply) GetCrcString() string { return "e3d736a1" } func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -794,7 +795,7 @@ type BfdUDPMod struct { func (m *BfdUDPMod) Reset() { *m = BfdUDPMod{} } func (*BfdUDPMod) GetMessageName() string { return "bfd_udp_mod" } -func (*BfdUDPMod) GetCrcString() string { return "783a3ff6" } +func (*BfdUDPMod) GetCrcString() string { return "913df085" } func (*BfdUDPMod) GetMessageType() api.MessageType { return api.RequestMessage } @@ -890,7 +891,7 @@ type BfdUDPSessionDetails struct { func (m *BfdUDPSessionDetails) Reset() { *m = BfdUDPSessionDetails{} } func (*BfdUDPSessionDetails) GetMessageName() string { return "bfd_udp_session_details" } -func (*BfdUDPSessionDetails) GetCrcString() string { return "60653c02" } +func (*BfdUDPSessionDetails) GetCrcString() string { return "09fb2f2d" } func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -976,6 +977,85 @@ func (m *BfdUDPSessionDump) Unmarshal(b []byte) error { return nil } +// BfdUDPSessionEvent defines message 'bfd_udp_session_event'. +type BfdUDPSessionEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + State BfdState `binapi:"bfd_state,name=state" json:"state,omitempty"` + IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` +} + +func (m *BfdUDPSessionEvent) Reset() { *m = BfdUDPSessionEvent{} } +func (*BfdUDPSessionEvent) GetMessageName() string { return "bfd_udp_session_event" } +func (*BfdUDPSessionEvent) GetCrcString() string { return "8eaaf062" } +func (*BfdUDPSessionEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *BfdUDPSessionEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 4 // m.State + size += 1 // m.IsAuthenticated + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + size += 4 // m.RequiredMinRx + size += 4 // m.DesiredMinTx + size += 1 // m.DetectMult + return size +} +func (m *BfdUDPSessionEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.State)) + buf.EncodeBool(m.IsAuthenticated) + buf.EncodeUint8(m.BfdKeyID) + buf.EncodeUint32(m.ConfKeyID) + buf.EncodeUint32(m.RequiredMinRx) + buf.EncodeUint32(m.DesiredMinTx) + buf.EncodeUint8(m.DetectMult) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.State = BfdState(buf.DecodeUint32()) + m.IsAuthenticated = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.DesiredMinTx = buf.DecodeUint32() + m.DetectMult = buf.DecodeUint8() + return nil +} + // BfdUDPSessionSetFlags defines message 'bfd_udp_session_set_flags'. type BfdUDPSessionSetFlags struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -986,7 +1066,7 @@ type BfdUDPSessionSetFlags struct { func (m *BfdUDPSessionSetFlags) Reset() { *m = BfdUDPSessionSetFlags{} } func (*BfdUDPSessionSetFlags) GetMessageName() string { return "bfd_udp_session_set_flags" } -func (*BfdUDPSessionSetFlags) GetCrcString() string { return "cf313851" } +func (*BfdUDPSessionSetFlags) GetCrcString() string { return "04b4bdfd" } func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1204,23 +1284,24 @@ func file_bfd_binapi_init() { api.RegisterMessage((*BfdAuthKeysDump)(nil), "bfd_auth_keys_dump_51077d14") api.RegisterMessage((*BfdAuthSetKey)(nil), "bfd_auth_set_key_690b8877") api.RegisterMessage((*BfdAuthSetKeyReply)(nil), "bfd_auth_set_key_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAdd)(nil), "bfd_udp_add_7a6d1185") + api.RegisterMessage((*BfdUDPAdd)(nil), "bfd_udp_add_939cd26a") api.RegisterMessage((*BfdUDPAddReply)(nil), "bfd_udp_add_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd_udp_auth_activate_493ee0ec") + api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd_udp_auth_activate_21fd1bdb") api.RegisterMessage((*BfdUDPAuthActivateReply)(nil), "bfd_udp_auth_activate_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd_udp_auth_deactivate_99978c32") + api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd_udp_auth_deactivate_9a05e2e0") api.RegisterMessage((*BfdUDPAuthDeactivateReply)(nil), "bfd_udp_auth_deactivate_reply_e8d4e804") - api.RegisterMessage((*BfdUDPDel)(nil), "bfd_udp_del_8096514d") + api.RegisterMessage((*BfdUDPDel)(nil), "bfd_udp_del_dcb13a89") api.RegisterMessage((*BfdUDPDelEchoSource)(nil), "bfd_udp_del_echo_source_51077d14") api.RegisterMessage((*BfdUDPDelEchoSourceReply)(nil), "bfd_udp_del_echo_source_reply_e8d4e804") api.RegisterMessage((*BfdUDPDelReply)(nil), "bfd_udp_del_reply_e8d4e804") api.RegisterMessage((*BfdUDPGetEchoSource)(nil), "bfd_udp_get_echo_source_51077d14") - api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd_udp_get_echo_source_reply_1e00cfce") - api.RegisterMessage((*BfdUDPMod)(nil), "bfd_udp_mod_783a3ff6") + api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd_udp_get_echo_source_reply_e3d736a1") + api.RegisterMessage((*BfdUDPMod)(nil), "bfd_udp_mod_913df085") api.RegisterMessage((*BfdUDPModReply)(nil), "bfd_udp_mod_reply_e8d4e804") - api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd_udp_session_details_60653c02") + api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd_udp_session_details_09fb2f2d") api.RegisterMessage((*BfdUDPSessionDump)(nil), "bfd_udp_session_dump_51077d14") - api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd_udp_session_set_flags_cf313851") + api.RegisterMessage((*BfdUDPSessionEvent)(nil), "bfd_udp_session_event_8eaaf062") + api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd_udp_session_set_flags_04b4bdfd") api.RegisterMessage((*BfdUDPSessionSetFlagsReply)(nil), "bfd_udp_session_set_flags_reply_e8d4e804") api.RegisterMessage((*BfdUDPSetEchoSource)(nil), "bfd_udp_set_echo_source_f9e6675e") api.RegisterMessage((*BfdUDPSetEchoSourceReply)(nil), "bfd_udp_set_echo_source_reply_e8d4e804") @@ -1253,6 +1334,7 @@ func AllMessages() []api.Message { (*BfdUDPModReply)(nil), (*BfdUDPSessionDetails)(nil), (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionEvent)(nil), (*BfdUDPSessionSetFlags)(nil), (*BfdUDPSessionSetFlagsReply)(nil), (*BfdUDPSetEchoSource)(nil), diff --git a/binapi/bfd/bfd_rest.ba.go b/binapi/bfd/bfd_rest.ba.go deleted file mode 100644 index 2f25f8b..0000000 --- a/binapi/bfd/bfd_rest.ba.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bfd - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bfd_auth_del_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdAuthDelKey) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdAuthDelKey(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_auth_set_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdAuthSetKey) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdAuthSetKey(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_auth_activate", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAuthActivate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPAuthActivate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_auth_deactivate", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAuthDeactivate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPAuthDeactivate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_del_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPDelEchoSource) - reply, err := rpc.BfdUDPDelEchoSource(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_get_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPGetEchoSource) - reply, err := rpc.BfdUDPGetEchoSource(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPMod) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPMod(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_session_set_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPSessionSetFlags) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPSessionSetFlags(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bfd_udp_set_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPSetEchoSource) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BfdUDPSetEchoSource(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_bfd_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantBfdEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantBfdEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/bfd/bfd_rpc.ba.go b/binapi/bfd/bfd_rpc.ba.go index 78cbd3a..669d749 100644 --- a/binapi/bfd/bfd_rpc.ba.go +++ b/binapi/bfd/bfd_rpc.ba.go @@ -5,12 +5,13 @@ package bfd import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service bfd. +// RPCService defines RPC service bfd. type RPCService interface { BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) @@ -42,7 +43,7 @@ func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) { @@ -54,7 +55,7 @@ func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -77,7 +78,11 @@ func (c *serviceClient_BfdAuthKeysDumpClient) Recv() (*BfdAuthKeysDetails, error switch m := msg.(type) { case *BfdAuthKeysDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -90,7 +95,7 @@ func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { @@ -99,7 +104,7 @@ func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { @@ -108,7 +113,7 @@ func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthAc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { @@ -117,7 +122,7 @@ func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuth if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { @@ -126,7 +131,7 @@ func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { @@ -135,7 +140,7 @@ func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { @@ -144,7 +149,7 @@ func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { @@ -153,7 +158,7 @@ func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPMo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) { @@ -165,7 +170,7 @@ func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSession if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -188,7 +193,11 @@ func (c *serviceClient_BfdUDPSessionDumpClient) Recv() (*BfdUDPSessionDetails, e switch m := msg.(type) { case *BfdUDPSessionDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -201,7 +210,7 @@ func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSes if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { @@ -210,7 +219,7 @@ func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { @@ -219,5 +228,5 @@ func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/bier/bier.ba.go b/binapi/bier/bier.ba.go index f024d80..f663e51 100644 --- a/binapi/bier/bier.ba.go +++ b/binapi/bier/bier.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/bier.api.json // Package bier contains generated bindings for API file bier.api. @@ -13,10 +13,10 @@ package bier import ( - api "git.fd.io/govpp.git/api" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - _ "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + fib_types "go.fd.io/govpp/binapi/fib_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "bier" APIVersion = "1.2.1" - VersionCrc = 0x9196a2d4 + VersionCrc = 0x8d1cd497 ) // BierRoute defines type 'bier_route'. @@ -58,7 +58,7 @@ type BierDispEntryAddDel struct { func (m *BierDispEntryAddDel) Reset() { *m = BierDispEntryAddDel{} } func (*BierDispEntryAddDel) GetMessageName() string { return "bier_disp_entry_add_del" } -func (*BierDispEntryAddDel) GetCrcString() string { return "648323eb" } +func (*BierDispEntryAddDel) GetCrcString() string { return "9eb80cb4" } func (*BierDispEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -214,7 +214,7 @@ type BierDispEntryDetails struct { func (m *BierDispEntryDetails) Reset() { *m = BierDispEntryDetails{} } func (*BierDispEntryDetails) GetMessageName() string { return "bier_disp_entry_details" } -func (*BierDispEntryDetails) GetCrcString() string { return "e5b039a9" } +func (*BierDispEntryDetails) GetCrcString() string { return "84c218f1" } func (*BierDispEntryDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -731,7 +731,7 @@ type BierRouteAddDel struct { func (m *BierRouteAddDel) Reset() { *m = BierRouteAddDel{} } func (*BierRouteAddDel) GetMessageName() string { return "bier_route_add_del" } -func (*BierRouteAddDel) GetCrcString() string { return "f29edca0" } +func (*BierRouteAddDel) GetCrcString() string { return "fd02f3ea" } func (*BierRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -888,7 +888,7 @@ type BierRouteDetails struct { func (m *BierRouteDetails) Reset() { *m = BierRouteDetails{} } func (*BierRouteDetails) GetMessageName() string { return "bier_route_details" } -func (*BierRouteDetails) GetCrcString() string { return "39ee6a56" } +func (*BierRouteDetails) GetCrcString() string { return "4008caee" } func (*BierRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1190,9 +1190,9 @@ func (m *BierTableDump) Unmarshal(b []byte) error { func init() { file_bier_binapi_init() } func file_bier_binapi_init() { - api.RegisterMessage((*BierDispEntryAddDel)(nil), "bier_disp_entry_add_del_648323eb") + api.RegisterMessage((*BierDispEntryAddDel)(nil), "bier_disp_entry_add_del_9eb80cb4") api.RegisterMessage((*BierDispEntryAddDelReply)(nil), "bier_disp_entry_add_del_reply_e8d4e804") - api.RegisterMessage((*BierDispEntryDetails)(nil), "bier_disp_entry_details_e5b039a9") + api.RegisterMessage((*BierDispEntryDetails)(nil), "bier_disp_entry_details_84c218f1") api.RegisterMessage((*BierDispEntryDump)(nil), "bier_disp_entry_dump_b5fa54ad") api.RegisterMessage((*BierDispTableAddDel)(nil), "bier_disp_table_add_del_889657ac") api.RegisterMessage((*BierDispTableAddDelReply)(nil), "bier_disp_table_add_del_reply_e8d4e804") @@ -1204,9 +1204,9 @@ func file_bier_binapi_init() { api.RegisterMessage((*BierImpDelReply)(nil), "bier_imp_del_reply_e8d4e804") api.RegisterMessage((*BierImpDetails)(nil), "bier_imp_details_b76192df") api.RegisterMessage((*BierImpDump)(nil), "bier_imp_dump_51077d14") - api.RegisterMessage((*BierRouteAddDel)(nil), "bier_route_add_del_f29edca0") + api.RegisterMessage((*BierRouteAddDel)(nil), "bier_route_add_del_fd02f3ea") api.RegisterMessage((*BierRouteAddDelReply)(nil), "bier_route_add_del_reply_e8d4e804") - api.RegisterMessage((*BierRouteDetails)(nil), "bier_route_details_39ee6a56") + api.RegisterMessage((*BierRouteDetails)(nil), "bier_route_details_4008caee") api.RegisterMessage((*BierRouteDump)(nil), "bier_route_dump_38339846") api.RegisterMessage((*BierTableAddDel)(nil), "bier_table_add_del_35e59209") api.RegisterMessage((*BierTableAddDelReply)(nil), "bier_table_add_del_reply_e8d4e804") diff --git a/binapi/bier/bier_rest.ba.go b/binapi/bier/bier_rest.ba.go deleted file mode 100644 index f65f8f3..0000000 --- a/binapi/bier/bier_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bier - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bier_disp_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierDispEntryAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierDispEntryAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bier_disp_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierDispTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierDispTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bier_imp_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierImpAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierImpAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bier_imp_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierImpDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierImpDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bier_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierRouteAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierRouteAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bier_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BierTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/bier/bier_rpc.ba.go b/binapi/bier/bier_rpc.ba.go index c744153..4e8ab06 100644 --- a/binapi/bier/bier_rpc.ba.go +++ b/binapi/bier/bier_rpc.ba.go @@ -5,12 +5,13 @@ package bier import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service bier. +// RPCService defines RPC service bier. type RPCService interface { BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) @@ -39,7 +40,7 @@ func (c *serviceClient) BierDispEntryAddDel(ctx context.Context, in *BierDispEnt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) { @@ -51,7 +52,7 @@ func (c *serviceClient) BierDispEntryDump(ctx context.Context, in *BierDispEntry if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -74,7 +75,11 @@ func (c *serviceClient_BierDispEntryDumpClient) Recv() (*BierDispEntryDetails, e switch m := msg.(type) { case *BierDispEntryDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -87,7 +92,7 @@ func (c *serviceClient) BierDispTableAddDel(ctx context.Context, in *BierDispTab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) { @@ -99,7 +104,7 @@ func (c *serviceClient) BierDispTableDump(ctx context.Context, in *BierDispTable if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -122,7 +127,11 @@ func (c *serviceClient_BierDispTableDumpClient) Recv() (*BierDispTableDetails, e switch m := msg.(type) { case *BierDispTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -135,7 +144,7 @@ func (c *serviceClient) BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierIm if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) { @@ -144,7 +153,7 @@ func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierIm if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) { @@ -156,7 +165,7 @@ func (c *serviceClient) BierImpDump(ctx context.Context, in *BierImpDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -179,7 +188,11 @@ func (c *serviceClient_BierImpDumpClient) Recv() (*BierImpDetails, error) { switch m := msg.(type) { case *BierImpDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -192,7 +205,7 @@ func (c *serviceClient) BierRouteAddDel(ctx context.Context, in *BierRouteAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) { @@ -204,7 +217,7 @@ func (c *serviceClient) BierRouteDump(ctx context.Context, in *BierRouteDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -227,7 +240,11 @@ func (c *serviceClient_BierRouteDumpClient) Recv() (*BierRouteDetails, error) { switch m := msg.(type) { case *BierRouteDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -240,7 +257,7 @@ func (c *serviceClient) BierTableAddDel(ctx context.Context, in *BierTableAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) { @@ -252,7 +269,7 @@ func (c *serviceClient) BierTableDump(ctx context.Context, in *BierTableDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -275,7 +292,11 @@ func (c *serviceClient_BierTableDumpClient) Recv() (*BierTableDetails, error) { switch m := msg.(type) { case *BierTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/bond/bond.ba.go b/binapi/bond/bond.ba.go index a734200..18067e1 100644 --- a/binapi/bond/bond.ba.go +++ b/binapi/bond/bond.ba.go @@ -1,23 +1,24 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/bond.api.json // Package bond contains generated bindings for API file bond.api. // // Contents: // 2 enums -// 14 messages +// 24 messages // package bond import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,8 +29,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "bond" - APIVersion = "2.0.0" - VersionCrc = 0xa65a4a1e + APIVersion = "2.1.0" + VersionCrc = 0xa03f5330 ) // BondLbAlgo defines enum 'bond_lb_algo'. @@ -107,7 +108,86 @@ func (x BondMode) String() string { return "BondMode(" + strconv.Itoa(int(x)) + ")" } +// BondAddMember defines message 'bond_add_member'. +type BondAddMember struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + BondSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bond_sw_if_index" json:"bond_sw_if_index,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` +} + +func (m *BondAddMember) Reset() { *m = BondAddMember{} } +func (*BondAddMember) GetMessageName() string { return "bond_add_member" } +func (*BondAddMember) GetCrcString() string { return "e7d14948" } +func (*BondAddMember) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondAddMember) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.BondSwIfIndex + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + return size +} +func (m *BondAddMember) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.BondSwIfIndex)) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + return buf.Bytes(), nil +} +func (m *BondAddMember) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.BondSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + return nil +} + +// BondAddMemberReply defines message 'bond_add_member_reply'. +type BondAddMemberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondAddMemberReply) Reset() { *m = BondAddMemberReply{} } +func (*BondAddMemberReply) GetMessageName() string { return "bond_add_member_reply" } +func (*BondAddMemberReply) GetCrcString() string { return "e8d4e804" } +func (*BondAddMemberReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondAddMemberReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *BondAddMemberReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *BondAddMemberReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // BondCreate defines message 'bond_create'. +// Deprecated: the message will be removed in the future versions type BondCreate struct { ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` @@ -119,7 +199,7 @@ type BondCreate struct { func (m *BondCreate) Reset() { *m = BondCreate{} } func (*BondCreate) GetMessageName() string { return "bond_create" } -func (*BondCreate) GetCrcString() string { return "48883c7e" } +func (*BondCreate) GetCrcString() string { return "f1dbd4ff" } func (*BondCreate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -160,6 +240,100 @@ func (m *BondCreate) Unmarshal(b []byte) error { return nil } +// BondCreate2 defines message 'bond_create2'. +type BondCreate2 struct { + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` + UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` +} + +func (m *BondCreate2) Reset() { *m = BondCreate2{} } +func (*BondCreate2) GetMessageName() string { return "bond_create2" } +func (*BondCreate2) GetCrcString() string { return "912fda76" } +func (*BondCreate2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondCreate2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + size += 1 // m.EnableGso + size += 1 // m.UseCustomMac + size += 1 * 6 // m.MacAddress + size += 4 // m.ID + return size +} +func (m *BondCreate2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + buf.EncodeBool(m.EnableGso) + buf.EncodeBool(m.UseCustomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint32(m.ID) + return buf.Bytes(), nil +} +func (m *BondCreate2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + m.EnableGso = buf.DecodeBool() + m.UseCustomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.ID = buf.DecodeUint32() + return nil +} + +// BondCreate2Reply defines message 'bond_create2_reply'. +type BondCreate2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondCreate2Reply) Reset() { *m = BondCreate2Reply{} } +func (*BondCreate2Reply) GetMessageName() string { return "bond_create2_reply" } +func (*BondCreate2Reply) GetCrcString() string { return "5383d31f" } +func (*BondCreate2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondCreate2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *BondCreate2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondCreate2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // BondCreateReply defines message 'bond_create_reply'. type BondCreateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -263,7 +437,74 @@ func (m *BondDeleteReply) Unmarshal(b []byte) error { return nil } +// BondDetachMember defines message 'bond_detach_member'. +type BondDetachMember struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondDetachMember) Reset() { *m = BondDetachMember{} } +func (*BondDetachMember) GetMessageName() string { return "bond_detach_member" } +func (*BondDetachMember) GetCrcString() string { return "f9e6675e" } +func (*BondDetachMember) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondDetachMember) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *BondDetachMember) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondDetachMember) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDetachMemberReply defines message 'bond_detach_member_reply'. +type BondDetachMemberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondDetachMemberReply) Reset() { *m = BondDetachMemberReply{} } +func (*BondDetachMemberReply) GetMessageName() string { return "bond_detach_member_reply" } +func (*BondDetachMemberReply) GetCrcString() string { return "e8d4e804" } +func (*BondDetachMemberReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondDetachMemberReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *BondDetachMemberReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *BondDetachMemberReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // BondDetachSlave defines message 'bond_detach_slave'. +// Deprecated: the message will be removed in the future versions type BondDetachSlave struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -297,6 +538,7 @@ func (m *BondDetachSlave) Unmarshal(b []byte) error { } // BondDetachSlaveReply defines message 'bond_detach_slave_reply'. +// Deprecated: the message will be removed in the future versions type BondDetachSlaveReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -330,6 +572,7 @@ func (m *BondDetachSlaveReply) Unmarshal(b []byte) error { } // BondEnslave defines message 'bond_enslave'. +// Deprecated: the message will be removed in the future versions type BondEnslave struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` BondSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bond_sw_if_index" json:"bond_sw_if_index,omitempty"` @@ -339,7 +582,7 @@ type BondEnslave struct { func (m *BondEnslave) Reset() { *m = BondEnslave{} } func (*BondEnslave) GetMessageName() string { return "bond_enslave" } -func (*BondEnslave) GetCrcString() string { return "076ecfa7" } +func (*BondEnslave) GetCrcString() string { return "e7d14948" } func (*BondEnslave) GetMessageType() api.MessageType { return api.RequestMessage } @@ -407,6 +650,100 @@ func (m *BondEnslaveReply) Unmarshal(b []byte) error { return nil } +// SwBondInterfaceDetails defines message 'sw_bond_interface_details'. +type SwBondInterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` + ActiveMembers uint32 `binapi:"u32,name=active_members" json:"active_members,omitempty"` + Members uint32 `binapi:"u32,name=members" json:"members,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` +} + +func (m *SwBondInterfaceDetails) Reset() { *m = SwBondInterfaceDetails{} } +func (*SwBondInterfaceDetails) GetMessageName() string { return "sw_bond_interface_details" } +func (*SwBondInterfaceDetails) GetCrcString() string { return "9428a69c" } +func (*SwBondInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwBondInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.ID + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + size += 4 // m.ActiveMembers + size += 4 // m.Members + size += 64 // m.InterfaceName + return size +} +func (m *SwBondInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.ID) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + buf.EncodeUint32(m.ActiveMembers) + buf.EncodeUint32(m.Members) + buf.EncodeString(m.InterfaceName, 64) + return buf.Bytes(), nil +} +func (m *SwBondInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ID = buf.DecodeUint32() + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + m.ActiveMembers = buf.DecodeUint32() + m.Members = buf.DecodeUint32() + m.InterfaceName = buf.DecodeString(64) + return nil +} + +// SwBondInterfaceDump defines message 'sw_bond_interface_dump'. +type SwBondInterfaceDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` +} + +func (m *SwBondInterfaceDump) Reset() { *m = SwBondInterfaceDump{} } +func (*SwBondInterfaceDump) GetMessageName() string { return "sw_bond_interface_dump" } +func (*SwBondInterfaceDump) GetCrcString() string { return "f9e6675e" } +func (*SwBondInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwBondInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwBondInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwBondInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // SwInterfaceBondDetails defines message 'sw_interface_bond_details'. type SwInterfaceBondDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -421,7 +758,7 @@ type SwInterfaceBondDetails struct { func (m *SwInterfaceBondDetails) Reset() { *m = SwInterfaceBondDetails{} } func (*SwInterfaceBondDetails) GetMessageName() string { return "sw_interface_bond_details" } -func (*SwInterfaceBondDetails) GetCrcString() string { return "f5ef2106" } +func (*SwInterfaceBondDetails) GetCrcString() string { return "bb7c929b" } func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -469,6 +806,7 @@ func (m *SwInterfaceBondDetails) Unmarshal(b []byte) error { } // SwInterfaceBondDump defines message 'sw_interface_bond_dump'. +// Deprecated: the message will be removed in the future versions type SwInterfaceBondDump struct{} func (m *SwInterfaceBondDump) Reset() { *m = SwInterfaceBondDump{} } @@ -621,6 +959,7 @@ func (m *SwInterfaceSlaveDetails) Unmarshal(b []byte) error { } // SwInterfaceSlaveDump defines message 'sw_interface_slave_dump'. +// Deprecated: the message will be removed in the future versions type SwInterfaceSlaveDump struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -653,40 +992,146 @@ func (m *SwInterfaceSlaveDump) Unmarshal(b []byte) error { return nil } +// SwMemberInterfaceDetails defines message 'sw_member_interface_details'. +type SwMemberInterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` + IsLocalNuma bool `binapi:"bool,name=is_local_numa" json:"is_local_numa,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` +} + +func (m *SwMemberInterfaceDetails) Reset() { *m = SwMemberInterfaceDetails{} } +func (*SwMemberInterfaceDetails) GetMessageName() string { return "sw_member_interface_details" } +func (*SwMemberInterfaceDetails) GetCrcString() string { return "3c4a0e23" } +func (*SwMemberInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwMemberInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + size += 1 // m.IsLocalNuma + size += 4 // m.Weight + return size +} +func (m *SwMemberInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + buf.EncodeBool(m.IsLocalNuma) + buf.EncodeUint32(m.Weight) + return buf.Bytes(), nil +} +func (m *SwMemberInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + m.IsLocalNuma = buf.DecodeBool() + m.Weight = buf.DecodeUint32() + return nil +} + +// SwMemberInterfaceDump defines message 'sw_member_interface_dump'. +type SwMemberInterfaceDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwMemberInterfaceDump) Reset() { *m = SwMemberInterfaceDump{} } +func (*SwMemberInterfaceDump) GetMessageName() string { return "sw_member_interface_dump" } +func (*SwMemberInterfaceDump) GetCrcString() string { return "f9e6675e" } +func (*SwMemberInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwMemberInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwMemberInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwMemberInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + func init() { file_bond_binapi_init() } func file_bond_binapi_init() { - api.RegisterMessage((*BondCreate)(nil), "bond_create_48883c7e") + api.RegisterMessage((*BondAddMember)(nil), "bond_add_member_e7d14948") + api.RegisterMessage((*BondAddMemberReply)(nil), "bond_add_member_reply_e8d4e804") + api.RegisterMessage((*BondCreate)(nil), "bond_create_f1dbd4ff") + api.RegisterMessage((*BondCreate2)(nil), "bond_create2_912fda76") + api.RegisterMessage((*BondCreate2Reply)(nil), "bond_create2_reply_5383d31f") api.RegisterMessage((*BondCreateReply)(nil), "bond_create_reply_5383d31f") api.RegisterMessage((*BondDelete)(nil), "bond_delete_f9e6675e") api.RegisterMessage((*BondDeleteReply)(nil), "bond_delete_reply_e8d4e804") + api.RegisterMessage((*BondDetachMember)(nil), "bond_detach_member_f9e6675e") + api.RegisterMessage((*BondDetachMemberReply)(nil), "bond_detach_member_reply_e8d4e804") api.RegisterMessage((*BondDetachSlave)(nil), "bond_detach_slave_f9e6675e") api.RegisterMessage((*BondDetachSlaveReply)(nil), "bond_detach_slave_reply_e8d4e804") - api.RegisterMessage((*BondEnslave)(nil), "bond_enslave_076ecfa7") + api.RegisterMessage((*BondEnslave)(nil), "bond_enslave_e7d14948") api.RegisterMessage((*BondEnslaveReply)(nil), "bond_enslave_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceBondDetails)(nil), "sw_interface_bond_details_f5ef2106") + api.RegisterMessage((*SwBondInterfaceDetails)(nil), "sw_bond_interface_details_9428a69c") + api.RegisterMessage((*SwBondInterfaceDump)(nil), "sw_bond_interface_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceBondDetails)(nil), "sw_interface_bond_details_bb7c929b") api.RegisterMessage((*SwInterfaceBondDump)(nil), "sw_interface_bond_dump_51077d14") api.RegisterMessage((*SwInterfaceSetBondWeight)(nil), "sw_interface_set_bond_weight_deb510a0") api.RegisterMessage((*SwInterfaceSetBondWeightReply)(nil), "sw_interface_set_bond_weight_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSlaveDetails)(nil), "sw_interface_slave_details_3c4a0e23") api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "sw_interface_slave_dump_f9e6675e") + api.RegisterMessage((*SwMemberInterfaceDetails)(nil), "sw_member_interface_details_3c4a0e23") + api.RegisterMessage((*SwMemberInterfaceDump)(nil), "sw_member_interface_dump_f9e6675e") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*BondAddMember)(nil), + (*BondAddMemberReply)(nil), (*BondCreate)(nil), + (*BondCreate2)(nil), + (*BondCreate2Reply)(nil), (*BondCreateReply)(nil), (*BondDelete)(nil), (*BondDeleteReply)(nil), + (*BondDetachMember)(nil), + (*BondDetachMemberReply)(nil), (*BondDetachSlave)(nil), (*BondDetachSlaveReply)(nil), (*BondEnslave)(nil), (*BondEnslaveReply)(nil), + (*SwBondInterfaceDetails)(nil), + (*SwBondInterfaceDump)(nil), (*SwInterfaceBondDetails)(nil), (*SwInterfaceBondDump)(nil), (*SwInterfaceSetBondWeight)(nil), (*SwInterfaceSetBondWeightReply)(nil), (*SwInterfaceSlaveDetails)(nil), (*SwInterfaceSlaveDump)(nil), + (*SwMemberInterfaceDetails)(nil), + (*SwMemberInterfaceDump)(nil), } } diff --git a/binapi/bond/bond_rest.ba.go b/binapi/bond/bond_rest.ba.go deleted file mode 100644 index c1893d5..0000000 --- a/binapi/bond/bond_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bond - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bond_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BondCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bond_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BondDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bond_detach_slave", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondDetachSlave) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BondDetachSlave(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bond_enslave", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondEnslave) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BondEnslave(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_bond_weight", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetBondWeight) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetBondWeight(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/bond/bond_rpc.ba.go b/binapi/bond/bond_rpc.ba.go index 5e60f84..b0c45f4 100644 --- a/binapi/bond/bond_rpc.ba.go +++ b/binapi/bond/bond_rpc.ba.go @@ -5,20 +5,26 @@ package bond import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service bond. +// RPCService defines RPC service bond. type RPCService interface { + BondAddMember(ctx context.Context, in *BondAddMember) (*BondAddMemberReply, error) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondCreate2(ctx context.Context, in *BondCreate2) (*BondCreate2Reply, error) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachMember(ctx context.Context, in *BondDetachMember) (*BondDetachMemberReply, error) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) + SwBondInterfaceDump(ctx context.Context, in *SwBondInterfaceDump) (RPCService_SwBondInterfaceDumpClient, error) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) SwInterfaceSetBondWeight(ctx context.Context, in *SwInterfaceSetBondWeight) (*SwInterfaceSetBondWeightReply, error) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) + SwMemberInterfaceDump(ctx context.Context, in *SwMemberInterfaceDump) (RPCService_SwMemberInterfaceDumpClient, error) } type serviceClient struct { @@ -29,13 +35,31 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) BondAddMember(ctx context.Context, in *BondAddMember) (*BondAddMemberReply, error) { + out := new(BondAddMemberReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { out := new(BondCreateReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) BondCreate2(ctx context.Context, in *BondCreate2) (*BondCreate2Reply, error) { + out := new(BondCreate2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { @@ -44,7 +68,16 @@ func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) BondDetachMember(ctx context.Context, in *BondDetachMember) (*BondDetachMemberReply, error) { + out := new(BondDetachMemberReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { @@ -53,7 +86,7 @@ func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { @@ -62,7 +95,50 @@ func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*Bond if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwBondInterfaceDump(ctx context.Context, in *SwBondInterfaceDump) (RPCService_SwBondInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwBondInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwBondInterfaceDumpClient interface { + Recv() (*SwBondInterfaceDetails, error) + api.Stream +} + +type serviceClient_SwBondInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwBondInterfaceDumpClient) Recv() (*SwBondInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwBondInterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) { @@ -74,7 +150,7 @@ func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterface if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -97,7 +173,11 @@ func (c *serviceClient_SwInterfaceBondDumpClient) Recv() (*SwInterfaceBondDetail switch m := msg.(type) { case *SwInterfaceBondDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -110,7 +190,7 @@ func (c *serviceClient) SwInterfaceSetBondWeight(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) { @@ -122,7 +202,7 @@ func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfac if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -145,7 +225,54 @@ func (c *serviceClient_SwInterfaceSlaveDumpClient) Recv() (*SwInterfaceSlaveDeta switch m := msg.(type) { case *SwInterfaceSlaveDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwMemberInterfaceDump(ctx context.Context, in *SwMemberInterfaceDump) (RPCService_SwMemberInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwMemberInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwMemberInterfaceDumpClient interface { + Recv() (*SwMemberInterfaceDetails, error) + api.Stream +} + +type serviceClient_SwMemberInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwMemberInterfaceDumpClient) Recv() (*SwMemberInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwMemberInterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/builtinurl/builtinurl.ba.go b/binapi/builtinurl/builtinurl.ba.go index 6b0350d..fc82105 100644 --- a/binapi/builtinurl/builtinurl.ba.go +++ b/binapi/builtinurl/builtinurl.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/builtinurl.api.json // Package builtinurl contains generated bindings for API file builtinurl.api. @@ -12,8 +12,8 @@ package builtinurl import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/builtinurl/builtinurl_rest.ba.go b/binapi/builtinurl/builtinurl_rest.ba.go deleted file mode 100644 index a4373f1..0000000 --- a/binapi/builtinurl/builtinurl_rest.ba.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package builtinurl - -import ( - "encoding/json" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/builtinurl_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(BuiltinurlEnable) - reply, err := rpc.BuiltinurlEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/builtinurl/builtinurl_rpc.ba.go b/binapi/builtinurl/builtinurl_rpc.ba.go index 6857de2..6137bb9 100644 --- a/binapi/builtinurl/builtinurl_rpc.ba.go +++ b/binapi/builtinurl/builtinurl_rpc.ba.go @@ -4,10 +4,11 @@ package builtinurl import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service builtinurl. +// RPCService defines RPC service builtinurl. type RPCService interface { BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go index 5430d74..276529b 100644 --- a/binapi/cdp/cdp.ba.go +++ b/binapi/cdp/cdp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/cdp.api.json // Package cdp contains generated bindings for API file cdp.api. @@ -12,8 +12,8 @@ package cdp import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/cdp/cdp_rest.ba.go b/binapi/cdp/cdp_rest.ba.go deleted file mode 100644 index b414757..0000000 --- a/binapi/cdp/cdp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package cdp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/cdp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CdpEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CdpEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/cdp/cdp_rpc.ba.go b/binapi/cdp/cdp_rpc.ba.go index a910833..4f7b291 100644 --- a/binapi/cdp/cdp_rpc.ba.go +++ b/binapi/cdp/cdp_rpc.ba.go @@ -4,10 +4,11 @@ package cdp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service cdp. +// RPCService defines RPC service cdp. type RPCService interface { CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) CdpEnableDisable(ctx context.Context, in *CdpEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/classify/classify.ba.go b/binapi/classify/classify.ba.go index 942c59c..7a8e586 100644 --- a/binapi/classify/classify.ba.go +++ b/binapi/classify/classify.ba.go @@ -1,22 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/classify.api.json // Package classify contains generated bindings for API file classify.api. // // Contents: // 3 enums -// 28 messages +// 42 messages // package classify import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,8 +28,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "classify" - APIVersion = "3.0.0" - VersionCrc = 0x1298bdec + APIVersion = "3.1.0" + VersionCrc = 0x532123e1 ) // ClassifyAction defines enum 'classify_action'. @@ -347,6 +348,256 @@ func (m *ClassifyAddDelTableReply) Unmarshal(b []byte) error { return nil } +// ClassifyPcapGetTables defines message 'classify_pcap_get_tables'. +type ClassifyPcapGetTables struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ClassifyPcapGetTables) Reset() { *m = ClassifyPcapGetTables{} } +func (*ClassifyPcapGetTables) GetMessageName() string { return "classify_pcap_get_tables" } +func (*ClassifyPcapGetTables) GetCrcString() string { return "f9e6675e" } +func (*ClassifyPcapGetTables) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyPcapGetTables) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *ClassifyPcapGetTables) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ClassifyPcapGetTables) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ClassifyPcapGetTablesReply defines message 'classify_pcap_get_tables_reply'. +type ClassifyPcapGetTablesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Indices []uint32 `binapi:"u32[count],name=indices" json:"indices,omitempty"` +} + +func (m *ClassifyPcapGetTablesReply) Reset() { *m = ClassifyPcapGetTablesReply{} } +func (*ClassifyPcapGetTablesReply) GetMessageName() string { return "classify_pcap_get_tables_reply" } +func (*ClassifyPcapGetTablesReply) GetCrcString() string { return "5f5bc9e6" } +func (*ClassifyPcapGetTablesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyPcapGetTablesReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.Indices) // m.Indices + return size +} +func (m *ClassifyPcapGetTablesReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(len(m.Indices))) + for i := 0; i < len(m.Indices); i++ { + var x uint32 + if i < len(m.Indices) { + x = uint32(m.Indices[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *ClassifyPcapGetTablesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Count = buf.DecodeUint32() + m.Indices = make([]uint32, m.Count) + for i := 0; i < len(m.Indices); i++ { + m.Indices[i] = buf.DecodeUint32() + } + return nil +} + +// ClassifyPcapLookupTable defines message 'classify_pcap_lookup_table'. +type ClassifyPcapLookupTable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=0" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=1" json:"match_n_vectors,omitempty"` + MaskLen uint32 `binapi:"u32,name=mask_len" json:"-"` + Mask []byte `binapi:"u8[mask_len],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyPcapLookupTable) Reset() { *m = ClassifyPcapLookupTable{} } +func (*ClassifyPcapLookupTable) GetMessageName() string { return "classify_pcap_lookup_table" } +func (*ClassifyPcapLookupTable) GetCrcString() string { return "e1b4cc6b" } +func (*ClassifyPcapLookupTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyPcapLookupTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + size += 4 // m.MaskLen + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyPcapLookupTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.SkipNVectors) + buf.EncodeUint32(m.MatchNVectors) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask, 0) + return buf.Bytes(), nil +} +func (m *ClassifyPcapLookupTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.MaskLen = buf.DecodeUint32() + m.Mask = make([]byte, m.MaskLen) + copy(m.Mask, buf.DecodeBytes(len(m.Mask))) + return nil +} + +// ClassifyPcapLookupTableReply defines message 'classify_pcap_lookup_table_reply'. +type ClassifyPcapLookupTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifyPcapLookupTableReply) Reset() { *m = ClassifyPcapLookupTableReply{} } +func (*ClassifyPcapLookupTableReply) GetMessageName() string { + return "classify_pcap_lookup_table_reply" +} +func (*ClassifyPcapLookupTableReply) GetCrcString() string { return "9c6c6773" } +func (*ClassifyPcapLookupTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyPcapLookupTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.TableIndex + return size +} +func (m *ClassifyPcapLookupTableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.TableIndex) + return buf.Bytes(), nil +} +func (m *ClassifyPcapLookupTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.TableIndex = buf.DecodeUint32() + return nil +} + +// ClassifyPcapSetTable defines message 'classify_pcap_set_table'. +type ClassifyPcapSetTable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index,default=4294967295" json:"table_index,omitempty"` + SortMasks bool `binapi:"bool,name=sort_masks,default=0" json:"sort_masks,omitempty"` +} + +func (m *ClassifyPcapSetTable) Reset() { *m = ClassifyPcapSetTable{} } +func (*ClassifyPcapSetTable) GetMessageName() string { return "classify_pcap_set_table" } +func (*ClassifyPcapSetTable) GetCrcString() string { return "006051b3" } +func (*ClassifyPcapSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyPcapSetTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + size += 1 // m.SortMasks + return size +} +func (m *ClassifyPcapSetTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.TableIndex) + buf.EncodeBool(m.SortMasks) + return buf.Bytes(), nil +} +func (m *ClassifyPcapSetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + m.SortMasks = buf.DecodeBool() + return nil +} + +// ClassifyPcapSetTableReply defines message 'classify_pcap_set_table_reply'. +type ClassifyPcapSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifyPcapSetTableReply) Reset() { *m = ClassifyPcapSetTableReply{} } +func (*ClassifyPcapSetTableReply) GetMessageName() string { return "classify_pcap_set_table_reply" } +func (*ClassifyPcapSetTableReply) GetCrcString() string { return "9c6c6773" } +func (*ClassifyPcapSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyPcapSetTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.TableIndex + return size +} +func (m *ClassifyPcapSetTableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.TableIndex) + return buf.Bytes(), nil +} +func (m *ClassifyPcapSetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.TableIndex = buf.DecodeUint32() + return nil +} + // ClassifySessionDetails defines message 'classify_session_details'. type ClassifySessionDetails struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -864,6 +1115,242 @@ func (m *ClassifyTableInfoReply) Unmarshal(b []byte) error { return nil } +// ClassifyTraceGetTables defines message 'classify_trace_get_tables'. +type ClassifyTraceGetTables struct{} + +func (m *ClassifyTraceGetTables) Reset() { *m = ClassifyTraceGetTables{} } +func (*ClassifyTraceGetTables) GetMessageName() string { return "classify_trace_get_tables" } +func (*ClassifyTraceGetTables) GetCrcString() string { return "51077d14" } +func (*ClassifyTraceGetTables) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTraceGetTables) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *ClassifyTraceGetTables) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *ClassifyTraceGetTables) Unmarshal(b []byte) error { + return nil +} + +// ClassifyTraceGetTablesReply defines message 'classify_trace_get_tables_reply'. +type ClassifyTraceGetTablesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Indices []uint32 `binapi:"u32[count],name=indices" json:"indices,omitempty"` +} + +func (m *ClassifyTraceGetTablesReply) Reset() { *m = ClassifyTraceGetTablesReply{} } +func (*ClassifyTraceGetTablesReply) GetMessageName() string { return "classify_trace_get_tables_reply" } +func (*ClassifyTraceGetTablesReply) GetCrcString() string { return "5f5bc9e6" } +func (*ClassifyTraceGetTablesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTraceGetTablesReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.Indices) // m.Indices + return size +} +func (m *ClassifyTraceGetTablesReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(len(m.Indices))) + for i := 0; i < len(m.Indices); i++ { + var x uint32 + if i < len(m.Indices) { + x = uint32(m.Indices[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *ClassifyTraceGetTablesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Count = buf.DecodeUint32() + m.Indices = make([]uint32, m.Count) + for i := 0; i < len(m.Indices); i++ { + m.Indices[i] = buf.DecodeUint32() + } + return nil +} + +// ClassifyTraceLookupTable defines message 'classify_trace_lookup_table'. +type ClassifyTraceLookupTable struct { + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=0" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=1" json:"match_n_vectors,omitempty"` + MaskLen uint32 `binapi:"u32,name=mask_len" json:"-"` + Mask []byte `binapi:"u8[mask_len],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyTraceLookupTable) Reset() { *m = ClassifyTraceLookupTable{} } +func (*ClassifyTraceLookupTable) GetMessageName() string { return "classify_trace_lookup_table" } +func (*ClassifyTraceLookupTable) GetCrcString() string { return "3f7b72e4" } +func (*ClassifyTraceLookupTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTraceLookupTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + size += 4 // m.MaskLen + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyTraceLookupTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SkipNVectors) + buf.EncodeUint32(m.MatchNVectors) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask, 0) + return buf.Bytes(), nil +} +func (m *ClassifyTraceLookupTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.MaskLen = buf.DecodeUint32() + m.Mask = make([]byte, m.MaskLen) + copy(m.Mask, buf.DecodeBytes(len(m.Mask))) + return nil +} + +// ClassifyTraceLookupTableReply defines message 'classify_trace_lookup_table_reply'. +type ClassifyTraceLookupTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifyTraceLookupTableReply) Reset() { *m = ClassifyTraceLookupTableReply{} } +func (*ClassifyTraceLookupTableReply) GetMessageName() string { + return "classify_trace_lookup_table_reply" +} +func (*ClassifyTraceLookupTableReply) GetCrcString() string { return "9c6c6773" } +func (*ClassifyTraceLookupTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTraceLookupTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.TableIndex + return size +} +func (m *ClassifyTraceLookupTableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.TableIndex) + return buf.Bytes(), nil +} +func (m *ClassifyTraceLookupTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.TableIndex = buf.DecodeUint32() + return nil +} + +// ClassifyTraceSetTable defines message 'classify_trace_set_table'. +type ClassifyTraceSetTable struct { + TableIndex uint32 `binapi:"u32,name=table_index,default=4294967295" json:"table_index,omitempty"` + SortMasks bool `binapi:"bool,name=sort_masks,default=0" json:"sort_masks,omitempty"` +} + +func (m *ClassifyTraceSetTable) Reset() { *m = ClassifyTraceSetTable{} } +func (*ClassifyTraceSetTable) GetMessageName() string { return "classify_trace_set_table" } +func (*ClassifyTraceSetTable) GetCrcString() string { return "3909b55a" } +func (*ClassifyTraceSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTraceSetTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.TableIndex + size += 1 // m.SortMasks + return size +} +func (m *ClassifyTraceSetTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.TableIndex) + buf.EncodeBool(m.SortMasks) + return buf.Bytes(), nil +} +func (m *ClassifyTraceSetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableIndex = buf.DecodeUint32() + m.SortMasks = buf.DecodeBool() + return nil +} + +// ClassifyTraceSetTableReply defines message 'classify_trace_set_table_reply'. +type ClassifyTraceSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifyTraceSetTableReply) Reset() { *m = ClassifyTraceSetTableReply{} } +func (*ClassifyTraceSetTableReply) GetMessageName() string { return "classify_trace_set_table_reply" } +func (*ClassifyTraceSetTableReply) GetCrcString() string { return "9c6c6773" } +func (*ClassifyTraceSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTraceSetTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.TableIndex + return size +} +func (m *ClassifyTraceSetTableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.TableIndex) + return buf.Bytes(), nil +} +func (m *ClassifyTraceSetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.TableIndex = buf.DecodeUint32() + return nil +} + // FlowClassifyDetails defines message 'flow_classify_details'. type FlowClassifyDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1340,12 +1827,92 @@ func (m *PolicerClassifySetInterfaceReply) Unmarshal(b []byte) error { return nil } +// PuntACLAddDel defines message 'punt_acl_add_del'. +type PuntACLAddDel struct { + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index,default=4294967295" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index,default=4294967295" json:"ip6_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *PuntACLAddDel) Reset() { *m = PuntACLAddDel{} } +func (*PuntACLAddDel) GetMessageName() string { return "punt_acl_add_del" } +func (*PuntACLAddDel) GetCrcString() string { return "a93bf3a0" } +func (*PuntACLAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PuntACLAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 1 // m.IsAdd + return size +} +func (m *PuntACLAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.IP4TableIndex) + buf.EncodeUint32(m.IP6TableIndex) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *PuntACLAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// PuntACLAddDelReply defines message 'punt_acl_add_del_reply'. +type PuntACLAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PuntACLAddDelReply) Reset() { *m = PuntACLAddDelReply{} } +func (*PuntACLAddDelReply) GetMessageName() string { return "punt_acl_add_del_reply" } +func (*PuntACLAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*PuntACLAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PuntACLAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PuntACLAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PuntACLAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_classify_binapi_init() } func file_classify_binapi_init() { api.RegisterMessage((*ClassifyAddDelSession)(nil), "classify_add_del_session_f20879f0") api.RegisterMessage((*ClassifyAddDelSessionReply)(nil), "classify_add_del_session_reply_e8d4e804") api.RegisterMessage((*ClassifyAddDelTable)(nil), "classify_add_del_table_6849e39e") api.RegisterMessage((*ClassifyAddDelTableReply)(nil), "classify_add_del_table_reply_05486349") + api.RegisterMessage((*ClassifyPcapGetTables)(nil), "classify_pcap_get_tables_f9e6675e") + api.RegisterMessage((*ClassifyPcapGetTablesReply)(nil), "classify_pcap_get_tables_reply_5f5bc9e6") + api.RegisterMessage((*ClassifyPcapLookupTable)(nil), "classify_pcap_lookup_table_e1b4cc6b") + api.RegisterMessage((*ClassifyPcapLookupTableReply)(nil), "classify_pcap_lookup_table_reply_9c6c6773") + api.RegisterMessage((*ClassifyPcapSetTable)(nil), "classify_pcap_set_table_006051b3") + api.RegisterMessage((*ClassifyPcapSetTableReply)(nil), "classify_pcap_set_table_reply_9c6c6773") api.RegisterMessage((*ClassifySessionDetails)(nil), "classify_session_details_60e3ef94") api.RegisterMessage((*ClassifySessionDump)(nil), "classify_session_dump_0cca2cd9") api.RegisterMessage((*ClassifySetInterfaceIPTable)(nil), "classify_set_interface_ip_table_e0b097c7") @@ -1358,6 +1925,12 @@ func file_classify_binapi_init() { api.RegisterMessage((*ClassifyTableIdsReply)(nil), "classify_table_ids_reply_d1d20e1d") api.RegisterMessage((*ClassifyTableInfo)(nil), "classify_table_info_0cca2cd9") api.RegisterMessage((*ClassifyTableInfoReply)(nil), "classify_table_info_reply_4a573c0e") + api.RegisterMessage((*ClassifyTraceGetTables)(nil), "classify_trace_get_tables_51077d14") + api.RegisterMessage((*ClassifyTraceGetTablesReply)(nil), "classify_trace_get_tables_reply_5f5bc9e6") + api.RegisterMessage((*ClassifyTraceLookupTable)(nil), "classify_trace_lookup_table_3f7b72e4") + api.RegisterMessage((*ClassifyTraceLookupTableReply)(nil), "classify_trace_lookup_table_reply_9c6c6773") + api.RegisterMessage((*ClassifyTraceSetTable)(nil), "classify_trace_set_table_3909b55a") + api.RegisterMessage((*ClassifyTraceSetTableReply)(nil), "classify_trace_set_table_reply_9c6c6773") api.RegisterMessage((*FlowClassifyDetails)(nil), "flow_classify_details_dfd08765") api.RegisterMessage((*FlowClassifyDump)(nil), "flow_classify_dump_8a6ad43d") api.RegisterMessage((*FlowClassifySetInterface)(nil), "flow_classify_set_interface_b6192f1c") @@ -1370,6 +1943,8 @@ func file_classify_binapi_init() { api.RegisterMessage((*PolicerClassifyDump)(nil), "policer_classify_dump_6bfe6603") api.RegisterMessage((*PolicerClassifySetInterface)(nil), "policer_classify_set_interface_de7ad708") api.RegisterMessage((*PolicerClassifySetInterfaceReply)(nil), "policer_classify_set_interface_reply_e8d4e804") + api.RegisterMessage((*PuntACLAddDel)(nil), "punt_acl_add_del_a93bf3a0") + api.RegisterMessage((*PuntACLAddDelReply)(nil), "punt_acl_add_del_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -1379,6 +1954,12 @@ func AllMessages() []api.Message { (*ClassifyAddDelSessionReply)(nil), (*ClassifyAddDelTable)(nil), (*ClassifyAddDelTableReply)(nil), + (*ClassifyPcapGetTables)(nil), + (*ClassifyPcapGetTablesReply)(nil), + (*ClassifyPcapLookupTable)(nil), + (*ClassifyPcapLookupTableReply)(nil), + (*ClassifyPcapSetTable)(nil), + (*ClassifyPcapSetTableReply)(nil), (*ClassifySessionDetails)(nil), (*ClassifySessionDump)(nil), (*ClassifySetInterfaceIPTable)(nil), @@ -1391,6 +1972,12 @@ func AllMessages() []api.Message { (*ClassifyTableIdsReply)(nil), (*ClassifyTableInfo)(nil), (*ClassifyTableInfoReply)(nil), + (*ClassifyTraceGetTables)(nil), + (*ClassifyTraceGetTablesReply)(nil), + (*ClassifyTraceLookupTable)(nil), + (*ClassifyTraceLookupTableReply)(nil), + (*ClassifyTraceSetTable)(nil), + (*ClassifyTraceSetTableReply)(nil), (*FlowClassifyDetails)(nil), (*FlowClassifyDump)(nil), (*FlowClassifySetInterface)(nil), @@ -1403,5 +1990,7 @@ func AllMessages() []api.Message { (*PolicerClassifyDump)(nil), (*PolicerClassifySetInterface)(nil), (*PolicerClassifySetInterfaceReply)(nil), + (*PuntACLAddDel)(nil), + (*PuntACLAddDelReply)(nil), } } diff --git a/binapi/classify/classify_rest.ba.go b/binapi/classify/classify_rest.ba.go deleted file mode 100644 index f50fefd..0000000 --- a/binapi/classify/classify_rest.ba.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package classify - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/classify_add_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyAddDelSession) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifyAddDelSession(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_add_del_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyAddDelTable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifyAddDelTable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_set_interface_ip_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifySetInterfaceIPTable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifySetInterfaceIPTable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_set_interface_l2_tables", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifySetInterfaceL2Tables) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifySetInterfaceL2Tables(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_table_by_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableByInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifyTableByInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_table_ids", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableIds) - reply, err := rpc.ClassifyTableIds(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/classify_table_info", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableInfo) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ClassifyTableInfo(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/flow_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowClassifySetInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.FlowClassifySetInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/input_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(InputACLSetInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.InputACLSetInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/output_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(OutputACLSetInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OutputACLSetInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/policer_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(PolicerClassifySetInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PolicerClassifySetInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/classify/classify_rpc.ba.go b/binapi/classify/classify_rpc.ba.go index 8893db8..b3e2161 100644 --- a/binapi/classify/classify_rpc.ba.go +++ b/binapi/classify/classify_rpc.ba.go @@ -5,27 +5,35 @@ package classify import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service classify. +// RPCService defines RPC service classify. type RPCService interface { ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) + ClassifyPcapGetTables(ctx context.Context, in *ClassifyPcapGetTables) (*ClassifyPcapGetTablesReply, error) + ClassifyPcapLookupTable(ctx context.Context, in *ClassifyPcapLookupTable) (*ClassifyPcapLookupTableReply, error) + ClassifyPcapSetTable(ctx context.Context, in *ClassifyPcapSetTable) (*ClassifyPcapSetTableReply, error) ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) ClassifySetInterfaceIPTable(ctx context.Context, in *ClassifySetInterfaceIPTable) (*ClassifySetInterfaceIPTableReply, error) ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) + ClassifyTraceGetTables(ctx context.Context, in *ClassifyTraceGetTables) (*ClassifyTraceGetTablesReply, error) + ClassifyTraceLookupTable(ctx context.Context, in *ClassifyTraceLookupTable) (*ClassifyTraceLookupTableReply, error) + ClassifyTraceSetTable(ctx context.Context, in *ClassifyTraceSetTable) (*ClassifyTraceSetTableReply, error) FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) FlowClassifySetInterface(ctx context.Context, in *FlowClassifySetInterface) (*FlowClassifySetInterfaceReply, error) InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) PolicerClassifySetInterface(ctx context.Context, in *PolicerClassifySetInterface) (*PolicerClassifySetInterfaceReply, error) + PuntACLAddDel(ctx context.Context, in *PuntACLAddDel) (*PuntACLAddDelReply, error) } type serviceClient struct { @@ -42,7 +50,7 @@ func (c *serviceClient) ClassifyAddDelSession(ctx context.Context, in *ClassifyA if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) { @@ -51,7 +59,34 @@ func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyPcapGetTables(ctx context.Context, in *ClassifyPcapGetTables) (*ClassifyPcapGetTablesReply, error) { + out := new(ClassifyPcapGetTablesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyPcapLookupTable(ctx context.Context, in *ClassifyPcapLookupTable) (*ClassifyPcapLookupTableReply, error) { + out := new(ClassifyPcapLookupTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyPcapSetTable(ctx context.Context, in *ClassifyPcapSetTable) (*ClassifyPcapSetTableReply, error) { + out := new(ClassifyPcapSetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) { @@ -63,7 +98,7 @@ func (c *serviceClient) ClassifySessionDump(ctx context.Context, in *ClassifySes if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -86,7 +121,11 @@ func (c *serviceClient_ClassifySessionDumpClient) Recv() (*ClassifySessionDetail switch m := msg.(type) { case *ClassifySessionDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -99,7 +138,7 @@ func (c *serviceClient) ClassifySetInterfaceIPTable(ctx context.Context, in *Cla if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) { @@ -108,7 +147,7 @@ func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *Cl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) { @@ -117,7 +156,7 @@ func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *Classi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) { @@ -126,7 +165,7 @@ func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) { @@ -135,7 +174,34 @@ func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyTraceGetTables(ctx context.Context, in *ClassifyTraceGetTables) (*ClassifyTraceGetTablesReply, error) { + out := new(ClassifyTraceGetTablesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyTraceLookupTable(ctx context.Context, in *ClassifyTraceLookupTable) (*ClassifyTraceLookupTableReply, error) { + out := new(ClassifyTraceLookupTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ClassifyTraceSetTable(ctx context.Context, in *ClassifyTraceSetTable) (*ClassifyTraceSetTableReply, error) { + out := new(ClassifyTraceSetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) { @@ -147,7 +213,7 @@ func (c *serviceClient) FlowClassifyDump(ctx context.Context, in *FlowClassifyDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -170,7 +236,11 @@ func (c *serviceClient_FlowClassifyDumpClient) Recv() (*FlowClassifyDetails, err switch m := msg.(type) { case *FlowClassifyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -183,7 +253,7 @@ func (c *serviceClient) FlowClassifySetInterface(ctx context.Context, in *FlowCl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) { @@ -192,7 +262,7 @@ func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) { @@ -201,7 +271,7 @@ func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACL if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) { @@ -213,7 +283,7 @@ func (c *serviceClient) PolicerClassifyDump(ctx context.Context, in *PolicerClas if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -236,7 +306,11 @@ func (c *serviceClient_PolicerClassifyDumpClient) Recv() (*PolicerClassifyDetail switch m := msg.(type) { case *PolicerClassifyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -249,5 +323,14 @@ func (c *serviceClient) PolicerClassifySetInterface(ctx context.Context, in *Pol if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PuntACLAddDel(ctx context.Context, in *PuntACLAddDel) (*PuntACLAddDelReply, error) { + out := new(PuntACLAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/cnat/cnat.ba.go b/binapi/cnat/cnat.ba.go new file mode 100644 index 0000000..ca35754 --- /dev/null +++ b/binapi/cnat/cnat.ba.go @@ -0,0 +1,1213 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/cnat.api.json + +// Package cnat contains generated bindings for API file cnat.api. +// +// Contents: +// 5 enums +// 4 structs +// 20 messages +// +package cnat + +import ( + "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "cnat" + APIVersion = "0.2.0" + VersionCrc = 0xfd05573b +) + +// CnatEndpointTupleFlags defines enum 'cnat_endpoint_tuple_flags'. +type CnatEndpointTupleFlags uint8 + +const ( + CNAT_EPT_NO_NAT CnatEndpointTupleFlags = 1 +) + +var ( + CnatEndpointTupleFlags_name = map[uint8]string{ + 1: "CNAT_EPT_NO_NAT", + } + CnatEndpointTupleFlags_value = map[string]uint8{ + "CNAT_EPT_NO_NAT": 1, + } +) + +func (x CnatEndpointTupleFlags) String() string { + s, ok := CnatEndpointTupleFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := CnatEndpointTupleFlags_name[uint8(n)] + if ok { + return s + } + return "CnatEndpointTupleFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// CnatLbType defines enum 'cnat_lb_type'. +type CnatLbType uint8 + +const ( + CNAT_LB_TYPE_DEFAULT CnatLbType = 0 + CNAT_LB_TYPE_MAGLEV CnatLbType = 1 +) + +var ( + CnatLbType_name = map[uint8]string{ + 0: "CNAT_LB_TYPE_DEFAULT", + 1: "CNAT_LB_TYPE_MAGLEV", + } + CnatLbType_value = map[string]uint8{ + "CNAT_LB_TYPE_DEFAULT": 0, + "CNAT_LB_TYPE_MAGLEV": 1, + } +) + +func (x CnatLbType) String() string { + s, ok := CnatLbType_name[uint8(x)] + if ok { + return s + } + return "CnatLbType(" + strconv.Itoa(int(x)) + ")" +} + +// CnatSnatPolicies defines enum 'cnat_snat_policies'. +type CnatSnatPolicies uint8 + +const ( + CNAT_POLICY_NONE CnatSnatPolicies = 0 + CNAT_POLICY_IF_PFX CnatSnatPolicies = 1 + CNAT_POLICY_K8S CnatSnatPolicies = 2 +) + +var ( + CnatSnatPolicies_name = map[uint8]string{ + 0: "CNAT_POLICY_NONE", + 1: "CNAT_POLICY_IF_PFX", + 2: "CNAT_POLICY_K8S", + } + CnatSnatPolicies_value = map[string]uint8{ + "CNAT_POLICY_NONE": 0, + "CNAT_POLICY_IF_PFX": 1, + "CNAT_POLICY_K8S": 2, + } +) + +func (x CnatSnatPolicies) String() string { + s, ok := CnatSnatPolicies_name[uint8(x)] + if ok { + return s + } + return "CnatSnatPolicies(" + strconv.Itoa(int(x)) + ")" +} + +// CnatSnatPolicyTable defines enum 'cnat_snat_policy_table'. +type CnatSnatPolicyTable uint8 + +const ( + CNAT_POLICY_INCLUDE_V4 CnatSnatPolicyTable = 0 + CNAT_POLICY_INCLUDE_V6 CnatSnatPolicyTable = 1 + CNAT_POLICY_POD CnatSnatPolicyTable = 2 +) + +var ( + CnatSnatPolicyTable_name = map[uint8]string{ + 0: "CNAT_POLICY_INCLUDE_V4", + 1: "CNAT_POLICY_INCLUDE_V6", + 2: "CNAT_POLICY_POD", + } + CnatSnatPolicyTable_value = map[string]uint8{ + "CNAT_POLICY_INCLUDE_V4": 0, + "CNAT_POLICY_INCLUDE_V6": 1, + "CNAT_POLICY_POD": 2, + } +) + +func (x CnatSnatPolicyTable) String() string { + s, ok := CnatSnatPolicyTable_name[uint8(x)] + if ok { + return s + } + return "CnatSnatPolicyTable(" + strconv.Itoa(int(x)) + ")" +} + +// CnatTranslationFlags defines enum 'cnat_translation_flags'. +type CnatTranslationFlags uint8 + +const ( + CNAT_TRANSLATION_ALLOC_PORT CnatTranslationFlags = 1 +) + +var ( + CnatTranslationFlags_name = map[uint8]string{ + 1: "CNAT_TRANSLATION_ALLOC_PORT", + } + CnatTranslationFlags_value = map[string]uint8{ + "CNAT_TRANSLATION_ALLOC_PORT": 1, + } +) + +func (x CnatTranslationFlags) String() string { + s, ok := CnatTranslationFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := CnatTranslationFlags_name[uint8(n)] + if ok { + return s + } + return "CnatTranslationFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// CnatEndpoint defines type 'cnat_endpoint'. +type CnatEndpoint struct { + Addr ip_types.Address `binapi:"address,name=addr" json:"addr,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IfAf ip_types.AddressFamily `binapi:"address_family,name=if_af" json:"if_af,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} + +// CnatEndpointTuple defines type 'cnat_endpoint_tuple'. +type CnatEndpointTuple struct { + DstEp CnatEndpoint `binapi:"cnat_endpoint,name=dst_ep" json:"dst_ep,omitempty"` + SrcEp CnatEndpoint `binapi:"cnat_endpoint,name=src_ep" json:"src_ep,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` +} + +// CnatSession defines type 'cnat_session'. +type CnatSession struct { + Src CnatEndpoint `binapi:"cnat_endpoint,name=src" json:"src,omitempty"` + Dst CnatEndpoint `binapi:"cnat_endpoint,name=dst" json:"dst,omitempty"` + New CnatEndpoint `binapi:"cnat_endpoint,name=new" json:"new,omitempty"` + IPProto ip_types.IPProto `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"` + Location uint8 `binapi:"u8,name=location" json:"location,omitempty"` + Timestamp float64 `binapi:"f64,name=timestamp" json:"timestamp,omitempty"` +} + +// CnatTranslation defines type 'cnat_translation'. +type CnatTranslation struct { + Vip CnatEndpoint `binapi:"cnat_endpoint,name=vip" json:"vip,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + IPProto ip_types.IPProto `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"` + IsRealIP uint8 `binapi:"u8,name=is_real_ip" json:"is_real_ip,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` + LbType CnatLbType `binapi:"cnat_lb_type,name=lb_type" json:"lb_type,omitempty"` + NPaths uint32 `binapi:"u32,name=n_paths" json:"-"` + Paths []CnatEndpointTuple `binapi:"cnat_endpoint_tuple[n_paths],name=paths" json:"paths,omitempty"` +} + +// CnatGetSnatAddresses defines message 'cnat_get_snat_addresses'. +// InProgress: the message form may change in the future versions +type CnatGetSnatAddresses struct{} + +func (m *CnatGetSnatAddresses) Reset() { *m = CnatGetSnatAddresses{} } +func (*CnatGetSnatAddresses) GetMessageName() string { return "cnat_get_snat_addresses" } +func (*CnatGetSnatAddresses) GetCrcString() string { return "51077d14" } +func (*CnatGetSnatAddresses) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatGetSnatAddresses) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *CnatGetSnatAddresses) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *CnatGetSnatAddresses) Unmarshal(b []byte) error { + return nil +} + +// CnatGetSnatAddressesReply defines message 'cnat_get_snat_addresses_reply'. +// InProgress: the message form may change in the future versions +type CnatGetSnatAddressesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + SnatIP4 ip_types.IP4Address `binapi:"ip4_address,name=snat_ip4" json:"snat_ip4,omitempty"` + SnatIP6 ip_types.IP6Address `binapi:"ip6_address,name=snat_ip6" json:"snat_ip6,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CnatGetSnatAddressesReply) Reset() { *m = CnatGetSnatAddressesReply{} } +func (*CnatGetSnatAddressesReply) GetMessageName() string { return "cnat_get_snat_addresses_reply" } +func (*CnatGetSnatAddressesReply) GetCrcString() string { return "879513c1" } +func (*CnatGetSnatAddressesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatGetSnatAddressesReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.ID + size += 1 * 4 // m.SnatIP4 + size += 1 * 16 // m.SnatIP6 + size += 4 // m.SwIfIndex + return size +} +func (m *CnatGetSnatAddressesReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.ID) + buf.EncodeBytes(m.SnatIP4[:], 4) + buf.EncodeBytes(m.SnatIP6[:], 16) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CnatGetSnatAddressesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ID = buf.DecodeUint32() + copy(m.SnatIP4[:], buf.DecodeBytes(4)) + copy(m.SnatIP6[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CnatSessionDetails defines message 'cnat_session_details'. +// InProgress: the message form may change in the future versions +type CnatSessionDetails struct { + Session CnatSession `binapi:"cnat_session,name=session" json:"session,omitempty"` +} + +func (m *CnatSessionDetails) Reset() { *m = CnatSessionDetails{} } +func (*CnatSessionDetails) GetMessageName() string { return "cnat_session_details" } +func (*CnatSessionDetails) GetCrcString() string { return "7e5017c7" } +func (*CnatSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSessionDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Session.Src.Addr.Af + size += 1 * 16 // m.Session.Src.Addr.Un + size += 4 // m.Session.Src.SwIfIndex + size += 1 // m.Session.Src.IfAf + size += 2 // m.Session.Src.Port + size += 1 // m.Session.Dst.Addr.Af + size += 1 * 16 // m.Session.Dst.Addr.Un + size += 4 // m.Session.Dst.SwIfIndex + size += 1 // m.Session.Dst.IfAf + size += 2 // m.Session.Dst.Port + size += 1 // m.Session.New.Addr.Af + size += 1 * 16 // m.Session.New.Addr.Un + size += 4 // m.Session.New.SwIfIndex + size += 1 // m.Session.New.IfAf + size += 2 // m.Session.New.Port + size += 1 // m.Session.IPProto + size += 1 // m.Session.Location + size += 8 // m.Session.Timestamp + return size +} +func (m *CnatSessionDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Session.Src.Addr.Af)) + buf.EncodeBytes(m.Session.Src.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Session.Src.SwIfIndex)) + buf.EncodeUint8(uint8(m.Session.Src.IfAf)) + buf.EncodeUint16(m.Session.Src.Port) + buf.EncodeUint8(uint8(m.Session.Dst.Addr.Af)) + buf.EncodeBytes(m.Session.Dst.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Session.Dst.SwIfIndex)) + buf.EncodeUint8(uint8(m.Session.Dst.IfAf)) + buf.EncodeUint16(m.Session.Dst.Port) + buf.EncodeUint8(uint8(m.Session.New.Addr.Af)) + buf.EncodeBytes(m.Session.New.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Session.New.SwIfIndex)) + buf.EncodeUint8(uint8(m.Session.New.IfAf)) + buf.EncodeUint16(m.Session.New.Port) + buf.EncodeUint8(uint8(m.Session.IPProto)) + buf.EncodeUint8(m.Session.Location) + buf.EncodeFloat64(m.Session.Timestamp) + return buf.Bytes(), nil +} +func (m *CnatSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Session.Src.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Session.Src.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Session.Src.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Session.Src.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Session.Src.Port = buf.DecodeUint16() + m.Session.Dst.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Session.Dst.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Session.Dst.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Session.Dst.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Session.Dst.Port = buf.DecodeUint16() + m.Session.New.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Session.New.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Session.New.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Session.New.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Session.New.Port = buf.DecodeUint16() + m.Session.IPProto = ip_types.IPProto(buf.DecodeUint8()) + m.Session.Location = buf.DecodeUint8() + m.Session.Timestamp = buf.DecodeFloat64() + return nil +} + +// CnatSessionDump defines message 'cnat_session_dump'. +// InProgress: the message form may change in the future versions +type CnatSessionDump struct{} + +func (m *CnatSessionDump) Reset() { *m = CnatSessionDump{} } +func (*CnatSessionDump) GetMessageName() string { return "cnat_session_dump" } +func (*CnatSessionDump) GetCrcString() string { return "51077d14" } +func (*CnatSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSessionDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *CnatSessionDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *CnatSessionDump) Unmarshal(b []byte) error { + return nil +} + +// CnatSessionPurge defines message 'cnat_session_purge'. +// InProgress: the message form may change in the future versions +type CnatSessionPurge struct{} + +func (m *CnatSessionPurge) Reset() { *m = CnatSessionPurge{} } +func (*CnatSessionPurge) GetMessageName() string { return "cnat_session_purge" } +func (*CnatSessionPurge) GetCrcString() string { return "51077d14" } +func (*CnatSessionPurge) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSessionPurge) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *CnatSessionPurge) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *CnatSessionPurge) Unmarshal(b []byte) error { + return nil +} + +// CnatSessionPurgeReply defines message 'cnat_session_purge_reply'. +// InProgress: the message form may change in the future versions +type CnatSessionPurgeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatSessionPurgeReply) Reset() { *m = CnatSessionPurgeReply{} } +func (*CnatSessionPurgeReply) GetMessageName() string { return "cnat_session_purge_reply" } +func (*CnatSessionPurgeReply) GetCrcString() string { return "e8d4e804" } +func (*CnatSessionPurgeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSessionPurgeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatSessionPurgeReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatSessionPurgeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatSetSnatAddresses defines message 'cnat_set_snat_addresses'. +// InProgress: the message form may change in the future versions +type CnatSetSnatAddresses struct { + SnatIP4 ip_types.IP4Address `binapi:"ip4_address,name=snat_ip4" json:"snat_ip4,omitempty"` + SnatIP6 ip_types.IP6Address `binapi:"ip6_address,name=snat_ip6" json:"snat_ip6,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CnatSetSnatAddresses) Reset() { *m = CnatSetSnatAddresses{} } +func (*CnatSetSnatAddresses) GetMessageName() string { return "cnat_set_snat_addresses" } +func (*CnatSetSnatAddresses) GetCrcString() string { return "d997e96c" } +func (*CnatSetSnatAddresses) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSetSnatAddresses) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.SnatIP4 + size += 1 * 16 // m.SnatIP6 + size += 4 // m.SwIfIndex + return size +} +func (m *CnatSetSnatAddresses) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.SnatIP4[:], 4) + buf.EncodeBytes(m.SnatIP6[:], 16) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CnatSetSnatAddresses) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.SnatIP4[:], buf.DecodeBytes(4)) + copy(m.SnatIP6[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CnatSetSnatAddressesReply defines message 'cnat_set_snat_addresses_reply'. +// InProgress: the message form may change in the future versions +type CnatSetSnatAddressesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatSetSnatAddressesReply) Reset() { *m = CnatSetSnatAddressesReply{} } +func (*CnatSetSnatAddressesReply) GetMessageName() string { return "cnat_set_snat_addresses_reply" } +func (*CnatSetSnatAddressesReply) GetCrcString() string { return "e8d4e804" } +func (*CnatSetSnatAddressesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSetSnatAddressesReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatSetSnatAddressesReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatSetSnatAddressesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatSetSnatPolicy defines message 'cnat_set_snat_policy'. +// InProgress: the message form may change in the future versions +type CnatSetSnatPolicy struct { + Policy CnatSnatPolicies `binapi:"cnat_snat_policies,name=policy" json:"policy,omitempty"` +} + +func (m *CnatSetSnatPolicy) Reset() { *m = CnatSetSnatPolicy{} } +func (*CnatSetSnatPolicy) GetMessageName() string { return "cnat_set_snat_policy" } +func (*CnatSetSnatPolicy) GetCrcString() string { return "d3e6eaf4" } +func (*CnatSetSnatPolicy) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSetSnatPolicy) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Policy + return size +} +func (m *CnatSetSnatPolicy) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Policy)) + return buf.Bytes(), nil +} +func (m *CnatSetSnatPolicy) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Policy = CnatSnatPolicies(buf.DecodeUint8()) + return nil +} + +// CnatSetSnatPolicyReply defines message 'cnat_set_snat_policy_reply'. +// InProgress: the message form may change in the future versions +type CnatSetSnatPolicyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatSetSnatPolicyReply) Reset() { *m = CnatSetSnatPolicyReply{} } +func (*CnatSetSnatPolicyReply) GetMessageName() string { return "cnat_set_snat_policy_reply" } +func (*CnatSetSnatPolicyReply) GetCrcString() string { return "e8d4e804" } +func (*CnatSetSnatPolicyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSetSnatPolicyReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatSetSnatPolicyReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatSetSnatPolicyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatSnatPolicyAddDelExcludePfx defines message 'cnat_snat_policy_add_del_exclude_pfx'. +// InProgress: the message form may change in the future versions +type CnatSnatPolicyAddDelExcludePfx struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *CnatSnatPolicyAddDelExcludePfx) Reset() { *m = CnatSnatPolicyAddDelExcludePfx{} } +func (*CnatSnatPolicyAddDelExcludePfx) GetMessageName() string { + return "cnat_snat_policy_add_del_exclude_pfx" +} +func (*CnatSnatPolicyAddDelExcludePfx) GetCrcString() string { return "e26dd79a" } +func (*CnatSnatPolicyAddDelExcludePfx) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSnatPolicyAddDelExcludePfx) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *CnatSnatPolicyAddDelExcludePfx) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Prefix.Len) + return buf.Bytes(), nil +} +func (m *CnatSnatPolicyAddDelExcludePfx) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// CnatSnatPolicyAddDelExcludePfxReply defines message 'cnat_snat_policy_add_del_exclude_pfx_reply'. +// InProgress: the message form may change in the future versions +type CnatSnatPolicyAddDelExcludePfxReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatSnatPolicyAddDelExcludePfxReply) Reset() { *m = CnatSnatPolicyAddDelExcludePfxReply{} } +func (*CnatSnatPolicyAddDelExcludePfxReply) GetMessageName() string { + return "cnat_snat_policy_add_del_exclude_pfx_reply" +} +func (*CnatSnatPolicyAddDelExcludePfxReply) GetCrcString() string { return "e8d4e804" } +func (*CnatSnatPolicyAddDelExcludePfxReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSnatPolicyAddDelExcludePfxReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatSnatPolicyAddDelExcludePfxReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatSnatPolicyAddDelExcludePfxReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatSnatPolicyAddDelIf defines message 'cnat_snat_policy_add_del_if'. +// InProgress: the message form may change in the future versions +type CnatSnatPolicyAddDelIf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Table CnatSnatPolicyTable `binapi:"cnat_snat_policy_table,name=table" json:"table,omitempty"` +} + +func (m *CnatSnatPolicyAddDelIf) Reset() { *m = CnatSnatPolicyAddDelIf{} } +func (*CnatSnatPolicyAddDelIf) GetMessageName() string { return "cnat_snat_policy_add_del_if" } +func (*CnatSnatPolicyAddDelIf) GetCrcString() string { return "6828deca" } +func (*CnatSnatPolicyAddDelIf) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatSnatPolicyAddDelIf) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + size += 1 // m.Table + return size +} +func (m *CnatSnatPolicyAddDelIf) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint8(uint8(m.Table)) + return buf.Bytes(), nil +} +func (m *CnatSnatPolicyAddDelIf) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeUint8() + m.Table = CnatSnatPolicyTable(buf.DecodeUint8()) + return nil +} + +// CnatSnatPolicyAddDelIfReply defines message 'cnat_snat_policy_add_del_if_reply'. +// InProgress: the message form may change in the future versions +type CnatSnatPolicyAddDelIfReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatSnatPolicyAddDelIfReply) Reset() { *m = CnatSnatPolicyAddDelIfReply{} } +func (*CnatSnatPolicyAddDelIfReply) GetMessageName() string { + return "cnat_snat_policy_add_del_if_reply" +} +func (*CnatSnatPolicyAddDelIfReply) GetCrcString() string { return "e8d4e804" } +func (*CnatSnatPolicyAddDelIfReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatSnatPolicyAddDelIfReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatSnatPolicyAddDelIfReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatSnatPolicyAddDelIfReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatTranslationDel defines message 'cnat_translation_del'. +// InProgress: the message form may change in the future versions +type CnatTranslationDel struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *CnatTranslationDel) Reset() { *m = CnatTranslationDel{} } +func (*CnatTranslationDel) GetMessageName() string { return "cnat_translation_del" } +func (*CnatTranslationDel) GetCrcString() string { return "3a91bde5" } +func (*CnatTranslationDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatTranslationDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.ID + return size +} +func (m *CnatTranslationDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.ID) + return buf.Bytes(), nil +} +func (m *CnatTranslationDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + return nil +} + +// CnatTranslationDelReply defines message 'cnat_translation_del_reply'. +// InProgress: the message form may change in the future versions +type CnatTranslationDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CnatTranslationDelReply) Reset() { *m = CnatTranslationDelReply{} } +func (*CnatTranslationDelReply) GetMessageName() string { return "cnat_translation_del_reply" } +func (*CnatTranslationDelReply) GetCrcString() string { return "e8d4e804" } +func (*CnatTranslationDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatTranslationDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CnatTranslationDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CnatTranslationDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CnatTranslationDetails defines message 'cnat_translation_details'. +// InProgress: the message form may change in the future versions +type CnatTranslationDetails struct { + Translation CnatTranslation `binapi:"cnat_translation,name=translation" json:"translation,omitempty"` +} + +func (m *CnatTranslationDetails) Reset() { *m = CnatTranslationDetails{} } +func (*CnatTranslationDetails) GetMessageName() string { return "cnat_translation_details" } +func (*CnatTranslationDetails) GetCrcString() string { return "347e1f16" } +func (*CnatTranslationDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatTranslationDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Translation.Vip.Addr.Af + size += 1 * 16 // m.Translation.Vip.Addr.Un + size += 4 // m.Translation.Vip.SwIfIndex + size += 1 // m.Translation.Vip.IfAf + size += 2 // m.Translation.Vip.Port + size += 4 // m.Translation.ID + size += 1 // m.Translation.IPProto + size += 1 // m.Translation.IsRealIP + size += 1 // m.Translation.Flags + size += 1 // m.Translation.LbType + size += 4 // m.Translation.NPaths + for j2 := 0; j2 < len(m.Translation.Paths); j2++ { + var s2 CnatEndpointTuple + _ = s2 + if j2 < len(m.Translation.Paths) { + s2 = m.Translation.Paths[j2] + } + size += 1 // s2.DstEp.Addr.Af + size += 1 * 16 // s2.DstEp.Addr.Un + size += 4 // s2.DstEp.SwIfIndex + size += 1 // s2.DstEp.IfAf + size += 2 // s2.DstEp.Port + size += 1 // s2.SrcEp.Addr.Af + size += 1 * 16 // s2.SrcEp.Addr.Un + size += 4 // s2.SrcEp.SwIfIndex + size += 1 // s2.SrcEp.IfAf + size += 2 // s2.SrcEp.Port + size += 1 // s2.Flags + } + return size +} +func (m *CnatTranslationDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Translation.Vip.Addr.Af)) + buf.EncodeBytes(m.Translation.Vip.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Translation.Vip.SwIfIndex)) + buf.EncodeUint8(uint8(m.Translation.Vip.IfAf)) + buf.EncodeUint16(m.Translation.Vip.Port) + buf.EncodeUint32(m.Translation.ID) + buf.EncodeUint8(uint8(m.Translation.IPProto)) + buf.EncodeUint8(m.Translation.IsRealIP) + buf.EncodeUint8(m.Translation.Flags) + buf.EncodeUint8(uint8(m.Translation.LbType)) + buf.EncodeUint32(uint32(len(m.Translation.Paths))) + for j1 := 0; j1 < len(m.Translation.Paths); j1++ { + var v1 CnatEndpointTuple // Paths + if j1 < len(m.Translation.Paths) { + v1 = m.Translation.Paths[j1] + } + buf.EncodeUint8(uint8(v1.DstEp.Addr.Af)) + buf.EncodeBytes(v1.DstEp.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(v1.DstEp.SwIfIndex)) + buf.EncodeUint8(uint8(v1.DstEp.IfAf)) + buf.EncodeUint16(v1.DstEp.Port) + buf.EncodeUint8(uint8(v1.SrcEp.Addr.Af)) + buf.EncodeBytes(v1.SrcEp.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(v1.SrcEp.SwIfIndex)) + buf.EncodeUint8(uint8(v1.SrcEp.IfAf)) + buf.EncodeUint16(v1.SrcEp.Port) + buf.EncodeUint8(v1.Flags) + } + return buf.Bytes(), nil +} +func (m *CnatTranslationDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Translation.Vip.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Vip.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Vip.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Vip.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Vip.Port = buf.DecodeUint16() + m.Translation.ID = buf.DecodeUint32() + m.Translation.IPProto = ip_types.IPProto(buf.DecodeUint8()) + m.Translation.IsRealIP = buf.DecodeUint8() + m.Translation.Flags = buf.DecodeUint8() + m.Translation.LbType = CnatLbType(buf.DecodeUint8()) + m.Translation.NPaths = buf.DecodeUint32() + m.Translation.Paths = make([]CnatEndpointTuple, m.Translation.NPaths) + for j1 := 0; j1 < len(m.Translation.Paths); j1++ { + m.Translation.Paths[j1].DstEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Paths[j1].DstEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Paths[j1].DstEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Paths[j1].DstEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Paths[j1].DstEp.Port = buf.DecodeUint16() + m.Translation.Paths[j1].SrcEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Paths[j1].SrcEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Paths[j1].SrcEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Paths[j1].SrcEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Paths[j1].SrcEp.Port = buf.DecodeUint16() + m.Translation.Paths[j1].Flags = buf.DecodeUint8() + } + return nil +} + +// CnatTranslationDump defines message 'cnat_translation_dump'. +// InProgress: the message form may change in the future versions +type CnatTranslationDump struct{} + +func (m *CnatTranslationDump) Reset() { *m = CnatTranslationDump{} } +func (*CnatTranslationDump) GetMessageName() string { return "cnat_translation_dump" } +func (*CnatTranslationDump) GetCrcString() string { return "51077d14" } +func (*CnatTranslationDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatTranslationDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *CnatTranslationDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *CnatTranslationDump) Unmarshal(b []byte) error { + return nil +} + +// CnatTranslationUpdate defines message 'cnat_translation_update'. +// InProgress: the message form may change in the future versions +type CnatTranslationUpdate struct { + Translation CnatTranslation `binapi:"cnat_translation,name=translation" json:"translation,omitempty"` +} + +func (m *CnatTranslationUpdate) Reset() { *m = CnatTranslationUpdate{} } +func (*CnatTranslationUpdate) GetMessageName() string { return "cnat_translation_update" } +func (*CnatTranslationUpdate) GetCrcString() string { return "cd5aedf5" } +func (*CnatTranslationUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CnatTranslationUpdate) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Translation.Vip.Addr.Af + size += 1 * 16 // m.Translation.Vip.Addr.Un + size += 4 // m.Translation.Vip.SwIfIndex + size += 1 // m.Translation.Vip.IfAf + size += 2 // m.Translation.Vip.Port + size += 4 // m.Translation.ID + size += 1 // m.Translation.IPProto + size += 1 // m.Translation.IsRealIP + size += 1 // m.Translation.Flags + size += 1 // m.Translation.LbType + size += 4 // m.Translation.NPaths + for j2 := 0; j2 < len(m.Translation.Paths); j2++ { + var s2 CnatEndpointTuple + _ = s2 + if j2 < len(m.Translation.Paths) { + s2 = m.Translation.Paths[j2] + } + size += 1 // s2.DstEp.Addr.Af + size += 1 * 16 // s2.DstEp.Addr.Un + size += 4 // s2.DstEp.SwIfIndex + size += 1 // s2.DstEp.IfAf + size += 2 // s2.DstEp.Port + size += 1 // s2.SrcEp.Addr.Af + size += 1 * 16 // s2.SrcEp.Addr.Un + size += 4 // s2.SrcEp.SwIfIndex + size += 1 // s2.SrcEp.IfAf + size += 2 // s2.SrcEp.Port + size += 1 // s2.Flags + } + return size +} +func (m *CnatTranslationUpdate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Translation.Vip.Addr.Af)) + buf.EncodeBytes(m.Translation.Vip.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Translation.Vip.SwIfIndex)) + buf.EncodeUint8(uint8(m.Translation.Vip.IfAf)) + buf.EncodeUint16(m.Translation.Vip.Port) + buf.EncodeUint32(m.Translation.ID) + buf.EncodeUint8(uint8(m.Translation.IPProto)) + buf.EncodeUint8(m.Translation.IsRealIP) + buf.EncodeUint8(m.Translation.Flags) + buf.EncodeUint8(uint8(m.Translation.LbType)) + buf.EncodeUint32(uint32(len(m.Translation.Paths))) + for j1 := 0; j1 < len(m.Translation.Paths); j1++ { + var v1 CnatEndpointTuple // Paths + if j1 < len(m.Translation.Paths) { + v1 = m.Translation.Paths[j1] + } + buf.EncodeUint8(uint8(v1.DstEp.Addr.Af)) + buf.EncodeBytes(v1.DstEp.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(v1.DstEp.SwIfIndex)) + buf.EncodeUint8(uint8(v1.DstEp.IfAf)) + buf.EncodeUint16(v1.DstEp.Port) + buf.EncodeUint8(uint8(v1.SrcEp.Addr.Af)) + buf.EncodeBytes(v1.SrcEp.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(v1.SrcEp.SwIfIndex)) + buf.EncodeUint8(uint8(v1.SrcEp.IfAf)) + buf.EncodeUint16(v1.SrcEp.Port) + buf.EncodeUint8(v1.Flags) + } + return buf.Bytes(), nil +} +func (m *CnatTranslationUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Translation.Vip.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Vip.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Vip.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Vip.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Vip.Port = buf.DecodeUint16() + m.Translation.ID = buf.DecodeUint32() + m.Translation.IPProto = ip_types.IPProto(buf.DecodeUint8()) + m.Translation.IsRealIP = buf.DecodeUint8() + m.Translation.Flags = buf.DecodeUint8() + m.Translation.LbType = CnatLbType(buf.DecodeUint8()) + m.Translation.NPaths = buf.DecodeUint32() + m.Translation.Paths = make([]CnatEndpointTuple, m.Translation.NPaths) + for j1 := 0; j1 < len(m.Translation.Paths); j1++ { + m.Translation.Paths[j1].DstEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Paths[j1].DstEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Paths[j1].DstEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Paths[j1].DstEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Paths[j1].DstEp.Port = buf.DecodeUint16() + m.Translation.Paths[j1].SrcEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Translation.Paths[j1].SrcEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Translation.Paths[j1].SrcEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Translation.Paths[j1].SrcEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) + m.Translation.Paths[j1].SrcEp.Port = buf.DecodeUint16() + m.Translation.Paths[j1].Flags = buf.DecodeUint8() + } + return nil +} + +// CnatTranslationUpdateReply defines message 'cnat_translation_update_reply'. +// InProgress: the message form may change in the future versions +type CnatTranslationUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *CnatTranslationUpdateReply) Reset() { *m = CnatTranslationUpdateReply{} } +func (*CnatTranslationUpdateReply) GetMessageName() string { return "cnat_translation_update_reply" } +func (*CnatTranslationUpdateReply) GetCrcString() string { return "e2fc8294" } +func (*CnatTranslationUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CnatTranslationUpdateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.ID + return size +} +func (m *CnatTranslationUpdateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.ID) + return buf.Bytes(), nil +} +func (m *CnatTranslationUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ID = buf.DecodeUint32() + return nil +} + +func init() { file_cnat_binapi_init() } +func file_cnat_binapi_init() { + api.RegisterMessage((*CnatGetSnatAddresses)(nil), "cnat_get_snat_addresses_51077d14") + api.RegisterMessage((*CnatGetSnatAddressesReply)(nil), "cnat_get_snat_addresses_reply_879513c1") + api.RegisterMessage((*CnatSessionDetails)(nil), "cnat_session_details_7e5017c7") + api.RegisterMessage((*CnatSessionDump)(nil), "cnat_session_dump_51077d14") + api.RegisterMessage((*CnatSessionPurge)(nil), "cnat_session_purge_51077d14") + api.RegisterMessage((*CnatSessionPurgeReply)(nil), "cnat_session_purge_reply_e8d4e804") + api.RegisterMessage((*CnatSetSnatAddresses)(nil), "cnat_set_snat_addresses_d997e96c") + api.RegisterMessage((*CnatSetSnatAddressesReply)(nil), "cnat_set_snat_addresses_reply_e8d4e804") + api.RegisterMessage((*CnatSetSnatPolicy)(nil), "cnat_set_snat_policy_d3e6eaf4") + api.RegisterMessage((*CnatSetSnatPolicyReply)(nil), "cnat_set_snat_policy_reply_e8d4e804") + api.RegisterMessage((*CnatSnatPolicyAddDelExcludePfx)(nil), "cnat_snat_policy_add_del_exclude_pfx_e26dd79a") + api.RegisterMessage((*CnatSnatPolicyAddDelExcludePfxReply)(nil), "cnat_snat_policy_add_del_exclude_pfx_reply_e8d4e804") + api.RegisterMessage((*CnatSnatPolicyAddDelIf)(nil), "cnat_snat_policy_add_del_if_6828deca") + api.RegisterMessage((*CnatSnatPolicyAddDelIfReply)(nil), "cnat_snat_policy_add_del_if_reply_e8d4e804") + api.RegisterMessage((*CnatTranslationDel)(nil), "cnat_translation_del_3a91bde5") + api.RegisterMessage((*CnatTranslationDelReply)(nil), "cnat_translation_del_reply_e8d4e804") + api.RegisterMessage((*CnatTranslationDetails)(nil), "cnat_translation_details_347e1f16") + api.RegisterMessage((*CnatTranslationDump)(nil), "cnat_translation_dump_51077d14") + api.RegisterMessage((*CnatTranslationUpdate)(nil), "cnat_translation_update_cd5aedf5") + api.RegisterMessage((*CnatTranslationUpdateReply)(nil), "cnat_translation_update_reply_e2fc8294") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CnatGetSnatAddresses)(nil), + (*CnatGetSnatAddressesReply)(nil), + (*CnatSessionDetails)(nil), + (*CnatSessionDump)(nil), + (*CnatSessionPurge)(nil), + (*CnatSessionPurgeReply)(nil), + (*CnatSetSnatAddresses)(nil), + (*CnatSetSnatAddressesReply)(nil), + (*CnatSetSnatPolicy)(nil), + (*CnatSetSnatPolicyReply)(nil), + (*CnatSnatPolicyAddDelExcludePfx)(nil), + (*CnatSnatPolicyAddDelExcludePfxReply)(nil), + (*CnatSnatPolicyAddDelIf)(nil), + (*CnatSnatPolicyAddDelIfReply)(nil), + (*CnatTranslationDel)(nil), + (*CnatTranslationDelReply)(nil), + (*CnatTranslationDetails)(nil), + (*CnatTranslationDump)(nil), + (*CnatTranslationUpdate)(nil), + (*CnatTranslationUpdateReply)(nil), + } +} diff --git a/binapi/cnat/cnat_rpc.ba.go b/binapi/cnat/cnat_rpc.ba.go new file mode 100644 index 0000000..2b83262 --- /dev/null +++ b/binapi/cnat/cnat_rpc.ba.go @@ -0,0 +1,192 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cnat + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service cnat. +type RPCService interface { + CnatGetSnatAddresses(ctx context.Context, in *CnatGetSnatAddresses) (*CnatGetSnatAddressesReply, error) + CnatSessionDump(ctx context.Context, in *CnatSessionDump) (RPCService_CnatSessionDumpClient, error) + CnatSessionPurge(ctx context.Context, in *CnatSessionPurge) (*CnatSessionPurgeReply, error) + CnatSetSnatAddresses(ctx context.Context, in *CnatSetSnatAddresses) (*CnatSetSnatAddressesReply, error) + CnatSetSnatPolicy(ctx context.Context, in *CnatSetSnatPolicy) (*CnatSetSnatPolicyReply, error) + CnatSnatPolicyAddDelExcludePfx(ctx context.Context, in *CnatSnatPolicyAddDelExcludePfx) (*CnatSnatPolicyAddDelExcludePfxReply, error) + CnatSnatPolicyAddDelIf(ctx context.Context, in *CnatSnatPolicyAddDelIf) (*CnatSnatPolicyAddDelIfReply, error) + CnatTranslationDel(ctx context.Context, in *CnatTranslationDel) (*CnatTranslationDelReply, error) + CnatTranslationDump(ctx context.Context, in *CnatTranslationDump) (RPCService_CnatTranslationDumpClient, error) + CnatTranslationUpdate(ctx context.Context, in *CnatTranslationUpdate) (*CnatTranslationUpdateReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CnatGetSnatAddresses(ctx context.Context, in *CnatGetSnatAddresses) (*CnatGetSnatAddressesReply, error) { + out := new(CnatGetSnatAddressesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatSessionDump(ctx context.Context, in *CnatSessionDump) (RPCService_CnatSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_CnatSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_CnatSessionDumpClient interface { + Recv() (*CnatSessionDetails, error) + api.Stream +} + +type serviceClient_CnatSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_CnatSessionDumpClient) Recv() (*CnatSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *CnatSessionDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) CnatSessionPurge(ctx context.Context, in *CnatSessionPurge) (*CnatSessionPurgeReply, error) { + out := new(CnatSessionPurgeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatSetSnatAddresses(ctx context.Context, in *CnatSetSnatAddresses) (*CnatSetSnatAddressesReply, error) { + out := new(CnatSetSnatAddressesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatSetSnatPolicy(ctx context.Context, in *CnatSetSnatPolicy) (*CnatSetSnatPolicyReply, error) { + out := new(CnatSetSnatPolicyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatSnatPolicyAddDelExcludePfx(ctx context.Context, in *CnatSnatPolicyAddDelExcludePfx) (*CnatSnatPolicyAddDelExcludePfxReply, error) { + out := new(CnatSnatPolicyAddDelExcludePfxReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatSnatPolicyAddDelIf(ctx context.Context, in *CnatSnatPolicyAddDelIf) (*CnatSnatPolicyAddDelIfReply, error) { + out := new(CnatSnatPolicyAddDelIfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatTranslationDel(ctx context.Context, in *CnatTranslationDel) (*CnatTranslationDelReply, error) { + out := new(CnatTranslationDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CnatTranslationDump(ctx context.Context, in *CnatTranslationDump) (RPCService_CnatTranslationDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_CnatTranslationDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_CnatTranslationDumpClient interface { + Recv() (*CnatTranslationDetails, error) + api.Stream +} + +type serviceClient_CnatTranslationDumpClient struct { + api.Stream +} + +func (c *serviceClient_CnatTranslationDumpClient) Recv() (*CnatTranslationDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *CnatTranslationDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) CnatTranslationUpdate(ctx context.Context, in *CnatTranslationUpdate) (*CnatTranslationUpdateReply, error) { + out := new(CnatTranslationUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/cop/cop.ba.go b/binapi/cop/cop.ba.go deleted file mode 100644 index 14f0b11..0000000 --- a/binapi/cop/cop.ba.go +++ /dev/null @@ -1,204 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/cop.api.json - -// Package cop contains generated bindings for API file cop.api. -// -// Contents: -// 4 messages -// -package cop - -import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "cop" - APIVersion = "1.0.1" - VersionCrc = 0xfd7e767d -) - -// CopInterfaceEnableDisable defines message 'cop_interface_enable_disable'. -type CopInterfaceEnableDisable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` -} - -func (m *CopInterfaceEnableDisable) Reset() { *m = CopInterfaceEnableDisable{} } -func (*CopInterfaceEnableDisable) GetMessageName() string { return "cop_interface_enable_disable" } -func (*CopInterfaceEnableDisable) GetCrcString() string { return "5501adee" } -func (*CopInterfaceEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *CopInterfaceEnableDisable) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 1 // m.EnableDisable - return size -} -func (m *CopInterfaceEnableDisable) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeBool(m.EnableDisable) - return buf.Bytes(), nil -} -func (m *CopInterfaceEnableDisable) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.EnableDisable = buf.DecodeBool() - return nil -} - -// CopInterfaceEnableDisableReply defines message 'cop_interface_enable_disable_reply'. -type CopInterfaceEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *CopInterfaceEnableDisableReply) Reset() { *m = CopInterfaceEnableDisableReply{} } -func (*CopInterfaceEnableDisableReply) GetMessageName() string { - return "cop_interface_enable_disable_reply" -} -func (*CopInterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*CopInterfaceEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *CopInterfaceEnableDisableReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *CopInterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *CopInterfaceEnableDisableReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// CopWhitelistEnableDisable defines message 'cop_whitelist_enable_disable'. -type CopWhitelistEnableDisable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - FibID uint32 `binapi:"u32,name=fib_id" json:"fib_id,omitempty"` - IP4 bool `binapi:"bool,name=ip4" json:"ip4,omitempty"` - IP6 bool `binapi:"bool,name=ip6" json:"ip6,omitempty"` - DefaultCop bool `binapi:"bool,name=default_cop" json:"default_cop,omitempty"` -} - -func (m *CopWhitelistEnableDisable) Reset() { *m = CopWhitelistEnableDisable{} } -func (*CopWhitelistEnableDisable) GetMessageName() string { return "cop_whitelist_enable_disable" } -func (*CopWhitelistEnableDisable) GetCrcString() string { return "debe13ea" } -func (*CopWhitelistEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *CopWhitelistEnableDisable) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.FibID - size += 1 // m.IP4 - size += 1 // m.IP6 - size += 1 // m.DefaultCop - return size -} -func (m *CopWhitelistEnableDisable) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(m.FibID) - buf.EncodeBool(m.IP4) - buf.EncodeBool(m.IP6) - buf.EncodeBool(m.DefaultCop) - return buf.Bytes(), nil -} -func (m *CopWhitelistEnableDisable) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.FibID = buf.DecodeUint32() - m.IP4 = buf.DecodeBool() - m.IP6 = buf.DecodeBool() - m.DefaultCop = buf.DecodeBool() - return nil -} - -// CopWhitelistEnableDisableReply defines message 'cop_whitelist_enable_disable_reply'. -type CopWhitelistEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *CopWhitelistEnableDisableReply) Reset() { *m = CopWhitelistEnableDisableReply{} } -func (*CopWhitelistEnableDisableReply) GetMessageName() string { - return "cop_whitelist_enable_disable_reply" -} -func (*CopWhitelistEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*CopWhitelistEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *CopWhitelistEnableDisableReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *CopWhitelistEnableDisableReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *CopWhitelistEnableDisableReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -func init() { file_cop_binapi_init() } -func file_cop_binapi_init() { - api.RegisterMessage((*CopInterfaceEnableDisable)(nil), "cop_interface_enable_disable_5501adee") - api.RegisterMessage((*CopInterfaceEnableDisableReply)(nil), "cop_interface_enable_disable_reply_e8d4e804") - api.RegisterMessage((*CopWhitelistEnableDisable)(nil), "cop_whitelist_enable_disable_debe13ea") - api.RegisterMessage((*CopWhitelistEnableDisableReply)(nil), "cop_whitelist_enable_disable_reply_e8d4e804") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*CopInterfaceEnableDisable)(nil), - (*CopInterfaceEnableDisableReply)(nil), - (*CopWhitelistEnableDisable)(nil), - (*CopWhitelistEnableDisableReply)(nil), - } -} diff --git a/binapi/cop/cop_rest.ba.go b/binapi/cop/cop_rest.ba.go deleted file mode 100644 index d9ed487..0000000 --- a/binapi/cop/cop_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package cop - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/cop_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CopInterfaceEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CopInterfaceEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/cop_whitelist_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CopWhitelistEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CopWhitelistEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/cop/cop_rpc.ba.go b/binapi/cop/cop_rpc.ba.go deleted file mode 100644 index 9f6f84e..0000000 --- a/binapi/cop/cop_rpc.ba.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package cop - -import ( - "context" - api "git.fd.io/govpp.git/api" -) - -// RPCService defines RPC service cop. -type RPCService interface { - CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) - CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) { - out := new(CopInterfaceEnableDisableReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) { - out := new(CopWhitelistEnableDisableReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} diff --git a/binapi/crypto/crypto.ba.go b/binapi/crypto/crypto.ba.go new file mode 100644 index 0000000..6cc0cb2 --- /dev/null +++ b/binapi/crypto/crypto.ba.go @@ -0,0 +1,251 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/core/crypto.api.json + +// Package crypto contains generated bindings for API file crypto.api. +// +// Contents: +// 2 enums +// 4 messages +// +package crypto + +import ( + "strconv" + + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "crypto" + APIVersion = "1.0.1" + VersionCrc = 0x22355ec6 +) + +// CryptoDispatchMode defines enum 'crypto_dispatch_mode'. +type CryptoDispatchMode uint8 + +const ( + CRYPTO_ASYNC_DISPATCH_POLLING CryptoDispatchMode = 0 + CRYPTO_ASYNC_DISPATCH_INTERRUPT CryptoDispatchMode = 1 +) + +var ( + CryptoDispatchMode_name = map[uint8]string{ + 0: "CRYPTO_ASYNC_DISPATCH_POLLING", + 1: "CRYPTO_ASYNC_DISPATCH_INTERRUPT", + } + CryptoDispatchMode_value = map[string]uint8{ + "CRYPTO_ASYNC_DISPATCH_POLLING": 0, + "CRYPTO_ASYNC_DISPATCH_INTERRUPT": 1, + } +) + +func (x CryptoDispatchMode) String() string { + s, ok := CryptoDispatchMode_name[uint8(x)] + if ok { + return s + } + return "CryptoDispatchMode(" + strconv.Itoa(int(x)) + ")" +} + +// CryptoOpClassType defines enum 'crypto_op_class_type'. +type CryptoOpClassType uint8 + +const ( + CRYPTO_API_OP_SIMPLE CryptoOpClassType = 0 + CRYPTO_API_OP_CHAINED CryptoOpClassType = 1 + CRYPTO_API_OP_BOTH CryptoOpClassType = 2 +) + +var ( + CryptoOpClassType_name = map[uint8]string{ + 0: "CRYPTO_API_OP_SIMPLE", + 1: "CRYPTO_API_OP_CHAINED", + 2: "CRYPTO_API_OP_BOTH", + } + CryptoOpClassType_value = map[string]uint8{ + "CRYPTO_API_OP_SIMPLE": 0, + "CRYPTO_API_OP_CHAINED": 1, + "CRYPTO_API_OP_BOTH": 2, + } +) + +func (x CryptoOpClassType) String() string { + s, ok := CryptoOpClassType_name[uint8(x)] + if ok { + return s + } + return "CryptoOpClassType(" + strconv.Itoa(int(x)) + ")" +} + +// CryptoSetAsyncDispatch defines message 'crypto_set_async_dispatch'. +type CryptoSetAsyncDispatch struct { + Mode CryptoDispatchMode `binapi:"crypto_dispatch_mode,name=mode" json:"mode,omitempty"` +} + +func (m *CryptoSetAsyncDispatch) Reset() { *m = CryptoSetAsyncDispatch{} } +func (*CryptoSetAsyncDispatch) GetMessageName() string { return "crypto_set_async_dispatch" } +func (*CryptoSetAsyncDispatch) GetCrcString() string { return "5ca4adc0" } +func (*CryptoSetAsyncDispatch) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CryptoSetAsyncDispatch) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Mode + return size +} +func (m *CryptoSetAsyncDispatch) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Mode)) + return buf.Bytes(), nil +} +func (m *CryptoSetAsyncDispatch) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Mode = CryptoDispatchMode(buf.DecodeUint8()) + return nil +} + +// CryptoSetAsyncDispatchReply defines message 'crypto_set_async_dispatch_reply'. +type CryptoSetAsyncDispatchReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CryptoSetAsyncDispatchReply) Reset() { *m = CryptoSetAsyncDispatchReply{} } +func (*CryptoSetAsyncDispatchReply) GetMessageName() string { return "crypto_set_async_dispatch_reply" } +func (*CryptoSetAsyncDispatchReply) GetCrcString() string { return "e8d4e804" } +func (*CryptoSetAsyncDispatchReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CryptoSetAsyncDispatchReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CryptoSetAsyncDispatchReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CryptoSetAsyncDispatchReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CryptoSetHandler defines message 'crypto_set_handler'. +type CryptoSetHandler struct { + AlgName string `binapi:"string[32],name=alg_name" json:"alg_name,omitempty"` + Engine string `binapi:"string[16],name=engine" json:"engine,omitempty"` + Oct CryptoOpClassType `binapi:"crypto_op_class_type,name=oct" json:"oct,omitempty"` + IsAsync uint8 `binapi:"u8,name=is_async" json:"is_async,omitempty"` +} + +func (m *CryptoSetHandler) Reset() { *m = CryptoSetHandler{} } +func (*CryptoSetHandler) GetMessageName() string { return "crypto_set_handler" } +func (*CryptoSetHandler) GetCrcString() string { return "ce9ad00d" } +func (*CryptoSetHandler) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CryptoSetHandler) Size() (size int) { + if m == nil { + return 0 + } + size += 32 // m.AlgName + size += 16 // m.Engine + size += 1 // m.Oct + size += 1 // m.IsAsync + return size +} +func (m *CryptoSetHandler) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.AlgName, 32) + buf.EncodeString(m.Engine, 16) + buf.EncodeUint8(uint8(m.Oct)) + buf.EncodeUint8(m.IsAsync) + return buf.Bytes(), nil +} +func (m *CryptoSetHandler) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AlgName = buf.DecodeString(32) + m.Engine = buf.DecodeString(16) + m.Oct = CryptoOpClassType(buf.DecodeUint8()) + m.IsAsync = buf.DecodeUint8() + return nil +} + +// CryptoSetHandlerReply defines message 'crypto_set_handler_reply'. +type CryptoSetHandlerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CryptoSetHandlerReply) Reset() { *m = CryptoSetHandlerReply{} } +func (*CryptoSetHandlerReply) GetMessageName() string { return "crypto_set_handler_reply" } +func (*CryptoSetHandlerReply) GetCrcString() string { return "e8d4e804" } +func (*CryptoSetHandlerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CryptoSetHandlerReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CryptoSetHandlerReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CryptoSetHandlerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_crypto_binapi_init() } +func file_crypto_binapi_init() { + api.RegisterMessage((*CryptoSetAsyncDispatch)(nil), "crypto_set_async_dispatch_5ca4adc0") + api.RegisterMessage((*CryptoSetAsyncDispatchReply)(nil), "crypto_set_async_dispatch_reply_e8d4e804") + api.RegisterMessage((*CryptoSetHandler)(nil), "crypto_set_handler_ce9ad00d") + api.RegisterMessage((*CryptoSetHandlerReply)(nil), "crypto_set_handler_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CryptoSetAsyncDispatch)(nil), + (*CryptoSetAsyncDispatchReply)(nil), + (*CryptoSetHandler)(nil), + (*CryptoSetHandlerReply)(nil), + } +} diff --git a/binapi/crypto/crypto_rpc.ba.go b/binapi/crypto/crypto_rpc.ba.go new file mode 100644 index 0000000..471f49d --- /dev/null +++ b/binapi/crypto/crypto_rpc.ba.go @@ -0,0 +1,41 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package crypto + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service crypto. +type RPCService interface { + CryptoSetAsyncDispatch(ctx context.Context, in *CryptoSetAsyncDispatch) (*CryptoSetAsyncDispatchReply, error) + CryptoSetHandler(ctx context.Context, in *CryptoSetHandler) (*CryptoSetHandlerReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CryptoSetAsyncDispatch(ctx context.Context, in *CryptoSetAsyncDispatch) (*CryptoSetAsyncDispatchReply, error) { + out := new(CryptoSetAsyncDispatchReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CryptoSetHandler(ctx context.Context, in *CryptoSetHandler) (*CryptoSetHandlerReply, error) { + out := new(CryptoSetHandlerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/crypto_sw_scheduler/crypto_sw_scheduler.ba.go b/binapi/crypto_sw_scheduler/crypto_sw_scheduler.ba.go new file mode 100644 index 0000000..bca39da --- /dev/null +++ b/binapi/crypto_sw_scheduler/crypto_sw_scheduler.ba.go @@ -0,0 +1,117 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/crypto_sw_scheduler.api.json + +// Package crypto_sw_scheduler contains generated bindings for API file crypto_sw_scheduler.api. +// +// Contents: +// 2 messages +// +package crypto_sw_scheduler + +import ( + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "crypto_sw_scheduler" + APIVersion = "0.1.0" + VersionCrc = 0xf4b02951 +) + +// CryptoSwSchedulerSetWorker defines message 'crypto_sw_scheduler_set_worker'. +// InProgress: the message form may change in the future versions +type CryptoSwSchedulerSetWorker struct { + WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"` + CryptoEnable bool `binapi:"bool,name=crypto_enable" json:"crypto_enable,omitempty"` +} + +func (m *CryptoSwSchedulerSetWorker) Reset() { *m = CryptoSwSchedulerSetWorker{} } +func (*CryptoSwSchedulerSetWorker) GetMessageName() string { return "crypto_sw_scheduler_set_worker" } +func (*CryptoSwSchedulerSetWorker) GetCrcString() string { return "b4274502" } +func (*CryptoSwSchedulerSetWorker) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CryptoSwSchedulerSetWorker) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.WorkerIndex + size += 1 // m.CryptoEnable + return size +} +func (m *CryptoSwSchedulerSetWorker) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.WorkerIndex) + buf.EncodeBool(m.CryptoEnable) + return buf.Bytes(), nil +} +func (m *CryptoSwSchedulerSetWorker) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WorkerIndex = buf.DecodeUint32() + m.CryptoEnable = buf.DecodeBool() + return nil +} + +// CryptoSwSchedulerSetWorkerReply defines message 'crypto_sw_scheduler_set_worker_reply'. +// InProgress: the message form may change in the future versions +type CryptoSwSchedulerSetWorkerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CryptoSwSchedulerSetWorkerReply) Reset() { *m = CryptoSwSchedulerSetWorkerReply{} } +func (*CryptoSwSchedulerSetWorkerReply) GetMessageName() string { + return "crypto_sw_scheduler_set_worker_reply" +} +func (*CryptoSwSchedulerSetWorkerReply) GetCrcString() string { return "e8d4e804" } +func (*CryptoSwSchedulerSetWorkerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CryptoSwSchedulerSetWorkerReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CryptoSwSchedulerSetWorkerReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *CryptoSwSchedulerSetWorkerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_crypto_sw_scheduler_binapi_init() } +func file_crypto_sw_scheduler_binapi_init() { + api.RegisterMessage((*CryptoSwSchedulerSetWorker)(nil), "crypto_sw_scheduler_set_worker_b4274502") + api.RegisterMessage((*CryptoSwSchedulerSetWorkerReply)(nil), "crypto_sw_scheduler_set_worker_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CryptoSwSchedulerSetWorker)(nil), + (*CryptoSwSchedulerSetWorkerReply)(nil), + } +} diff --git a/binapi/crypto_sw_scheduler/crypto_sw_scheduler_rpc.ba.go b/binapi/crypto_sw_scheduler/crypto_sw_scheduler_rpc.ba.go new file mode 100644 index 0000000..54dffd3 --- /dev/null +++ b/binapi/crypto_sw_scheduler/crypto_sw_scheduler_rpc.ba.go @@ -0,0 +1,31 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package crypto_sw_scheduler + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service crypto_sw_scheduler. +type RPCService interface { + CryptoSwSchedulerSetWorker(ctx context.Context, in *CryptoSwSchedulerSetWorker) (*CryptoSwSchedulerSetWorkerReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CryptoSwSchedulerSetWorker(ctx context.Context, in *CryptoSwSchedulerSetWorker) (*CryptoSwSchedulerSetWorkerReply, error) { + out := new(CryptoSwSchedulerSetWorkerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/ct6/ct6.ba.go b/binapi/ct6/ct6.ba.go index 5dc6097..9971a49 100644 --- a/binapi/ct6/ct6.ba.go +++ b/binapi/ct6/ct6.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/ct6.api.json // Package ct6 contains generated bindings for API file ct6.api. @@ -12,9 +12,9 @@ package ct6 import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ct6" APIVersion = "1.0.0" - VersionCrc = 0xd9691434 + VersionCrc = 0x5c824a95 ) // Ct6EnableDisable defines message 'ct6_enable_disable'. diff --git a/binapi/ct6/ct6_rest.ba.go b/binapi/ct6/ct6_rest.ba.go deleted file mode 100644 index a3ffcde..0000000 --- a/binapi/ct6/ct6_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ct6 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ct6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ct6EnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ct6EnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ct6/ct6_rpc.ba.go b/binapi/ct6/ct6_rpc.ba.go index 888fd32..14fb816 100644 --- a/binapi/ct6/ct6_rpc.ba.go +++ b/binapi/ct6/ct6_rpc.ba.go @@ -4,10 +4,11 @@ package ct6 import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service ct6. +// RPCService defines RPC service ct6. type RPCService interface { Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/det44/det44.ba.go b/binapi/det44/det44.ba.go new file mode 100644 index 0000000..f58b00c --- /dev/null +++ b/binapi/det44/det44.ba.go @@ -0,0 +1,1635 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/det44.api.json + +// Package det44 contains generated bindings for API file det44.api. +// +// Contents: +// 38 messages +// +package det44 + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + _ "go.fd.io/govpp/binapi/nat_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "det44" + APIVersion = "1.0.0" + VersionCrc = 0x6d6e88dd +) + +// Det44AddDelMap defines message 'det44_add_del_map'. +type Det44AddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` +} + +func (m *Det44AddDelMap) Reset() { *m = Det44AddDelMap{} } +func (*Det44AddDelMap) GetMessageName() string { return "det44_add_del_map" } +func (*Det44AddDelMap) GetCrcString() string { return "1150a190" } +func (*Det44AddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44AddDelMap) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + return size +} +func (m *Det44AddDelMap) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(m.InPlen) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(m.OutPlen) + return buf.Bytes(), nil +} +func (m *Det44AddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + return nil +} + +// Det44AddDelMapReply defines message 'det44_add_del_map_reply'. +type Det44AddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44AddDelMapReply) Reset() { *m = Det44AddDelMapReply{} } +func (*Det44AddDelMapReply) GetMessageName() string { return "det44_add_del_map_reply" } +func (*Det44AddDelMapReply) GetCrcString() string { return "e8d4e804" } +func (*Det44AddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44AddDelMapReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44AddDelMapReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44AddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Det44CloseSessionIn defines message 'det44_close_session_in'. +type Det44CloseSessionIn struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *Det44CloseSessionIn) Reset() { *m = Det44CloseSessionIn{} } +func (*Det44CloseSessionIn) GetMessageName() string { return "det44_close_session_in" } +func (*Det44CloseSessionIn) GetCrcString() string { return "3c68e073" } +func (*Det44CloseSessionIn) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44CloseSessionIn) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *Det44CloseSessionIn) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint16(m.InPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + return buf.Bytes(), nil +} +func (m *Det44CloseSessionIn) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// Det44CloseSessionInReply defines message 'det44_close_session_in_reply'. +type Det44CloseSessionInReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44CloseSessionInReply) Reset() { *m = Det44CloseSessionInReply{} } +func (*Det44CloseSessionInReply) GetMessageName() string { return "det44_close_session_in_reply" } +func (*Det44CloseSessionInReply) GetCrcString() string { return "e8d4e804" } +func (*Det44CloseSessionInReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44CloseSessionInReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44CloseSessionInReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44CloseSessionInReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Det44CloseSessionOut defines message 'det44_close_session_out'. +type Det44CloseSessionOut struct { + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *Det44CloseSessionOut) Reset() { *m = Det44CloseSessionOut{} } +func (*Det44CloseSessionOut) GetMessageName() string { return "det44_close_session_out" } +func (*Det44CloseSessionOut) GetCrcString() string { return "f6b259d1" } +func (*Det44CloseSessionOut) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44CloseSessionOut) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.OutAddr + size += 2 // m.OutPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *Det44CloseSessionOut) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint16(m.OutPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + return buf.Bytes(), nil +} +func (m *Det44CloseSessionOut) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// Det44CloseSessionOutReply defines message 'det44_close_session_out_reply'. +type Det44CloseSessionOutReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44CloseSessionOutReply) Reset() { *m = Det44CloseSessionOutReply{} } +func (*Det44CloseSessionOutReply) GetMessageName() string { return "det44_close_session_out_reply" } +func (*Det44CloseSessionOutReply) GetCrcString() string { return "e8d4e804" } +func (*Det44CloseSessionOutReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44CloseSessionOutReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44CloseSessionOutReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44CloseSessionOutReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Det44Forward defines message 'det44_forward'. +type Det44Forward struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *Det44Forward) Reset() { *m = Det44Forward{} } +func (*Det44Forward) GetMessageName() string { return "det44_forward" } +func (*Det44Forward) GetCrcString() string { return "7f8a89cd" } +func (*Det44Forward) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44Forward) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + return size +} +func (m *Det44Forward) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *Det44Forward) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// Det44ForwardReply defines message 'det44_forward_reply'. +type Det44ForwardReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + OutPortLo uint16 `binapi:"u16,name=out_port_lo" json:"out_port_lo,omitempty"` + OutPortHi uint16 `binapi:"u16,name=out_port_hi" json:"out_port_hi,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *Det44ForwardReply) Reset() { *m = Det44ForwardReply{} } +func (*Det44ForwardReply) GetMessageName() string { return "det44_forward_reply" } +func (*Det44ForwardReply) GetCrcString() string { return "a8ccbdc0" } +func (*Det44ForwardReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44ForwardReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 2 // m.OutPortLo + size += 2 // m.OutPortHi + size += 1 * 4 // m.OutAddr + return size +} +func (m *Det44ForwardReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint16(m.OutPortLo) + buf.EncodeUint16(m.OutPortHi) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *Det44ForwardReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.OutPortLo = buf.DecodeUint16() + m.OutPortHi = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// Det44GetTimeouts defines message 'det44_get_timeouts'. +type Det44GetTimeouts struct{} + +func (m *Det44GetTimeouts) Reset() { *m = Det44GetTimeouts{} } +func (*Det44GetTimeouts) GetMessageName() string { return "det44_get_timeouts" } +func (*Det44GetTimeouts) GetCrcString() string { return "51077d14" } +func (*Det44GetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44GetTimeouts) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Det44GetTimeouts) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Det44GetTimeouts) Unmarshal(b []byte) error { + return nil +} + +// Det44GetTimeoutsReply defines message 'det44_get_timeouts_reply'. +// InProgress: the message form may change in the future versions +type Det44GetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *Det44GetTimeoutsReply) Reset() { *m = Det44GetTimeoutsReply{} } +func (*Det44GetTimeoutsReply) GetMessageName() string { return "det44_get_timeouts_reply" } +func (*Det44GetTimeoutsReply) GetCrcString() string { return "3c4df4e1" } +func (*Det44GetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44GetTimeoutsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *Det44GetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.UDP) + buf.EncodeUint32(m.TCPEstablished) + buf.EncodeUint32(m.TCPTransitory) + buf.EncodeUint32(m.ICMP) + return buf.Bytes(), nil +} +func (m *Det44GetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// Det44InterfaceAddDelFeature defines message 'det44_interface_add_del_feature'. +// InProgress: the message form may change in the future versions +type Det44InterfaceAddDelFeature struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + IsInside bool `binapi:"bool,name=is_inside" json:"is_inside,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Det44InterfaceAddDelFeature) Reset() { *m = Det44InterfaceAddDelFeature{} } +func (*Det44InterfaceAddDelFeature) GetMessageName() string { return "det44_interface_add_del_feature" } +func (*Det44InterfaceAddDelFeature) GetCrcString() string { return "dc17a836" } +func (*Det44InterfaceAddDelFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44InterfaceAddDelFeature) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.IsInside + size += 4 // m.SwIfIndex + return size +} +func (m *Det44InterfaceAddDelFeature) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsInside) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Det44InterfaceAddDelFeature) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsInside = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Det44InterfaceAddDelFeatureReply defines message 'det44_interface_add_del_feature_reply'. +// InProgress: the message form may change in the future versions +type Det44InterfaceAddDelFeatureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44InterfaceAddDelFeatureReply) Reset() { *m = Det44InterfaceAddDelFeatureReply{} } +func (*Det44InterfaceAddDelFeatureReply) GetMessageName() string { + return "det44_interface_add_del_feature_reply" +} +func (*Det44InterfaceAddDelFeatureReply) GetCrcString() string { return "e8d4e804" } +func (*Det44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44InterfaceAddDelFeatureReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44InterfaceAddDelFeatureReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44InterfaceAddDelFeatureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Det44InterfaceDetails defines message 'det44_interface_details'. +// InProgress: the message form may change in the future versions +type Det44InterfaceDetails struct { + IsInside bool `binapi:"bool,name=is_inside" json:"is_inside,omitempty"` + IsOutside bool `binapi:"bool,name=is_outside" json:"is_outside,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Det44InterfaceDetails) Reset() { *m = Det44InterfaceDetails{} } +func (*Det44InterfaceDetails) GetMessageName() string { return "det44_interface_details" } +func (*Det44InterfaceDetails) GetCrcString() string { return "e60cc5be" } +func (*Det44InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44InterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsInside + size += 1 // m.IsOutside + size += 4 // m.SwIfIndex + return size +} +func (m *Det44InterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsInside) + buf.EncodeBool(m.IsOutside) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Det44InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsInside = buf.DecodeBool() + m.IsOutside = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Det44InterfaceDump defines message 'det44_interface_dump'. +// InProgress: the message form may change in the future versions +type Det44InterfaceDump struct{} + +func (m *Det44InterfaceDump) Reset() { *m = Det44InterfaceDump{} } +func (*Det44InterfaceDump) GetMessageName() string { return "det44_interface_dump" } +func (*Det44InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Det44InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44InterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Det44InterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Det44InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Det44MapDetails defines message 'det44_map_details'. +type Det44MapDetails struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` + SharingRatio uint32 `binapi:"u32,name=sharing_ratio" json:"sharing_ratio,omitempty"` + PortsPerHost uint16 `binapi:"u16,name=ports_per_host" json:"ports_per_host,omitempty"` + SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` +} + +func (m *Det44MapDetails) Reset() { *m = Det44MapDetails{} } +func (*Det44MapDetails) GetMessageName() string { return "det44_map_details" } +func (*Det44MapDetails) GetCrcString() string { return "ad91dc83" } +func (*Det44MapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44MapDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + size += 4 // m.SharingRatio + size += 2 // m.PortsPerHost + size += 4 // m.SesNum + return size +} +func (m *Det44MapDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(m.InPlen) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(m.OutPlen) + buf.EncodeUint32(m.SharingRatio) + buf.EncodeUint16(m.PortsPerHost) + buf.EncodeUint32(m.SesNum) + return buf.Bytes(), nil +} +func (m *Det44MapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + m.SharingRatio = buf.DecodeUint32() + m.PortsPerHost = buf.DecodeUint16() + m.SesNum = buf.DecodeUint32() + return nil +} + +// Det44MapDump defines message 'det44_map_dump'. +type Det44MapDump struct{} + +func (m *Det44MapDump) Reset() { *m = Det44MapDump{} } +func (*Det44MapDump) GetMessageName() string { return "det44_map_dump" } +func (*Det44MapDump) GetCrcString() string { return "51077d14" } +func (*Det44MapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44MapDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Det44MapDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Det44MapDump) Unmarshal(b []byte) error { + return nil +} + +// Det44PluginEnableDisable defines message 'det44_plugin_enable_disable'. +// InProgress: the message form may change in the future versions +type Det44PluginEnableDisable struct { + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Det44PluginEnableDisable) Reset() { *m = Det44PluginEnableDisable{} } +func (*Det44PluginEnableDisable) GetMessageName() string { return "det44_plugin_enable_disable" } +func (*Det44PluginEnableDisable) GetCrcString() string { return "617b6bf8" } +func (*Det44PluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44PluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 1 // m.Enable + return size +} +func (m *Det44PluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Det44PluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + return nil +} + +// Det44PluginEnableDisableReply defines message 'det44_plugin_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Det44PluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44PluginEnableDisableReply) Reset() { *m = Det44PluginEnableDisableReply{} } +func (*Det44PluginEnableDisableReply) GetMessageName() string { + return "det44_plugin_enable_disable_reply" +} +func (*Det44PluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Det44PluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44PluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44PluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44PluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Det44Reverse defines message 'det44_reverse'. +type Det44Reverse struct { + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *Det44Reverse) Reset() { *m = Det44Reverse{} } +func (*Det44Reverse) GetMessageName() string { return "det44_reverse" } +func (*Det44Reverse) GetCrcString() string { return "a7573fe1" } +func (*Det44Reverse) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44Reverse) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.OutPort + size += 1 * 4 // m.OutAddr + return size +} +func (m *Det44Reverse) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.OutPort) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *Det44Reverse) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OutPort = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// Det44ReverseReply defines message 'det44_reverse_reply'. +type Det44ReverseReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *Det44ReverseReply) Reset() { *m = Det44ReverseReply{} } +func (*Det44ReverseReply) GetMessageName() string { return "det44_reverse_reply" } +func (*Det44ReverseReply) GetCrcString() string { return "34066d48" } +func (*Det44ReverseReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44ReverseReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 4 // m.InAddr + return size +} +func (m *Det44ReverseReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *Det44ReverseReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// Det44SessionDetails defines message 'det44_session_details'. +type Det44SessionDetails struct { + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + State uint8 `binapi:"u8,name=state" json:"state,omitempty"` + Expire uint32 `binapi:"u32,name=expire" json:"expire,omitempty"` +} + +func (m *Det44SessionDetails) Reset() { *m = Det44SessionDetails{} } +func (*Det44SessionDetails) GetMessageName() string { return "det44_session_details" } +func (*Det44SessionDetails) GetCrcString() string { return "27f3c171" } +func (*Det44SessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44SessionDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + size += 2 // m.OutPort + size += 1 // m.State + size += 4 // m.Expire + return size +} +func (m *Det44SessionDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.InPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + buf.EncodeUint16(m.OutPort) + buf.EncodeUint8(m.State) + buf.EncodeUint32(m.Expire) + return buf.Bytes(), nil +} +func (m *Det44SessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + m.OutPort = buf.DecodeUint16() + m.State = buf.DecodeUint8() + m.Expire = buf.DecodeUint32() + return nil +} + +// Det44SessionDump defines message 'det44_session_dump'. +type Det44SessionDump struct { + UserAddr ip_types.IP4Address `binapi:"ip4_address,name=user_addr" json:"user_addr,omitempty"` +} + +func (m *Det44SessionDump) Reset() { *m = Det44SessionDump{} } +func (*Det44SessionDump) GetMessageName() string { return "det44_session_dump" } +func (*Det44SessionDump) GetCrcString() string { return "e45a3af7" } +func (*Det44SessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44SessionDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.UserAddr + return size +} +func (m *Det44SessionDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.UserAddr[:], 4) + return buf.Bytes(), nil +} +func (m *Det44SessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.UserAddr[:], buf.DecodeBytes(4)) + return nil +} + +// Det44SetTimeouts defines message 'det44_set_timeouts'. +// InProgress: the message form may change in the future versions +type Det44SetTimeouts struct { + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *Det44SetTimeouts) Reset() { *m = Det44SetTimeouts{} } +func (*Det44SetTimeouts) GetMessageName() string { return "det44_set_timeouts" } +func (*Det44SetTimeouts) GetCrcString() string { return "d4746b16" } +func (*Det44SetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Det44SetTimeouts) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *Det44SetTimeouts) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.UDP) + buf.EncodeUint32(m.TCPEstablished) + buf.EncodeUint32(m.TCPTransitory) + buf.EncodeUint32(m.ICMP) + return buf.Bytes(), nil +} +func (m *Det44SetTimeouts) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// Det44SetTimeoutsReply defines message 'det44_set_timeouts_reply'. +// InProgress: the message form may change in the future versions +type Det44SetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Det44SetTimeoutsReply) Reset() { *m = Det44SetTimeoutsReply{} } +func (*Det44SetTimeoutsReply) GetMessageName() string { return "det44_set_timeouts_reply" } +func (*Det44SetTimeoutsReply) GetCrcString() string { return "e8d4e804" } +func (*Det44SetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Det44SetTimeoutsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Det44SetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Det44SetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// NatDetAddDelMap defines message 'nat_det_add_del_map'. +// Deprecated: the message will be removed in the future versions +type NatDetAddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` +} + +func (m *NatDetAddDelMap) Reset() { *m = NatDetAddDelMap{} } +func (*NatDetAddDelMap) GetMessageName() string { return "nat_det_add_del_map" } +func (*NatDetAddDelMap) GetCrcString() string { return "1150a190" } +func (*NatDetAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetAddDelMap) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + return size +} +func (m *NatDetAddDelMap) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(m.InPlen) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(m.OutPlen) + return buf.Bytes(), nil +} +func (m *NatDetAddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + return nil +} + +// NatDetAddDelMapReply defines message 'nat_det_add_del_map_reply'. +// Deprecated: the message will be removed in the future versions +type NatDetAddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetAddDelMapReply) Reset() { *m = NatDetAddDelMapReply{} } +func (*NatDetAddDelMapReply) GetMessageName() string { return "nat_det_add_del_map_reply" } +func (*NatDetAddDelMapReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetAddDelMapReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *NatDetAddDelMapReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *NatDetAddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// NatDetCloseSessionIn defines message 'nat_det_close_session_in'. +// Deprecated: the message will be removed in the future versions +type NatDetCloseSessionIn struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *NatDetCloseSessionIn) Reset() { *m = NatDetCloseSessionIn{} } +func (*NatDetCloseSessionIn) GetMessageName() string { return "nat_det_close_session_in" } +func (*NatDetCloseSessionIn) GetCrcString() string { return "3c68e073" } +func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetCloseSessionIn) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *NatDetCloseSessionIn) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint16(m.InPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionIn) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// NatDetCloseSessionInReply defines message 'nat_det_close_session_in_reply'. +// Deprecated: the message will be removed in the future versions +type NatDetCloseSessionInReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetCloseSessionInReply) Reset() { *m = NatDetCloseSessionInReply{} } +func (*NatDetCloseSessionInReply) GetMessageName() string { return "nat_det_close_session_in_reply" } +func (*NatDetCloseSessionInReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetCloseSessionInReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *NatDetCloseSessionInReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionInReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// NatDetCloseSessionOut defines message 'nat_det_close_session_out'. +// Deprecated: the message will be removed in the future versions +type NatDetCloseSessionOut struct { + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *NatDetCloseSessionOut) Reset() { *m = NatDetCloseSessionOut{} } +func (*NatDetCloseSessionOut) GetMessageName() string { return "nat_det_close_session_out" } +func (*NatDetCloseSessionOut) GetCrcString() string { return "f6b259d1" } +func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetCloseSessionOut) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.OutAddr + size += 2 // m.OutPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *NatDetCloseSessionOut) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint16(m.OutPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionOut) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// NatDetCloseSessionOutReply defines message 'nat_det_close_session_out_reply'. +// Deprecated: the message will be removed in the future versions +type NatDetCloseSessionOutReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetCloseSessionOutReply) Reset() { *m = NatDetCloseSessionOutReply{} } +func (*NatDetCloseSessionOutReply) GetMessageName() string { return "nat_det_close_session_out_reply" } +func (*NatDetCloseSessionOutReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetCloseSessionOutReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *NatDetCloseSessionOutReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionOutReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// NatDetForward defines message 'nat_det_forward'. +// Deprecated: the message will be removed in the future versions +type NatDetForward struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *NatDetForward) Reset() { *m = NatDetForward{} } +func (*NatDetForward) GetMessageName() string { return "nat_det_forward" } +func (*NatDetForward) GetCrcString() string { return "7f8a89cd" } +func (*NatDetForward) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetForward) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + return size +} +func (m *NatDetForward) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetForward) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetForwardReply defines message 'nat_det_forward_reply'. +// Deprecated: the message will be removed in the future versions +type NatDetForwardReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + OutPortLo uint16 `binapi:"u16,name=out_port_lo" json:"out_port_lo,omitempty"` + OutPortHi uint16 `binapi:"u16,name=out_port_hi" json:"out_port_hi,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *NatDetForwardReply) Reset() { *m = NatDetForwardReply{} } +func (*NatDetForwardReply) GetMessageName() string { return "nat_det_forward_reply" } +func (*NatDetForwardReply) GetCrcString() string { return "a8ccbdc0" } +func (*NatDetForwardReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetForwardReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 2 // m.OutPortLo + size += 2 // m.OutPortHi + size += 1 * 4 // m.OutAddr + return size +} +func (m *NatDetForwardReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint16(m.OutPortLo) + buf.EncodeUint16(m.OutPortHi) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetForwardReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.OutPortLo = buf.DecodeUint16() + m.OutPortHi = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetMapDetails defines message 'nat_det_map_details'. +// Deprecated: the message will be removed in the future versions +type NatDetMapDetails struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` + SharingRatio uint32 `binapi:"u32,name=sharing_ratio" json:"sharing_ratio,omitempty"` + PortsPerHost uint16 `binapi:"u16,name=ports_per_host" json:"ports_per_host,omitempty"` + SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` +} + +func (m *NatDetMapDetails) Reset() { *m = NatDetMapDetails{} } +func (*NatDetMapDetails) GetMessageName() string { return "nat_det_map_details" } +func (*NatDetMapDetails) GetCrcString() string { return "ad91dc83" } +func (*NatDetMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetMapDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + size += 4 // m.SharingRatio + size += 2 // m.PortsPerHost + size += 4 // m.SesNum + return size +} +func (m *NatDetMapDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(m.InPlen) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(m.OutPlen) + buf.EncodeUint32(m.SharingRatio) + buf.EncodeUint16(m.PortsPerHost) + buf.EncodeUint32(m.SesNum) + return buf.Bytes(), nil +} +func (m *NatDetMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + m.SharingRatio = buf.DecodeUint32() + m.PortsPerHost = buf.DecodeUint16() + m.SesNum = buf.DecodeUint32() + return nil +} + +// NatDetMapDump defines message 'nat_det_map_dump'. +// Deprecated: the message will be removed in the future versions +type NatDetMapDump struct{} + +func (m *NatDetMapDump) Reset() { *m = NatDetMapDump{} } +func (*NatDetMapDump) GetMessageName() string { return "nat_det_map_dump" } +func (*NatDetMapDump) GetCrcString() string { return "51077d14" } +func (*NatDetMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetMapDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *NatDetMapDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *NatDetMapDump) Unmarshal(b []byte) error { + return nil +} + +// NatDetReverse defines message 'nat_det_reverse'. +// Deprecated: the message will be removed in the future versions +type NatDetReverse struct { + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *NatDetReverse) Reset() { *m = NatDetReverse{} } +func (*NatDetReverse) GetMessageName() string { return "nat_det_reverse" } +func (*NatDetReverse) GetCrcString() string { return "a7573fe1" } +func (*NatDetReverse) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetReverse) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.OutPort + size += 1 * 4 // m.OutAddr + return size +} +func (m *NatDetReverse) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.OutPort) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetReverse) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OutPort = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetReverseReply defines message 'nat_det_reverse_reply'. +// Deprecated: the message will be removed in the future versions +type NatDetReverseReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *NatDetReverseReply) Reset() { *m = NatDetReverseReply{} } +func (*NatDetReverseReply) GetMessageName() string { return "nat_det_reverse_reply" } +func (*NatDetReverseReply) GetCrcString() string { return "34066d48" } +func (*NatDetReverseReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetReverseReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 4 // m.InAddr + return size +} +func (m *NatDetReverseReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetReverseReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetSessionDetails defines message 'nat_det_session_details'. +// Deprecated: the message will be removed in the future versions +type NatDetSessionDetails struct { + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + State uint8 `binapi:"u8,name=state" json:"state,omitempty"` + Expire uint32 `binapi:"u32,name=expire" json:"expire,omitempty"` +} + +func (m *NatDetSessionDetails) Reset() { *m = NatDetSessionDetails{} } +func (*NatDetSessionDetails) GetMessageName() string { return "nat_det_session_details" } +func (*NatDetSessionDetails) GetCrcString() string { return "27f3c171" } +func (*NatDetSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetSessionDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + size += 2 // m.OutPort + size += 1 // m.State + size += 4 // m.Expire + return size +} +func (m *NatDetSessionDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.InPort) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(m.ExtPort) + buf.EncodeUint16(m.OutPort) + buf.EncodeUint8(m.State) + buf.EncodeUint32(m.Expire) + return buf.Bytes(), nil +} +func (m *NatDetSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + m.OutPort = buf.DecodeUint16() + m.State = buf.DecodeUint8() + m.Expire = buf.DecodeUint32() + return nil +} + +// NatDetSessionDump defines message 'nat_det_session_dump'. +// Deprecated: the message will be removed in the future versions +type NatDetSessionDump struct { + UserAddr ip_types.IP4Address `binapi:"ip4_address,name=user_addr" json:"user_addr,omitempty"` +} + +func (m *NatDetSessionDump) Reset() { *m = NatDetSessionDump{} } +func (*NatDetSessionDump) GetMessageName() string { return "nat_det_session_dump" } +func (*NatDetSessionDump) GetCrcString() string { return "e45a3af7" } +func (*NatDetSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetSessionDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.UserAddr + return size +} +func (m *NatDetSessionDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.UserAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.UserAddr[:], buf.DecodeBytes(4)) + return nil +} + +func init() { file_det44_binapi_init() } +func file_det44_binapi_init() { + api.RegisterMessage((*Det44AddDelMap)(nil), "det44_add_del_map_1150a190") + api.RegisterMessage((*Det44AddDelMapReply)(nil), "det44_add_del_map_reply_e8d4e804") + api.RegisterMessage((*Det44CloseSessionIn)(nil), "det44_close_session_in_3c68e073") + api.RegisterMessage((*Det44CloseSessionInReply)(nil), "det44_close_session_in_reply_e8d4e804") + api.RegisterMessage((*Det44CloseSessionOut)(nil), "det44_close_session_out_f6b259d1") + api.RegisterMessage((*Det44CloseSessionOutReply)(nil), "det44_close_session_out_reply_e8d4e804") + api.RegisterMessage((*Det44Forward)(nil), "det44_forward_7f8a89cd") + api.RegisterMessage((*Det44ForwardReply)(nil), "det44_forward_reply_a8ccbdc0") + api.RegisterMessage((*Det44GetTimeouts)(nil), "det44_get_timeouts_51077d14") + api.RegisterMessage((*Det44GetTimeoutsReply)(nil), "det44_get_timeouts_reply_3c4df4e1") + api.RegisterMessage((*Det44InterfaceAddDelFeature)(nil), "det44_interface_add_del_feature_dc17a836") + api.RegisterMessage((*Det44InterfaceAddDelFeatureReply)(nil), "det44_interface_add_del_feature_reply_e8d4e804") + api.RegisterMessage((*Det44InterfaceDetails)(nil), "det44_interface_details_e60cc5be") + api.RegisterMessage((*Det44InterfaceDump)(nil), "det44_interface_dump_51077d14") + api.RegisterMessage((*Det44MapDetails)(nil), "det44_map_details_ad91dc83") + api.RegisterMessage((*Det44MapDump)(nil), "det44_map_dump_51077d14") + api.RegisterMessage((*Det44PluginEnableDisable)(nil), "det44_plugin_enable_disable_617b6bf8") + api.RegisterMessage((*Det44PluginEnableDisableReply)(nil), "det44_plugin_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Det44Reverse)(nil), "det44_reverse_a7573fe1") + api.RegisterMessage((*Det44ReverseReply)(nil), "det44_reverse_reply_34066d48") + api.RegisterMessage((*Det44SessionDetails)(nil), "det44_session_details_27f3c171") + api.RegisterMessage((*Det44SessionDump)(nil), "det44_session_dump_e45a3af7") + api.RegisterMessage((*Det44SetTimeouts)(nil), "det44_set_timeouts_d4746b16") + api.RegisterMessage((*Det44SetTimeoutsReply)(nil), "det44_set_timeouts_reply_e8d4e804") + api.RegisterMessage((*NatDetAddDelMap)(nil), "nat_det_add_del_map_1150a190") + api.RegisterMessage((*NatDetAddDelMapReply)(nil), "nat_det_add_del_map_reply_e8d4e804") + api.RegisterMessage((*NatDetCloseSessionIn)(nil), "nat_det_close_session_in_3c68e073") + api.RegisterMessage((*NatDetCloseSessionInReply)(nil), "nat_det_close_session_in_reply_e8d4e804") + api.RegisterMessage((*NatDetCloseSessionOut)(nil), "nat_det_close_session_out_f6b259d1") + api.RegisterMessage((*NatDetCloseSessionOutReply)(nil), "nat_det_close_session_out_reply_e8d4e804") + api.RegisterMessage((*NatDetForward)(nil), "nat_det_forward_7f8a89cd") + api.RegisterMessage((*NatDetForwardReply)(nil), "nat_det_forward_reply_a8ccbdc0") + api.RegisterMessage((*NatDetMapDetails)(nil), "nat_det_map_details_ad91dc83") + api.RegisterMessage((*NatDetMapDump)(nil), "nat_det_map_dump_51077d14") + api.RegisterMessage((*NatDetReverse)(nil), "nat_det_reverse_a7573fe1") + api.RegisterMessage((*NatDetReverseReply)(nil), "nat_det_reverse_reply_34066d48") + api.RegisterMessage((*NatDetSessionDetails)(nil), "nat_det_session_details_27f3c171") + api.RegisterMessage((*NatDetSessionDump)(nil), "nat_det_session_dump_e45a3af7") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Det44AddDelMap)(nil), + (*Det44AddDelMapReply)(nil), + (*Det44CloseSessionIn)(nil), + (*Det44CloseSessionInReply)(nil), + (*Det44CloseSessionOut)(nil), + (*Det44CloseSessionOutReply)(nil), + (*Det44Forward)(nil), + (*Det44ForwardReply)(nil), + (*Det44GetTimeouts)(nil), + (*Det44GetTimeoutsReply)(nil), + (*Det44InterfaceAddDelFeature)(nil), + (*Det44InterfaceAddDelFeatureReply)(nil), + (*Det44InterfaceDetails)(nil), + (*Det44InterfaceDump)(nil), + (*Det44MapDetails)(nil), + (*Det44MapDump)(nil), + (*Det44PluginEnableDisable)(nil), + (*Det44PluginEnableDisableReply)(nil), + (*Det44Reverse)(nil), + (*Det44ReverseReply)(nil), + (*Det44SessionDetails)(nil), + (*Det44SessionDump)(nil), + (*Det44SetTimeouts)(nil), + (*Det44SetTimeoutsReply)(nil), + (*NatDetAddDelMap)(nil), + (*NatDetAddDelMapReply)(nil), + (*NatDetCloseSessionIn)(nil), + (*NatDetCloseSessionInReply)(nil), + (*NatDetCloseSessionOut)(nil), + (*NatDetCloseSessionOutReply)(nil), + (*NatDetForward)(nil), + (*NatDetForwardReply)(nil), + (*NatDetMapDetails)(nil), + (*NatDetMapDump)(nil), + (*NatDetReverse)(nil), + (*NatDetReverseReply)(nil), + (*NatDetSessionDetails)(nil), + (*NatDetSessionDump)(nil), + } +} diff --git a/binapi/det44/det44_rpc.ba.go b/binapi/det44/det44_rpc.ba.go new file mode 100644 index 0000000..2c1eb37 --- /dev/null +++ b/binapi/det44/det44_rpc.ba.go @@ -0,0 +1,384 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package det44 + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service det44. +type RPCService interface { + Det44AddDelMap(ctx context.Context, in *Det44AddDelMap) (*Det44AddDelMapReply, error) + Det44CloseSessionIn(ctx context.Context, in *Det44CloseSessionIn) (*Det44CloseSessionInReply, error) + Det44CloseSessionOut(ctx context.Context, in *Det44CloseSessionOut) (*Det44CloseSessionOutReply, error) + Det44Forward(ctx context.Context, in *Det44Forward) (*Det44ForwardReply, error) + Det44GetTimeouts(ctx context.Context, in *Det44GetTimeouts) (*Det44GetTimeoutsReply, error) + Det44InterfaceAddDelFeature(ctx context.Context, in *Det44InterfaceAddDelFeature) (*Det44InterfaceAddDelFeatureReply, error) + Det44InterfaceDump(ctx context.Context, in *Det44InterfaceDump) (RPCService_Det44InterfaceDumpClient, error) + Det44MapDump(ctx context.Context, in *Det44MapDump) (RPCService_Det44MapDumpClient, error) + Det44PluginEnableDisable(ctx context.Context, in *Det44PluginEnableDisable) (*Det44PluginEnableDisableReply, error) + Det44Reverse(ctx context.Context, in *Det44Reverse) (*Det44ReverseReply, error) + Det44SessionDump(ctx context.Context, in *Det44SessionDump) (RPCService_Det44SessionDumpClient, error) + Det44SetTimeouts(ctx context.Context, in *Det44SetTimeouts) (*Det44SetTimeoutsReply, error) + NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) + NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) + NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) + NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) + NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) + NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) + NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Det44AddDelMap(ctx context.Context, in *Det44AddDelMap) (*Det44AddDelMapReply, error) { + out := new(Det44AddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44CloseSessionIn(ctx context.Context, in *Det44CloseSessionIn) (*Det44CloseSessionInReply, error) { + out := new(Det44CloseSessionInReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44CloseSessionOut(ctx context.Context, in *Det44CloseSessionOut) (*Det44CloseSessionOutReply, error) { + out := new(Det44CloseSessionOutReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44Forward(ctx context.Context, in *Det44Forward) (*Det44ForwardReply, error) { + out := new(Det44ForwardReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44GetTimeouts(ctx context.Context, in *Det44GetTimeouts) (*Det44GetTimeoutsReply, error) { + out := new(Det44GetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44InterfaceAddDelFeature(ctx context.Context, in *Det44InterfaceAddDelFeature) (*Det44InterfaceAddDelFeatureReply, error) { + out := new(Det44InterfaceAddDelFeatureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44InterfaceDump(ctx context.Context, in *Det44InterfaceDump) (RPCService_Det44InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Det44InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Det44InterfaceDumpClient interface { + Recv() (*Det44InterfaceDetails, error) + api.Stream +} + +type serviceClient_Det44InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Det44InterfaceDumpClient) Recv() (*Det44InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Det44InterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Det44MapDump(ctx context.Context, in *Det44MapDump) (RPCService_Det44MapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Det44MapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Det44MapDumpClient interface { + Recv() (*Det44MapDetails, error) + api.Stream +} + +type serviceClient_Det44MapDumpClient struct { + api.Stream +} + +func (c *serviceClient_Det44MapDumpClient) Recv() (*Det44MapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Det44MapDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Det44PluginEnableDisable(ctx context.Context, in *Det44PluginEnableDisable) (*Det44PluginEnableDisableReply, error) { + out := new(Det44PluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44Reverse(ctx context.Context, in *Det44Reverse) (*Det44ReverseReply, error) { + out := new(Det44ReverseReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Det44SessionDump(ctx context.Context, in *Det44SessionDump) (RPCService_Det44SessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Det44SessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Det44SessionDumpClient interface { + Recv() (*Det44SessionDetails, error) + api.Stream +} + +type serviceClient_Det44SessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_Det44SessionDumpClient) Recv() (*Det44SessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Det44SessionDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Det44SetTimeouts(ctx context.Context, in *Det44SetTimeouts) (*Det44SetTimeoutsReply, error) { + out := new(Det44SetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { + out := new(NatDetAddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { + out := new(NatDetCloseSessionInReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { + out := new(NatDetCloseSessionOutReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { + out := new(NatDetForwardReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NatDetMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NatDetMapDumpClient interface { + Recv() (*NatDetMapDetails, error) + api.Stream +} + +type serviceClient_NatDetMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_NatDetMapDumpClient) Recv() (*NatDetMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NatDetMapDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { + out := new(NatDetReverseReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NatDetSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NatDetSessionDumpClient interface { + Recv() (*NatDetSessionDetails, error) + api.Stream +} + +type serviceClient_NatDetSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_NatDetSessionDumpClient) Recv() (*NatDetSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NatDetSessionDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/dhcp/dhcp.ba.go b/binapi/dhcp/dhcp.ba.go index 7e0fd0b..941447f 100644 --- a/binapi/dhcp/dhcp.ba.go +++ b/binapi/dhcp/dhcp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/dhcp.api.json // Package dhcp contains generated bindings for API file dhcp.api. @@ -14,12 +14,13 @@ package dhcp import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -31,7 +32,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "dhcp" APIVersion = "3.0.1" - VersionCrc = 0x96274cae + VersionCrc = 0x3cf8291a ) // DHCPClientState defines enum 'dhcp_client_state'. @@ -359,7 +360,7 @@ type DHCP6PdReplyEvent struct { func (m *DHCP6PdReplyEvent) Reset() { *m = DHCP6PdReplyEvent{} } func (*DHCP6PdReplyEvent) GetMessageName() string { return "dhcp6_pd_reply_event" } -func (*DHCP6PdReplyEvent) GetCrcString() string { return "cb3e462b" } +func (*DHCP6PdReplyEvent) GetCrcString() string { return "5e878029" } func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -458,7 +459,7 @@ type DHCP6PdSendClientMessage struct { func (m *DHCP6PdSendClientMessage) Reset() { *m = DHCP6PdSendClientMessage{} } func (*DHCP6PdSendClientMessage) GetMessageName() string { return "dhcp6_pd_send_client_message" } -func (*DHCP6PdSendClientMessage) GetCrcString() string { return "064badb8" } +func (*DHCP6PdSendClientMessage) GetCrcString() string { return "3739fd8d" } func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } @@ -594,7 +595,7 @@ type DHCP6ReplyEvent struct { func (m *DHCP6ReplyEvent) Reset() { *m = DHCP6ReplyEvent{} } func (*DHCP6ReplyEvent) GetMessageName() string { return "dhcp6_reply_event" } -func (*DHCP6ReplyEvent) GetCrcString() string { return "9f3af9e5" } +func (*DHCP6ReplyEvent) GetCrcString() string { return "85b7b17e" } func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -690,7 +691,7 @@ type DHCP6SendClientMessage struct { func (m *DHCP6SendClientMessage) Reset() { *m = DHCP6SendClientMessage{} } func (*DHCP6SendClientMessage) GetMessageName() string { return "dhcp6_send_client_message" } -func (*DHCP6SendClientMessage) GetCrcString() string { return "f6f14ef0" } +func (*DHCP6SendClientMessage) GetCrcString() string { return "f8222476" } func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } @@ -812,7 +813,7 @@ type DHCPClientConfig struct { func (m *DHCPClientConfig) Reset() { *m = DHCPClientConfig{} } func (*DHCPClientConfig) GetMessageName() string { return "dhcp_client_config" } -func (*DHCPClientConfig) GetCrcString() string { return "959b80a3" } +func (*DHCPClientConfig) GetCrcString() string { return "1af013ea" } func (*DHCPClientConfig) GetMessageType() api.MessageType { return api.RequestMessage } @@ -901,7 +902,7 @@ type DHCPClientDetails struct { func (m *DHCPClientDetails) Reset() { *m = DHCPClientDetails{} } func (*DHCPClientDetails) GetMessageName() string { return "dhcp_client_details" } -func (*DHCPClientDetails) GetCrcString() string { return "acd82f5a" } +func (*DHCPClientDetails) GetCrcString() string { return "3c5cd28a" } func (*DHCPClientDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1036,7 +1037,7 @@ type DHCPComplEvent struct { func (m *DHCPComplEvent) Reset() { *m = DHCPComplEvent{} } func (*DHCPComplEvent) GetMessageName() string { return "dhcp_compl_event" } -func (*DHCPComplEvent) GetCrcString() string { return "e908fd1d" } +func (*DHCPComplEvent) GetCrcString() string { return "554a44e5" } func (*DHCPComplEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -1260,7 +1261,7 @@ type DHCPProxyConfig struct { func (m *DHCPProxyConfig) Reset() { *m = DHCPProxyConfig{} } func (*DHCPProxyConfig) GetMessageName() string { return "dhcp_proxy_config" } -func (*DHCPProxyConfig) GetCrcString() string { return "6767230e" } +func (*DHCPProxyConfig) GetCrcString() string { return "4058a689" } func (*DHCPProxyConfig) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1352,7 +1353,7 @@ type DHCPProxyDetails struct { func (m *DHCPProxyDetails) Reset() { *m = DHCPProxyDetails{} } func (*DHCPProxyDetails) GetMessageName() string { return "dhcp_proxy_details" } -func (*DHCPProxyDetails) GetCrcString() string { return "ce16f044" } +func (*DHCPProxyDetails) GetCrcString() string { return "dcbaf540" } func (*DHCPProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1698,24 +1699,24 @@ func file_dhcp_binapi_init() { api.RegisterMessage((*DHCP6ClientsEnableDisableReply)(nil), "dhcp6_clients_enable_disable_reply_e8d4e804") api.RegisterMessage((*DHCP6DuidLlSet)(nil), "dhcp6_duid_ll_set_0f6ca323") api.RegisterMessage((*DHCP6DuidLlSetReply)(nil), "dhcp6_duid_ll_set_reply_e8d4e804") - api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp6_pd_reply_event_cb3e462b") - api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp6_pd_send_client_message_064badb8") + api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp6_pd_reply_event_5e878029") + api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp6_pd_send_client_message_3739fd8d") api.RegisterMessage((*DHCP6PdSendClientMessageReply)(nil), "dhcp6_pd_send_client_message_reply_e8d4e804") - api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp6_reply_event_9f3af9e5") - api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp6_send_client_message_f6f14ef0") + api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp6_reply_event_85b7b17e") + api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp6_send_client_message_f8222476") api.RegisterMessage((*DHCP6SendClientMessageReply)(nil), "dhcp6_send_client_message_reply_e8d4e804") - api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp_client_config_959b80a3") + api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp_client_config_1af013ea") api.RegisterMessage((*DHCPClientConfigReply)(nil), "dhcp_client_config_reply_e8d4e804") - api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp_client_details_acd82f5a") + api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp_client_details_3c5cd28a") api.RegisterMessage((*DHCPClientDump)(nil), "dhcp_client_dump_51077d14") - api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp_compl_event_e908fd1d") + api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp_compl_event_554a44e5") api.RegisterMessage((*DHCPPluginControlPing)(nil), "dhcp_plugin_control_ping_51077d14") api.RegisterMessage((*DHCPPluginControlPingReply)(nil), "dhcp_plugin_control_ping_reply_f6b0b8ca") api.RegisterMessage((*DHCPPluginGetVersion)(nil), "dhcp_plugin_get_version_51077d14") api.RegisterMessage((*DHCPPluginGetVersionReply)(nil), "dhcp_plugin_get_version_reply_9b32cf86") - api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp_proxy_config_6767230e") + api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp_proxy_config_4058a689") api.RegisterMessage((*DHCPProxyConfigReply)(nil), "dhcp_proxy_config_reply_e8d4e804") - api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp_proxy_details_ce16f044") + api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp_proxy_details_dcbaf540") api.RegisterMessage((*DHCPProxyDump)(nil), "dhcp_proxy_dump_5c5b063f") api.RegisterMessage((*DHCPProxySetVss)(nil), "dhcp_proxy_set_vss_50537301") api.RegisterMessage((*DHCPProxySetVssReply)(nil), "dhcp_proxy_set_vss_reply_e8d4e804") diff --git a/binapi/dhcp/dhcp_rest.ba.go b/binapi/dhcp/dhcp_rest.ba.go deleted file mode 100644 index 4a4d9d1..0000000 --- a/binapi/dhcp/dhcp_rest.ba.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dhcp6_clients_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6ClientsEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6ClientsEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp6_duid_ll_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6DuidLlSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6DuidLlSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp6_pd_send_client_message", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6PdSendClientMessage) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6PdSendClientMessage(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp6_send_client_message", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6SendClientMessage) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6SendClientMessage(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp_client_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCPClientConfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCPClientConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCPPluginControlPing) - reply, err := rpc.DHCPPluginControlPing(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCPPluginGetVersion) - reply, err := rpc.DHCPPluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp_proxy_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCPProxyConfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCPProxyConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dhcp_proxy_set_vss", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCPProxySetVss) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCPProxySetVss(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_dhcp6_pd_reply_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantDHCP6PdReplyEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantDHCP6PdReplyEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_dhcp6_reply_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantDHCP6ReplyEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantDHCP6ReplyEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/dhcp/dhcp_rpc.ba.go b/binapi/dhcp/dhcp_rpc.ba.go index 379bb9b..757c04e 100644 --- a/binapi/dhcp/dhcp_rpc.ba.go +++ b/binapi/dhcp/dhcp_rpc.ba.go @@ -5,12 +5,13 @@ package dhcp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service dhcp. +// RPCService defines RPC service dhcp. type RPCService interface { DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) @@ -41,7 +42,7 @@ func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { @@ -50,7 +51,7 @@ func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { @@ -59,7 +60,7 @@ func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6P if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { @@ -68,7 +69,7 @@ func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6Sen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { @@ -77,7 +78,7 @@ func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) { @@ -89,7 +90,7 @@ func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -112,7 +113,11 @@ func (c *serviceClient_DHCPClientDumpClient) Recv() (*DHCPClientDetails, error) switch m := msg.(type) { case *DHCPClientDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -125,7 +130,7 @@ func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPlugi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) { @@ -143,7 +148,7 @@ func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) { @@ -155,7 +160,7 @@ func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -178,7 +183,11 @@ func (c *serviceClient_DHCPProxyDumpClient) Recv() (*DHCPProxyDetails, error) { switch m := msg.(type) { case *DHCPProxyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -191,7 +200,7 @@ func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { @@ -200,7 +209,7 @@ func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { @@ -209,5 +218,5 @@ func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6R if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go index 4fcb012..87ab1fb 100644 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/dhcp6_ia_na_client_cp.api.json // Package dhcp6_ia_na_client_cp contains generated bindings for API file dhcp6_ia_na_client_cp.api. @@ -12,9 +12,9 @@ package dhcp6_ia_na_client_cp import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "dhcp6_ia_na_client_cp" APIVersion = "1.0.1" - VersionCrc = 0x7c918b8 + VersionCrc = 0x6e8abdfb ) // DHCP6ClientEnableDisable defines message 'dhcp6_client_enable_disable'. diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go deleted file mode 100644 index 0fd5ce2..0000000 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp6_ia_na_client_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dhcp6_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6ClientEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6ClientEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go index b975236..04cf458 100644 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go @@ -4,10 +4,11 @@ package dhcp6_ia_na_client_cp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service dhcp6_ia_na_client_cp. +// RPCService defines RPC service dhcp6_ia_na_client_cp. type RPCService interface { DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6C if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go index 7e4e2bb..f83b427 100644 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/dhcp6_pd_client_cp.api.json // Package dhcp6_pd_client_cp contains generated bindings for API file dhcp6_pd_client_cp.api. @@ -12,10 +12,10 @@ package dhcp6_pd_client_cp import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "dhcp6_pd_client_cp" APIVersion = "2.0.0" - VersionCrc = 0x96f41948 + VersionCrc = 0xd4418668 ) // DHCP6PdClientEnableDisable defines message 'dhcp6_pd_client_enable_disable'. @@ -118,7 +118,7 @@ func (m *IP6AddDelAddressUsingPrefix) Reset() { *m = IP6AddDelAddressUsingPrefix func (*IP6AddDelAddressUsingPrefix) GetMessageName() string { return "ip6_add_del_address_using_prefix" } -func (*IP6AddDelAddressUsingPrefix) GetCrcString() string { return "9b3d11e0" } +func (*IP6AddDelAddressUsingPrefix) GetCrcString() string { return "3982f30a" } func (*IP6AddDelAddressUsingPrefix) GetMessageType() api.MessageType { return api.RequestMessage } @@ -195,7 +195,7 @@ func init() { file_dhcp6_pd_client_cp_binapi_init() } func file_dhcp6_pd_client_cp_binapi_init() { api.RegisterMessage((*DHCP6PdClientEnableDisable)(nil), "dhcp6_pd_client_enable_disable_a75a0772") api.RegisterMessage((*DHCP6PdClientEnableDisableReply)(nil), "dhcp6_pd_client_enable_disable_reply_e8d4e804") - api.RegisterMessage((*IP6AddDelAddressUsingPrefix)(nil), "ip6_add_del_address_using_prefix_9b3d11e0") + api.RegisterMessage((*IP6AddDelAddressUsingPrefix)(nil), "ip6_add_del_address_using_prefix_3982f30a") api.RegisterMessage((*IP6AddDelAddressUsingPrefixReply)(nil), "ip6_add_del_address_using_prefix_reply_e8d4e804") } diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go deleted file mode 100644 index fa76aa8..0000000 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp6_pd_client_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dhcp6_pd_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6PdClientEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DHCP6PdClientEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip6_add_del_address_using_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6AddDelAddressUsingPrefix) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IP6AddDelAddressUsingPrefix(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go index 7199e5a..cd18f14 100644 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go @@ -4,10 +4,11 @@ package dhcp6_pd_client_cp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service dhcp6_pd_client_cp. +// RPCService defines RPC service dhcp6_pd_client_cp. type RPCService interface { DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dns/dns.ba.go b/binapi/dns/dns.ba.go index fc2324c..ca458a2 100644 --- a/binapi/dns/dns.ba.go +++ b/binapi/dns/dns.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/dns.api.json // Package dns contains generated bindings for API file dns.api. @@ -12,8 +12,8 @@ package dns import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/dns/dns_rest.ba.go b/binapi/dns/dns_rest.ba.go deleted file mode 100644 index e67d971..0000000 --- a/binapi/dns/dns_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dns - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dns_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DNSEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dns_name_server_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSNameServerAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DNSNameServerAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dns_resolve_ip", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSResolveIP) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DNSResolveIP(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dns_resolve_name", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSResolveName) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DNSResolveName(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/dns/dns_rpc.ba.go b/binapi/dns/dns_rpc.ba.go index 57760ab..8b5c98f 100644 --- a/binapi/dns/dns_rpc.ba.go +++ b/binapi/dns/dns_rpc.ba.go @@ -4,10 +4,11 @@ package dns import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service dns. +// RPCService defines RPC service dns. type RPCService interface { DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) @@ -29,7 +30,7 @@ func (c *serviceClient) DNSEnableDisable(ctx context.Context, in *DNSEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) { @@ -38,7 +39,7 @@ func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServ if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) { @@ -47,7 +48,7 @@ func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) { @@ -56,5 +57,5 @@ func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dslite/dslite.ba.go b/binapi/dslite/dslite.ba.go index efcf240..5c548cc 100644 --- a/binapi/dslite/dslite.ba.go +++ b/binapi/dslite/dslite.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/dslite.api.json // Package dslite contains generated bindings for API file dslite.api. @@ -12,10 +12,10 @@ package dslite import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "dslite" APIVersion = "1.0.0" - VersionCrc = 0xb62715c5 + VersionCrc = 0x1afa049b ) // DsliteAddDelPoolAddrRange defines message 'dslite_add_del_pool_addr_range'. @@ -39,7 +39,7 @@ type DsliteAddDelPoolAddrRange struct { func (m *DsliteAddDelPoolAddrRange) Reset() { *m = DsliteAddDelPoolAddrRange{} } func (*DsliteAddDelPoolAddrRange) GetMessageName() string { return "dslite_add_del_pool_addr_range" } -func (*DsliteAddDelPoolAddrRange) GetCrcString() string { return "c448457a" } +func (*DsliteAddDelPoolAddrRange) GetCrcString() string { return "de2a5b02" } func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { return api.RequestMessage } @@ -202,7 +202,7 @@ type DsliteGetAftrAddrReply struct { func (m *DsliteGetAftrAddrReply) Reset() { *m = DsliteGetAftrAddrReply{} } func (*DsliteGetAftrAddrReply) GetMessageName() string { return "dslite_get_aftr_addr_reply" } -func (*DsliteGetAftrAddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetAftrAddrReply) GetCrcString() string { return "8e23608e" } func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -270,7 +270,7 @@ type DsliteGetB4AddrReply struct { func (m *DsliteGetB4AddrReply) Reset() { *m = DsliteGetB4AddrReply{} } func (*DsliteGetB4AddrReply) GetMessageName() string { return "dslite_get_b4_addr_reply" } -func (*DsliteGetB4AddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetB4AddrReply) GetCrcString() string { return "8e23608e" } func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -310,7 +310,7 @@ type DsliteSetAftrAddr struct { func (m *DsliteSetAftrAddr) Reset() { *m = DsliteSetAftrAddr{} } func (*DsliteSetAftrAddr) GetMessageName() string { return "dslite_set_aftr_addr" } -func (*DsliteSetAftrAddr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetAftrAddr) GetCrcString() string { return "78b50fdf" } func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { return api.RequestMessage } @@ -380,7 +380,7 @@ type DsliteSetB4Addr struct { func (m *DsliteSetB4Addr) Reset() { *m = DsliteSetB4Addr{} } func (*DsliteSetB4Addr) GetMessageName() string { return "dslite_set_b4_addr" } -func (*DsliteSetB4Addr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetB4Addr) GetCrcString() string { return "78b50fdf" } func (*DsliteSetB4Addr) GetMessageType() api.MessageType { return api.RequestMessage } @@ -444,17 +444,17 @@ func (m *DsliteSetB4AddrReply) Unmarshal(b []byte) error { func init() { file_dslite_binapi_init() } func file_dslite_binapi_init() { - api.RegisterMessage((*DsliteAddDelPoolAddrRange)(nil), "dslite_add_del_pool_addr_range_c448457a") + api.RegisterMessage((*DsliteAddDelPoolAddrRange)(nil), "dslite_add_del_pool_addr_range_de2a5b02") api.RegisterMessage((*DsliteAddDelPoolAddrRangeReply)(nil), "dslite_add_del_pool_addr_range_reply_e8d4e804") api.RegisterMessage((*DsliteAddressDetails)(nil), "dslite_address_details_ec26d648") api.RegisterMessage((*DsliteAddressDump)(nil), "dslite_address_dump_51077d14") api.RegisterMessage((*DsliteGetAftrAddr)(nil), "dslite_get_aftr_addr_51077d14") - api.RegisterMessage((*DsliteGetAftrAddrReply)(nil), "dslite_get_aftr_addr_reply_38e30db1") + api.RegisterMessage((*DsliteGetAftrAddrReply)(nil), "dslite_get_aftr_addr_reply_8e23608e") api.RegisterMessage((*DsliteGetB4Addr)(nil), "dslite_get_b4_addr_51077d14") - api.RegisterMessage((*DsliteGetB4AddrReply)(nil), "dslite_get_b4_addr_reply_38e30db1") - api.RegisterMessage((*DsliteSetAftrAddr)(nil), "dslite_set_aftr_addr_1e955f8d") + api.RegisterMessage((*DsliteGetB4AddrReply)(nil), "dslite_get_b4_addr_reply_8e23608e") + api.RegisterMessage((*DsliteSetAftrAddr)(nil), "dslite_set_aftr_addr_78b50fdf") api.RegisterMessage((*DsliteSetAftrAddrReply)(nil), "dslite_set_aftr_addr_reply_e8d4e804") - api.RegisterMessage((*DsliteSetB4Addr)(nil), "dslite_set_b4_addr_1e955f8d") + api.RegisterMessage((*DsliteSetB4Addr)(nil), "dslite_set_b4_addr_78b50fdf") api.RegisterMessage((*DsliteSetB4AddrReply)(nil), "dslite_set_b4_addr_reply_e8d4e804") } diff --git a/binapi/dslite/dslite_rest.ba.go b/binapi/dslite/dslite_rest.ba.go deleted file mode 100644 index eba86b0..0000000 --- a/binapi/dslite/dslite_rest.ba.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dslite - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dslite_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteAddDelPoolAddrRange) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DsliteAddDelPoolAddrRange(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dslite_get_aftr_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteGetAftrAddr) - reply, err := rpc.DsliteGetAftrAddr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dslite_get_b4_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteGetB4Addr) - reply, err := rpc.DsliteGetB4Addr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dslite_set_aftr_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteSetAftrAddr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DsliteSetAftrAddr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/dslite_set_b4_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteSetB4Addr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DsliteSetB4Addr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/dslite/dslite_rpc.ba.go b/binapi/dslite/dslite_rpc.ba.go index 7f6e90e..5924275 100644 --- a/binapi/dslite/dslite_rpc.ba.go +++ b/binapi/dslite/dslite_rpc.ba.go @@ -5,12 +5,13 @@ package dslite import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service dslite. +// RPCService defines RPC service dslite. type RPCService interface { DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) @@ -34,7 +35,7 @@ func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *Dslit if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) { @@ -46,7 +47,7 @@ func (c *serviceClient) DsliteAddressDump(ctx context.Context, in *DsliteAddress if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -69,7 +70,11 @@ func (c *serviceClient_DsliteAddressDumpClient) Recv() (*DsliteAddressDetails, e switch m := msg.(type) { case *DsliteAddressDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -82,7 +87,7 @@ func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { @@ -91,7 +96,7 @@ func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { @@ -100,7 +105,7 @@ func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { @@ -109,5 +114,5 @@ func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ethernet_types/ethernet_types.ba.go b/binapi/ethernet_types/ethernet_types.ba.go index b54b1ef..78d56be 100644 --- a/binapi/ethernet_types/ethernet_types.ba.go +++ b/binapi/ethernet_types/ethernet_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ethernet_types.api.json // Package ethernet_types contains generated bindings for API file ethernet_types.api. @@ -12,8 +12,9 @@ package ethernet_types import ( - api "git.fd.io/govpp.git/api" "net" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -22,6 +23,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "ethernet_types" + APIVersion = "1.0.0" + VersionCrc = 0xf24103d6 +) + // MacAddress defines alias 'mac_address'. type MacAddress [6]uint8 @@ -34,15 +41,19 @@ func ParseMacAddress(s string) (MacAddress, error) { copy(macaddr[:], mac[:]) return macaddr, nil } + func (x MacAddress) ToMAC() net.HardwareAddr { return net.HardwareAddr(x[:]) } + func (x MacAddress) String() string { return x.ToMAC().String() } + func (x *MacAddress) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *MacAddress) UnmarshalText(text []byte) error { mac, err := ParseMacAddress(string(text)) if err != nil { diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go index cc54364..f2c46a9 100644 --- a/binapi/feature/feature.ba.go +++ b/binapi/feature/feature.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/feature.api.json // Package feature contains generated bindings for API file feature.api. @@ -12,9 +12,9 @@ package feature import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "feature" APIVersion = "1.0.2" - VersionCrc = 0x8dd9f8ab + VersionCrc = 0x8a6e6da1 ) // FeatureEnableDisable defines message 'feature_enable_disable'. diff --git a/binapi/feature/feature_rest.ba.go b/binapi/feature/feature_rest.ba.go deleted file mode 100644 index a1b0604..0000000 --- a/binapi/feature/feature_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package feature - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(FeatureEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.FeatureEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/feature/feature_rpc.ba.go b/binapi/feature/feature_rpc.ba.go index cd91188..8f98139 100644 --- a/binapi/feature/feature_rpc.ba.go +++ b/binapi/feature/feature_rpc.ba.go @@ -4,10 +4,11 @@ package feature import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service feature. +// RPCService defines RPC service feature. type RPCService interface { FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) FeatureEnableDisable(ctx context.Context, in *FeatureEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/fib/fib.ba.go b/binapi/fib/fib.ba.go new file mode 100644 index 0000000..62b4998 --- /dev/null +++ b/binapi/fib/fib.ba.go @@ -0,0 +1,199 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/core/fib.api.json + +// Package fib contains generated bindings for API file fib.api. +// +// Contents: +// 1 struct +// 4 messages +// +package fib + +import ( + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/fib_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "fib" + APIVersion = "1.0.0" + VersionCrc = 0x4ef4abc1 +) + +// FibSource defines type 'fib_source'. +type FibSource struct { + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +// FibSourceAdd defines message 'fib_source_add'. +type FibSourceAdd struct { + Src FibSource `binapi:"fib_source,name=src" json:"src,omitempty"` +} + +func (m *FibSourceAdd) Reset() { *m = FibSourceAdd{} } +func (*FibSourceAdd) GetMessageName() string { return "fib_source_add" } +func (*FibSourceAdd) GetCrcString() string { return "b3ac2aec" } +func (*FibSourceAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FibSourceAdd) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Src.Priority + size += 1 // m.Src.ID + size += 64 // m.Src.Name + return size +} +func (m *FibSourceAdd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Src.Priority) + buf.EncodeUint8(m.Src.ID) + buf.EncodeString(m.Src.Name, 64) + return buf.Bytes(), nil +} +func (m *FibSourceAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Src.Priority = buf.DecodeUint8() + m.Src.ID = buf.DecodeUint8() + m.Src.Name = buf.DecodeString(64) + return nil +} + +// FibSourceAddReply defines message 'fib_source_add_reply'. +type FibSourceAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` +} + +func (m *FibSourceAddReply) Reset() { *m = FibSourceAddReply{} } +func (*FibSourceAddReply) GetMessageName() string { return "fib_source_add_reply" } +func (*FibSourceAddReply) GetCrcString() string { return "604fd6f1" } +func (*FibSourceAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FibSourceAddReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 // m.ID + return size +} +func (m *FibSourceAddReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint8(m.ID) + return buf.Bytes(), nil +} +func (m *FibSourceAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ID = buf.DecodeUint8() + return nil +} + +// FibSourceDetails defines message 'fib_source_details'. +type FibSourceDetails struct { + Src FibSource `binapi:"fib_source,name=src" json:"src,omitempty"` +} + +func (m *FibSourceDetails) Reset() { *m = FibSourceDetails{} } +func (*FibSourceDetails) GetMessageName() string { return "fib_source_details" } +func (*FibSourceDetails) GetCrcString() string { return "8668acdb" } +func (*FibSourceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FibSourceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Src.Priority + size += 1 // m.Src.ID + size += 64 // m.Src.Name + return size +} +func (m *FibSourceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Src.Priority) + buf.EncodeUint8(m.Src.ID) + buf.EncodeString(m.Src.Name, 64) + return buf.Bytes(), nil +} +func (m *FibSourceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Src.Priority = buf.DecodeUint8() + m.Src.ID = buf.DecodeUint8() + m.Src.Name = buf.DecodeString(64) + return nil +} + +// FibSourceDump defines message 'fib_source_dump'. +type FibSourceDump struct{} + +func (m *FibSourceDump) Reset() { *m = FibSourceDump{} } +func (*FibSourceDump) GetMessageName() string { return "fib_source_dump" } +func (*FibSourceDump) GetCrcString() string { return "51077d14" } +func (*FibSourceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FibSourceDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *FibSourceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *FibSourceDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_fib_binapi_init() } +func file_fib_binapi_init() { + api.RegisterMessage((*FibSourceAdd)(nil), "fib_source_add_b3ac2aec") + api.RegisterMessage((*FibSourceAddReply)(nil), "fib_source_add_reply_604fd6f1") + api.RegisterMessage((*FibSourceDetails)(nil), "fib_source_details_8668acdb") + api.RegisterMessage((*FibSourceDump)(nil), "fib_source_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FibSourceAdd)(nil), + (*FibSourceAddReply)(nil), + (*FibSourceDetails)(nil), + (*FibSourceDump)(nil), + } +} diff --git a/binapi/fib/fib_rpc.ba.go b/binapi/fib/fib_rpc.ba.go new file mode 100644 index 0000000..e3e5c4b --- /dev/null +++ b/binapi/fib/fib_rpc.ba.go @@ -0,0 +1,78 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package fib + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service fib. +type RPCService interface { + FibSourceAdd(ctx context.Context, in *FibSourceAdd) (*FibSourceAddReply, error) + FibSourceDump(ctx context.Context, in *FibSourceDump) (RPCService_FibSourceDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FibSourceAdd(ctx context.Context, in *FibSourceAdd) (*FibSourceAddReply, error) { + out := new(FibSourceAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) FibSourceDump(ctx context.Context, in *FibSourceDump) (RPCService_FibSourceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_FibSourceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_FibSourceDumpClient interface { + Recv() (*FibSourceDetails, error) + api.Stream +} + +type serviceClient_FibSourceDumpClient struct { + api.Stream +} + +func (c *serviceClient_FibSourceDumpClient) Recv() (*FibSourceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *FibSourceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/fib_types/fib_types.ba.go b/binapi/fib_types/fib_types.ba.go index eb67597..3c59560 100644 --- a/binapi/fib_types/fib_types.ba.go +++ b/binapi/fib_types/fib_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/fib_types.api.json // Package fib_types contains generated bindings for API file fib_types.api. @@ -13,9 +13,10 @@ package fib_types import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" "strconv" + + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -24,6 +25,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "fib_types" + APIVersion = "2.0.1" + VersionCrc = 0x21fd785b +) + // FibPathFlags defines enum 'fib_path_flags'. type FibPathFlags uint32 diff --git a/binapi/flow/flow.ba.go b/binapi/flow/flow.ba.go new file mode 100644 index 0000000..3fc211f --- /dev/null +++ b/binapi/flow/flow.ba.go @@ -0,0 +1,367 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/core/flow.api.json + +// Package flow contains generated bindings for API file flow.api. +// +// Contents: +// 8 messages +// +package flow + +import ( + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + flow_types "go.fd.io/govpp/binapi/flow_types" + _ "go.fd.io/govpp/binapi/interface_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "flow" + APIVersion = "0.0.2" + VersionCrc = 0x140d3585 +) + +// FlowAdd defines message 'flow_add'. +// InProgress: the message form may change in the future versions +type FlowAdd struct { + Flow flow_types.FlowRule `binapi:"flow_rule,name=flow" json:"flow,omitempty"` +} + +func (m *FlowAdd) Reset() { *m = FlowAdd{} } +func (*FlowAdd) GetMessageName() string { return "flow_add" } +func (*FlowAdd) GetCrcString() string { return "f946ed84" } +func (*FlowAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowAdd) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Flow.Type + size += 4 // m.Flow.Index + size += 4 // m.Flow.Actions + size += 4 // m.Flow.MarkFlowID + size += 4 // m.Flow.RedirectNodeIndex + size += 4 // m.Flow.RedirectDeviceInputNextIndex + size += 4 // m.Flow.RedirectQueue + size += 4 // m.Flow.BufferAdvance + size += 1 * 82 // m.Flow.Flow + return size +} +func (m *FlowAdd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Flow.Type)) + buf.EncodeUint32(m.Flow.Index) + buf.EncodeUint32(uint32(m.Flow.Actions)) + buf.EncodeUint32(m.Flow.MarkFlowID) + buf.EncodeUint32(m.Flow.RedirectNodeIndex) + buf.EncodeUint32(m.Flow.RedirectDeviceInputNextIndex) + buf.EncodeUint32(m.Flow.RedirectQueue) + buf.EncodeInt32(m.Flow.BufferAdvance) + buf.EncodeBytes(m.Flow.Flow.XXX_UnionData[:], 82) + return buf.Bytes(), nil +} +func (m *FlowAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flow.Type = flow_types.FlowType(buf.DecodeUint32()) + m.Flow.Index = buf.DecodeUint32() + m.Flow.Actions = flow_types.FlowAction(buf.DecodeUint32()) + m.Flow.MarkFlowID = buf.DecodeUint32() + m.Flow.RedirectNodeIndex = buf.DecodeUint32() + m.Flow.RedirectDeviceInputNextIndex = buf.DecodeUint32() + m.Flow.RedirectQueue = buf.DecodeUint32() + m.Flow.BufferAdvance = buf.DecodeInt32() + copy(m.Flow.Flow.XXX_UnionData[:], buf.DecodeBytes(82)) + return nil +} + +// FlowAddReply defines message 'flow_add_reply'. +// InProgress: the message form may change in the future versions +type FlowAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FlowIndex uint32 `binapi:"u32,name=flow_index" json:"flow_index,omitempty"` +} + +func (m *FlowAddReply) Reset() { *m = FlowAddReply{} } +func (*FlowAddReply) GetMessageName() string { return "flow_add_reply" } +func (*FlowAddReply) GetCrcString() string { return "8587dc85" } +func (*FlowAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowAddReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.FlowIndex + return size +} +func (m *FlowAddReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.FlowIndex) + return buf.Bytes(), nil +} +func (m *FlowAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.FlowIndex = buf.DecodeUint32() + return nil +} + +// FlowDel defines message 'flow_del'. +// InProgress: the message form may change in the future versions +type FlowDel struct { + FlowIndex uint32 `binapi:"u32,name=flow_index" json:"flow_index,omitempty"` +} + +func (m *FlowDel) Reset() { *m = FlowDel{} } +func (*FlowDel) GetMessageName() string { return "flow_del" } +func (*FlowDel) GetCrcString() string { return "b6b9b02c" } +func (*FlowDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.FlowIndex + return size +} +func (m *FlowDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FlowIndex) + return buf.Bytes(), nil +} +func (m *FlowDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FlowIndex = buf.DecodeUint32() + return nil +} + +// FlowDelReply defines message 'flow_del_reply'. +// InProgress: the message form may change in the future versions +type FlowDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowDelReply) Reset() { *m = FlowDelReply{} } +func (*FlowDelReply) GetMessageName() string { return "flow_del_reply" } +func (*FlowDelReply) GetCrcString() string { return "e8d4e804" } +func (*FlowDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *FlowDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *FlowDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// FlowDisable defines message 'flow_disable'. +// InProgress: the message form may change in the future versions +type FlowDisable struct { + FlowIndex uint32 `binapi:"u32,name=flow_index" json:"flow_index,omitempty"` + HwIfIndex uint32 `binapi:"u32,name=hw_if_index" json:"hw_if_index,omitempty"` +} + +func (m *FlowDisable) Reset() { *m = FlowDisable{} } +func (*FlowDisable) GetMessageName() string { return "flow_disable" } +func (*FlowDisable) GetCrcString() string { return "2024be69" } +func (*FlowDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.FlowIndex + size += 4 // m.HwIfIndex + return size +} +func (m *FlowDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FlowIndex) + buf.EncodeUint32(m.HwIfIndex) + return buf.Bytes(), nil +} +func (m *FlowDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FlowIndex = buf.DecodeUint32() + m.HwIfIndex = buf.DecodeUint32() + return nil +} + +// FlowDisableReply defines message 'flow_disable_reply'. +// InProgress: the message form may change in the future versions +type FlowDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowDisableReply) Reset() { *m = FlowDisableReply{} } +func (*FlowDisableReply) GetMessageName() string { return "flow_disable_reply" } +func (*FlowDisableReply) GetCrcString() string { return "e8d4e804" } +func (*FlowDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *FlowDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *FlowDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// FlowEnable defines message 'flow_enable'. +// InProgress: the message form may change in the future versions +type FlowEnable struct { + FlowIndex uint32 `binapi:"u32,name=flow_index" json:"flow_index,omitempty"` + HwIfIndex uint32 `binapi:"u32,name=hw_if_index" json:"hw_if_index,omitempty"` +} + +func (m *FlowEnable) Reset() { *m = FlowEnable{} } +func (*FlowEnable) GetMessageName() string { return "flow_enable" } +func (*FlowEnable) GetCrcString() string { return "2024be69" } +func (*FlowEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowEnable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.FlowIndex + size += 4 // m.HwIfIndex + return size +} +func (m *FlowEnable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FlowIndex) + buf.EncodeUint32(m.HwIfIndex) + return buf.Bytes(), nil +} +func (m *FlowEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FlowIndex = buf.DecodeUint32() + m.HwIfIndex = buf.DecodeUint32() + return nil +} + +// FlowEnableReply defines message 'flow_enable_reply'. +// InProgress: the message form may change in the future versions +type FlowEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowEnableReply) Reset() { *m = FlowEnableReply{} } +func (*FlowEnableReply) GetMessageName() string { return "flow_enable_reply" } +func (*FlowEnableReply) GetCrcString() string { return "e8d4e804" } +func (*FlowEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowEnableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *FlowEnableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *FlowEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_flow_binapi_init() } +func file_flow_binapi_init() { + api.RegisterMessage((*FlowAdd)(nil), "flow_add_f946ed84") + api.RegisterMessage((*FlowAddReply)(nil), "flow_add_reply_8587dc85") + api.RegisterMessage((*FlowDel)(nil), "flow_del_b6b9b02c") + api.RegisterMessage((*FlowDelReply)(nil), "flow_del_reply_e8d4e804") + api.RegisterMessage((*FlowDisable)(nil), "flow_disable_2024be69") + api.RegisterMessage((*FlowDisableReply)(nil), "flow_disable_reply_e8d4e804") + api.RegisterMessage((*FlowEnable)(nil), "flow_enable_2024be69") + api.RegisterMessage((*FlowEnableReply)(nil), "flow_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FlowAdd)(nil), + (*FlowAddReply)(nil), + (*FlowDel)(nil), + (*FlowDelReply)(nil), + (*FlowDisable)(nil), + (*FlowDisableReply)(nil), + (*FlowEnable)(nil), + (*FlowEnableReply)(nil), + } +} diff --git a/binapi/flow/flow_rpc.ba.go b/binapi/flow/flow_rpc.ba.go new file mode 100644 index 0000000..96cc83a --- /dev/null +++ b/binapi/flow/flow_rpc.ba.go @@ -0,0 +1,61 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package flow + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service flow. +type RPCService interface { + FlowAdd(ctx context.Context, in *FlowAdd) (*FlowAddReply, error) + FlowDel(ctx context.Context, in *FlowDel) (*FlowDelReply, error) + FlowDisable(ctx context.Context, in *FlowDisable) (*FlowDisableReply, error) + FlowEnable(ctx context.Context, in *FlowEnable) (*FlowEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FlowAdd(ctx context.Context, in *FlowAdd) (*FlowAddReply, error) { + out := new(FlowAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) FlowDel(ctx context.Context, in *FlowDel) (*FlowDelReply, error) { + out := new(FlowDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) FlowDisable(ctx context.Context, in *FlowDisable) (*FlowDisableReply, error) { + out := new(FlowDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) FlowEnable(ctx context.Context, in *FlowEnable) (*FlowEnableReply, error) { + out := new(FlowEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/flow_types/flow_types.ba.go b/binapi/flow_types/flow_types.ba.go new file mode 100644 index 0000000..c425bdc --- /dev/null +++ b/binapi/flow_types/flow_types.ba.go @@ -0,0 +1,753 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/core/flow_types.api.json + +// Package flow_types contains generated bindings for API file flow_types.api. +// +// Contents: +// 2 enums +// 17 structs +// 1 union +// +package flow_types + +import ( + "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "flow_types" + APIVersion = "0.0.3" + VersionCrc = 0xd789ede8 +) + +// FlowAction defines enum 'flow_action'. +type FlowAction uint32 + +const ( + FLOW_ACTION_COUNT FlowAction = 1 + FLOW_ACTION_MARK FlowAction = 2 + FLOW_ACTION_BUFFER_ADVANCE FlowAction = 4 + FLOW_ACTION_REDIRECT_TO_NODE FlowAction = 8 + FLOW_ACTION_REDIRECT_TO_QUEUE FlowAction = 16 + FLOW_ACTION_DROP FlowAction = 64 +) + +var ( + FlowAction_name = map[uint32]string{ + 1: "FLOW_ACTION_COUNT", + 2: "FLOW_ACTION_MARK", + 4: "FLOW_ACTION_BUFFER_ADVANCE", + 8: "FLOW_ACTION_REDIRECT_TO_NODE", + 16: "FLOW_ACTION_REDIRECT_TO_QUEUE", + 64: "FLOW_ACTION_DROP", + } + FlowAction_value = map[string]uint32{ + "FLOW_ACTION_COUNT": 1, + "FLOW_ACTION_MARK": 2, + "FLOW_ACTION_BUFFER_ADVANCE": 4, + "FLOW_ACTION_REDIRECT_TO_NODE": 8, + "FLOW_ACTION_REDIRECT_TO_QUEUE": 16, + "FLOW_ACTION_DROP": 64, + } +) + +func (x FlowAction) String() string { + s, ok := FlowAction_name[uint32(x)] + if ok { + return s + } + return "FlowAction(" + strconv.Itoa(int(x)) + ")" +} + +// FlowType defines enum 'flow_type'. +type FlowType uint32 + +const ( + FLOW_TYPE_ETHERNET FlowType = 1 + FLOW_TYPE_IP4 FlowType = 2 + FLOW_TYPE_IP6 FlowType = 3 + FLOW_TYPE_IP4_L2TPV3OIP FlowType = 4 + FLOW_TYPE_IP4_IPSEC_ESP FlowType = 5 + FLOW_TYPE_IP4_IPSEC_AH FlowType = 6 + FLOW_TYPE_IP4_N_TUPLE FlowType = 7 + FLOW_TYPE_IP6_N_TUPLE FlowType = 8 + FLOW_TYPE_IP4_N_TUPLE_TAGGED FlowType = 9 + FLOW_TYPE_IP6_N_TUPLE_TAGGED FlowType = 10 + FLOW_TYPE_IP4_VXLAN FlowType = 11 + FLOW_TYPE_IP6_VXLAN FlowType = 12 + FLOW_TYPE_IP4_GTPC FlowType = 13 + FLOW_TYPE_IP4_GTPU FlowType = 14 +) + +var ( + FlowType_name = map[uint32]string{ + 1: "FLOW_TYPE_ETHERNET", + 2: "FLOW_TYPE_IP4", + 3: "FLOW_TYPE_IP6", + 4: "FLOW_TYPE_IP4_L2TPV3OIP", + 5: "FLOW_TYPE_IP4_IPSEC_ESP", + 6: "FLOW_TYPE_IP4_IPSEC_AH", + 7: "FLOW_TYPE_IP4_N_TUPLE", + 8: "FLOW_TYPE_IP6_N_TUPLE", + 9: "FLOW_TYPE_IP4_N_TUPLE_TAGGED", + 10: "FLOW_TYPE_IP6_N_TUPLE_TAGGED", + 11: "FLOW_TYPE_IP4_VXLAN", + 12: "FLOW_TYPE_IP6_VXLAN", + 13: "FLOW_TYPE_IP4_GTPC", + 14: "FLOW_TYPE_IP4_GTPU", + } + FlowType_value = map[string]uint32{ + "FLOW_TYPE_ETHERNET": 1, + "FLOW_TYPE_IP4": 2, + "FLOW_TYPE_IP6": 3, + "FLOW_TYPE_IP4_L2TPV3OIP": 4, + "FLOW_TYPE_IP4_IPSEC_ESP": 5, + "FLOW_TYPE_IP4_IPSEC_AH": 6, + "FLOW_TYPE_IP4_N_TUPLE": 7, + "FLOW_TYPE_IP6_N_TUPLE": 8, + "FLOW_TYPE_IP4_N_TUPLE_TAGGED": 9, + "FLOW_TYPE_IP6_N_TUPLE_TAGGED": 10, + "FLOW_TYPE_IP4_VXLAN": 11, + "FLOW_TYPE_IP6_VXLAN": 12, + "FLOW_TYPE_IP4_GTPC": 13, + "FLOW_TYPE_IP4_GTPU": 14, + } +) + +func (x FlowType) String() string { + s, ok := FlowType_name[uint32(x)] + if ok { + return s + } + return "FlowType(" + strconv.Itoa(int(x)) + ")" +} + +// FlowEthernet defines type 'flow_ethernet'. +type FlowEthernet struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ethernet_types.MacAddress `binapi:"mac_address,name=src_addr" json:"src_addr,omitempty"` + DstAddr ethernet_types.MacAddress `binapi:"mac_address,name=dst_addr" json:"dst_addr,omitempty"` + Type uint16 `binapi:"u16,name=type" json:"type,omitempty"` +} + +// FlowIP4 defines type 'flow_ip4'. +type FlowIP4 struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` +} + +// FlowIP4Gtpc defines type 'flow_ip4_gtpc'. +type FlowIP4Gtpc struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` + Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` +} + +// FlowIP4Gtpu defines type 'flow_ip4_gtpu'. +type FlowIP4Gtpu struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` + Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` +} + +// FlowIP4IpsecAh defines type 'flow_ip4_ipsec_ah'. +type FlowIP4IpsecAh struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` +} + +// FlowIP4IpsecEsp defines type 'flow_ip4_ipsec_esp'. +type FlowIP4IpsecEsp struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` +} + +// FlowIP4L2tpv3oip defines type 'flow_ip4_l2tpv3oip'. +type FlowIP4L2tpv3oip struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SessionID uint32 `binapi:"u32,name=session_id" json:"session_id,omitempty"` +} + +// FlowIP4NTuple defines type 'flow_ip4_n_tuple'. +type FlowIP4NTuple struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` +} + +// FlowIP4NTupleTagged defines type 'flow_ip4_n_tuple_tagged'. +type FlowIP4NTupleTagged struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` +} + +// FlowIP4Vxlan defines type 'flow_ip4_vxlan'. +type FlowIP4Vxlan struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP4AddressAndMask `binapi:"ip4_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +// FlowIP6 defines type 'flow_ip6'. +type FlowIP6 struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` +} + +// FlowIP6NTuple defines type 'flow_ip6_n_tuple'. +type FlowIP6NTuple struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` +} + +// FlowIP6NTupleTagged defines type 'flow_ip6_n_tuple_tagged'. +type FlowIP6NTupleTagged struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` +} + +// FlowIP6Vxlan defines type 'flow_ip6_vxlan'. +type FlowIP6Vxlan struct { + Foo int32 `binapi:"i32,name=foo" json:"foo,omitempty"` + SrcAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=src_addr" json:"src_addr,omitempty"` + DstAddr ip_types.IP6AddressAndMask `binapi:"ip6_address_and_mask,name=dst_addr" json:"dst_addr,omitempty"` + Protocol IPProtAndMask `binapi:"ip_prot_and_mask,name=protocol" json:"protocol,omitempty"` + SrcPort IPPortAndMask `binapi:"ip_port_and_mask,name=src_port" json:"src_port,omitempty"` + DstPort IPPortAndMask `binapi:"ip_port_and_mask,name=dst_port" json:"dst_port,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +// FlowRule defines type 'flow_rule'. +type FlowRule struct { + Type FlowType `binapi:"flow_type,name=type" json:"type,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Actions FlowAction `binapi:"flow_action,name=actions" json:"actions,omitempty"` + MarkFlowID uint32 `binapi:"u32,name=mark_flow_id" json:"mark_flow_id,omitempty"` + RedirectNodeIndex uint32 `binapi:"u32,name=redirect_node_index" json:"redirect_node_index,omitempty"` + RedirectDeviceInputNextIndex uint32 `binapi:"u32,name=redirect_device_input_next_index" json:"redirect_device_input_next_index,omitempty"` + RedirectQueue uint32 `binapi:"u32,name=redirect_queue" json:"redirect_queue,omitempty"` + BufferAdvance int32 `binapi:"i32,name=buffer_advance" json:"buffer_advance,omitempty"` + Flow FlowUnion `binapi:"flow,name=flow" json:"flow,omitempty"` +} + +// IPPortAndMask defines type 'ip_port_and_mask'. +type IPPortAndMask struct { + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + Mask uint16 `binapi:"u16,name=mask" json:"mask,omitempty"` +} + +// IPProtAndMask defines type 'ip_prot_and_mask'. +type IPProtAndMask struct { + Prot ip_types.IPProto `binapi:"ip_proto,name=prot" json:"prot,omitempty"` + Mask uint8 `binapi:"u8,name=mask" json:"mask,omitempty"` +} + +// FlowUnion defines union 'flow'. +type FlowUnion struct { + // FlowUnion can be one of: + // - Ethernet *FlowEthernet + // - IP4 *FlowIP4 + // - IP6 *FlowIP6 + // - IP4L2tpv3oip *FlowIP4L2tpv3oip + // - IP4IpsecEsp *FlowIP4IpsecEsp + // - IP4IpsecAh *FlowIP4IpsecAh + // - IP4NTuple *FlowIP4NTuple + // - IP6NTuple *FlowIP6NTuple + // - IP4NTupleTagged *FlowIP4NTupleTagged + // - IP6NTupleTagged *FlowIP6NTupleTagged + // - IP4Vxlan *FlowIP4Vxlan + // - IP6Vxlan *FlowIP6Vxlan + // - IP4Gtpc *FlowIP4Gtpc + // - IP4Gtpu *FlowIP4Gtpu + XXX_UnionData [82]byte +} + +func FlowUnionEthernet(a FlowEthernet) (u FlowUnion) { + u.SetEthernet(a) + return +} +func (u *FlowUnion) SetEthernet(a FlowEthernet) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr[:], 6) + buf.EncodeBytes(a.DstAddr[:], 6) + buf.EncodeUint16(a.Type) +} +func (u *FlowUnion) GetEthernet() (a FlowEthernet) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr[:], buf.DecodeBytes(6)) + copy(a.DstAddr[:], buf.DecodeBytes(6)) + a.Type = buf.DecodeUint16() + return +} + +func FlowUnionIP4(a FlowIP4) (u FlowUnion) { + u.SetIP4(a) + return +} +func (u *FlowUnion) SetIP4(a FlowIP4) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) +} +func (u *FlowUnion) GetIP4() (a FlowIP4) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + return +} + +func FlowUnionIP6(a FlowIP6) (u FlowUnion) { + u.SetIP6(a) + return +} +func (u *FlowUnion) SetIP6(a FlowIP6) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 16) + buf.EncodeBytes(a.SrcAddr.Mask[:], 16) + buf.EncodeBytes(a.DstAddr.Addr[:], 16) + buf.EncodeBytes(a.DstAddr.Mask[:], 16) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) +} +func (u *FlowUnion) GetIP6() (a FlowIP6) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(16)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + return +} + +func FlowUnionIP4L2tpv3oip(a FlowIP4L2tpv3oip) (u FlowUnion) { + u.SetIP4L2tpv3oip(a) + return +} +func (u *FlowUnion) SetIP4L2tpv3oip(a FlowIP4L2tpv3oip) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint32(a.SessionID) +} +func (u *FlowUnion) GetIP4L2tpv3oip() (a FlowIP4L2tpv3oip) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SessionID = buf.DecodeUint32() + return +} + +func FlowUnionIP4IpsecEsp(a FlowIP4IpsecEsp) (u FlowUnion) { + u.SetIP4IpsecEsp(a) + return +} +func (u *FlowUnion) SetIP4IpsecEsp(a FlowIP4IpsecEsp) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint32(a.Spi) +} +func (u *FlowUnion) GetIP4IpsecEsp() (a FlowIP4IpsecEsp) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.Spi = buf.DecodeUint32() + return +} + +func FlowUnionIP4IpsecAh(a FlowIP4IpsecAh) (u FlowUnion) { + u.SetIP4IpsecAh(a) + return +} +func (u *FlowUnion) SetIP4IpsecAh(a FlowIP4IpsecAh) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint32(a.Spi) +} +func (u *FlowUnion) GetIP4IpsecAh() (a FlowIP4IpsecAh) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.Spi = buf.DecodeUint32() + return +} + +func FlowUnionIP4NTuple(a FlowIP4NTuple) (u FlowUnion) { + u.SetIP4NTuple(a) + return +} +func (u *FlowUnion) SetIP4NTuple(a FlowIP4NTuple) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) +} +func (u *FlowUnion) GetIP4NTuple() (a FlowIP4NTuple) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + return +} + +func FlowUnionIP6NTuple(a FlowIP6NTuple) (u FlowUnion) { + u.SetIP6NTuple(a) + return +} +func (u *FlowUnion) SetIP6NTuple(a FlowIP6NTuple) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 16) + buf.EncodeBytes(a.SrcAddr.Mask[:], 16) + buf.EncodeBytes(a.DstAddr.Addr[:], 16) + buf.EncodeBytes(a.DstAddr.Mask[:], 16) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) +} +func (u *FlowUnion) GetIP6NTuple() (a FlowIP6NTuple) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(16)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + return +} + +func FlowUnionIP4NTupleTagged(a FlowIP4NTupleTagged) (u FlowUnion) { + u.SetIP4NTupleTagged(a) + return +} +func (u *FlowUnion) SetIP4NTupleTagged(a FlowIP4NTupleTagged) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) +} +func (u *FlowUnion) GetIP4NTupleTagged() (a FlowIP4NTupleTagged) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + return +} + +func FlowUnionIP6NTupleTagged(a FlowIP6NTupleTagged) (u FlowUnion) { + u.SetIP6NTupleTagged(a) + return +} +func (u *FlowUnion) SetIP6NTupleTagged(a FlowIP6NTupleTagged) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 16) + buf.EncodeBytes(a.SrcAddr.Mask[:], 16) + buf.EncodeBytes(a.DstAddr.Addr[:], 16) + buf.EncodeBytes(a.DstAddr.Mask[:], 16) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) +} +func (u *FlowUnion) GetIP6NTupleTagged() (a FlowIP6NTupleTagged) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(16)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + return +} + +func FlowUnionIP4Vxlan(a FlowIP4Vxlan) (u FlowUnion) { + u.SetIP4Vxlan(a) + return +} +func (u *FlowUnion) SetIP4Vxlan(a FlowIP4Vxlan) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) + buf.EncodeUint32(a.Vni) +} +func (u *FlowUnion) GetIP4Vxlan() (a FlowIP4Vxlan) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + a.Vni = buf.DecodeUint32() + return +} + +func FlowUnionIP6Vxlan(a FlowIP6Vxlan) (u FlowUnion) { + u.SetIP6Vxlan(a) + return +} +func (u *FlowUnion) SetIP6Vxlan(a FlowIP6Vxlan) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 16) + buf.EncodeBytes(a.SrcAddr.Mask[:], 16) + buf.EncodeBytes(a.DstAddr.Addr[:], 16) + buf.EncodeBytes(a.DstAddr.Mask[:], 16) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) + buf.EncodeUint32(a.Vni) +} +func (u *FlowUnion) GetIP6Vxlan() (a FlowIP6Vxlan) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(16)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(16)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + a.Vni = buf.DecodeUint32() + return +} + +func FlowUnionIP4Gtpc(a FlowIP4Gtpc) (u FlowUnion) { + u.SetIP4Gtpc(a) + return +} +func (u *FlowUnion) SetIP4Gtpc(a FlowIP4Gtpc) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) + buf.EncodeUint32(a.Teid) +} +func (u *FlowUnion) GetIP4Gtpc() (a FlowIP4Gtpc) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + a.Teid = buf.DecodeUint32() + return +} + +func FlowUnionIP4Gtpu(a FlowIP4Gtpu) (u FlowUnion) { + u.SetIP4Gtpu(a) + return +} +func (u *FlowUnion) SetIP4Gtpu(a FlowIP4Gtpu) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeInt32(a.Foo) + buf.EncodeBytes(a.SrcAddr.Addr[:], 4) + buf.EncodeBytes(a.SrcAddr.Mask[:], 4) + buf.EncodeBytes(a.DstAddr.Addr[:], 4) + buf.EncodeBytes(a.DstAddr.Mask[:], 4) + buf.EncodeUint8(uint8(a.Protocol.Prot)) + buf.EncodeUint8(a.Protocol.Mask) + buf.EncodeUint16(a.SrcPort.Port) + buf.EncodeUint16(a.SrcPort.Mask) + buf.EncodeUint16(a.DstPort.Port) + buf.EncodeUint16(a.DstPort.Mask) + buf.EncodeUint32(a.Teid) +} +func (u *FlowUnion) GetIP4Gtpu() (a FlowIP4Gtpu) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + a.Foo = buf.DecodeInt32() + copy(a.SrcAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.SrcAddr.Mask[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Addr[:], buf.DecodeBytes(4)) + copy(a.DstAddr.Mask[:], buf.DecodeBytes(4)) + a.Protocol.Prot = ip_types.IPProto(buf.DecodeUint8()) + a.Protocol.Mask = buf.DecodeUint8() + a.SrcPort.Port = buf.DecodeUint16() + a.SrcPort.Mask = buf.DecodeUint16() + a.DstPort.Port = buf.DecodeUint16() + a.DstPort.Mask = buf.DecodeUint16() + a.Teid = buf.DecodeUint32() + return +} diff --git a/binapi/flowprobe/flowprobe.ba.go b/binapi/flowprobe/flowprobe.ba.go index a08f7d0..762882b 100644 --- a/binapi/flowprobe/flowprobe.ba.go +++ b/binapi/flowprobe/flowprobe.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/flowprobe.api.json // Package flowprobe contains generated bindings for API file flowprobe.api. @@ -13,10 +13,11 @@ package flowprobe import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "flowprobe" APIVersion = "1.0.0" - VersionCrc = 0xe904179b + VersionCrc = 0x8da9f1c ) // FlowprobeRecordFlags defines enum 'flowprobe_record_flags'. diff --git a/binapi/flowprobe/flowprobe_rest.ba.go b/binapi/flowprobe/flowprobe_rest.ba.go deleted file mode 100644 index 3de76b9..0000000 --- a/binapi/flowprobe/flowprobe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package flowprobe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/flowprobe_params", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowprobeParams) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.FlowprobeParams(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/flowprobe_tx_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowprobeTxInterfaceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.FlowprobeTxInterfaceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/flowprobe/flowprobe_rpc.ba.go b/binapi/flowprobe/flowprobe_rpc.ba.go index 42c6887..0419178 100644 --- a/binapi/flowprobe/flowprobe_rpc.ba.go +++ b/binapi/flowprobe/flowprobe_rpc.ba.go @@ -4,10 +4,11 @@ package flowprobe import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service flowprobe. +// RPCService defines RPC service flowprobe. type RPCService interface { FlowprobeParams(ctx context.Context, in *FlowprobeParams) (*FlowprobeParamsReply, error) FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) FlowprobeParams(ctx context.Context, in *FlowprobeParams if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) FlowprobeTxInterfaceAddDel(ctx context.Context, in *Flow if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/gbp/gbp.ba.go b/binapi/gbp/gbp.ba.go deleted file mode 100644 index a203527..0000000 --- a/binapi/gbp/gbp.ba.go +++ /dev/null @@ -1,2519 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/gbp.api.json - -// Package gbp contains generated bindings for API file gbp.api. -// -// Contents: -// 1 alias -// 7 enums -// 14 structs -// 48 messages -// -package gbp - -import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" - "strconv" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "gbp" - APIVersion = "2.0.0" - VersionCrc = 0xa084c6b0 -) - -// GbpBridgeDomainFlags defines enum 'gbp_bridge_domain_flags'. -type GbpBridgeDomainFlags uint32 - -const ( - GBP_BD_API_FLAG_NONE GbpBridgeDomainFlags = 0 - GBP_BD_API_FLAG_DO_NOT_LEARN GbpBridgeDomainFlags = 1 - GBP_BD_API_FLAG_UU_FWD_DROP GbpBridgeDomainFlags = 2 - GBP_BD_API_FLAG_MCAST_DROP GbpBridgeDomainFlags = 4 - GBP_BD_API_FLAG_UCAST_ARP GbpBridgeDomainFlags = 8 -) - -var ( - GbpBridgeDomainFlags_name = map[uint32]string{ - 0: "GBP_BD_API_FLAG_NONE", - 1: "GBP_BD_API_FLAG_DO_NOT_LEARN", - 2: "GBP_BD_API_FLAG_UU_FWD_DROP", - 4: "GBP_BD_API_FLAG_MCAST_DROP", - 8: "GBP_BD_API_FLAG_UCAST_ARP", - } - GbpBridgeDomainFlags_value = map[string]uint32{ - "GBP_BD_API_FLAG_NONE": 0, - "GBP_BD_API_FLAG_DO_NOT_LEARN": 1, - "GBP_BD_API_FLAG_UU_FWD_DROP": 2, - "GBP_BD_API_FLAG_MCAST_DROP": 4, - "GBP_BD_API_FLAG_UCAST_ARP": 8, - } -) - -func (x GbpBridgeDomainFlags) String() string { - s, ok := GbpBridgeDomainFlags_name[uint32(x)] - if ok { - return s - } - str := func(n uint32) string { - s, ok := GbpBridgeDomainFlags_name[uint32(n)] - if ok { - return s - } - return "GbpBridgeDomainFlags(" + strconv.Itoa(int(n)) + ")" - } - for i := uint32(0); i <= 32; i++ { - val := uint32(x) - if val&(1<<i) != 0 { - if s != "" { - s += "|" - } - s += str(1 << i) - } - } - if s == "" { - return str(uint32(x)) - } - return s -} - -// GbpEndpointFlags defines enum 'gbp_endpoint_flags'. -type GbpEndpointFlags uint32 - -const ( - GBP_API_ENDPOINT_FLAG_NONE GbpEndpointFlags = 0 - GBP_API_ENDPOINT_FLAG_BOUNCE GbpEndpointFlags = 1 - GBP_API_ENDPOINT_FLAG_REMOTE GbpEndpointFlags = 2 - GBP_API_ENDPOINT_FLAG_LEARNT GbpEndpointFlags = 4 - GBP_API_ENDPOINT_FLAG_EXTERNAL GbpEndpointFlags = 8 -) - -var ( - GbpEndpointFlags_name = map[uint32]string{ - 0: "GBP_API_ENDPOINT_FLAG_NONE", - 1: "GBP_API_ENDPOINT_FLAG_BOUNCE", - 2: "GBP_API_ENDPOINT_FLAG_REMOTE", - 4: "GBP_API_ENDPOINT_FLAG_LEARNT", - 8: "GBP_API_ENDPOINT_FLAG_EXTERNAL", - } - GbpEndpointFlags_value = map[string]uint32{ - "GBP_API_ENDPOINT_FLAG_NONE": 0, - "GBP_API_ENDPOINT_FLAG_BOUNCE": 1, - "GBP_API_ENDPOINT_FLAG_REMOTE": 2, - "GBP_API_ENDPOINT_FLAG_LEARNT": 4, - "GBP_API_ENDPOINT_FLAG_EXTERNAL": 8, - } -) - -func (x GbpEndpointFlags) String() string { - s, ok := GbpEndpointFlags_name[uint32(x)] - if ok { - return s - } - str := func(n uint32) string { - s, ok := GbpEndpointFlags_name[uint32(n)] - if ok { - return s - } - return "GbpEndpointFlags(" + strconv.Itoa(int(n)) + ")" - } - for i := uint32(0); i <= 32; i++ { - val := uint32(x) - if val&(1<<i) != 0 { - if s != "" { - s += "|" - } - s += str(1 << i) - } - } - if s == "" { - return str(uint32(x)) - } - return s -} - -// GbpExtItfFlags defines enum 'gbp_ext_itf_flags'. -type GbpExtItfFlags uint32 - -const ( - GBP_API_EXT_ITF_F_NONE GbpExtItfFlags = 0 - GBP_API_EXT_ITF_F_ANON GbpExtItfFlags = 1 -) - -var ( - GbpExtItfFlags_name = map[uint32]string{ - 0: "GBP_API_EXT_ITF_F_NONE", - 1: "GBP_API_EXT_ITF_F_ANON", - } - GbpExtItfFlags_value = map[string]uint32{ - "GBP_API_EXT_ITF_F_NONE": 0, - "GBP_API_EXT_ITF_F_ANON": 1, - } -) - -func (x GbpExtItfFlags) String() string { - s, ok := GbpExtItfFlags_name[uint32(x)] - if ok { - return s - } - str := func(n uint32) string { - s, ok := GbpExtItfFlags_name[uint32(n)] - if ok { - return s - } - return "GbpExtItfFlags(" + strconv.Itoa(int(n)) + ")" - } - for i := uint32(0); i <= 32; i++ { - val := uint32(x) - if val&(1<<i) != 0 { - if s != "" { - s += "|" - } - s += str(1 << i) - } - } - if s == "" { - return str(uint32(x)) - } - return s -} - -// GbpHashMode defines enum 'gbp_hash_mode'. -type GbpHashMode uint32 - -const ( - GBP_API_HASH_MODE_SRC_IP GbpHashMode = 1 - GBP_API_HASH_MODE_DST_IP GbpHashMode = 2 - GBP_API_HASH_MODE_SYMMETRIC GbpHashMode = 3 -) - -var ( - GbpHashMode_name = map[uint32]string{ - 1: "GBP_API_HASH_MODE_SRC_IP", - 2: "GBP_API_HASH_MODE_DST_IP", - 3: "GBP_API_HASH_MODE_SYMMETRIC", - } - GbpHashMode_value = map[string]uint32{ - "GBP_API_HASH_MODE_SRC_IP": 1, - "GBP_API_HASH_MODE_DST_IP": 2, - "GBP_API_HASH_MODE_SYMMETRIC": 3, - } -) - -func (x GbpHashMode) String() string { - s, ok := GbpHashMode_name[uint32(x)] - if ok { - return s - } - return "GbpHashMode(" + strconv.Itoa(int(x)) + ")" -} - -// GbpRuleAction defines enum 'gbp_rule_action'. -type GbpRuleAction uint32 - -const ( - GBP_API_RULE_PERMIT GbpRuleAction = 1 - GBP_API_RULE_DENY GbpRuleAction = 2 - GBP_API_RULE_REDIRECT GbpRuleAction = 3 -) - -var ( - GbpRuleAction_name = map[uint32]string{ - 1: "GBP_API_RULE_PERMIT", - 2: "GBP_API_RULE_DENY", - 3: "GBP_API_RULE_REDIRECT", - } - GbpRuleAction_value = map[string]uint32{ - "GBP_API_RULE_PERMIT": 1, - "GBP_API_RULE_DENY": 2, - "GBP_API_RULE_REDIRECT": 3, - } -) - -func (x GbpRuleAction) String() string { - s, ok := GbpRuleAction_name[uint32(x)] - if ok { - return s - } - return "GbpRuleAction(" + strconv.Itoa(int(x)) + ")" -} - -// GbpSubnetType defines enum 'gbp_subnet_type'. -type GbpSubnetType uint32 - -const ( - GBP_API_SUBNET_TRANSPORT GbpSubnetType = 1 - GBP_API_SUBNET_STITCHED_INTERNAL GbpSubnetType = 2 - GBP_API_SUBNET_STITCHED_EXTERNAL GbpSubnetType = 3 - GBP_API_SUBNET_L3_OUT GbpSubnetType = 4 - GBP_API_SUBNET_ANON_L3_OUT GbpSubnetType = 5 -) - -var ( - GbpSubnetType_name = map[uint32]string{ - 1: "GBP_API_SUBNET_TRANSPORT", - 2: "GBP_API_SUBNET_STITCHED_INTERNAL", - 3: "GBP_API_SUBNET_STITCHED_EXTERNAL", - 4: "GBP_API_SUBNET_L3_OUT", - 5: "GBP_API_SUBNET_ANON_L3_OUT", - } - GbpSubnetType_value = map[string]uint32{ - "GBP_API_SUBNET_TRANSPORT": 1, - "GBP_API_SUBNET_STITCHED_INTERNAL": 2, - "GBP_API_SUBNET_STITCHED_EXTERNAL": 3, - "GBP_API_SUBNET_L3_OUT": 4, - "GBP_API_SUBNET_ANON_L3_OUT": 5, - } -) - -func (x GbpSubnetType) String() string { - s, ok := GbpSubnetType_name[uint32(x)] - if ok { - return s - } - return "GbpSubnetType(" + strconv.Itoa(int(x)) + ")" -} - -// GbpVxlanTunnelMode defines enum 'gbp_vxlan_tunnel_mode'. -type GbpVxlanTunnelMode uint32 - -const ( - GBP_VXLAN_TUNNEL_MODE_L2 GbpVxlanTunnelMode = 1 - GBP_VXLAN_TUNNEL_MODE_L3 GbpVxlanTunnelMode = 2 -) - -var ( - GbpVxlanTunnelMode_name = map[uint32]string{ - 1: "GBP_VXLAN_TUNNEL_MODE_L2", - 2: "GBP_VXLAN_TUNNEL_MODE_L3", - } - GbpVxlanTunnelMode_value = map[string]uint32{ - "GBP_VXLAN_TUNNEL_MODE_L2": 1, - "GBP_VXLAN_TUNNEL_MODE_L3": 2, - } -) - -func (x GbpVxlanTunnelMode) String() string { - s, ok := GbpVxlanTunnelMode_name[uint32(x)] - if ok { - return s - } - return "GbpVxlanTunnelMode(" + strconv.Itoa(int(x)) + ")" -} - -// GbpScope defines alias 'gbp_scope'. -type GbpScope uint16 - -// GbpBridgeDomain defines type 'gbp_bridge_domain'. -type GbpBridgeDomain struct { - BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` - Flags GbpBridgeDomainFlags `binapi:"gbp_bridge_domain_flags,name=flags" json:"flags,omitempty"` - BviSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bvi_sw_if_index" json:"bvi_sw_if_index,omitempty"` - UuFwdSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=uu_fwd_sw_if_index" json:"uu_fwd_sw_if_index,omitempty"` - BmFloodSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bm_flood_sw_if_index" json:"bm_flood_sw_if_index,omitempty"` -} - -// GbpContract defines type 'gbp_contract'. -type GbpContract struct { - Scope GbpScope `binapi:"gbp_scope,name=scope" json:"scope,omitempty"` - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` - Dclass uint16 `binapi:"u16,name=dclass" json:"dclass,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - NEtherTypes uint8 `binapi:"u8,name=n_ether_types" json:"n_ether_types,omitempty"` - AllowedEthertypes []uint16 `binapi:"u16[16],name=allowed_ethertypes" json:"allowed_ethertypes,omitempty"` - NRules uint8 `binapi:"u8,name=n_rules" json:"-"` - Rules []GbpRule `binapi:"gbp_rule[n_rules],name=rules" json:"rules,omitempty"` -} - -// GbpEndpoint defines type 'gbp_endpoint'. -type GbpEndpoint struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` - Flags GbpEndpointFlags `binapi:"gbp_endpoint_flags,name=flags" json:"flags,omitempty"` - Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` - Tun GbpEndpointTun `binapi:"gbp_endpoint_tun,name=tun" json:"tun,omitempty"` - NIps uint8 `binapi:"u8,name=n_ips" json:"-"` - Ips []ip_types.Address `binapi:"address[n_ips],name=ips" json:"ips,omitempty"` -} - -// GbpEndpointGroup defines type 'gbp_endpoint_group'. -type GbpEndpointGroup struct { - Vnid uint32 `binapi:"u32,name=vnid" json:"vnid,omitempty"` - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` - BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` - UplinkSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=uplink_sw_if_index" json:"uplink_sw_if_index,omitempty"` - Retention GbpEndpointRetention `binapi:"gbp_endpoint_retention,name=retention" json:"retention,omitempty"` -} - -// GbpEndpointRetention defines type 'gbp_endpoint_retention'. -type GbpEndpointRetention struct { - RemoteEpTimeout uint32 `binapi:"u32,name=remote_ep_timeout" json:"remote_ep_timeout,omitempty"` -} - -// GbpEndpointTun defines type 'gbp_endpoint_tun'. -type GbpEndpointTun struct { - Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` - Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` -} - -// GbpExtItf defines type 'gbp_ext_itf'. -type GbpExtItf struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` - Flags GbpExtItfFlags `binapi:"gbp_ext_itf_flags,name=flags" json:"flags,omitempty"` -} - -// GbpNextHop defines type 'gbp_next_hop'. -type GbpNextHop struct { - IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` - Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` - BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` -} - -// GbpNextHopSet defines type 'gbp_next_hop_set'. -type GbpNextHopSet struct { - HashMode GbpHashMode `binapi:"gbp_hash_mode,name=hash_mode" json:"hash_mode,omitempty"` - NNhs uint8 `binapi:"u8,name=n_nhs" json:"n_nhs,omitempty"` - Nhs [8]GbpNextHop `binapi:"gbp_next_hop[8],name=nhs" json:"nhs,omitempty"` -} - -// GbpRecirc defines type 'gbp_recirc'. -type GbpRecirc struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` - IsExt bool `binapi:"bool,name=is_ext" json:"is_ext,omitempty"` -} - -// GbpRouteDomain defines type 'gbp_route_domain'. -type GbpRouteDomain struct { - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` - IP4TableID uint32 `binapi:"u32,name=ip4_table_id" json:"ip4_table_id,omitempty"` - IP6TableID uint32 `binapi:"u32,name=ip6_table_id" json:"ip6_table_id,omitempty"` - IP4UuSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip4_uu_sw_if_index" json:"ip4_uu_sw_if_index,omitempty"` - IP6UuSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip6_uu_sw_if_index" json:"ip6_uu_sw_if_index,omitempty"` - Scope GbpScope `binapi:"gbp_scope,name=scope" json:"scope,omitempty"` -} - -// GbpRule defines type 'gbp_rule'. -type GbpRule struct { - Action GbpRuleAction `binapi:"gbp_rule_action,name=action" json:"action,omitempty"` - NhSet GbpNextHopSet `binapi:"gbp_next_hop_set,name=nh_set" json:"nh_set,omitempty"` -} - -// GbpSubnet defines type 'gbp_subnet'. -type GbpSubnet struct { - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` - Type GbpSubnetType `binapi:"gbp_subnet_type,name=type" json:"type,omitempty"` - Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` -} - -// GbpVxlanTunnel defines type 'gbp_vxlan_tunnel'. -type GbpVxlanTunnel struct { - Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` - Mode GbpVxlanTunnelMode `binapi:"gbp_vxlan_tunnel_mode,name=mode" json:"mode,omitempty"` - BdRdID uint32 `binapi:"u32,name=bd_rd_id" json:"bd_rd_id,omitempty"` - Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` -} - -// GbpBridgeDomainAdd defines message 'gbp_bridge_domain_add'. -type GbpBridgeDomainAdd struct { - Bd GbpBridgeDomain `binapi:"gbp_bridge_domain,name=bd" json:"bd,omitempty"` -} - -func (m *GbpBridgeDomainAdd) Reset() { *m = GbpBridgeDomainAdd{} } -func (*GbpBridgeDomainAdd) GetMessageName() string { return "gbp_bridge_domain_add" } -func (*GbpBridgeDomainAdd) GetCrcString() string { return "8454bfdf" } -func (*GbpBridgeDomainAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpBridgeDomainAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Bd.BdID - size += 4 // m.Bd.RdID - size += 4 // m.Bd.Flags - size += 4 // m.Bd.BviSwIfIndex - size += 4 // m.Bd.UuFwdSwIfIndex - size += 4 // m.Bd.BmFloodSwIfIndex - return size -} -func (m *GbpBridgeDomainAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Bd.BdID) - buf.EncodeUint32(m.Bd.RdID) - buf.EncodeUint32(uint32(m.Bd.Flags)) - buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex)) - buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex)) - buf.EncodeUint32(uint32(m.Bd.BmFloodSwIfIndex)) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Bd.BdID = buf.DecodeUint32() - m.Bd.RdID = buf.DecodeUint32() - m.Bd.Flags = GbpBridgeDomainFlags(buf.DecodeUint32()) - m.Bd.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Bd.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Bd.BmFloodSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// GbpBridgeDomainAddReply defines message 'gbp_bridge_domain_add_reply'. -type GbpBridgeDomainAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpBridgeDomainAddReply) Reset() { *m = GbpBridgeDomainAddReply{} } -func (*GbpBridgeDomainAddReply) GetMessageName() string { return "gbp_bridge_domain_add_reply" } -func (*GbpBridgeDomainAddReply) GetCrcString() string { return "e8d4e804" } -func (*GbpBridgeDomainAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpBridgeDomainAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpBridgeDomainAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpBridgeDomainDel defines message 'gbp_bridge_domain_del'. -type GbpBridgeDomainDel struct { - BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` -} - -func (m *GbpBridgeDomainDel) Reset() { *m = GbpBridgeDomainDel{} } -func (*GbpBridgeDomainDel) GetMessageName() string { return "gbp_bridge_domain_del" } -func (*GbpBridgeDomainDel) GetCrcString() string { return "c25fdce6" } -func (*GbpBridgeDomainDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpBridgeDomainDel) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.BdID - return size -} -func (m *GbpBridgeDomainDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.BdID) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.BdID = buf.DecodeUint32() - return nil -} - -// GbpBridgeDomainDelReply defines message 'gbp_bridge_domain_del_reply'. -type GbpBridgeDomainDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpBridgeDomainDelReply) Reset() { *m = GbpBridgeDomainDelReply{} } -func (*GbpBridgeDomainDelReply) GetMessageName() string { return "gbp_bridge_domain_del_reply" } -func (*GbpBridgeDomainDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpBridgeDomainDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpBridgeDomainDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpBridgeDomainDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpBridgeDomainDetails defines message 'gbp_bridge_domain_details'. -type GbpBridgeDomainDetails struct { - Bd GbpBridgeDomain `binapi:"gbp_bridge_domain,name=bd" json:"bd,omitempty"` -} - -func (m *GbpBridgeDomainDetails) Reset() { *m = GbpBridgeDomainDetails{} } -func (*GbpBridgeDomainDetails) GetMessageName() string { return "gbp_bridge_domain_details" } -func (*GbpBridgeDomainDetails) GetCrcString() string { return "2acd15f9" } -func (*GbpBridgeDomainDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpBridgeDomainDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Bd.BdID - size += 4 // m.Bd.RdID - size += 4 // m.Bd.Flags - size += 4 // m.Bd.BviSwIfIndex - size += 4 // m.Bd.UuFwdSwIfIndex - size += 4 // m.Bd.BmFloodSwIfIndex - return size -} -func (m *GbpBridgeDomainDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Bd.BdID) - buf.EncodeUint32(m.Bd.RdID) - buf.EncodeUint32(uint32(m.Bd.Flags)) - buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex)) - buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex)) - buf.EncodeUint32(uint32(m.Bd.BmFloodSwIfIndex)) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Bd.BdID = buf.DecodeUint32() - m.Bd.RdID = buf.DecodeUint32() - m.Bd.Flags = GbpBridgeDomainFlags(buf.DecodeUint32()) - m.Bd.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Bd.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Bd.BmFloodSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// GbpBridgeDomainDump defines message 'gbp_bridge_domain_dump'. -type GbpBridgeDomainDump struct{} - -func (m *GbpBridgeDomainDump) Reset() { *m = GbpBridgeDomainDump{} } -func (*GbpBridgeDomainDump) GetMessageName() string { return "gbp_bridge_domain_dump" } -func (*GbpBridgeDomainDump) GetCrcString() string { return "51077d14" } -func (*GbpBridgeDomainDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpBridgeDomainDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpBridgeDomainDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainDump) Unmarshal(b []byte) error { - return nil -} - -// GbpBridgeDomainDumpReply defines message 'gbp_bridge_domain_dump_reply'. -type GbpBridgeDomainDumpReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpBridgeDomainDumpReply) Reset() { *m = GbpBridgeDomainDumpReply{} } -func (*GbpBridgeDomainDumpReply) GetMessageName() string { return "gbp_bridge_domain_dump_reply" } -func (*GbpBridgeDomainDumpReply) GetCrcString() string { return "e8d4e804" } -func (*GbpBridgeDomainDumpReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpBridgeDomainDumpReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpBridgeDomainDumpReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpBridgeDomainDumpReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpContractAddDel defines message 'gbp_contract_add_del'. -type GbpContractAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Contract GbpContract `binapi:"gbp_contract,name=contract" json:"contract,omitempty"` -} - -func (m *GbpContractAddDel) Reset() { *m = GbpContractAddDel{} } -func (*GbpContractAddDel) GetMessageName() string { return "gbp_contract_add_del" } -func (*GbpContractAddDel) GetCrcString() string { return "553e275b" } -func (*GbpContractAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpContractAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 2 // m.Contract.Scope - size += 2 // m.Contract.Sclass - size += 2 // m.Contract.Dclass - size += 4 // m.Contract.ACLIndex - size += 1 // m.Contract.NEtherTypes - size += 2 * 16 // m.Contract.AllowedEthertypes - size += 1 // m.Contract.NRules - for j2 := 0; j2 < len(m.Contract.Rules); j2++ { - var s2 GbpRule - _ = s2 - if j2 < len(m.Contract.Rules) { - s2 = m.Contract.Rules[j2] - } - size += 4 // s2.Action - size += 4 // s2.NhSet.HashMode - size += 1 // s2.NhSet.NNhs - for j4 := 0; j4 < 8; j4++ { - size += 1 // s2.NhSet.Nhs[j4].IP.Af - size += 1 * 16 // s2.NhSet.Nhs[j4].IP.Un - size += 1 * 6 // s2.NhSet.Nhs[j4].Mac - size += 4 // s2.NhSet.Nhs[j4].BdID - size += 4 // s2.NhSet.Nhs[j4].RdID - } - } - return size -} -func (m *GbpContractAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint16(uint16(m.Contract.Scope)) - buf.EncodeUint16(m.Contract.Sclass) - buf.EncodeUint16(m.Contract.Dclass) - buf.EncodeUint32(m.Contract.ACLIndex) - buf.EncodeUint8(m.Contract.NEtherTypes) - for i := 0; i < 16; i++ { - var x uint16 - if i < len(m.Contract.AllowedEthertypes) { - x = uint16(m.Contract.AllowedEthertypes[i]) - } - buf.EncodeUint16(x) - } - buf.EncodeUint8(uint8(len(m.Contract.Rules))) - for j1 := 0; j1 < len(m.Contract.Rules); j1++ { - var v1 GbpRule // Rules - if j1 < len(m.Contract.Rules) { - v1 = m.Contract.Rules[j1] - } - buf.EncodeUint32(uint32(v1.Action)) - buf.EncodeUint32(uint32(v1.NhSet.HashMode)) - buf.EncodeUint8(v1.NhSet.NNhs) - for j3 := 0; j3 < 8; j3++ { - buf.EncodeUint8(uint8(v1.NhSet.Nhs[j3].IP.Af)) - buf.EncodeBytes(v1.NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], 16) - buf.EncodeBytes(v1.NhSet.Nhs[j3].Mac[:], 6) - buf.EncodeUint32(v1.NhSet.Nhs[j3].BdID) - buf.EncodeUint32(v1.NhSet.Nhs[j3].RdID) - } - } - return buf.Bytes(), nil -} -func (m *GbpContractAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Contract.Scope = GbpScope(buf.DecodeUint16()) - m.Contract.Sclass = buf.DecodeUint16() - m.Contract.Dclass = buf.DecodeUint16() - m.Contract.ACLIndex = buf.DecodeUint32() - m.Contract.NEtherTypes = buf.DecodeUint8() - m.Contract.AllowedEthertypes = make([]uint16, 16) - for i := 0; i < len(m.Contract.AllowedEthertypes); i++ { - m.Contract.AllowedEthertypes[i] = buf.DecodeUint16() - } - m.Contract.NRules = buf.DecodeUint8() - m.Contract.Rules = make([]GbpRule, m.Contract.NRules) - for j1 := 0; j1 < len(m.Contract.Rules); j1++ { - m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32()) - m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32()) - m.Contract.Rules[j1].NhSet.NNhs = buf.DecodeUint8() - for j3 := 0; j3 < 8; j3++ { - m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - copy(m.Contract.Rules[j1].NhSet.Nhs[j3].Mac[:], buf.DecodeBytes(6)) - m.Contract.Rules[j1].NhSet.Nhs[j3].BdID = buf.DecodeUint32() - m.Contract.Rules[j1].NhSet.Nhs[j3].RdID = buf.DecodeUint32() - } - } - return nil -} - -// GbpContractAddDelReply defines message 'gbp_contract_add_del_reply'. -type GbpContractAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` -} - -func (m *GbpContractAddDelReply) Reset() { *m = GbpContractAddDelReply{} } -func (*GbpContractAddDelReply) GetMessageName() string { return "gbp_contract_add_del_reply" } -func (*GbpContractAddDelReply) GetCrcString() string { return "1992deab" } -func (*GbpContractAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpContractAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.StatsIndex - return size -} -func (m *GbpContractAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.StatsIndex) - return buf.Bytes(), nil -} -func (m *GbpContractAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.StatsIndex = buf.DecodeUint32() - return nil -} - -// GbpContractDetails defines message 'gbp_contract_details'. -type GbpContractDetails struct { - Contract GbpContract `binapi:"gbp_contract,name=contract" json:"contract,omitempty"` -} - -func (m *GbpContractDetails) Reset() { *m = GbpContractDetails{} } -func (*GbpContractDetails) GetMessageName() string { return "gbp_contract_details" } -func (*GbpContractDetails) GetCrcString() string { return "2a18db6e" } -func (*GbpContractDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpContractDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 2 // m.Contract.Scope - size += 2 // m.Contract.Sclass - size += 2 // m.Contract.Dclass - size += 4 // m.Contract.ACLIndex - size += 1 // m.Contract.NEtherTypes - size += 2 * 16 // m.Contract.AllowedEthertypes - size += 1 // m.Contract.NRules - for j2 := 0; j2 < len(m.Contract.Rules); j2++ { - var s2 GbpRule - _ = s2 - if j2 < len(m.Contract.Rules) { - s2 = m.Contract.Rules[j2] - } - size += 4 // s2.Action - size += 4 // s2.NhSet.HashMode - size += 1 // s2.NhSet.NNhs - for j4 := 0; j4 < 8; j4++ { - size += 1 // s2.NhSet.Nhs[j4].IP.Af - size += 1 * 16 // s2.NhSet.Nhs[j4].IP.Un - size += 1 * 6 // s2.NhSet.Nhs[j4].Mac - size += 4 // s2.NhSet.Nhs[j4].BdID - size += 4 // s2.NhSet.Nhs[j4].RdID - } - } - return size -} -func (m *GbpContractDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint16(uint16(m.Contract.Scope)) - buf.EncodeUint16(m.Contract.Sclass) - buf.EncodeUint16(m.Contract.Dclass) - buf.EncodeUint32(m.Contract.ACLIndex) - buf.EncodeUint8(m.Contract.NEtherTypes) - for i := 0; i < 16; i++ { - var x uint16 - if i < len(m.Contract.AllowedEthertypes) { - x = uint16(m.Contract.AllowedEthertypes[i]) - } - buf.EncodeUint16(x) - } - buf.EncodeUint8(uint8(len(m.Contract.Rules))) - for j1 := 0; j1 < len(m.Contract.Rules); j1++ { - var v1 GbpRule // Rules - if j1 < len(m.Contract.Rules) { - v1 = m.Contract.Rules[j1] - } - buf.EncodeUint32(uint32(v1.Action)) - buf.EncodeUint32(uint32(v1.NhSet.HashMode)) - buf.EncodeUint8(v1.NhSet.NNhs) - for j3 := 0; j3 < 8; j3++ { - buf.EncodeUint8(uint8(v1.NhSet.Nhs[j3].IP.Af)) - buf.EncodeBytes(v1.NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], 16) - buf.EncodeBytes(v1.NhSet.Nhs[j3].Mac[:], 6) - buf.EncodeUint32(v1.NhSet.Nhs[j3].BdID) - buf.EncodeUint32(v1.NhSet.Nhs[j3].RdID) - } - } - return buf.Bytes(), nil -} -func (m *GbpContractDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Contract.Scope = GbpScope(buf.DecodeUint16()) - m.Contract.Sclass = buf.DecodeUint16() - m.Contract.Dclass = buf.DecodeUint16() - m.Contract.ACLIndex = buf.DecodeUint32() - m.Contract.NEtherTypes = buf.DecodeUint8() - m.Contract.AllowedEthertypes = make([]uint16, 16) - for i := 0; i < len(m.Contract.AllowedEthertypes); i++ { - m.Contract.AllowedEthertypes[i] = buf.DecodeUint16() - } - m.Contract.NRules = buf.DecodeUint8() - m.Contract.Rules = make([]GbpRule, m.Contract.NRules) - for j1 := 0; j1 < len(m.Contract.Rules); j1++ { - m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32()) - m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32()) - m.Contract.Rules[j1].NhSet.NNhs = buf.DecodeUint8() - for j3 := 0; j3 < 8; j3++ { - m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - copy(m.Contract.Rules[j1].NhSet.Nhs[j3].Mac[:], buf.DecodeBytes(6)) - m.Contract.Rules[j1].NhSet.Nhs[j3].BdID = buf.DecodeUint32() - m.Contract.Rules[j1].NhSet.Nhs[j3].RdID = buf.DecodeUint32() - } - } - return nil -} - -// GbpContractDump defines message 'gbp_contract_dump'. -type GbpContractDump struct{} - -func (m *GbpContractDump) Reset() { *m = GbpContractDump{} } -func (*GbpContractDump) GetMessageName() string { return "gbp_contract_dump" } -func (*GbpContractDump) GetCrcString() string { return "51077d14" } -func (*GbpContractDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpContractDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpContractDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpContractDump) Unmarshal(b []byte) error { - return nil -} - -// GbpEndpointAdd defines message 'gbp_endpoint_add'. -type GbpEndpointAdd struct { - Endpoint GbpEndpoint `binapi:"gbp_endpoint,name=endpoint" json:"endpoint,omitempty"` -} - -func (m *GbpEndpointAdd) Reset() { *m = GbpEndpointAdd{} } -func (*GbpEndpointAdd) GetMessageName() string { return "gbp_endpoint_add" } -func (*GbpEndpointAdd) GetCrcString() string { return "9ce16d5a" } -func (*GbpEndpointAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Endpoint.SwIfIndex - size += 2 // m.Endpoint.Sclass - size += 4 // m.Endpoint.Flags - size += 1 * 6 // m.Endpoint.Mac - size += 1 // m.Endpoint.Tun.Src.Af - size += 1 * 16 // m.Endpoint.Tun.Src.Un - size += 1 // m.Endpoint.Tun.Dst.Af - size += 1 * 16 // m.Endpoint.Tun.Dst.Un - size += 1 // m.Endpoint.NIps - for j2 := 0; j2 < len(m.Endpoint.Ips); j2++ { - var s2 ip_types.Address - _ = s2 - if j2 < len(m.Endpoint.Ips) { - s2 = m.Endpoint.Ips[j2] - } - size += 1 // s2.Af - size += 1 * 16 // s2.Un - } - return size -} -func (m *GbpEndpointAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex)) - buf.EncodeUint16(m.Endpoint.Sclass) - buf.EncodeUint32(uint32(m.Endpoint.Flags)) - buf.EncodeBytes(m.Endpoint.Mac[:], 6) - buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af)) - buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af)) - buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(len(m.Endpoint.Ips))) - for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { - var v1 ip_types.Address // Ips - if j1 < len(m.Endpoint.Ips) { - v1 = m.Endpoint.Ips[j1] - } - buf.EncodeUint8(uint8(v1.Af)) - buf.EncodeBytes(v1.Un.XXX_UnionData[:], 16) - } - return buf.Bytes(), nil -} -func (m *GbpEndpointAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Endpoint.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Endpoint.Sclass = buf.DecodeUint16() - m.Endpoint.Flags = GbpEndpointFlags(buf.DecodeUint32()) - copy(m.Endpoint.Mac[:], buf.DecodeBytes(6)) - m.Endpoint.Tun.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Endpoint.NIps = buf.DecodeUint8() - m.Endpoint.Ips = make([]ip_types.Address, m.Endpoint.NIps) - for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { - m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16)) - } - return nil -} - -// GbpEndpointAddReply defines message 'gbp_endpoint_add_reply'. -type GbpEndpointAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` -} - -func (m *GbpEndpointAddReply) Reset() { *m = GbpEndpointAddReply{} } -func (*GbpEndpointAddReply) GetMessageName() string { return "gbp_endpoint_add_reply" } -func (*GbpEndpointAddReply) GetCrcString() string { return "1dd3ff3e" } -func (*GbpEndpointAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.Handle - return size -} -func (m *GbpEndpointAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.Handle) - return buf.Bytes(), nil -} -func (m *GbpEndpointAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.Handle = buf.DecodeUint32() - return nil -} - -// GbpEndpointDel defines message 'gbp_endpoint_del'. -type GbpEndpointDel struct { - Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` -} - -func (m *GbpEndpointDel) Reset() { *m = GbpEndpointDel{} } -func (*GbpEndpointDel) GetMessageName() string { return "gbp_endpoint_del" } -func (*GbpEndpointDel) GetCrcString() string { return "b93cd566" } -func (*GbpEndpointDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointDel) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Handle - return size -} -func (m *GbpEndpointDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Handle) - return buf.Bytes(), nil -} -func (m *GbpEndpointDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Handle = buf.DecodeUint32() - return nil -} - -// GbpEndpointDelReply defines message 'gbp_endpoint_del_reply'. -type GbpEndpointDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpEndpointDelReply) Reset() { *m = GbpEndpointDelReply{} } -func (*GbpEndpointDelReply) GetMessageName() string { return "gbp_endpoint_del_reply" } -func (*GbpEndpointDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpEndpointDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpEndpointDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpEndpointDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpEndpointDetails defines message 'gbp_endpoint_details'. -type GbpEndpointDetails struct { - Age float64 `binapi:"f64,name=age" json:"age,omitempty"` - Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` - Endpoint GbpEndpoint `binapi:"gbp_endpoint,name=endpoint" json:"endpoint,omitempty"` -} - -func (m *GbpEndpointDetails) Reset() { *m = GbpEndpointDetails{} } -func (*GbpEndpointDetails) GetMessageName() string { return "gbp_endpoint_details" } -func (*GbpEndpointDetails) GetCrcString() string { return "08aecb60" } -func (*GbpEndpointDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 8 // m.Age - size += 4 // m.Handle - size += 4 // m.Endpoint.SwIfIndex - size += 2 // m.Endpoint.Sclass - size += 4 // m.Endpoint.Flags - size += 1 * 6 // m.Endpoint.Mac - size += 1 // m.Endpoint.Tun.Src.Af - size += 1 * 16 // m.Endpoint.Tun.Src.Un - size += 1 // m.Endpoint.Tun.Dst.Af - size += 1 * 16 // m.Endpoint.Tun.Dst.Un - size += 1 // m.Endpoint.NIps - for j2 := 0; j2 < len(m.Endpoint.Ips); j2++ { - var s2 ip_types.Address - _ = s2 - if j2 < len(m.Endpoint.Ips) { - s2 = m.Endpoint.Ips[j2] - } - size += 1 // s2.Af - size += 1 * 16 // s2.Un - } - return size -} -func (m *GbpEndpointDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeFloat64(m.Age) - buf.EncodeUint32(m.Handle) - buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex)) - buf.EncodeUint16(m.Endpoint.Sclass) - buf.EncodeUint32(uint32(m.Endpoint.Flags)) - buf.EncodeBytes(m.Endpoint.Mac[:], 6) - buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af)) - buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af)) - buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(len(m.Endpoint.Ips))) - for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { - var v1 ip_types.Address // Ips - if j1 < len(m.Endpoint.Ips) { - v1 = m.Endpoint.Ips[j1] - } - buf.EncodeUint8(uint8(v1.Af)) - buf.EncodeBytes(v1.Un.XXX_UnionData[:], 16) - } - return buf.Bytes(), nil -} -func (m *GbpEndpointDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Age = buf.DecodeFloat64() - m.Handle = buf.DecodeUint32() - m.Endpoint.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Endpoint.Sclass = buf.DecodeUint16() - m.Endpoint.Flags = GbpEndpointFlags(buf.DecodeUint32()) - copy(m.Endpoint.Mac[:], buf.DecodeBytes(6)) - m.Endpoint.Tun.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Endpoint.NIps = buf.DecodeUint8() - m.Endpoint.Ips = make([]ip_types.Address, m.Endpoint.NIps) - for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { - m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16)) - } - return nil -} - -// GbpEndpointDump defines message 'gbp_endpoint_dump'. -type GbpEndpointDump struct{} - -func (m *GbpEndpointDump) Reset() { *m = GbpEndpointDump{} } -func (*GbpEndpointDump) GetMessageName() string { return "gbp_endpoint_dump" } -func (*GbpEndpointDump) GetCrcString() string { return "51077d14" } -func (*GbpEndpointDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpEndpointDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpEndpointDump) Unmarshal(b []byte) error { - return nil -} - -// GbpEndpointGroupAdd defines message 'gbp_endpoint_group_add'. -type GbpEndpointGroupAdd struct { - Epg GbpEndpointGroup `binapi:"gbp_endpoint_group,name=epg" json:"epg,omitempty"` -} - -func (m *GbpEndpointGroupAdd) Reset() { *m = GbpEndpointGroupAdd{} } -func (*GbpEndpointGroupAdd) GetMessageName() string { return "gbp_endpoint_group_add" } -func (*GbpEndpointGroupAdd) GetCrcString() string { return "8e0f4054" } -func (*GbpEndpointGroupAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointGroupAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Epg.Vnid - size += 2 // m.Epg.Sclass - size += 4 // m.Epg.BdID - size += 4 // m.Epg.RdID - size += 4 // m.Epg.UplinkSwIfIndex - size += 4 // m.Epg.Retention.RemoteEpTimeout - return size -} -func (m *GbpEndpointGroupAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Epg.Vnid) - buf.EncodeUint16(m.Epg.Sclass) - buf.EncodeUint32(m.Epg.BdID) - buf.EncodeUint32(m.Epg.RdID) - buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex)) - buf.EncodeUint32(m.Epg.Retention.RemoteEpTimeout) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Epg.Vnid = buf.DecodeUint32() - m.Epg.Sclass = buf.DecodeUint16() - m.Epg.BdID = buf.DecodeUint32() - m.Epg.RdID = buf.DecodeUint32() - m.Epg.UplinkSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Epg.Retention.RemoteEpTimeout = buf.DecodeUint32() - return nil -} - -// GbpEndpointGroupAddReply defines message 'gbp_endpoint_group_add_reply'. -type GbpEndpointGroupAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpEndpointGroupAddReply) Reset() { *m = GbpEndpointGroupAddReply{} } -func (*GbpEndpointGroupAddReply) GetMessageName() string { return "gbp_endpoint_group_add_reply" } -func (*GbpEndpointGroupAddReply) GetCrcString() string { return "e8d4e804" } -func (*GbpEndpointGroupAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointGroupAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpEndpointGroupAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpEndpointGroupDel defines message 'gbp_endpoint_group_del'. -type GbpEndpointGroupDel struct { - Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` -} - -func (m *GbpEndpointGroupDel) Reset() { *m = GbpEndpointGroupDel{} } -func (*GbpEndpointGroupDel) GetMessageName() string { return "gbp_endpoint_group_del" } -func (*GbpEndpointGroupDel) GetCrcString() string { return "3436b8b7" } -func (*GbpEndpointGroupDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointGroupDel) Size() (size int) { - if m == nil { - return 0 - } - size += 2 // m.Sclass - return size -} -func (m *GbpEndpointGroupDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint16(m.Sclass) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Sclass = buf.DecodeUint16() - return nil -} - -// GbpEndpointGroupDelReply defines message 'gbp_endpoint_group_del_reply'. -type GbpEndpointGroupDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpEndpointGroupDelReply) Reset() { *m = GbpEndpointGroupDelReply{} } -func (*GbpEndpointGroupDelReply) GetMessageName() string { return "gbp_endpoint_group_del_reply" } -func (*GbpEndpointGroupDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpEndpointGroupDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointGroupDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpEndpointGroupDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpEndpointGroupDetails defines message 'gbp_endpoint_group_details'. -type GbpEndpointGroupDetails struct { - Epg GbpEndpointGroup `binapi:"gbp_endpoint_group,name=epg" json:"epg,omitempty"` -} - -func (m *GbpEndpointGroupDetails) Reset() { *m = GbpEndpointGroupDetails{} } -func (*GbpEndpointGroupDetails) GetMessageName() string { return "gbp_endpoint_group_details" } -func (*GbpEndpointGroupDetails) GetCrcString() string { return "8f38292c" } -func (*GbpEndpointGroupDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpEndpointGroupDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Epg.Vnid - size += 2 // m.Epg.Sclass - size += 4 // m.Epg.BdID - size += 4 // m.Epg.RdID - size += 4 // m.Epg.UplinkSwIfIndex - size += 4 // m.Epg.Retention.RemoteEpTimeout - return size -} -func (m *GbpEndpointGroupDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Epg.Vnid) - buf.EncodeUint16(m.Epg.Sclass) - buf.EncodeUint32(m.Epg.BdID) - buf.EncodeUint32(m.Epg.RdID) - buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex)) - buf.EncodeUint32(m.Epg.Retention.RemoteEpTimeout) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Epg.Vnid = buf.DecodeUint32() - m.Epg.Sclass = buf.DecodeUint16() - m.Epg.BdID = buf.DecodeUint32() - m.Epg.RdID = buf.DecodeUint32() - m.Epg.UplinkSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Epg.Retention.RemoteEpTimeout = buf.DecodeUint32() - return nil -} - -// GbpEndpointGroupDump defines message 'gbp_endpoint_group_dump'. -type GbpEndpointGroupDump struct{} - -func (m *GbpEndpointGroupDump) Reset() { *m = GbpEndpointGroupDump{} } -func (*GbpEndpointGroupDump) GetMessageName() string { return "gbp_endpoint_group_dump" } -func (*GbpEndpointGroupDump) GetCrcString() string { return "51077d14" } -func (*GbpEndpointGroupDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpEndpointGroupDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpEndpointGroupDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpEndpointGroupDump) Unmarshal(b []byte) error { - return nil -} - -// GbpExtItfAddDel defines message 'gbp_ext_itf_add_del'. -type GbpExtItfAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - ExtItf GbpExtItf `binapi:"gbp_ext_itf,name=ext_itf" json:"ext_itf,omitempty"` -} - -func (m *GbpExtItfAddDel) Reset() { *m = GbpExtItfAddDel{} } -func (*GbpExtItfAddDel) GetMessageName() string { return "gbp_ext_itf_add_del" } -func (*GbpExtItfAddDel) GetCrcString() string { return "12ed5700" } -func (*GbpExtItfAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpExtItfAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.ExtItf.SwIfIndex - size += 4 // m.ExtItf.BdID - size += 4 // m.ExtItf.RdID - size += 4 // m.ExtItf.Flags - return size -} -func (m *GbpExtItfAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex)) - buf.EncodeUint32(m.ExtItf.BdID) - buf.EncodeUint32(m.ExtItf.RdID) - buf.EncodeUint32(uint32(m.ExtItf.Flags)) - return buf.Bytes(), nil -} -func (m *GbpExtItfAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.ExtItf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.ExtItf.BdID = buf.DecodeUint32() - m.ExtItf.RdID = buf.DecodeUint32() - m.ExtItf.Flags = GbpExtItfFlags(buf.DecodeUint32()) - return nil -} - -// GbpExtItfAddDelReply defines message 'gbp_ext_itf_add_del_reply'. -type GbpExtItfAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpExtItfAddDelReply) Reset() { *m = GbpExtItfAddDelReply{} } -func (*GbpExtItfAddDelReply) GetMessageName() string { return "gbp_ext_itf_add_del_reply" } -func (*GbpExtItfAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpExtItfAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpExtItfAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpExtItfAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpExtItfAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpExtItfDetails defines message 'gbp_ext_itf_details'. -type GbpExtItfDetails struct { - ExtItf GbpExtItf `binapi:"gbp_ext_itf,name=ext_itf" json:"ext_itf,omitempty"` -} - -func (m *GbpExtItfDetails) Reset() { *m = GbpExtItfDetails{} } -func (*GbpExtItfDetails) GetMessageName() string { return "gbp_ext_itf_details" } -func (*GbpExtItfDetails) GetCrcString() string { return "408a45c0" } -func (*GbpExtItfDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpExtItfDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.ExtItf.SwIfIndex - size += 4 // m.ExtItf.BdID - size += 4 // m.ExtItf.RdID - size += 4 // m.ExtItf.Flags - return size -} -func (m *GbpExtItfDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex)) - buf.EncodeUint32(m.ExtItf.BdID) - buf.EncodeUint32(m.ExtItf.RdID) - buf.EncodeUint32(uint32(m.ExtItf.Flags)) - return buf.Bytes(), nil -} -func (m *GbpExtItfDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.ExtItf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.ExtItf.BdID = buf.DecodeUint32() - m.ExtItf.RdID = buf.DecodeUint32() - m.ExtItf.Flags = GbpExtItfFlags(buf.DecodeUint32()) - return nil -} - -// GbpExtItfDump defines message 'gbp_ext_itf_dump'. -type GbpExtItfDump struct{} - -func (m *GbpExtItfDump) Reset() { *m = GbpExtItfDump{} } -func (*GbpExtItfDump) GetMessageName() string { return "gbp_ext_itf_dump" } -func (*GbpExtItfDump) GetCrcString() string { return "51077d14" } -func (*GbpExtItfDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpExtItfDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpExtItfDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpExtItfDump) Unmarshal(b []byte) error { - return nil -} - -// GbpRecircAddDel defines message 'gbp_recirc_add_del'. -type GbpRecircAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Recirc GbpRecirc `binapi:"gbp_recirc,name=recirc" json:"recirc,omitempty"` -} - -func (m *GbpRecircAddDel) Reset() { *m = GbpRecircAddDel{} } -func (*GbpRecircAddDel) GetMessageName() string { return "gbp_recirc_add_del" } -func (*GbpRecircAddDel) GetCrcString() string { return "718c69c3" } -func (*GbpRecircAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpRecircAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.Recirc.SwIfIndex - size += 2 // m.Recirc.Sclass - size += 1 // m.Recirc.IsExt - return size -} -func (m *GbpRecircAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(uint32(m.Recirc.SwIfIndex)) - buf.EncodeUint16(m.Recirc.Sclass) - buf.EncodeBool(m.Recirc.IsExt) - return buf.Bytes(), nil -} -func (m *GbpRecircAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Recirc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Recirc.Sclass = buf.DecodeUint16() - m.Recirc.IsExt = buf.DecodeBool() - return nil -} - -// GbpRecircAddDelReply defines message 'gbp_recirc_add_del_reply'. -type GbpRecircAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpRecircAddDelReply) Reset() { *m = GbpRecircAddDelReply{} } -func (*GbpRecircAddDelReply) GetMessageName() string { return "gbp_recirc_add_del_reply" } -func (*GbpRecircAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpRecircAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRecircAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpRecircAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpRecircAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpRecircDetails defines message 'gbp_recirc_details'. -type GbpRecircDetails struct { - Recirc GbpRecirc `binapi:"gbp_recirc,name=recirc" json:"recirc,omitempty"` -} - -func (m *GbpRecircDetails) Reset() { *m = GbpRecircDetails{} } -func (*GbpRecircDetails) GetMessageName() string { return "gbp_recirc_details" } -func (*GbpRecircDetails) GetCrcString() string { return "66ecc42e" } -func (*GbpRecircDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRecircDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Recirc.SwIfIndex - size += 2 // m.Recirc.Sclass - size += 1 // m.Recirc.IsExt - return size -} -func (m *GbpRecircDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.Recirc.SwIfIndex)) - buf.EncodeUint16(m.Recirc.Sclass) - buf.EncodeBool(m.Recirc.IsExt) - return buf.Bytes(), nil -} -func (m *GbpRecircDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Recirc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Recirc.Sclass = buf.DecodeUint16() - m.Recirc.IsExt = buf.DecodeBool() - return nil -} - -// GbpRecircDump defines message 'gbp_recirc_dump'. -type GbpRecircDump struct{} - -func (m *GbpRecircDump) Reset() { *m = GbpRecircDump{} } -func (*GbpRecircDump) GetMessageName() string { return "gbp_recirc_dump" } -func (*GbpRecircDump) GetCrcString() string { return "51077d14" } -func (*GbpRecircDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpRecircDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpRecircDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpRecircDump) Unmarshal(b []byte) error { - return nil -} - -// GbpRouteDomainAdd defines message 'gbp_route_domain_add'. -type GbpRouteDomainAdd struct { - Rd GbpRouteDomain `binapi:"gbp_route_domain,name=rd" json:"rd,omitempty"` -} - -func (m *GbpRouteDomainAdd) Reset() { *m = GbpRouteDomainAdd{} } -func (*GbpRouteDomainAdd) GetMessageName() string { return "gbp_route_domain_add" } -func (*GbpRouteDomainAdd) GetCrcString() string { return "2d0afe38" } -func (*GbpRouteDomainAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpRouteDomainAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Rd.RdID - size += 4 // m.Rd.IP4TableID - size += 4 // m.Rd.IP6TableID - size += 4 // m.Rd.IP4UuSwIfIndex - size += 4 // m.Rd.IP6UuSwIfIndex - size += 2 // m.Rd.Scope - return size -} -func (m *GbpRouteDomainAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Rd.RdID) - buf.EncodeUint32(m.Rd.IP4TableID) - buf.EncodeUint32(m.Rd.IP6TableID) - buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex)) - buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex)) - buf.EncodeUint16(uint16(m.Rd.Scope)) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Rd.RdID = buf.DecodeUint32() - m.Rd.IP4TableID = buf.DecodeUint32() - m.Rd.IP6TableID = buf.DecodeUint32() - m.Rd.IP4UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Rd.IP6UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Rd.Scope = GbpScope(buf.DecodeUint16()) - return nil -} - -// GbpRouteDomainAddReply defines message 'gbp_route_domain_add_reply'. -type GbpRouteDomainAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpRouteDomainAddReply) Reset() { *m = GbpRouteDomainAddReply{} } -func (*GbpRouteDomainAddReply) GetMessageName() string { return "gbp_route_domain_add_reply" } -func (*GbpRouteDomainAddReply) GetCrcString() string { return "e8d4e804" } -func (*GbpRouteDomainAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRouteDomainAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpRouteDomainAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpRouteDomainDel defines message 'gbp_route_domain_del'. -type GbpRouteDomainDel struct { - RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` -} - -func (m *GbpRouteDomainDel) Reset() { *m = GbpRouteDomainDel{} } -func (*GbpRouteDomainDel) GetMessageName() string { return "gbp_route_domain_del" } -func (*GbpRouteDomainDel) GetCrcString() string { return "bee4edcd" } -func (*GbpRouteDomainDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpRouteDomainDel) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.RdID - return size -} -func (m *GbpRouteDomainDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.RdID) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.RdID = buf.DecodeUint32() - return nil -} - -// GbpRouteDomainDelReply defines message 'gbp_route_domain_del_reply'. -type GbpRouteDomainDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpRouteDomainDelReply) Reset() { *m = GbpRouteDomainDelReply{} } -func (*GbpRouteDomainDelReply) GetMessageName() string { return "gbp_route_domain_del_reply" } -func (*GbpRouteDomainDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpRouteDomainDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRouteDomainDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpRouteDomainDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpRouteDomainDetails defines message 'gbp_route_domain_details'. -type GbpRouteDomainDetails struct { - Rd GbpRouteDomain `binapi:"gbp_route_domain,name=rd" json:"rd,omitempty"` -} - -func (m *GbpRouteDomainDetails) Reset() { *m = GbpRouteDomainDetails{} } -func (*GbpRouteDomainDetails) GetMessageName() string { return "gbp_route_domain_details" } -func (*GbpRouteDomainDetails) GetCrcString() string { return "8ab11375" } -func (*GbpRouteDomainDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRouteDomainDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Rd.RdID - size += 4 // m.Rd.IP4TableID - size += 4 // m.Rd.IP6TableID - size += 4 // m.Rd.IP4UuSwIfIndex - size += 4 // m.Rd.IP6UuSwIfIndex - size += 2 // m.Rd.Scope - return size -} -func (m *GbpRouteDomainDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Rd.RdID) - buf.EncodeUint32(m.Rd.IP4TableID) - buf.EncodeUint32(m.Rd.IP6TableID) - buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex)) - buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex)) - buf.EncodeUint16(uint16(m.Rd.Scope)) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Rd.RdID = buf.DecodeUint32() - m.Rd.IP4TableID = buf.DecodeUint32() - m.Rd.IP6TableID = buf.DecodeUint32() - m.Rd.IP4UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Rd.IP6UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Rd.Scope = GbpScope(buf.DecodeUint16()) - return nil -} - -// GbpRouteDomainDump defines message 'gbp_route_domain_dump'. -type GbpRouteDomainDump struct{} - -func (m *GbpRouteDomainDump) Reset() { *m = GbpRouteDomainDump{} } -func (*GbpRouteDomainDump) GetMessageName() string { return "gbp_route_domain_dump" } -func (*GbpRouteDomainDump) GetCrcString() string { return "51077d14" } -func (*GbpRouteDomainDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpRouteDomainDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpRouteDomainDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainDump) Unmarshal(b []byte) error { - return nil -} - -// GbpRouteDomainDumpReply defines message 'gbp_route_domain_dump_reply'. -type GbpRouteDomainDumpReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpRouteDomainDumpReply) Reset() { *m = GbpRouteDomainDumpReply{} } -func (*GbpRouteDomainDumpReply) GetMessageName() string { return "gbp_route_domain_dump_reply" } -func (*GbpRouteDomainDumpReply) GetCrcString() string { return "e8d4e804" } -func (*GbpRouteDomainDumpReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpRouteDomainDumpReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpRouteDomainDumpReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpRouteDomainDumpReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpSubnetAddDel defines message 'gbp_subnet_add_del'. -type GbpSubnetAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Subnet GbpSubnet `binapi:"gbp_subnet,name=subnet" json:"subnet,omitempty"` -} - -func (m *GbpSubnetAddDel) Reset() { *m = GbpSubnetAddDel{} } -func (*GbpSubnetAddDel) GetMessageName() string { return "gbp_subnet_add_del" } -func (*GbpSubnetAddDel) GetCrcString() string { return "888aca35" } -func (*GbpSubnetAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpSubnetAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.Subnet.RdID - size += 4 // m.Subnet.SwIfIndex - size += 2 // m.Subnet.Sclass - size += 4 // m.Subnet.Type - size += 1 // m.Subnet.Prefix.Address.Af - size += 1 * 16 // m.Subnet.Prefix.Address.Un - size += 1 // m.Subnet.Prefix.Len - return size -} -func (m *GbpSubnetAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(m.Subnet.RdID) - buf.EncodeUint32(uint32(m.Subnet.SwIfIndex)) - buf.EncodeUint16(m.Subnet.Sclass) - buf.EncodeUint32(uint32(m.Subnet.Type)) - buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af)) - buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(m.Subnet.Prefix.Len) - return buf.Bytes(), nil -} -func (m *GbpSubnetAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Subnet.RdID = buf.DecodeUint32() - m.Subnet.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Subnet.Sclass = buf.DecodeUint16() - m.Subnet.Type = GbpSubnetType(buf.DecodeUint32()) - m.Subnet.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Subnet.Prefix.Len = buf.DecodeUint8() - return nil -} - -// GbpSubnetAddDelReply defines message 'gbp_subnet_add_del_reply'. -type GbpSubnetAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpSubnetAddDelReply) Reset() { *m = GbpSubnetAddDelReply{} } -func (*GbpSubnetAddDelReply) GetMessageName() string { return "gbp_subnet_add_del_reply" } -func (*GbpSubnetAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpSubnetAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpSubnetAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpSubnetAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpSubnetAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpSubnetDetails defines message 'gbp_subnet_details'. -type GbpSubnetDetails struct { - Subnet GbpSubnet `binapi:"gbp_subnet,name=subnet" json:"subnet,omitempty"` -} - -func (m *GbpSubnetDetails) Reset() { *m = GbpSubnetDetails{} } -func (*GbpSubnetDetails) GetMessageName() string { return "gbp_subnet_details" } -func (*GbpSubnetDetails) GetCrcString() string { return "4ed84156" } -func (*GbpSubnetDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpSubnetDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Subnet.RdID - size += 4 // m.Subnet.SwIfIndex - size += 2 // m.Subnet.Sclass - size += 4 // m.Subnet.Type - size += 1 // m.Subnet.Prefix.Address.Af - size += 1 * 16 // m.Subnet.Prefix.Address.Un - size += 1 // m.Subnet.Prefix.Len - return size -} -func (m *GbpSubnetDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Subnet.RdID) - buf.EncodeUint32(uint32(m.Subnet.SwIfIndex)) - buf.EncodeUint16(m.Subnet.Sclass) - buf.EncodeUint32(uint32(m.Subnet.Type)) - buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af)) - buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(m.Subnet.Prefix.Len) - return buf.Bytes(), nil -} -func (m *GbpSubnetDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Subnet.RdID = buf.DecodeUint32() - m.Subnet.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Subnet.Sclass = buf.DecodeUint16() - m.Subnet.Type = GbpSubnetType(buf.DecodeUint32()) - m.Subnet.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Subnet.Prefix.Len = buf.DecodeUint8() - return nil -} - -// GbpSubnetDump defines message 'gbp_subnet_dump'. -type GbpSubnetDump struct{} - -func (m *GbpSubnetDump) Reset() { *m = GbpSubnetDump{} } -func (*GbpSubnetDump) GetMessageName() string { return "gbp_subnet_dump" } -func (*GbpSubnetDump) GetCrcString() string { return "51077d14" } -func (*GbpSubnetDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpSubnetDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpSubnetDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpSubnetDump) Unmarshal(b []byte) error { - return nil -} - -// GbpVxlanTunnelAdd defines message 'gbp_vxlan_tunnel_add'. -type GbpVxlanTunnelAdd struct { - Tunnel GbpVxlanTunnel `binapi:"gbp_vxlan_tunnel,name=tunnel" json:"tunnel,omitempty"` -} - -func (m *GbpVxlanTunnelAdd) Reset() { *m = GbpVxlanTunnelAdd{} } -func (*GbpVxlanTunnelAdd) GetMessageName() string { return "gbp_vxlan_tunnel_add" } -func (*GbpVxlanTunnelAdd) GetCrcString() string { return "3e070b35" } -func (*GbpVxlanTunnelAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpVxlanTunnelAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Tunnel.Vni - size += 4 // m.Tunnel.Mode - size += 4 // m.Tunnel.BdRdID - size += 1 * 4 // m.Tunnel.Src - return size -} -func (m *GbpVxlanTunnelAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Tunnel.Vni) - buf.EncodeUint32(uint32(m.Tunnel.Mode)) - buf.EncodeUint32(m.Tunnel.BdRdID) - buf.EncodeBytes(m.Tunnel.Src[:], 4) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Tunnel.Vni = buf.DecodeUint32() - m.Tunnel.Mode = GbpVxlanTunnelMode(buf.DecodeUint32()) - m.Tunnel.BdRdID = buf.DecodeUint32() - copy(m.Tunnel.Src[:], buf.DecodeBytes(4)) - return nil -} - -// GbpVxlanTunnelAddReply defines message 'gbp_vxlan_tunnel_add_reply'. -type GbpVxlanTunnelAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *GbpVxlanTunnelAddReply) Reset() { *m = GbpVxlanTunnelAddReply{} } -func (*GbpVxlanTunnelAddReply) GetMessageName() string { return "gbp_vxlan_tunnel_add_reply" } -func (*GbpVxlanTunnelAddReply) GetCrcString() string { return "5383d31f" } -func (*GbpVxlanTunnelAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpVxlanTunnelAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.SwIfIndex - return size -} -func (m *GbpVxlanTunnelAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// GbpVxlanTunnelDel defines message 'gbp_vxlan_tunnel_del'. -type GbpVxlanTunnelDel struct { - Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` -} - -func (m *GbpVxlanTunnelDel) Reset() { *m = GbpVxlanTunnelDel{} } -func (*GbpVxlanTunnelDel) GetMessageName() string { return "gbp_vxlan_tunnel_del" } -func (*GbpVxlanTunnelDel) GetCrcString() string { return "8d1f2fe9" } -func (*GbpVxlanTunnelDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpVxlanTunnelDel) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Vni - return size -} -func (m *GbpVxlanTunnelDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Vni) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Vni = buf.DecodeUint32() - return nil -} - -// GbpVxlanTunnelDelReply defines message 'gbp_vxlan_tunnel_del_reply'. -type GbpVxlanTunnelDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *GbpVxlanTunnelDelReply) Reset() { *m = GbpVxlanTunnelDelReply{} } -func (*GbpVxlanTunnelDelReply) GetMessageName() string { return "gbp_vxlan_tunnel_del_reply" } -func (*GbpVxlanTunnelDelReply) GetCrcString() string { return "e8d4e804" } -func (*GbpVxlanTunnelDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpVxlanTunnelDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *GbpVxlanTunnelDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// GbpVxlanTunnelDetails defines message 'gbp_vxlan_tunnel_details'. -type GbpVxlanTunnelDetails struct { - Tunnel GbpVxlanTunnel `binapi:"gbp_vxlan_tunnel,name=tunnel" json:"tunnel,omitempty"` -} - -func (m *GbpVxlanTunnelDetails) Reset() { *m = GbpVxlanTunnelDetails{} } -func (*GbpVxlanTunnelDetails) GetMessageName() string { return "gbp_vxlan_tunnel_details" } -func (*GbpVxlanTunnelDetails) GetCrcString() string { return "65c6c818" } -func (*GbpVxlanTunnelDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GbpVxlanTunnelDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Tunnel.Vni - size += 4 // m.Tunnel.Mode - size += 4 // m.Tunnel.BdRdID - size += 1 * 4 // m.Tunnel.Src - return size -} -func (m *GbpVxlanTunnelDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Tunnel.Vni) - buf.EncodeUint32(uint32(m.Tunnel.Mode)) - buf.EncodeUint32(m.Tunnel.BdRdID) - buf.EncodeBytes(m.Tunnel.Src[:], 4) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Tunnel.Vni = buf.DecodeUint32() - m.Tunnel.Mode = GbpVxlanTunnelMode(buf.DecodeUint32()) - m.Tunnel.BdRdID = buf.DecodeUint32() - copy(m.Tunnel.Src[:], buf.DecodeBytes(4)) - return nil -} - -// GbpVxlanTunnelDump defines message 'gbp_vxlan_tunnel_dump'. -type GbpVxlanTunnelDump struct{} - -func (m *GbpVxlanTunnelDump) Reset() { *m = GbpVxlanTunnelDump{} } -func (*GbpVxlanTunnelDump) GetMessageName() string { return "gbp_vxlan_tunnel_dump" } -func (*GbpVxlanTunnelDump) GetCrcString() string { return "51077d14" } -func (*GbpVxlanTunnelDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GbpVxlanTunnelDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GbpVxlanTunnelDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GbpVxlanTunnelDump) Unmarshal(b []byte) error { - return nil -} - -func init() { file_gbp_binapi_init() } -func file_gbp_binapi_init() { - api.RegisterMessage((*GbpBridgeDomainAdd)(nil), "gbp_bridge_domain_add_8454bfdf") - api.RegisterMessage((*GbpBridgeDomainAddReply)(nil), "gbp_bridge_domain_add_reply_e8d4e804") - api.RegisterMessage((*GbpBridgeDomainDel)(nil), "gbp_bridge_domain_del_c25fdce6") - api.RegisterMessage((*GbpBridgeDomainDelReply)(nil), "gbp_bridge_domain_del_reply_e8d4e804") - api.RegisterMessage((*GbpBridgeDomainDetails)(nil), "gbp_bridge_domain_details_2acd15f9") - api.RegisterMessage((*GbpBridgeDomainDump)(nil), "gbp_bridge_domain_dump_51077d14") - api.RegisterMessage((*GbpBridgeDomainDumpReply)(nil), "gbp_bridge_domain_dump_reply_e8d4e804") - api.RegisterMessage((*GbpContractAddDel)(nil), "gbp_contract_add_del_553e275b") - api.RegisterMessage((*GbpContractAddDelReply)(nil), "gbp_contract_add_del_reply_1992deab") - api.RegisterMessage((*GbpContractDetails)(nil), "gbp_contract_details_2a18db6e") - api.RegisterMessage((*GbpContractDump)(nil), "gbp_contract_dump_51077d14") - api.RegisterMessage((*GbpEndpointAdd)(nil), "gbp_endpoint_add_9ce16d5a") - api.RegisterMessage((*GbpEndpointAddReply)(nil), "gbp_endpoint_add_reply_1dd3ff3e") - api.RegisterMessage((*GbpEndpointDel)(nil), "gbp_endpoint_del_b93cd566") - api.RegisterMessage((*GbpEndpointDelReply)(nil), "gbp_endpoint_del_reply_e8d4e804") - api.RegisterMessage((*GbpEndpointDetails)(nil), "gbp_endpoint_details_08aecb60") - api.RegisterMessage((*GbpEndpointDump)(nil), "gbp_endpoint_dump_51077d14") - api.RegisterMessage((*GbpEndpointGroupAdd)(nil), "gbp_endpoint_group_add_8e0f4054") - api.RegisterMessage((*GbpEndpointGroupAddReply)(nil), "gbp_endpoint_group_add_reply_e8d4e804") - api.RegisterMessage((*GbpEndpointGroupDel)(nil), "gbp_endpoint_group_del_3436b8b7") - api.RegisterMessage((*GbpEndpointGroupDelReply)(nil), "gbp_endpoint_group_del_reply_e8d4e804") - api.RegisterMessage((*GbpEndpointGroupDetails)(nil), "gbp_endpoint_group_details_8f38292c") - api.RegisterMessage((*GbpEndpointGroupDump)(nil), "gbp_endpoint_group_dump_51077d14") - api.RegisterMessage((*GbpExtItfAddDel)(nil), "gbp_ext_itf_add_del_12ed5700") - api.RegisterMessage((*GbpExtItfAddDelReply)(nil), "gbp_ext_itf_add_del_reply_e8d4e804") - api.RegisterMessage((*GbpExtItfDetails)(nil), "gbp_ext_itf_details_408a45c0") - api.RegisterMessage((*GbpExtItfDump)(nil), "gbp_ext_itf_dump_51077d14") - api.RegisterMessage((*GbpRecircAddDel)(nil), "gbp_recirc_add_del_718c69c3") - api.RegisterMessage((*GbpRecircAddDelReply)(nil), "gbp_recirc_add_del_reply_e8d4e804") - api.RegisterMessage((*GbpRecircDetails)(nil), "gbp_recirc_details_66ecc42e") - api.RegisterMessage((*GbpRecircDump)(nil), "gbp_recirc_dump_51077d14") - api.RegisterMessage((*GbpRouteDomainAdd)(nil), "gbp_route_domain_add_2d0afe38") - api.RegisterMessage((*GbpRouteDomainAddReply)(nil), "gbp_route_domain_add_reply_e8d4e804") - api.RegisterMessage((*GbpRouteDomainDel)(nil), "gbp_route_domain_del_bee4edcd") - api.RegisterMessage((*GbpRouteDomainDelReply)(nil), "gbp_route_domain_del_reply_e8d4e804") - api.RegisterMessage((*GbpRouteDomainDetails)(nil), "gbp_route_domain_details_8ab11375") - api.RegisterMessage((*GbpRouteDomainDump)(nil), "gbp_route_domain_dump_51077d14") - api.RegisterMessage((*GbpRouteDomainDumpReply)(nil), "gbp_route_domain_dump_reply_e8d4e804") - api.RegisterMessage((*GbpSubnetAddDel)(nil), "gbp_subnet_add_del_888aca35") - api.RegisterMessage((*GbpSubnetAddDelReply)(nil), "gbp_subnet_add_del_reply_e8d4e804") - api.RegisterMessage((*GbpSubnetDetails)(nil), "gbp_subnet_details_4ed84156") - api.RegisterMessage((*GbpSubnetDump)(nil), "gbp_subnet_dump_51077d14") - api.RegisterMessage((*GbpVxlanTunnelAdd)(nil), "gbp_vxlan_tunnel_add_3e070b35") - api.RegisterMessage((*GbpVxlanTunnelAddReply)(nil), "gbp_vxlan_tunnel_add_reply_5383d31f") - api.RegisterMessage((*GbpVxlanTunnelDel)(nil), "gbp_vxlan_tunnel_del_8d1f2fe9") - api.RegisterMessage((*GbpVxlanTunnelDelReply)(nil), "gbp_vxlan_tunnel_del_reply_e8d4e804") - api.RegisterMessage((*GbpVxlanTunnelDetails)(nil), "gbp_vxlan_tunnel_details_65c6c818") - api.RegisterMessage((*GbpVxlanTunnelDump)(nil), "gbp_vxlan_tunnel_dump_51077d14") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*GbpBridgeDomainAdd)(nil), - (*GbpBridgeDomainAddReply)(nil), - (*GbpBridgeDomainDel)(nil), - (*GbpBridgeDomainDelReply)(nil), - (*GbpBridgeDomainDetails)(nil), - (*GbpBridgeDomainDump)(nil), - (*GbpBridgeDomainDumpReply)(nil), - (*GbpContractAddDel)(nil), - (*GbpContractAddDelReply)(nil), - (*GbpContractDetails)(nil), - (*GbpContractDump)(nil), - (*GbpEndpointAdd)(nil), - (*GbpEndpointAddReply)(nil), - (*GbpEndpointDel)(nil), - (*GbpEndpointDelReply)(nil), - (*GbpEndpointDetails)(nil), - (*GbpEndpointDump)(nil), - (*GbpEndpointGroupAdd)(nil), - (*GbpEndpointGroupAddReply)(nil), - (*GbpEndpointGroupDel)(nil), - (*GbpEndpointGroupDelReply)(nil), - (*GbpEndpointGroupDetails)(nil), - (*GbpEndpointGroupDump)(nil), - (*GbpExtItfAddDel)(nil), - (*GbpExtItfAddDelReply)(nil), - (*GbpExtItfDetails)(nil), - (*GbpExtItfDump)(nil), - (*GbpRecircAddDel)(nil), - (*GbpRecircAddDelReply)(nil), - (*GbpRecircDetails)(nil), - (*GbpRecircDump)(nil), - (*GbpRouteDomainAdd)(nil), - (*GbpRouteDomainAddReply)(nil), - (*GbpRouteDomainDel)(nil), - (*GbpRouteDomainDelReply)(nil), - (*GbpRouteDomainDetails)(nil), - (*GbpRouteDomainDump)(nil), - (*GbpRouteDomainDumpReply)(nil), - (*GbpSubnetAddDel)(nil), - (*GbpSubnetAddDelReply)(nil), - (*GbpSubnetDetails)(nil), - (*GbpSubnetDump)(nil), - (*GbpVxlanTunnelAdd)(nil), - (*GbpVxlanTunnelAddReply)(nil), - (*GbpVxlanTunnelDel)(nil), - (*GbpVxlanTunnelDelReply)(nil), - (*GbpVxlanTunnelDetails)(nil), - (*GbpVxlanTunnelDump)(nil), - } -} diff --git a/binapi/gbp/gbp_rest.ba.go b/binapi/gbp/gbp_rest.ba.go deleted file mode 100644 index 9999a07..0000000 --- a/binapi/gbp/gbp_rest.ba.go +++ /dev/null @@ -1,336 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gbp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gbp_bridge_domain_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpBridgeDomainAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpBridgeDomainAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_bridge_domain_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpBridgeDomainDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpBridgeDomainDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_contract_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpContractAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpContractAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_endpoint_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpEndpointAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_endpoint_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpEndpointDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_endpoint_group_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointGroupAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpEndpointGroupAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_endpoint_group_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointGroupDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpEndpointGroupDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_ext_itf_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpExtItfAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpExtItfAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_recirc_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRecircAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpRecircAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_route_domain_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRouteDomainAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpRouteDomainAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_route_domain_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRouteDomainDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpRouteDomainDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_subnet_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpSubnetAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpSubnetAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_vxlan_tunnel_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpVxlanTunnelAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpVxlanTunnelAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gbp_vxlan_tunnel_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpVxlanTunnelDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GbpVxlanTunnelDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/gbp/gbp_rpc.ba.go b/binapi/gbp/gbp_rpc.ba.go deleted file mode 100644 index d10e224..0000000 --- a/binapi/gbp/gbp_rpc.ba.go +++ /dev/null @@ -1,523 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gbp - -import ( - "context" - "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" - "io" -) - -// RPCService defines RPC service gbp. -type RPCService interface { - GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) - GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) - GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) - GbpContractAddDel(ctx context.Context, in *GbpContractAddDel) (*GbpContractAddDelReply, error) - GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) - GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) (*GbpEndpointAddReply, error) - GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) - GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) - GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpointGroupAdd) (*GbpEndpointGroupAddReply, error) - GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) - GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) - GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel) (*GbpExtItfAddDelReply, error) - GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) - GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel) (*GbpRecircAddDelReply, error) - GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) - GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomainAdd) (*GbpRouteDomainAddReply, error) - GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) - GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) - GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel) (*GbpSubnetAddDelReply, error) - GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) - GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunnelAdd) (*GbpVxlanTunnelAddReply, error) - GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) - GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) { - out := new(GbpBridgeDomainAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) { - out := new(GbpBridgeDomainDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpBridgeDomainDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpBridgeDomainDumpClient interface { - Recv() (*GbpBridgeDomainDetails, error) - api.Stream -} - -type serviceClient_GbpBridgeDomainDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpBridgeDomainDumpClient) Recv() (*GbpBridgeDomainDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpBridgeDomainDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpContractAddDel(ctx context.Context, in *GbpContractAddDel) (*GbpContractAddDelReply, error) { - out := new(GbpContractAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpContractDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpContractDumpClient interface { - Recv() (*GbpContractDetails, error) - api.Stream -} - -type serviceClient_GbpContractDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpContractDumpClient) Recv() (*GbpContractDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpContractDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) (*GbpEndpointAddReply, error) { - out := new(GbpEndpointAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) { - out := new(GbpEndpointDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpEndpointDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpEndpointDumpClient interface { - Recv() (*GbpEndpointDetails, error) - api.Stream -} - -type serviceClient_GbpEndpointDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpEndpointDumpClient) Recv() (*GbpEndpointDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpEndpointDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpointGroupAdd) (*GbpEndpointGroupAddReply, error) { - out := new(GbpEndpointGroupAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) { - out := new(GbpEndpointGroupDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpEndpointGroupDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpEndpointGroupDumpClient interface { - Recv() (*GbpEndpointGroupDetails, error) - api.Stream -} - -type serviceClient_GbpEndpointGroupDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpEndpointGroupDumpClient) Recv() (*GbpEndpointGroupDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpEndpointGroupDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel) (*GbpExtItfAddDelReply, error) { - out := new(GbpExtItfAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpExtItfDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpExtItfDumpClient interface { - Recv() (*GbpExtItfDetails, error) - api.Stream -} - -type serviceClient_GbpExtItfDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpExtItfDumpClient) Recv() (*GbpExtItfDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpExtItfDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel) (*GbpRecircAddDelReply, error) { - out := new(GbpRecircAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpRecircDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpRecircDumpClient interface { - Recv() (*GbpRecircDetails, error) - api.Stream -} - -type serviceClient_GbpRecircDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpRecircDumpClient) Recv() (*GbpRecircDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpRecircDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomainAdd) (*GbpRouteDomainAddReply, error) { - out := new(GbpRouteDomainAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) { - out := new(GbpRouteDomainDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpRouteDomainDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpRouteDomainDumpClient interface { - Recv() (*GbpRouteDomainDetails, error) - api.Stream -} - -type serviceClient_GbpRouteDomainDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpRouteDomainDumpClient) Recv() (*GbpRouteDomainDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpRouteDomainDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel) (*GbpSubnetAddDelReply, error) { - out := new(GbpSubnetAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpSubnetDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpSubnetDumpClient interface { - Recv() (*GbpSubnetDetails, error) - api.Stream -} - -type serviceClient_GbpSubnetDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpSubnetDumpClient) Recv() (*GbpSubnetDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpSubnetDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunnelAdd) (*GbpVxlanTunnelAddReply, error) { - out := new(GbpVxlanTunnelAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) { - out := new(GbpVxlanTunnelDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_GbpVxlanTunnelDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_GbpVxlanTunnelDumpClient interface { - Recv() (*GbpVxlanTunnelDetails, error) - api.Stream -} - -type serviceClient_GbpVxlanTunnelDumpClient struct { - api.Stream -} - -func (c *serviceClient_GbpVxlanTunnelDumpClient) Recv() (*GbpVxlanTunnelDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *GbpVxlanTunnelDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} diff --git a/binapi/gen.go b/binapi/gen.go index aefde2b..ed9eed7 100644 --- a/binapi/gen.go +++ b/binapi/gen.go @@ -18,4 +18,5 @@ package binapi // // go generate ./binapi // -//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=. -gen=rpc,rest +//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=. -gen=rpc +//go:generate binapi-generator -input-file=/usr/share/vpp/api/core/vpe.api.json -output-dir=. -gen=http diff --git a/binapi/geneve/geneve.ba.go b/binapi/geneve/geneve.ba.go index fcd512d..c864308 100644 --- a/binapi/geneve/geneve.ba.go +++ b/binapi/geneve/geneve.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/geneve.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/geneve.api.json // Package geneve contains generated bindings for API file geneve.api. // // Contents: -// 6 messages +// 8 messages // package geneve import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,11 +27,12 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "geneve" - APIVersion = "2.0.0" - VersionCrc = 0x7730c1d3 + APIVersion = "2.1.0" + VersionCrc = 0xe3dbb8a3 ) // GeneveAddDelTunnel defines message 'geneve_add_del_tunnel'. +// Deprecated: the message will be removed in the future versions type GeneveAddDelTunnel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` LocalAddress ip_types.Address `binapi:"address,name=local_address" json:"local_address,omitempty"` @@ -44,7 +45,7 @@ type GeneveAddDelTunnel struct { func (m *GeneveAddDelTunnel) Reset() { *m = GeneveAddDelTunnel{} } func (*GeneveAddDelTunnel) GetMessageName() string { return "geneve_add_del_tunnel" } -func (*GeneveAddDelTunnel) GetCrcString() string { return "976693b5" } +func (*GeneveAddDelTunnel) GetCrcString() string { return "99445831" } func (*GeneveAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -94,6 +95,110 @@ func (m *GeneveAddDelTunnel) Unmarshal(b []byte) error { return nil } +// GeneveAddDelTunnel2 defines message 'geneve_add_del_tunnel2'. +type GeneveAddDelTunnel2 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + LocalAddress ip_types.Address `binapi:"address,name=local_address" json:"local_address,omitempty"` + RemoteAddress ip_types.Address `binapi:"address,name=remote_address" json:"remote_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + L3Mode bool `binapi:"bool,name=l3_mode" json:"l3_mode,omitempty"` +} + +func (m *GeneveAddDelTunnel2) Reset() { *m = GeneveAddDelTunnel2{} } +func (*GeneveAddDelTunnel2) GetMessageName() string { return "geneve_add_del_tunnel2" } +func (*GeneveAddDelTunnel2) GetCrcString() string { return "8c2a9999" } +func (*GeneveAddDelTunnel2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GeneveAddDelTunnel2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.LocalAddress.Af + size += 1 * 16 // m.LocalAddress.Un + size += 1 // m.RemoteAddress.Af + size += 1 * 16 // m.RemoteAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + size += 1 // m.L3Mode + return size +} +func (m *GeneveAddDelTunnel2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.LocalAddress.Af)) + buf.EncodeBytes(m.LocalAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.RemoteAddress.Af)) + buf.EncodeBytes(m.RemoteAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapNextIndex) + buf.EncodeUint32(m.Vni) + buf.EncodeBool(m.L3Mode) + return buf.Bytes(), nil +} +func (m *GeneveAddDelTunnel2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocalAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RemoteAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.RemoteAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + m.L3Mode = buf.DecodeBool() + return nil +} + +// GeneveAddDelTunnel2Reply defines message 'geneve_add_del_tunnel2_reply'. +type GeneveAddDelTunnel2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GeneveAddDelTunnel2Reply) Reset() { *m = GeneveAddDelTunnel2Reply{} } +func (*GeneveAddDelTunnel2Reply) GetMessageName() string { return "geneve_add_del_tunnel2_reply" } +func (*GeneveAddDelTunnel2Reply) GetCrcString() string { return "5383d31f" } +func (*GeneveAddDelTunnel2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GeneveAddDelTunnel2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GeneveAddDelTunnel2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GeneveAddDelTunnel2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // GeneveAddDelTunnelReply defines message 'geneve_add_del_tunnel_reply'. type GeneveAddDelTunnelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -144,7 +249,7 @@ type GeneveTunnelDetails struct { func (m *GeneveTunnelDetails) Reset() { *m = GeneveTunnelDetails{} } func (*GeneveTunnelDetails) GetMessageName() string { return "geneve_tunnel_details" } -func (*GeneveTunnelDetails) GetCrcString() string { return "e27e2748" } +func (*GeneveTunnelDetails) GetCrcString() string { return "6b16eb24" } func (*GeneveTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -305,9 +410,11 @@ func (m *SwInterfaceSetGeneveBypassReply) Unmarshal(b []byte) error { func init() { file_geneve_binapi_init() } func file_geneve_binapi_init() { - api.RegisterMessage((*GeneveAddDelTunnel)(nil), "geneve_add_del_tunnel_976693b5") + api.RegisterMessage((*GeneveAddDelTunnel)(nil), "geneve_add_del_tunnel_99445831") + api.RegisterMessage((*GeneveAddDelTunnel2)(nil), "geneve_add_del_tunnel2_8c2a9999") + api.RegisterMessage((*GeneveAddDelTunnel2Reply)(nil), "geneve_add_del_tunnel2_reply_5383d31f") api.RegisterMessage((*GeneveAddDelTunnelReply)(nil), "geneve_add_del_tunnel_reply_5383d31f") - api.RegisterMessage((*GeneveTunnelDetails)(nil), "geneve_tunnel_details_e27e2748") + api.RegisterMessage((*GeneveTunnelDetails)(nil), "geneve_tunnel_details_6b16eb24") api.RegisterMessage((*GeneveTunnelDump)(nil), "geneve_tunnel_dump_f9e6675e") api.RegisterMessage((*SwInterfaceSetGeneveBypass)(nil), "sw_interface_set_geneve_bypass_65247409") api.RegisterMessage((*SwInterfaceSetGeneveBypassReply)(nil), "sw_interface_set_geneve_bypass_reply_e8d4e804") @@ -317,6 +424,8 @@ func file_geneve_binapi_init() { func AllMessages() []api.Message { return []api.Message{ (*GeneveAddDelTunnel)(nil), + (*GeneveAddDelTunnel2)(nil), + (*GeneveAddDelTunnel2Reply)(nil), (*GeneveAddDelTunnelReply)(nil), (*GeneveTunnelDetails)(nil), (*GeneveTunnelDump)(nil), diff --git a/binapi/geneve/geneve_rest.ba.go b/binapi/geneve/geneve_rest.ba.go deleted file mode 100644 index 4987b1d..0000000 --- a/binapi/geneve/geneve_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package geneve - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/geneve_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(GeneveAddDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GeneveAddDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_geneve_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetGeneveBypass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetGeneveBypass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/geneve/geneve_rpc.ba.go b/binapi/geneve/geneve_rpc.ba.go index df9a6be..62b84b0 100644 --- a/binapi/geneve/geneve_rpc.ba.go +++ b/binapi/geneve/geneve_rpc.ba.go @@ -5,14 +5,16 @@ package geneve import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service geneve. +// RPCService defines RPC service geneve. type RPCService interface { GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDelTunnel) (*GeneveAddDelTunnelReply, error) + GeneveAddDelTunnel2(ctx context.Context, in *GeneveAddDelTunnel2) (*GeneveAddDelTunnel2Reply, error) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) SwInterfaceSetGeneveBypass(ctx context.Context, in *SwInterfaceSetGeneveBypass) (*SwInterfaceSetGeneveBypassReply, error) } @@ -31,7 +33,16 @@ func (c *serviceClient) GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) GeneveAddDelTunnel2(ctx context.Context, in *GeneveAddDelTunnel2) (*GeneveAddDelTunnel2Reply, error) { + out := new(GeneveAddDelTunnel2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) { @@ -43,7 +54,7 @@ func (c *serviceClient) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -66,7 +77,11 @@ func (c *serviceClient_GeneveTunnelDumpClient) Recv() (*GeneveTunnelDetails, err switch m := msg.(type) { case *GeneveTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -79,5 +94,5 @@ func (c *serviceClient) SwInterfaceSetGeneveBypass(ctx context.Context, in *SwIn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/graph/graph.ba.go b/binapi/graph/graph.ba.go new file mode 100644 index 0000000..ba95224 --- /dev/null +++ b/binapi/graph/graph.ba.go @@ -0,0 +1,240 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/graph.api.json + +// Package graph contains generated bindings for API file graph.api. +// +// Contents: +// 1 enum +// 3 messages +// +package graph + +import ( + "strconv" + + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "graph" + APIVersion = "1.0.0" + VersionCrc = 0xa0b3fd1c +) + +// NodeFlag defines enum 'node_flag'. +type NodeFlag uint32 + +const ( + NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH NodeFlag = 1 + NODE_FLAG_IS_OUTPUT NodeFlag = 2 + NODE_FLAG_IS_DROP NodeFlag = 4 + NODE_FLAG_IS_PUNT NodeFlag = 8 + NODE_FLAG_IS_HANDOFF NodeFlag = 16 + NODE_FLAG_TRACE NodeFlag = 32 + NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE NodeFlag = 64 + NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE NodeFlag = 128 + NODE_FLAG_TRACE_SUPPORTED NodeFlag = 256 +) + +var ( + NodeFlag_name = map[uint32]string{ + 1: "NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH", + 2: "NODE_FLAG_IS_OUTPUT", + 4: "NODE_FLAG_IS_DROP", + 8: "NODE_FLAG_IS_PUNT", + 16: "NODE_FLAG_IS_HANDOFF", + 32: "NODE_FLAG_TRACE", + 64: "NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE", + 128: "NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE", + 256: "NODE_FLAG_TRACE_SUPPORTED", + } + NodeFlag_value = map[string]uint32{ + "NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH": 1, + "NODE_FLAG_IS_OUTPUT": 2, + "NODE_FLAG_IS_DROP": 4, + "NODE_FLAG_IS_PUNT": 8, + "NODE_FLAG_IS_HANDOFF": 16, + "NODE_FLAG_TRACE": 32, + "NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE": 64, + "NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE": 128, + "NODE_FLAG_TRACE_SUPPORTED": 256, + } +) + +func (x NodeFlag) String() string { + s, ok := NodeFlag_name[uint32(x)] + if ok { + return s + } + return "NodeFlag(" + strconv.Itoa(int(x)) + ")" +} + +// GraphNodeDetails defines message 'graph_node_details'. +type GraphNodeDetails struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Flags NodeFlag `binapi:"node_flag,name=flags" json:"flags,omitempty"` + NArcs uint32 `binapi:"u32,name=n_arcs" json:"-"` + ArcsOut []uint32 `binapi:"u32[n_arcs],name=arcs_out" json:"arcs_out,omitempty"` +} + +func (m *GraphNodeDetails) Reset() { *m = GraphNodeDetails{} } +func (*GraphNodeDetails) GetMessageName() string { return "graph_node_details" } +func (*GraphNodeDetails) GetCrcString() string { return "ac762018" } +func (*GraphNodeDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GraphNodeDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Index + size += 64 // m.Name + size += 4 // m.Flags + size += 4 // m.NArcs + size += 4 * len(m.ArcsOut) // m.ArcsOut + return size +} +func (m *GraphNodeDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Index) + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeUint32(uint32(len(m.ArcsOut))) + for i := 0; i < len(m.ArcsOut); i++ { + var x uint32 + if i < len(m.ArcsOut) { + x = uint32(m.ArcsOut[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *GraphNodeDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + m.Name = buf.DecodeString(64) + m.Flags = NodeFlag(buf.DecodeUint32()) + m.NArcs = buf.DecodeUint32() + m.ArcsOut = make([]uint32, m.NArcs) + for i := 0; i < len(m.ArcsOut); i++ { + m.ArcsOut[i] = buf.DecodeUint32() + } + return nil +} + +// GraphNodeGet defines message 'graph_node_get'. +type GraphNodeGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Flags NodeFlag `binapi:"node_flag,name=flags" json:"flags,omitempty"` + WantArcs bool `binapi:"bool,name=want_arcs" json:"want_arcs,omitempty"` +} + +func (m *GraphNodeGet) Reset() { *m = GraphNodeGet{} } +func (*GraphNodeGet) GetMessageName() string { return "graph_node_get" } +func (*GraphNodeGet) GetCrcString() string { return "39c8792e" } +func (*GraphNodeGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GraphNodeGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + size += 4 // m.Index + size += 64 // m.Name + size += 4 // m.Flags + size += 1 // m.WantArcs + return size +} +func (m *GraphNodeGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + buf.EncodeUint32(m.Index) + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeBool(m.WantArcs) + return buf.Bytes(), nil +} +func (m *GraphNodeGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + m.Index = buf.DecodeUint32() + m.Name = buf.DecodeString(64) + m.Flags = NodeFlag(buf.DecodeUint32()) + m.WantArcs = buf.DecodeBool() + return nil +} + +// GraphNodeGetReply defines message 'graph_node_get_reply'. +type GraphNodeGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *GraphNodeGetReply) Reset() { *m = GraphNodeGetReply{} } +func (*GraphNodeGetReply) GetMessageName() string { return "graph_node_get_reply" } +func (*GraphNodeGetReply) GetCrcString() string { return "53b48f5d" } +func (*GraphNodeGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GraphNodeGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *GraphNodeGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *GraphNodeGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +func init() { file_graph_binapi_init() } +func file_graph_binapi_init() { + api.RegisterMessage((*GraphNodeDetails)(nil), "graph_node_details_ac762018") + api.RegisterMessage((*GraphNodeGet)(nil), "graph_node_get_39c8792e") + api.RegisterMessage((*GraphNodeGetReply)(nil), "graph_node_get_reply_53b48f5d") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GraphNodeDetails)(nil), + (*GraphNodeGet)(nil), + (*GraphNodeGetReply)(nil), + } +} diff --git a/binapi/graph/graph_rpc.ba.go b/binapi/graph/graph_rpc.ba.go new file mode 100644 index 0000000..96a2202 --- /dev/null +++ b/binapi/graph/graph_rpc.ba.go @@ -0,0 +1,64 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package graph + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service graph. +type RPCService interface { + GraphNodeGet(ctx context.Context, in *GraphNodeGet) (RPCService_GraphNodeGetClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GraphNodeGet(ctx context.Context, in *GraphNodeGet) (RPCService_GraphNodeGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GraphNodeGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GraphNodeGetClient interface { + Recv() (*GraphNodeDetails, error) + api.Stream +} + +type serviceClient_GraphNodeGetClient struct { + api.Stream +} + +func (c *serviceClient_GraphNodeGetClient) Recv() (*GraphNodeDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GraphNodeDetails: + return m, nil + case *GraphNodeGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/gre/gre.ba.go b/binapi/gre/gre.ba.go index d14c51e..ee09bad 100644 --- a/binapi/gre/gre.ba.go +++ b/binapi/gre/gre.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/gre.api.json // Package gre contains generated bindings for API file gre.api. @@ -14,12 +14,13 @@ package gre import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + tunnel_types "go.fd.io/govpp/binapi/tunnel_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,8 +31,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "gre" - APIVersion = "2.1.0" - VersionCrc = 0xb9021569 + APIVersion = "2.1.1" + VersionCrc = 0x98b44dd1 ) // GreTunnelType defines enum 'gre_tunnel_type'. @@ -85,7 +86,7 @@ type GreTunnelAddDel struct { func (m *GreTunnelAddDel) Reset() { *m = GreTunnelAddDel{} } func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" } -func (*GreTunnelAddDel) GetCrcString() string { return "6efc9c22" } +func (*GreTunnelAddDel) GetCrcString() string { return "a27d7f17" } func (*GreTunnelAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -188,7 +189,7 @@ type GreTunnelDetails struct { func (m *GreTunnelDetails) Reset() { *m = GreTunnelDetails{} } func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" } -func (*GreTunnelDetails) GetCrcString() string { return "003bfbf1" } +func (*GreTunnelDetails) GetCrcString() string { return "24435433" } func (*GreTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -279,9 +280,9 @@ func (m *GreTunnelDump) Unmarshal(b []byte) error { func init() { file_gre_binapi_init() } func file_gre_binapi_init() { - api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_6efc9c22") + api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_a27d7f17") api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f") - api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_003bfbf1") + api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_24435433") api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e") } diff --git a/binapi/gre/gre_rest.ba.go b/binapi/gre/gre_rest.ba.go deleted file mode 100644 index d344aa8..0000000 --- a/binapi/gre/gre_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gre - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gre_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GreTunnelAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GreTunnelAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/gre/gre_rpc.ba.go b/binapi/gre/gre_rpc.ba.go index f664fb3..8c11524 100644 --- a/binapi/gre/gre_rpc.ba.go +++ b/binapi/gre/gre_rpc.ba.go @@ -5,12 +5,13 @@ package gre import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service gre. +// RPCService defines RPC service gre. type RPCService interface { GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) @@ -30,7 +31,7 @@ func (c *serviceClient) GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) { @@ -42,7 +43,7 @@ func (c *serviceClient) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -65,7 +66,11 @@ func (c *serviceClient_GreTunnelDumpClient) Recv() (*GreTunnelDetails, error) { switch m := msg.(type) { case *GreTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/gso/gso.ba.go b/binapi/gso/gso.ba.go index 78e7536..7627e65 100644 --- a/binapi/gso/gso.ba.go +++ b/binapi/gso/gso.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/gso.api.json // Package gso contains generated bindings for API file gso.api. @@ -12,9 +12,9 @@ package gso import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "gso" APIVersion = "1.0.0" - VersionCrc = 0x2ec8641f + VersionCrc = 0x81a73026 ) // FeatureGsoEnableDisable defines message 'feature_gso_enable_disable'. diff --git a/binapi/gso/gso_rest.ba.go b/binapi/gso/gso_rest.ba.go deleted file mode 100644 index d04c3bd..0000000 --- a/binapi/gso/gso_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gso - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/feature_gso_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(FeatureGsoEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.FeatureGsoEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/gso/gso_rpc.ba.go b/binapi/gso/gso_rpc.ba.go index d955acc..f30f23f 100644 --- a/binapi/gso/gso_rpc.ba.go +++ b/binapi/gso/gso_rpc.ba.go @@ -4,10 +4,11 @@ package gso import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service gso. +// RPCService defines RPC service gso. type RPCService interface { FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) FeatureGsoEnableDisable(ctx context.Context, in *Feature if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/gtpu/gtpu.ba.go b/binapi/gtpu/gtpu.ba.go index 96ae51f..3eefd1a 100644 --- a/binapi/gtpu/gtpu.ba.go +++ b/binapi/gtpu/gtpu.ba.go @@ -1,21 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/gtpu.api.json // Package gtpu contains generated bindings for API file gtpu.api. // // Contents: -// 8 messages +// 10 messages // package gtpu import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,8 +26,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "gtpu" - APIVersion = "2.0.0" - VersionCrc = 0x30326e2d + APIVersion = "2.0.1" + VersionCrc = 0x1462473 ) // GtpuAddDelTunnel defines message 'gtpu_add_del_tunnel'. @@ -39,11 +39,12 @@ type GtpuAddDelTunnel struct { EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` + Tteid uint32 `binapi:"u32,name=tteid" json:"tteid,omitempty"` } func (m *GtpuAddDelTunnel) Reset() { *m = GtpuAddDelTunnel{} } func (*GtpuAddDelTunnel) GetMessageName() string { return "gtpu_add_del_tunnel" } -func (*GtpuAddDelTunnel) GetCrcString() string { return "9a26a51c" } +func (*GtpuAddDelTunnel) GetCrcString() string { return "ca983a2b" } func (*GtpuAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -61,6 +62,7 @@ func (m *GtpuAddDelTunnel) Size() (size int) { size += 4 // m.EncapVrfID size += 4 // m.DecapNextIndex size += 4 // m.Teid + size += 4 // m.Tteid return size } func (m *GtpuAddDelTunnel) Marshal(b []byte) ([]byte, error) { @@ -77,6 +79,7 @@ func (m *GtpuAddDelTunnel) Marshal(b []byte) ([]byte, error) { buf.EncodeUint32(m.EncapVrfID) buf.EncodeUint32(m.DecapNextIndex) buf.EncodeUint32(m.Teid) + buf.EncodeUint32(m.Tteid) return buf.Bytes(), nil } func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error { @@ -90,6 +93,7 @@ func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error { m.EncapVrfID = buf.DecodeUint32() m.DecapNextIndex = buf.DecodeUint32() m.Teid = buf.DecodeUint32() + m.Tteid = buf.DecodeUint32() return nil } @@ -213,11 +217,12 @@ type GtpuTunnelDetails struct { EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` + Tteid uint32 `binapi:"u32,name=tteid" json:"tteid,omitempty"` } func (m *GtpuTunnelDetails) Reset() { *m = GtpuTunnelDetails{} } func (*GtpuTunnelDetails) GetMessageName() string { return "gtpu_tunnel_details" } -func (*GtpuTunnelDetails) GetCrcString() string { return "a4d81a09" } +func (*GtpuTunnelDetails) GetCrcString() string { return "27f434ae" } func (*GtpuTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -235,6 +240,7 @@ func (m *GtpuTunnelDetails) Size() (size int) { size += 4 // m.EncapVrfID size += 4 // m.DecapNextIndex size += 4 // m.Teid + size += 4 // m.Tteid return size } func (m *GtpuTunnelDetails) Marshal(b []byte) ([]byte, error) { @@ -251,6 +257,7 @@ func (m *GtpuTunnelDetails) Marshal(b []byte) ([]byte, error) { buf.EncodeUint32(m.EncapVrfID) buf.EncodeUint32(m.DecapNextIndex) buf.EncodeUint32(m.Teid) + buf.EncodeUint32(m.Tteid) return buf.Bytes(), nil } func (m *GtpuTunnelDetails) Unmarshal(b []byte) error { @@ -264,6 +271,7 @@ func (m *GtpuTunnelDetails) Unmarshal(b []byte) error { m.EncapVrfID = buf.DecodeUint32() m.DecapNextIndex = buf.DecodeUint32() m.Teid = buf.DecodeUint32() + m.Tteid = buf.DecodeUint32() return nil } @@ -300,6 +308,87 @@ func (m *GtpuTunnelDump) Unmarshal(b []byte) error { return nil } +// GtpuTunnelUpdateTteid defines message 'gtpu_tunnel_update_tteid'. +type GtpuTunnelUpdateTteid struct { + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` + Tteid uint32 `binapi:"u32,name=tteid" json:"tteid,omitempty"` +} + +func (m *GtpuTunnelUpdateTteid) Reset() { *m = GtpuTunnelUpdateTteid{} } +func (*GtpuTunnelUpdateTteid) GetMessageName() string { return "gtpu_tunnel_update_tteid" } +func (*GtpuTunnelUpdateTteid) GetCrcString() string { return "79f33816" } +func (*GtpuTunnelUpdateTteid) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GtpuTunnelUpdateTteid) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.EncapVrfID + size += 4 // m.Teid + size += 4 // m.Tteid + return size +} +func (m *GtpuTunnelUpdateTteid) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.Teid) + buf.EncodeUint32(m.Tteid) + return buf.Bytes(), nil +} +func (m *GtpuTunnelUpdateTteid) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.EncapVrfID = buf.DecodeUint32() + m.Teid = buf.DecodeUint32() + m.Tteid = buf.DecodeUint32() + return nil +} + +// GtpuTunnelUpdateTteidReply defines message 'gtpu_tunnel_update_tteid_reply'. +type GtpuTunnelUpdateTteidReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GtpuTunnelUpdateTteidReply) Reset() { *m = GtpuTunnelUpdateTteidReply{} } +func (*GtpuTunnelUpdateTteidReply) GetMessageName() string { return "gtpu_tunnel_update_tteid_reply" } +func (*GtpuTunnelUpdateTteidReply) GetCrcString() string { return "e8d4e804" } +func (*GtpuTunnelUpdateTteidReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GtpuTunnelUpdateTteidReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *GtpuTunnelUpdateTteidReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *GtpuTunnelUpdateTteidReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceSetGtpuBypass defines message 'sw_interface_set_gtpu_bypass'. type SwInterfaceSetGtpuBypass struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -378,12 +467,14 @@ func (m *SwInterfaceSetGtpuBypassReply) Unmarshal(b []byte) error { func init() { file_gtpu_binapi_init() } func file_gtpu_binapi_init() { - api.RegisterMessage((*GtpuAddDelTunnel)(nil), "gtpu_add_del_tunnel_9a26a51c") + api.RegisterMessage((*GtpuAddDelTunnel)(nil), "gtpu_add_del_tunnel_ca983a2b") api.RegisterMessage((*GtpuAddDelTunnelReply)(nil), "gtpu_add_del_tunnel_reply_5383d31f") api.RegisterMessage((*GtpuOffloadRx)(nil), "gtpu_offload_rx_f0b08786") api.RegisterMessage((*GtpuOffloadRxReply)(nil), "gtpu_offload_rx_reply_e8d4e804") - api.RegisterMessage((*GtpuTunnelDetails)(nil), "gtpu_tunnel_details_a4d81a09") + api.RegisterMessage((*GtpuTunnelDetails)(nil), "gtpu_tunnel_details_27f434ae") api.RegisterMessage((*GtpuTunnelDump)(nil), "gtpu_tunnel_dump_f9e6675e") + api.RegisterMessage((*GtpuTunnelUpdateTteid)(nil), "gtpu_tunnel_update_tteid_79f33816") + api.RegisterMessage((*GtpuTunnelUpdateTteidReply)(nil), "gtpu_tunnel_update_tteid_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetGtpuBypass)(nil), "sw_interface_set_gtpu_bypass_65247409") api.RegisterMessage((*SwInterfaceSetGtpuBypassReply)(nil), "sw_interface_set_gtpu_bypass_reply_e8d4e804") } @@ -397,6 +488,8 @@ func AllMessages() []api.Message { (*GtpuOffloadRxReply)(nil), (*GtpuTunnelDetails)(nil), (*GtpuTunnelDump)(nil), + (*GtpuTunnelUpdateTteid)(nil), + (*GtpuTunnelUpdateTteidReply)(nil), (*SwInterfaceSetGtpuBypass)(nil), (*SwInterfaceSetGtpuBypassReply)(nil), } diff --git a/binapi/gtpu/gtpu_rest.ba.go b/binapi/gtpu/gtpu_rest.ba.go deleted file mode 100644 index 6631cd8..0000000 --- a/binapi/gtpu/gtpu_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gtpu - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gtpu_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(GtpuAddDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GtpuAddDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gtpu_offload_rx", func(w http.ResponseWriter, req *http.Request) { - var request = new(GtpuOffloadRx) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GtpuOffloadRx(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_gtpu_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetGtpuBypass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetGtpuBypass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/gtpu/gtpu_rpc.ba.go b/binapi/gtpu/gtpu_rpc.ba.go index fb0bb47..7dcb1f2 100644 --- a/binapi/gtpu/gtpu_rpc.ba.go +++ b/binapi/gtpu/gtpu_rpc.ba.go @@ -5,16 +5,18 @@ package gtpu import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service gtpu. +// RPCService defines RPC service gtpu. type RPCService interface { GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) + GtpuTunnelUpdateTteid(ctx context.Context, in *GtpuTunnelUpdateTteid) (*GtpuTunnelUpdateTteidReply, error) SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error) } @@ -32,7 +34,7 @@ func (c *serviceClient) GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) { @@ -41,7 +43,7 @@ func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) { @@ -53,7 +55,7 @@ func (c *serviceClient) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -76,18 +78,31 @@ func (c *serviceClient_GtpuTunnelDumpClient) Recv() (*GtpuTunnelDetails, error) switch m := msg.(type) { case *GtpuTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) GtpuTunnelUpdateTteid(ctx context.Context, in *GtpuTunnelUpdateTteid) (*GtpuTunnelUpdateTteidReply, error) { + out := new(GtpuTunnelUpdateTteidReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error) { out := new(SwInterfaceSetGtpuBypassReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/http_static/http_static.ba.go b/binapi/http_static/http_static.ba.go index 2116a8b..1d1701e 100644 --- a/binapi/http_static/http_static.ba.go +++ b/binapi/http_static/http_static.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/http_static.api.json // Package http_static contains generated bindings for API file http_static.api. @@ -12,8 +12,8 @@ package http_static import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/http_static/http_static_rest.ba.go b/binapi/http_static/http_static_rest.ba.go deleted file mode 100644 index f488f5a..0000000 --- a/binapi/http_static/http_static_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package http_static - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/http_static_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(HTTPStaticEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.HTTPStaticEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/http_static/http_static_rpc.ba.go b/binapi/http_static/http_static_rpc.ba.go index 415313d..01f44ea 100644 --- a/binapi/http_static/http_static_rpc.ba.go +++ b/binapi/http_static/http_static_rpc.ba.go @@ -4,10 +4,11 @@ package http_static import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service http_static. +// RPCService defines RPC service http_static. type RPCService interface { HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnable) (*HTTPStaticEnableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/igmp/igmp.ba.go b/binapi/igmp/igmp.ba.go index 5026657..8dc9a3d 100644 --- a/binapi/igmp/igmp.ba.go +++ b/binapi/igmp/igmp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/igmp.api.json // Package igmp contains generated bindings for API file igmp.api. @@ -14,11 +14,12 @@ package igmp import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "igmp" APIVersion = "1.0.0" - VersionCrc = 0x290eccf8 + VersionCrc = 0x95a4ff29 ) // FilterMode defines enum 'filter_mode'. @@ -177,7 +178,7 @@ type IgmpDetails struct { func (m *IgmpDetails) Reset() { *m = IgmpDetails{} } func (*IgmpDetails) GetMessageName() string { return "igmp_details" } -func (*IgmpDetails) GetCrcString() string { return "52f12a89" } +func (*IgmpDetails) GetCrcString() string { return "38f09929" } func (*IgmpDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -326,7 +327,7 @@ type IgmpEvent struct { func (m *IgmpEvent) Reset() { *m = IgmpEvent{} } func (*IgmpEvent) GetMessageName() string { return "igmp_event" } -func (*IgmpEvent) GetCrcString() string { return "d7696eaf" } +func (*IgmpEvent) GetCrcString() string { return "85fe93ec" } func (*IgmpEvent) GetMessageType() api.MessageType { return api.OtherMessage } @@ -368,7 +369,7 @@ type IgmpGroupPrefixDetails struct { func (m *IgmpGroupPrefixDetails) Reset() { *m = IgmpGroupPrefixDetails{} } func (*IgmpGroupPrefixDetails) GetMessageName() string { return "igmp_group_prefix_details" } -func (*IgmpGroupPrefixDetails) GetCrcString() string { return "c3b3c526" } +func (*IgmpGroupPrefixDetails) GetCrcString() string { return "259ccd81" } func (*IgmpGroupPrefixDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -437,7 +438,7 @@ type IgmpGroupPrefixSet struct { func (m *IgmpGroupPrefixSet) Reset() { *m = IgmpGroupPrefixSet{} } func (*IgmpGroupPrefixSet) GetMessageName() string { return "igmp_group_prefix_set" } -func (*IgmpGroupPrefixSet) GetCrcString() string { return "d4f20ac5" } +func (*IgmpGroupPrefixSet) GetCrcString() string { return "5b14a5ce" } func (*IgmpGroupPrefixSet) GetMessageType() api.MessageType { return api.RequestMessage } @@ -512,7 +513,7 @@ type IgmpListen struct { func (m *IgmpListen) Reset() { *m = IgmpListen{} } func (*IgmpListen) GetMessageName() string { return "igmp_listen" } -func (*IgmpListen) GetCrcString() string { return "3f93a51a" } +func (*IgmpListen) GetCrcString() string { return "19a49f1e" } func (*IgmpListen) GetMessageType() api.MessageType { return api.RequestMessage } @@ -825,16 +826,16 @@ func init() { file_igmp_binapi_init() } func file_igmp_binapi_init() { api.RegisterMessage((*IgmpClearInterface)(nil), "igmp_clear_interface_f9e6675e") api.RegisterMessage((*IgmpClearInterfaceReply)(nil), "igmp_clear_interface_reply_e8d4e804") - api.RegisterMessage((*IgmpDetails)(nil), "igmp_details_52f12a89") + api.RegisterMessage((*IgmpDetails)(nil), "igmp_details_38f09929") api.RegisterMessage((*IgmpDump)(nil), "igmp_dump_f9e6675e") api.RegisterMessage((*IgmpEnableDisable)(nil), "igmp_enable_disable_b1edfb96") api.RegisterMessage((*IgmpEnableDisableReply)(nil), "igmp_enable_disable_reply_e8d4e804") - api.RegisterMessage((*IgmpEvent)(nil), "igmp_event_d7696eaf") - api.RegisterMessage((*IgmpGroupPrefixDetails)(nil), "igmp_group_prefix_details_c3b3c526") + api.RegisterMessage((*IgmpEvent)(nil), "igmp_event_85fe93ec") + api.RegisterMessage((*IgmpGroupPrefixDetails)(nil), "igmp_group_prefix_details_259ccd81") api.RegisterMessage((*IgmpGroupPrefixDump)(nil), "igmp_group_prefix_dump_51077d14") - api.RegisterMessage((*IgmpGroupPrefixSet)(nil), "igmp_group_prefix_set_d4f20ac5") + api.RegisterMessage((*IgmpGroupPrefixSet)(nil), "igmp_group_prefix_set_5b14a5ce") api.RegisterMessage((*IgmpGroupPrefixSetReply)(nil), "igmp_group_prefix_set_reply_e8d4e804") - api.RegisterMessage((*IgmpListen)(nil), "igmp_listen_3f93a51a") + api.RegisterMessage((*IgmpListen)(nil), "igmp_listen_19a49f1e") api.RegisterMessage((*IgmpListenReply)(nil), "igmp_listen_reply_e8d4e804") api.RegisterMessage((*IgmpProxyDeviceAddDel)(nil), "igmp_proxy_device_add_del_0b9be9ce") api.RegisterMessage((*IgmpProxyDeviceAddDelInterface)(nil), "igmp_proxy_device_add_del_interface_1a9ec24a") diff --git a/binapi/igmp/igmp_rest.ba.go b/binapi/igmp/igmp_rest.ba.go deleted file mode 100644 index c3869ff..0000000 --- a/binapi/igmp/igmp_rest.ba.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package igmp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/igmp_clear_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpClearInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpClearInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/igmp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/igmp_group_prefix_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpGroupPrefixSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpGroupPrefixSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/igmp_listen", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpListen) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpListen(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/igmp_proxy_device_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpProxyDeviceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpProxyDeviceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/igmp_proxy_device_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpProxyDeviceAddDelInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IgmpProxyDeviceAddDelInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_igmp_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIgmpEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantIgmpEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/igmp/igmp_rpc.ba.go b/binapi/igmp/igmp_rpc.ba.go index b873bda..74c3b41 100644 --- a/binapi/igmp/igmp_rpc.ba.go +++ b/binapi/igmp/igmp_rpc.ba.go @@ -5,12 +5,13 @@ package igmp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service igmp. +// RPCService defines RPC service igmp. type RPCService interface { IgmpClearInterface(ctx context.Context, in *IgmpClearInterface) (*IgmpClearInterfaceReply, error) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) @@ -37,7 +38,7 @@ func (c *serviceClient) IgmpClearInterface(ctx context.Context, in *IgmpClearInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) { @@ -49,7 +50,7 @@ func (c *serviceClient) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -72,7 +73,11 @@ func (c *serviceClient_IgmpDumpClient) Recv() (*IgmpDetails, error) { switch m := msg.(type) { case *IgmpDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -85,7 +90,7 @@ func (c *serviceClient) IgmpEnableDisable(ctx context.Context, in *IgmpEnableDis if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpGroupPrefixDump(ctx context.Context, in *IgmpGroupPrefixDump) (RPCService_IgmpGroupPrefixDumpClient, error) { @@ -97,7 +102,7 @@ func (c *serviceClient) IgmpGroupPrefixDump(ctx context.Context, in *IgmpGroupPr if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -120,7 +125,11 @@ func (c *serviceClient_IgmpGroupPrefixDumpClient) Recv() (*IgmpGroupPrefixDetail switch m := msg.(type) { case *IgmpGroupPrefixDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -133,7 +142,7 @@ func (c *serviceClient) IgmpGroupPrefixSet(ctx context.Context, in *IgmpGroupPre if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpListenReply, error) { @@ -142,7 +151,7 @@ func (c *serviceClient) IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxyDeviceAddDel) (*IgmpProxyDeviceAddDelReply, error) { @@ -151,7 +160,7 @@ func (c *serviceClient) IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxy if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpProxyDeviceAddDelInterface(ctx context.Context, in *IgmpProxyDeviceAddDelInterface) (*IgmpProxyDeviceAddDelInterfaceReply, error) { @@ -160,7 +169,7 @@ func (c *serviceClient) IgmpProxyDeviceAddDelInterface(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) (*WantIgmpEventsReply, error) { @@ -169,5 +178,5 @@ func (c *serviceClient) WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ikev2/ikev2.ba.go b/binapi/ikev2/ikev2.ba.go index 5fc68c3..42e70bb 100644 --- a/binapi/ikev2/ikev2.ba.go +++ b/binapi/ikev2/ikev2.ba.go @@ -1,21 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/ikev2.api.json // Package ikev2 contains generated bindings for API file ikev2.api. // // Contents: -// 36 messages +// 50 messages // package ikev2 import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ikev2_types "go.fd.io/govpp/binapi/ikev2_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,10 +28,195 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ikev2" APIVersion = "1.0.1" - VersionCrc = 0x2ebaa2d8 + VersionCrc = 0x8eb2437c ) +// Ikev2ChildSaDetails defines message 'ikev2_child_sa_details'. +// InProgress: the message form may change in the future versions +type Ikev2ChildSaDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ChildSa ikev2_types.Ikev2ChildSa `binapi:"ikev2_child_sa,name=child_sa" json:"child_sa,omitempty"` +} + +func (m *Ikev2ChildSaDetails) Reset() { *m = Ikev2ChildSaDetails{} } +func (*Ikev2ChildSaDetails) GetMessageName() string { return "ikev2_child_sa_details" } +func (*Ikev2ChildSaDetails) GetCrcString() string { return "ff67741f" } +func (*Ikev2ChildSaDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ChildSaDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.ChildSa.SaIndex + size += 4 // m.ChildSa.ChildSaIndex + size += 4 // m.ChildSa.ISpi + size += 4 // m.ChildSa.RSpi + size += 1 * 64 // m.ChildSa.Keys.SkD + size += 1 // m.ChildSa.Keys.SkDLen + size += 1 * 64 // m.ChildSa.Keys.SkAi + size += 1 // m.ChildSa.Keys.SkAiLen + size += 1 * 64 // m.ChildSa.Keys.SkAr + size += 1 // m.ChildSa.Keys.SkArLen + size += 1 * 64 // m.ChildSa.Keys.SkEi + size += 1 // m.ChildSa.Keys.SkEiLen + size += 1 * 64 // m.ChildSa.Keys.SkEr + size += 1 // m.ChildSa.Keys.SkErLen + size += 1 * 64 // m.ChildSa.Keys.SkPi + size += 1 // m.ChildSa.Keys.SkPiLen + size += 1 * 64 // m.ChildSa.Keys.SkPr + size += 1 // m.ChildSa.Keys.SkPrLen + size += 1 // m.ChildSa.Encryption.TransformType + size += 2 // m.ChildSa.Encryption.TransformID + size += 2 // m.ChildSa.Encryption.KeyLen + size += 2 // m.ChildSa.Encryption.KeyTrunc + size += 2 // m.ChildSa.Encryption.BlockSize + size += 1 // m.ChildSa.Encryption.DhGroup + size += 1 // m.ChildSa.Integrity.TransformType + size += 2 // m.ChildSa.Integrity.TransformID + size += 2 // m.ChildSa.Integrity.KeyLen + size += 2 // m.ChildSa.Integrity.KeyTrunc + size += 2 // m.ChildSa.Integrity.BlockSize + size += 1 // m.ChildSa.Integrity.DhGroup + size += 1 // m.ChildSa.Esn.TransformType + size += 2 // m.ChildSa.Esn.TransformID + size += 2 // m.ChildSa.Esn.KeyLen + size += 2 // m.ChildSa.Esn.KeyTrunc + size += 2 // m.ChildSa.Esn.BlockSize + size += 1 // m.ChildSa.Esn.DhGroup + return size +} +func (m *Ikev2ChildSaDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.ChildSa.SaIndex) + buf.EncodeUint32(m.ChildSa.ChildSaIndex) + buf.EncodeUint32(m.ChildSa.ISpi) + buf.EncodeUint32(m.ChildSa.RSpi) + buf.EncodeBytes(m.ChildSa.Keys.SkD, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkDLen) + buf.EncodeBytes(m.ChildSa.Keys.SkAi, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkAiLen) + buf.EncodeBytes(m.ChildSa.Keys.SkAr, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkArLen) + buf.EncodeBytes(m.ChildSa.Keys.SkEi, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkEiLen) + buf.EncodeBytes(m.ChildSa.Keys.SkEr, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkErLen) + buf.EncodeBytes(m.ChildSa.Keys.SkPi, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkPiLen) + buf.EncodeBytes(m.ChildSa.Keys.SkPr, 64) + buf.EncodeUint8(m.ChildSa.Keys.SkPrLen) + buf.EncodeUint8(m.ChildSa.Encryption.TransformType) + buf.EncodeUint16(m.ChildSa.Encryption.TransformID) + buf.EncodeUint16(m.ChildSa.Encryption.KeyLen) + buf.EncodeUint16(m.ChildSa.Encryption.KeyTrunc) + buf.EncodeUint16(m.ChildSa.Encryption.BlockSize) + buf.EncodeUint8(m.ChildSa.Encryption.DhGroup) + buf.EncodeUint8(m.ChildSa.Integrity.TransformType) + buf.EncodeUint16(m.ChildSa.Integrity.TransformID) + buf.EncodeUint16(m.ChildSa.Integrity.KeyLen) + buf.EncodeUint16(m.ChildSa.Integrity.KeyTrunc) + buf.EncodeUint16(m.ChildSa.Integrity.BlockSize) + buf.EncodeUint8(m.ChildSa.Integrity.DhGroup) + buf.EncodeUint8(m.ChildSa.Esn.TransformType) + buf.EncodeUint16(m.ChildSa.Esn.TransformID) + buf.EncodeUint16(m.ChildSa.Esn.KeyLen) + buf.EncodeUint16(m.ChildSa.Esn.KeyTrunc) + buf.EncodeUint16(m.ChildSa.Esn.BlockSize) + buf.EncodeUint8(m.ChildSa.Esn.DhGroup) + return buf.Bytes(), nil +} +func (m *Ikev2ChildSaDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ChildSa.SaIndex = buf.DecodeUint32() + m.ChildSa.ChildSaIndex = buf.DecodeUint32() + m.ChildSa.ISpi = buf.DecodeUint32() + m.ChildSa.RSpi = buf.DecodeUint32() + m.ChildSa.Keys.SkD = make([]byte, 64) + copy(m.ChildSa.Keys.SkD, buf.DecodeBytes(len(m.ChildSa.Keys.SkD))) + m.ChildSa.Keys.SkDLen = buf.DecodeUint8() + m.ChildSa.Keys.SkAi = make([]byte, 64) + copy(m.ChildSa.Keys.SkAi, buf.DecodeBytes(len(m.ChildSa.Keys.SkAi))) + m.ChildSa.Keys.SkAiLen = buf.DecodeUint8() + m.ChildSa.Keys.SkAr = make([]byte, 64) + copy(m.ChildSa.Keys.SkAr, buf.DecodeBytes(len(m.ChildSa.Keys.SkAr))) + m.ChildSa.Keys.SkArLen = buf.DecodeUint8() + m.ChildSa.Keys.SkEi = make([]byte, 64) + copy(m.ChildSa.Keys.SkEi, buf.DecodeBytes(len(m.ChildSa.Keys.SkEi))) + m.ChildSa.Keys.SkEiLen = buf.DecodeUint8() + m.ChildSa.Keys.SkEr = make([]byte, 64) + copy(m.ChildSa.Keys.SkEr, buf.DecodeBytes(len(m.ChildSa.Keys.SkEr))) + m.ChildSa.Keys.SkErLen = buf.DecodeUint8() + m.ChildSa.Keys.SkPi = make([]byte, 64) + copy(m.ChildSa.Keys.SkPi, buf.DecodeBytes(len(m.ChildSa.Keys.SkPi))) + m.ChildSa.Keys.SkPiLen = buf.DecodeUint8() + m.ChildSa.Keys.SkPr = make([]byte, 64) + copy(m.ChildSa.Keys.SkPr, buf.DecodeBytes(len(m.ChildSa.Keys.SkPr))) + m.ChildSa.Keys.SkPrLen = buf.DecodeUint8() + m.ChildSa.Encryption.TransformType = buf.DecodeUint8() + m.ChildSa.Encryption.TransformID = buf.DecodeUint16() + m.ChildSa.Encryption.KeyLen = buf.DecodeUint16() + m.ChildSa.Encryption.KeyTrunc = buf.DecodeUint16() + m.ChildSa.Encryption.BlockSize = buf.DecodeUint16() + m.ChildSa.Encryption.DhGroup = buf.DecodeUint8() + m.ChildSa.Integrity.TransformType = buf.DecodeUint8() + m.ChildSa.Integrity.TransformID = buf.DecodeUint16() + m.ChildSa.Integrity.KeyLen = buf.DecodeUint16() + m.ChildSa.Integrity.KeyTrunc = buf.DecodeUint16() + m.ChildSa.Integrity.BlockSize = buf.DecodeUint16() + m.ChildSa.Integrity.DhGroup = buf.DecodeUint8() + m.ChildSa.Esn.TransformType = buf.DecodeUint8() + m.ChildSa.Esn.TransformID = buf.DecodeUint16() + m.ChildSa.Esn.KeyLen = buf.DecodeUint16() + m.ChildSa.Esn.KeyTrunc = buf.DecodeUint16() + m.ChildSa.Esn.BlockSize = buf.DecodeUint16() + m.ChildSa.Esn.DhGroup = buf.DecodeUint8() + return nil +} + +// Ikev2ChildSaDump defines message 'ikev2_child_sa_dump'. +// InProgress: the message form may change in the future versions +type Ikev2ChildSaDump struct { + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` +} + +func (m *Ikev2ChildSaDump) Reset() { *m = Ikev2ChildSaDump{} } +func (*Ikev2ChildSaDump) GetMessageName() string { return "ikev2_child_sa_dump" } +func (*Ikev2ChildSaDump) GetCrcString() string { return "01eab609" } +func (*Ikev2ChildSaDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ChildSaDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SaIndex + return size +} +func (m *Ikev2ChildSaDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SaIndex) + return buf.Bytes(), nil +} +func (m *Ikev2ChildSaDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SaIndex = buf.DecodeUint32() + return nil +} + // Ikev2InitiateDelChildSa defines message 'ikev2_initiate_del_child_sa'. +// InProgress: the message form may change in the future versions type Ikev2InitiateDelChildSa struct { Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"` } @@ -64,6 +250,7 @@ func (m *Ikev2InitiateDelChildSa) Unmarshal(b []byte) error { } // Ikev2InitiateDelChildSaReply defines message 'ikev2_initiate_del_child_sa_reply'. +// InProgress: the message form may change in the future versions type Ikev2InitiateDelChildSaReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -99,6 +286,7 @@ func (m *Ikev2InitiateDelChildSaReply) Unmarshal(b []byte) error { } // Ikev2InitiateDelIkeSa defines message 'ikev2_initiate_del_ike_sa'. +// InProgress: the message form may change in the future versions type Ikev2InitiateDelIkeSa struct { Ispi uint64 `binapi:"u64,name=ispi" json:"ispi,omitempty"` } @@ -132,6 +320,7 @@ func (m *Ikev2InitiateDelIkeSa) Unmarshal(b []byte) error { } // Ikev2InitiateDelIkeSaReply defines message 'ikev2_initiate_del_ike_sa_reply'. +// InProgress: the message form may change in the future versions type Ikev2InitiateDelIkeSaReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -165,6 +354,7 @@ func (m *Ikev2InitiateDelIkeSaReply) Unmarshal(b []byte) error { } // Ikev2InitiateRekeyChildSa defines message 'ikev2_initiate_rekey_child_sa'. +// InProgress: the message form may change in the future versions type Ikev2InitiateRekeyChildSa struct { Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"` } @@ -198,6 +388,7 @@ func (m *Ikev2InitiateRekeyChildSa) Unmarshal(b []byte) error { } // Ikev2InitiateRekeyChildSaReply defines message 'ikev2_initiate_rekey_child_sa_reply'. +// InProgress: the message form may change in the future versions type Ikev2InitiateRekeyChildSaReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -233,6 +424,7 @@ func (m *Ikev2InitiateRekeyChildSaReply) Unmarshal(b []byte) error { } // Ikev2InitiateSaInit defines message 'ikev2_initiate_sa_init'. +// InProgress: the message form may change in the future versions type Ikev2InitiateSaInit struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` } @@ -266,6 +458,7 @@ func (m *Ikev2InitiateSaInit) Unmarshal(b []byte) error { } // Ikev2InitiateSaInitReply defines message 'ikev2_initiate_sa_init_reply'. +// InProgress: the message form may change in the future versions type Ikev2InitiateSaInitReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -298,6 +491,87 @@ func (m *Ikev2InitiateSaInitReply) Unmarshal(b []byte) error { return nil } +// Ikev2NonceGet defines message 'ikev2_nonce_get'. +// InProgress: the message form may change in the future versions +type Ikev2NonceGet struct { + IsInitiator bool `binapi:"bool,name=is_initiator" json:"is_initiator,omitempty"` + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` +} + +func (m *Ikev2NonceGet) Reset() { *m = Ikev2NonceGet{} } +func (*Ikev2NonceGet) GetMessageName() string { return "ikev2_nonce_get" } +func (*Ikev2NonceGet) GetCrcString() string { return "7fe9ad51" } +func (*Ikev2NonceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2NonceGet) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsInitiator + size += 4 // m.SaIndex + return size +} +func (m *Ikev2NonceGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsInitiator) + buf.EncodeUint32(m.SaIndex) + return buf.Bytes(), nil +} +func (m *Ikev2NonceGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsInitiator = buf.DecodeBool() + m.SaIndex = buf.DecodeUint32() + return nil +} + +// Ikev2NonceGetReply defines message 'ikev2_nonce_get_reply'. +// InProgress: the message form may change in the future versions +type Ikev2NonceGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"-"` + Nonce []byte `binapi:"u8[data_len],name=nonce" json:"nonce,omitempty"` +} + +func (m *Ikev2NonceGetReply) Reset() { *m = Ikev2NonceGetReply{} } +func (*Ikev2NonceGetReply) GetMessageName() string { return "ikev2_nonce_get_reply" } +func (*Ikev2NonceGetReply) GetCrcString() string { return "1b37a342" } +func (*Ikev2NonceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2NonceGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.DataLen + size += 1 * len(m.Nonce) // m.Nonce + return size +} +func (m *Ikev2NonceGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(len(m.Nonce))) + buf.EncodeBytes(m.Nonce, 0) + return buf.Bytes(), nil +} +func (m *Ikev2NonceGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.DataLen = buf.DecodeUint32() + m.Nonce = make([]byte, m.DataLen) + copy(m.Nonce, buf.DecodeBytes(len(m.Nonce))) + return nil +} + // Ikev2PluginGetVersion defines message 'ikev2_plugin_get_version'. type Ikev2PluginGetVersion struct{} @@ -363,6 +637,7 @@ func (m *Ikev2PluginGetVersionReply) Unmarshal(b []byte) error { } // Ikev2ProfileAddDel defines message 'ikev2_profile_add_del'. +// InProgress: the message form may change in the future versions type Ikev2ProfileAddDel struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` @@ -400,6 +675,7 @@ func (m *Ikev2ProfileAddDel) Unmarshal(b []byte) error { } // Ikev2ProfileAddDelReply defines message 'ikev2_profile_add_del_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -432,7 +708,285 @@ func (m *Ikev2ProfileAddDelReply) Unmarshal(b []byte) error { return nil } +// Ikev2ProfileDetails defines message 'ikev2_profile_details'. +// InProgress: the message form may change in the future versions +type Ikev2ProfileDetails struct { + Profile ikev2_types.Ikev2Profile `binapi:"ikev2_profile,name=profile" json:"profile,omitempty"` +} + +func (m *Ikev2ProfileDetails) Reset() { *m = Ikev2ProfileDetails{} } +func (*Ikev2ProfileDetails) GetMessageName() string { return "ikev2_profile_details" } +func (*Ikev2ProfileDetails) GetCrcString() string { return "670d01d9" } +func (*Ikev2ProfileDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.Profile.Name + size += 1 // m.Profile.LocID.Type + size += 1 // m.Profile.LocID.DataLen + size += 64 // m.Profile.LocID.Data + size += 1 // m.Profile.RemID.Type + size += 1 // m.Profile.RemID.DataLen + size += 64 // m.Profile.RemID.Data + size += 4 // m.Profile.LocTs.SaIndex + size += 4 // m.Profile.LocTs.ChildSaIndex + size += 1 // m.Profile.LocTs.IsLocal + size += 1 // m.Profile.LocTs.ProtocolID + size += 2 // m.Profile.LocTs.StartPort + size += 2 // m.Profile.LocTs.EndPort + size += 1 // m.Profile.LocTs.StartAddr.Af + size += 1 * 16 // m.Profile.LocTs.StartAddr.Un + size += 1 // m.Profile.LocTs.EndAddr.Af + size += 1 * 16 // m.Profile.LocTs.EndAddr.Un + size += 4 // m.Profile.RemTs.SaIndex + size += 4 // m.Profile.RemTs.ChildSaIndex + size += 1 // m.Profile.RemTs.IsLocal + size += 1 // m.Profile.RemTs.ProtocolID + size += 2 // m.Profile.RemTs.StartPort + size += 2 // m.Profile.RemTs.EndPort + size += 1 // m.Profile.RemTs.StartAddr.Af + size += 1 * 16 // m.Profile.RemTs.StartAddr.Un + size += 1 // m.Profile.RemTs.EndAddr.Af + size += 1 * 16 // m.Profile.RemTs.EndAddr.Un + size += 4 // m.Profile.Responder.SwIfIndex + size += 1 // m.Profile.Responder.Addr.Af + size += 1 * 16 // m.Profile.Responder.Addr.Un + size += 1 // m.Profile.IkeTs.CryptoAlg + size += 4 // m.Profile.IkeTs.CryptoKeySize + size += 1 // m.Profile.IkeTs.IntegAlg + size += 1 // m.Profile.IkeTs.DhGroup + size += 1 // m.Profile.EspTs.CryptoAlg + size += 4 // m.Profile.EspTs.CryptoKeySize + size += 1 // m.Profile.EspTs.IntegAlg + size += 8 // m.Profile.Lifetime + size += 8 // m.Profile.LifetimeMaxdata + size += 4 // m.Profile.LifetimeJitter + size += 4 // m.Profile.Handover + size += 2 // m.Profile.IpsecOverUDPPort + size += 4 // m.Profile.TunItf + size += 1 // m.Profile.UDPEncap + size += 1 // m.Profile.NattDisabled + size += 1 // m.Profile.Auth.Method + size += 1 // m.Profile.Auth.Hex + size += 4 // m.Profile.Auth.DataLen + size += 1 * len(m.Profile.Auth.Data) // m.Profile.Auth.Data + return size +} +func (m *Ikev2ProfileDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Profile.Name, 64) + buf.EncodeUint8(m.Profile.LocID.Type) + buf.EncodeUint8(m.Profile.LocID.DataLen) + buf.EncodeString(m.Profile.LocID.Data, 64) + buf.EncodeUint8(m.Profile.RemID.Type) + buf.EncodeUint8(m.Profile.RemID.DataLen) + buf.EncodeString(m.Profile.RemID.Data, 64) + buf.EncodeUint32(m.Profile.LocTs.SaIndex) + buf.EncodeUint32(m.Profile.LocTs.ChildSaIndex) + buf.EncodeBool(m.Profile.LocTs.IsLocal) + buf.EncodeUint8(m.Profile.LocTs.ProtocolID) + buf.EncodeUint16(m.Profile.LocTs.StartPort) + buf.EncodeUint16(m.Profile.LocTs.EndPort) + buf.EncodeUint8(uint8(m.Profile.LocTs.StartAddr.Af)) + buf.EncodeBytes(m.Profile.LocTs.StartAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Profile.LocTs.EndAddr.Af)) + buf.EncodeBytes(m.Profile.LocTs.EndAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.Profile.RemTs.SaIndex) + buf.EncodeUint32(m.Profile.RemTs.ChildSaIndex) + buf.EncodeBool(m.Profile.RemTs.IsLocal) + buf.EncodeUint8(m.Profile.RemTs.ProtocolID) + buf.EncodeUint16(m.Profile.RemTs.StartPort) + buf.EncodeUint16(m.Profile.RemTs.EndPort) + buf.EncodeUint8(uint8(m.Profile.RemTs.StartAddr.Af)) + buf.EncodeBytes(m.Profile.RemTs.StartAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Profile.RemTs.EndAddr.Af)) + buf.EncodeBytes(m.Profile.RemTs.EndAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Profile.Responder.SwIfIndex)) + buf.EncodeUint8(uint8(m.Profile.Responder.Addr.Af)) + buf.EncodeBytes(m.Profile.Responder.Addr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Profile.IkeTs.CryptoAlg) + buf.EncodeUint32(m.Profile.IkeTs.CryptoKeySize) + buf.EncodeUint8(m.Profile.IkeTs.IntegAlg) + buf.EncodeUint8(m.Profile.IkeTs.DhGroup) + buf.EncodeUint8(m.Profile.EspTs.CryptoAlg) + buf.EncodeUint32(m.Profile.EspTs.CryptoKeySize) + buf.EncodeUint8(m.Profile.EspTs.IntegAlg) + buf.EncodeUint64(m.Profile.Lifetime) + buf.EncodeUint64(m.Profile.LifetimeMaxdata) + buf.EncodeUint32(m.Profile.LifetimeJitter) + buf.EncodeUint32(m.Profile.Handover) + buf.EncodeUint16(m.Profile.IpsecOverUDPPort) + buf.EncodeUint32(m.Profile.TunItf) + buf.EncodeBool(m.Profile.UDPEncap) + buf.EncodeBool(m.Profile.NattDisabled) + buf.EncodeUint8(m.Profile.Auth.Method) + buf.EncodeUint8(m.Profile.Auth.Hex) + buf.EncodeUint32(uint32(len(m.Profile.Auth.Data))) + buf.EncodeBytes(m.Profile.Auth.Data, 0) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Profile.Name = buf.DecodeString(64) + m.Profile.LocID.Type = buf.DecodeUint8() + m.Profile.LocID.DataLen = buf.DecodeUint8() + m.Profile.LocID.Data = buf.DecodeString(64) + m.Profile.RemID.Type = buf.DecodeUint8() + m.Profile.RemID.DataLen = buf.DecodeUint8() + m.Profile.RemID.Data = buf.DecodeString(64) + m.Profile.LocTs.SaIndex = buf.DecodeUint32() + m.Profile.LocTs.ChildSaIndex = buf.DecodeUint32() + m.Profile.LocTs.IsLocal = buf.DecodeBool() + m.Profile.LocTs.ProtocolID = buf.DecodeUint8() + m.Profile.LocTs.StartPort = buf.DecodeUint16() + m.Profile.LocTs.EndPort = buf.DecodeUint16() + m.Profile.LocTs.StartAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Profile.LocTs.StartAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Profile.LocTs.EndAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Profile.LocTs.EndAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Profile.RemTs.SaIndex = buf.DecodeUint32() + m.Profile.RemTs.ChildSaIndex = buf.DecodeUint32() + m.Profile.RemTs.IsLocal = buf.DecodeBool() + m.Profile.RemTs.ProtocolID = buf.DecodeUint8() + m.Profile.RemTs.StartPort = buf.DecodeUint16() + m.Profile.RemTs.EndPort = buf.DecodeUint16() + m.Profile.RemTs.StartAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Profile.RemTs.StartAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Profile.RemTs.EndAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Profile.RemTs.EndAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Profile.Responder.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Profile.Responder.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Profile.Responder.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Profile.IkeTs.CryptoAlg = buf.DecodeUint8() + m.Profile.IkeTs.CryptoKeySize = buf.DecodeUint32() + m.Profile.IkeTs.IntegAlg = buf.DecodeUint8() + m.Profile.IkeTs.DhGroup = buf.DecodeUint8() + m.Profile.EspTs.CryptoAlg = buf.DecodeUint8() + m.Profile.EspTs.CryptoKeySize = buf.DecodeUint32() + m.Profile.EspTs.IntegAlg = buf.DecodeUint8() + m.Profile.Lifetime = buf.DecodeUint64() + m.Profile.LifetimeMaxdata = buf.DecodeUint64() + m.Profile.LifetimeJitter = buf.DecodeUint32() + m.Profile.Handover = buf.DecodeUint32() + m.Profile.IpsecOverUDPPort = buf.DecodeUint16() + m.Profile.TunItf = buf.DecodeUint32() + m.Profile.UDPEncap = buf.DecodeBool() + m.Profile.NattDisabled = buf.DecodeBool() + m.Profile.Auth.Method = buf.DecodeUint8() + m.Profile.Auth.Hex = buf.DecodeUint8() + m.Profile.Auth.DataLen = buf.DecodeUint32() + m.Profile.Auth.Data = make([]byte, m.Profile.Auth.DataLen) + copy(m.Profile.Auth.Data, buf.DecodeBytes(len(m.Profile.Auth.Data))) + return nil +} + +// Ikev2ProfileDisableNatt defines message 'ikev2_profile_disable_natt'. +// InProgress: the message form may change in the future versions +type Ikev2ProfileDisableNatt struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *Ikev2ProfileDisableNatt) Reset() { *m = Ikev2ProfileDisableNatt{} } +func (*Ikev2ProfileDisableNatt) GetMessageName() string { return "ikev2_profile_disable_natt" } +func (*Ikev2ProfileDisableNatt) GetCrcString() string { return "ebf79a66" } +func (*Ikev2ProfileDisableNatt) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileDisableNatt) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.Name + return size +} +func (m *Ikev2ProfileDisableNatt) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileDisableNatt) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + return nil +} + +// Ikev2ProfileDisableNattReply defines message 'ikev2_profile_disable_natt_reply'. +// InProgress: the message form may change in the future versions +type Ikev2ProfileDisableNattReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileDisableNattReply) Reset() { *m = Ikev2ProfileDisableNattReply{} } +func (*Ikev2ProfileDisableNattReply) GetMessageName() string { + return "ikev2_profile_disable_natt_reply" +} +func (*Ikev2ProfileDisableNattReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileDisableNattReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileDisableNattReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileDisableNattReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileDisableNattReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Ikev2ProfileDump defines message 'ikev2_profile_dump'. +// InProgress: the message form may change in the future versions +type Ikev2ProfileDump struct{} + +func (m *Ikev2ProfileDump) Reset() { *m = Ikev2ProfileDump{} } +func (*Ikev2ProfileDump) GetMessageName() string { return "ikev2_profile_dump" } +func (*Ikev2ProfileDump) GetCrcString() string { return "51077d14" } +func (*Ikev2ProfileDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Ikev2ProfileDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileDump) Unmarshal(b []byte) error { + return nil +} + // Ikev2ProfileSetAuth defines message 'ikev2_profile_set_auth'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetAuth struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` AuthMethod uint8 `binapi:"u8,name=auth_method" json:"auth_method,omitempty"` @@ -483,6 +1037,7 @@ func (m *Ikev2ProfileSetAuth) Unmarshal(b []byte) error { } // Ikev2ProfileSetAuthReply defines message 'ikev2_profile_set_auth_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetAuthReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -516,6 +1071,7 @@ func (m *Ikev2ProfileSetAuthReply) Unmarshal(b []byte) error { } // Ikev2ProfileSetID defines message 'ikev2_profile_set_id'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetID struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` @@ -566,6 +1122,7 @@ func (m *Ikev2ProfileSetID) Unmarshal(b []byte) error { } // Ikev2ProfileSetIDReply defines message 'ikev2_profile_set_id_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetIDReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -599,6 +1156,7 @@ func (m *Ikev2ProfileSetIDReply) Unmarshal(b []byte) error { } // Ikev2ProfileSetIpsecUDPPort defines message 'ikev2_profile_set_ipsec_udp_port'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetIpsecUDPPort struct { IsSet uint8 `binapi:"u8,name=is_set" json:"is_set,omitempty"` Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` @@ -642,6 +1200,7 @@ func (m *Ikev2ProfileSetIpsecUDPPort) Unmarshal(b []byte) error { } // Ikev2ProfileSetIpsecUDPPortReply defines message 'ikev2_profile_set_ipsec_udp_port_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetIpsecUDPPortReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -677,6 +1236,7 @@ func (m *Ikev2ProfileSetIpsecUDPPortReply) Unmarshal(b []byte) error { } // Ikev2ProfileSetLiveness defines message 'ikev2_profile_set_liveness'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetLiveness struct { Period uint32 `binapi:"u32,name=period" json:"period,omitempty"` MaxRetries uint32 `binapi:"u32,name=max_retries" json:"max_retries,omitempty"` @@ -714,6 +1274,7 @@ func (m *Ikev2ProfileSetLiveness) Unmarshal(b []byte) error { } // Ikev2ProfileSetLivenessReply defines message 'ikev2_profile_set_liveness_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetLivenessReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -749,19 +1310,15 @@ func (m *Ikev2ProfileSetLivenessReply) Unmarshal(b []byte) error { } // Ikev2ProfileSetTs defines message 'ikev2_profile_set_ts'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetTs struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty"` - IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` - StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` - EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` - StartAddr uint32 `binapi:"u32,name=start_addr" json:"start_addr,omitempty"` - EndAddr uint32 `binapi:"u32,name=end_addr" json:"end_addr,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Ts ikev2_types.Ikev2Ts `binapi:"ikev2_ts,name=ts" json:"ts,omitempty"` } func (m *Ikev2ProfileSetTs) Reset() { *m = Ikev2ProfileSetTs{} } func (*Ikev2ProfileSetTs) GetMessageName() string { return "ikev2_profile_set_ts" } -func (*Ikev2ProfileSetTs) GetCrcString() string { return "64d55c16" } +func (*Ikev2ProfileSetTs) GetCrcString() string { return "8eb8cfd1" } func (*Ikev2ProfileSetTs) GetMessageType() api.MessageType { return api.RequestMessage } @@ -770,13 +1327,17 @@ func (m *Ikev2ProfileSetTs) Size() (size int) { if m == nil { return 0 } - size += 64 // m.Name - size += 1 // m.IsLocal - size += 1 // m.Proto - size += 2 // m.StartPort - size += 2 // m.EndPort - size += 4 // m.StartAddr - size += 4 // m.EndAddr + size += 64 // m.Name + size += 4 // m.Ts.SaIndex + size += 4 // m.Ts.ChildSaIndex + size += 1 // m.Ts.IsLocal + size += 1 // m.Ts.ProtocolID + size += 2 // m.Ts.StartPort + size += 2 // m.Ts.EndPort + size += 1 // m.Ts.StartAddr.Af + size += 1 * 16 // m.Ts.StartAddr.Un + size += 1 // m.Ts.EndAddr.Af + size += 1 * 16 // m.Ts.EndAddr.Un return size } func (m *Ikev2ProfileSetTs) Marshal(b []byte) ([]byte, error) { @@ -785,27 +1346,36 @@ func (m *Ikev2ProfileSetTs) Marshal(b []byte) ([]byte, error) { } buf := codec.NewBuffer(b) buf.EncodeString(m.Name, 64) - buf.EncodeBool(m.IsLocal) - buf.EncodeUint8(m.Proto) - buf.EncodeUint16(m.StartPort) - buf.EncodeUint16(m.EndPort) - buf.EncodeUint32(m.StartAddr) - buf.EncodeUint32(m.EndAddr) + buf.EncodeUint32(m.Ts.SaIndex) + buf.EncodeUint32(m.Ts.ChildSaIndex) + buf.EncodeBool(m.Ts.IsLocal) + buf.EncodeUint8(m.Ts.ProtocolID) + buf.EncodeUint16(m.Ts.StartPort) + buf.EncodeUint16(m.Ts.EndPort) + buf.EncodeUint8(uint8(m.Ts.StartAddr.Af)) + buf.EncodeBytes(m.Ts.StartAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Ts.EndAddr.Af)) + buf.EncodeBytes(m.Ts.EndAddr.Un.XXX_UnionData[:], 16) return buf.Bytes(), nil } func (m *Ikev2ProfileSetTs) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Name = buf.DecodeString(64) - m.IsLocal = buf.DecodeBool() - m.Proto = buf.DecodeUint8() - m.StartPort = buf.DecodeUint16() - m.EndPort = buf.DecodeUint16() - m.StartAddr = buf.DecodeUint32() - m.EndAddr = buf.DecodeUint32() + m.Ts.SaIndex = buf.DecodeUint32() + m.Ts.ChildSaIndex = buf.DecodeUint32() + m.Ts.IsLocal = buf.DecodeBool() + m.Ts.ProtocolID = buf.DecodeUint8() + m.Ts.StartPort = buf.DecodeUint16() + m.Ts.EndPort = buf.DecodeUint16() + m.Ts.StartAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Ts.StartAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Ts.EndAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Ts.EndAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) return nil } // Ikev2ProfileSetTsReply defines message 'ikev2_profile_set_ts_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetTsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -839,6 +1409,7 @@ func (m *Ikev2ProfileSetTsReply) Unmarshal(b []byte) error { } // Ikev2ProfileSetUDPEncap defines message 'ikev2_profile_set_udp_encap'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetUDPEncap struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` } @@ -872,6 +1443,7 @@ func (m *Ikev2ProfileSetUDPEncap) Unmarshal(b []byte) error { } // Ikev2ProfileSetUDPEncapReply defines message 'ikev2_profile_set_udp_encap_reply'. +// InProgress: the message form may change in the future versions type Ikev2ProfileSetUDPEncapReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -906,18 +1478,260 @@ func (m *Ikev2ProfileSetUDPEncapReply) Unmarshal(b []byte) error { return nil } +// Ikev2SaDetails defines message 'ikev2_sa_details'. +// InProgress: the message form may change in the future versions +type Ikev2SaDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Sa ikev2_types.Ikev2Sa `binapi:"ikev2_sa,name=sa" json:"sa,omitempty"` +} + +func (m *Ikev2SaDetails) Reset() { *m = Ikev2SaDetails{} } +func (*Ikev2SaDetails) GetMessageName() string { return "ikev2_sa_details" } +func (*Ikev2SaDetails) GetCrcString() string { return "937c22d5" } +func (*Ikev2SaDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SaDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Sa.SaIndex + size += 4 // m.Sa.ProfileIndex + size += 8 // m.Sa.Ispi + size += 8 // m.Sa.Rspi + size += 1 // m.Sa.Iaddr.Af + size += 1 * 16 // m.Sa.Iaddr.Un + size += 1 // m.Sa.Raddr.Af + size += 1 * 16 // m.Sa.Raddr.Un + size += 1 * 64 // m.Sa.Keys.SkD + size += 1 // m.Sa.Keys.SkDLen + size += 1 * 64 // m.Sa.Keys.SkAi + size += 1 // m.Sa.Keys.SkAiLen + size += 1 * 64 // m.Sa.Keys.SkAr + size += 1 // m.Sa.Keys.SkArLen + size += 1 * 64 // m.Sa.Keys.SkEi + size += 1 // m.Sa.Keys.SkEiLen + size += 1 * 64 // m.Sa.Keys.SkEr + size += 1 // m.Sa.Keys.SkErLen + size += 1 * 64 // m.Sa.Keys.SkPi + size += 1 // m.Sa.Keys.SkPiLen + size += 1 * 64 // m.Sa.Keys.SkPr + size += 1 // m.Sa.Keys.SkPrLen + size += 1 // m.Sa.IID.Type + size += 1 // m.Sa.IID.DataLen + size += 64 // m.Sa.IID.Data + size += 1 // m.Sa.RID.Type + size += 1 // m.Sa.RID.DataLen + size += 64 // m.Sa.RID.Data + size += 1 // m.Sa.Encryption.TransformType + size += 2 // m.Sa.Encryption.TransformID + size += 2 // m.Sa.Encryption.KeyLen + size += 2 // m.Sa.Encryption.KeyTrunc + size += 2 // m.Sa.Encryption.BlockSize + size += 1 // m.Sa.Encryption.DhGroup + size += 1 // m.Sa.Integrity.TransformType + size += 2 // m.Sa.Integrity.TransformID + size += 2 // m.Sa.Integrity.KeyLen + size += 2 // m.Sa.Integrity.KeyTrunc + size += 2 // m.Sa.Integrity.BlockSize + size += 1 // m.Sa.Integrity.DhGroup + size += 1 // m.Sa.Prf.TransformType + size += 2 // m.Sa.Prf.TransformID + size += 2 // m.Sa.Prf.KeyLen + size += 2 // m.Sa.Prf.KeyTrunc + size += 2 // m.Sa.Prf.BlockSize + size += 1 // m.Sa.Prf.DhGroup + size += 1 // m.Sa.Dh.TransformType + size += 2 // m.Sa.Dh.TransformID + size += 2 // m.Sa.Dh.KeyLen + size += 2 // m.Sa.Dh.KeyTrunc + size += 2 // m.Sa.Dh.BlockSize + size += 1 // m.Sa.Dh.DhGroup + size += 2 // m.Sa.Stats.NKeepalives + size += 2 // m.Sa.Stats.NRekeyReq + size += 2 // m.Sa.Stats.NSaInitReq + size += 2 // m.Sa.Stats.NSaAuthReq + size += 2 // m.Sa.Stats.NRetransmit + size += 2 // m.Sa.Stats.NInitSaRetransmit + return size +} +func (m *Ikev2SaDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Sa.SaIndex) + buf.EncodeUint32(m.Sa.ProfileIndex) + buf.EncodeUint64(m.Sa.Ispi) + buf.EncodeUint64(m.Sa.Rspi) + buf.EncodeUint8(uint8(m.Sa.Iaddr.Af)) + buf.EncodeBytes(m.Sa.Iaddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Sa.Raddr.Af)) + buf.EncodeBytes(m.Sa.Raddr.Un.XXX_UnionData[:], 16) + buf.EncodeBytes(m.Sa.Keys.SkD, 64) + buf.EncodeUint8(m.Sa.Keys.SkDLen) + buf.EncodeBytes(m.Sa.Keys.SkAi, 64) + buf.EncodeUint8(m.Sa.Keys.SkAiLen) + buf.EncodeBytes(m.Sa.Keys.SkAr, 64) + buf.EncodeUint8(m.Sa.Keys.SkArLen) + buf.EncodeBytes(m.Sa.Keys.SkEi, 64) + buf.EncodeUint8(m.Sa.Keys.SkEiLen) + buf.EncodeBytes(m.Sa.Keys.SkEr, 64) + buf.EncodeUint8(m.Sa.Keys.SkErLen) + buf.EncodeBytes(m.Sa.Keys.SkPi, 64) + buf.EncodeUint8(m.Sa.Keys.SkPiLen) + buf.EncodeBytes(m.Sa.Keys.SkPr, 64) + buf.EncodeUint8(m.Sa.Keys.SkPrLen) + buf.EncodeUint8(m.Sa.IID.Type) + buf.EncodeUint8(m.Sa.IID.DataLen) + buf.EncodeString(m.Sa.IID.Data, 64) + buf.EncodeUint8(m.Sa.RID.Type) + buf.EncodeUint8(m.Sa.RID.DataLen) + buf.EncodeString(m.Sa.RID.Data, 64) + buf.EncodeUint8(m.Sa.Encryption.TransformType) + buf.EncodeUint16(m.Sa.Encryption.TransformID) + buf.EncodeUint16(m.Sa.Encryption.KeyLen) + buf.EncodeUint16(m.Sa.Encryption.KeyTrunc) + buf.EncodeUint16(m.Sa.Encryption.BlockSize) + buf.EncodeUint8(m.Sa.Encryption.DhGroup) + buf.EncodeUint8(m.Sa.Integrity.TransformType) + buf.EncodeUint16(m.Sa.Integrity.TransformID) + buf.EncodeUint16(m.Sa.Integrity.KeyLen) + buf.EncodeUint16(m.Sa.Integrity.KeyTrunc) + buf.EncodeUint16(m.Sa.Integrity.BlockSize) + buf.EncodeUint8(m.Sa.Integrity.DhGroup) + buf.EncodeUint8(m.Sa.Prf.TransformType) + buf.EncodeUint16(m.Sa.Prf.TransformID) + buf.EncodeUint16(m.Sa.Prf.KeyLen) + buf.EncodeUint16(m.Sa.Prf.KeyTrunc) + buf.EncodeUint16(m.Sa.Prf.BlockSize) + buf.EncodeUint8(m.Sa.Prf.DhGroup) + buf.EncodeUint8(m.Sa.Dh.TransformType) + buf.EncodeUint16(m.Sa.Dh.TransformID) + buf.EncodeUint16(m.Sa.Dh.KeyLen) + buf.EncodeUint16(m.Sa.Dh.KeyTrunc) + buf.EncodeUint16(m.Sa.Dh.BlockSize) + buf.EncodeUint8(m.Sa.Dh.DhGroup) + buf.EncodeUint16(m.Sa.Stats.NKeepalives) + buf.EncodeUint16(m.Sa.Stats.NRekeyReq) + buf.EncodeUint16(m.Sa.Stats.NSaInitReq) + buf.EncodeUint16(m.Sa.Stats.NSaAuthReq) + buf.EncodeUint16(m.Sa.Stats.NRetransmit) + buf.EncodeUint16(m.Sa.Stats.NInitSaRetransmit) + return buf.Bytes(), nil +} +func (m *Ikev2SaDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Sa.SaIndex = buf.DecodeUint32() + m.Sa.ProfileIndex = buf.DecodeUint32() + m.Sa.Ispi = buf.DecodeUint64() + m.Sa.Rspi = buf.DecodeUint64() + m.Sa.Iaddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Sa.Iaddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Sa.Raddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Sa.Raddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Sa.Keys.SkD = make([]byte, 64) + copy(m.Sa.Keys.SkD, buf.DecodeBytes(len(m.Sa.Keys.SkD))) + m.Sa.Keys.SkDLen = buf.DecodeUint8() + m.Sa.Keys.SkAi = make([]byte, 64) + copy(m.Sa.Keys.SkAi, buf.DecodeBytes(len(m.Sa.Keys.SkAi))) + m.Sa.Keys.SkAiLen = buf.DecodeUint8() + m.Sa.Keys.SkAr = make([]byte, 64) + copy(m.Sa.Keys.SkAr, buf.DecodeBytes(len(m.Sa.Keys.SkAr))) + m.Sa.Keys.SkArLen = buf.DecodeUint8() + m.Sa.Keys.SkEi = make([]byte, 64) + copy(m.Sa.Keys.SkEi, buf.DecodeBytes(len(m.Sa.Keys.SkEi))) + m.Sa.Keys.SkEiLen = buf.DecodeUint8() + m.Sa.Keys.SkEr = make([]byte, 64) + copy(m.Sa.Keys.SkEr, buf.DecodeBytes(len(m.Sa.Keys.SkEr))) + m.Sa.Keys.SkErLen = buf.DecodeUint8() + m.Sa.Keys.SkPi = make([]byte, 64) + copy(m.Sa.Keys.SkPi, buf.DecodeBytes(len(m.Sa.Keys.SkPi))) + m.Sa.Keys.SkPiLen = buf.DecodeUint8() + m.Sa.Keys.SkPr = make([]byte, 64) + copy(m.Sa.Keys.SkPr, buf.DecodeBytes(len(m.Sa.Keys.SkPr))) + m.Sa.Keys.SkPrLen = buf.DecodeUint8() + m.Sa.IID.Type = buf.DecodeUint8() + m.Sa.IID.DataLen = buf.DecodeUint8() + m.Sa.IID.Data = buf.DecodeString(64) + m.Sa.RID.Type = buf.DecodeUint8() + m.Sa.RID.DataLen = buf.DecodeUint8() + m.Sa.RID.Data = buf.DecodeString(64) + m.Sa.Encryption.TransformType = buf.DecodeUint8() + m.Sa.Encryption.TransformID = buf.DecodeUint16() + m.Sa.Encryption.KeyLen = buf.DecodeUint16() + m.Sa.Encryption.KeyTrunc = buf.DecodeUint16() + m.Sa.Encryption.BlockSize = buf.DecodeUint16() + m.Sa.Encryption.DhGroup = buf.DecodeUint8() + m.Sa.Integrity.TransformType = buf.DecodeUint8() + m.Sa.Integrity.TransformID = buf.DecodeUint16() + m.Sa.Integrity.KeyLen = buf.DecodeUint16() + m.Sa.Integrity.KeyTrunc = buf.DecodeUint16() + m.Sa.Integrity.BlockSize = buf.DecodeUint16() + m.Sa.Integrity.DhGroup = buf.DecodeUint8() + m.Sa.Prf.TransformType = buf.DecodeUint8() + m.Sa.Prf.TransformID = buf.DecodeUint16() + m.Sa.Prf.KeyLen = buf.DecodeUint16() + m.Sa.Prf.KeyTrunc = buf.DecodeUint16() + m.Sa.Prf.BlockSize = buf.DecodeUint16() + m.Sa.Prf.DhGroup = buf.DecodeUint8() + m.Sa.Dh.TransformType = buf.DecodeUint8() + m.Sa.Dh.TransformID = buf.DecodeUint16() + m.Sa.Dh.KeyLen = buf.DecodeUint16() + m.Sa.Dh.KeyTrunc = buf.DecodeUint16() + m.Sa.Dh.BlockSize = buf.DecodeUint16() + m.Sa.Dh.DhGroup = buf.DecodeUint8() + m.Sa.Stats.NKeepalives = buf.DecodeUint16() + m.Sa.Stats.NRekeyReq = buf.DecodeUint16() + m.Sa.Stats.NSaInitReq = buf.DecodeUint16() + m.Sa.Stats.NSaAuthReq = buf.DecodeUint16() + m.Sa.Stats.NRetransmit = buf.DecodeUint16() + m.Sa.Stats.NInitSaRetransmit = buf.DecodeUint16() + return nil +} + +// Ikev2SaDump defines message 'ikev2_sa_dump'. +// InProgress: the message form may change in the future versions +type Ikev2SaDump struct{} + +func (m *Ikev2SaDump) Reset() { *m = Ikev2SaDump{} } +func (*Ikev2SaDump) GetMessageName() string { return "ikev2_sa_dump" } +func (*Ikev2SaDump) GetCrcString() string { return "51077d14" } +func (*Ikev2SaDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SaDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Ikev2SaDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Ikev2SaDump) Unmarshal(b []byte) error { + return nil +} + // Ikev2SetEspTransforms defines message 'ikev2_set_esp_transforms'. +// InProgress: the message form may change in the future versions type Ikev2SetEspTransforms struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty"` - CryptoAlg uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"` - CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` - IntegAlg uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"` - DhGroup uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Tr ikev2_types.Ikev2EspTransforms `binapi:"ikev2_esp_transforms,name=tr" json:"tr,omitempty"` } func (m *Ikev2SetEspTransforms) Reset() { *m = Ikev2SetEspTransforms{} } func (*Ikev2SetEspTransforms) GetMessageName() string { return "ikev2_set_esp_transforms" } -func (*Ikev2SetEspTransforms) GetCrcString() string { return "936a1a37" } +func (*Ikev2SetEspTransforms) GetCrcString() string { return "a63dc205" } func (*Ikev2SetEspTransforms) GetMessageType() api.MessageType { return api.RequestMessage } @@ -927,10 +1741,9 @@ func (m *Ikev2SetEspTransforms) Size() (size int) { return 0 } size += 64 // m.Name - size += 4 // m.CryptoAlg - size += 4 // m.CryptoKeySize - size += 4 // m.IntegAlg - size += 4 // m.DhGroup + size += 1 // m.Tr.CryptoAlg + size += 4 // m.Tr.CryptoKeySize + size += 1 // m.Tr.IntegAlg return size } func (m *Ikev2SetEspTransforms) Marshal(b []byte) ([]byte, error) { @@ -939,23 +1752,22 @@ func (m *Ikev2SetEspTransforms) Marshal(b []byte) ([]byte, error) { } buf := codec.NewBuffer(b) buf.EncodeString(m.Name, 64) - buf.EncodeUint32(m.CryptoAlg) - buf.EncodeUint32(m.CryptoKeySize) - buf.EncodeUint32(m.IntegAlg) - buf.EncodeUint32(m.DhGroup) + buf.EncodeUint8(m.Tr.CryptoAlg) + buf.EncodeUint32(m.Tr.CryptoKeySize) + buf.EncodeUint8(m.Tr.IntegAlg) return buf.Bytes(), nil } func (m *Ikev2SetEspTransforms) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Name = buf.DecodeString(64) - m.CryptoAlg = buf.DecodeUint32() - m.CryptoKeySize = buf.DecodeUint32() - m.IntegAlg = buf.DecodeUint32() - m.DhGroup = buf.DecodeUint32() + m.Tr.CryptoAlg = buf.DecodeUint8() + m.Tr.CryptoKeySize = buf.DecodeUint32() + m.Tr.IntegAlg = buf.DecodeUint8() return nil } // Ikev2SetEspTransformsReply defines message 'ikev2_set_esp_transforms_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetEspTransformsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -989,17 +1801,15 @@ func (m *Ikev2SetEspTransformsReply) Unmarshal(b []byte) error { } // Ikev2SetIkeTransforms defines message 'ikev2_set_ike_transforms'. +// InProgress: the message form may change in the future versions type Ikev2SetIkeTransforms struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty"` - CryptoAlg uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"` - CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` - IntegAlg uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"` - DhGroup uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Tr ikev2_types.Ikev2IkeTransforms `binapi:"ikev2_ike_transforms,name=tr" json:"tr,omitempty"` } func (m *Ikev2SetIkeTransforms) Reset() { *m = Ikev2SetIkeTransforms{} } func (*Ikev2SetIkeTransforms) GetMessageName() string { return "ikev2_set_ike_transforms" } -func (*Ikev2SetIkeTransforms) GetCrcString() string { return "936a1a37" } +func (*Ikev2SetIkeTransforms) GetCrcString() string { return "076d7378" } func (*Ikev2SetIkeTransforms) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1009,10 +1819,10 @@ func (m *Ikev2SetIkeTransforms) Size() (size int) { return 0 } size += 64 // m.Name - size += 4 // m.CryptoAlg - size += 4 // m.CryptoKeySize - size += 4 // m.IntegAlg - size += 4 // m.DhGroup + size += 1 // m.Tr.CryptoAlg + size += 4 // m.Tr.CryptoKeySize + size += 1 // m.Tr.IntegAlg + size += 1 // m.Tr.DhGroup return size } func (m *Ikev2SetIkeTransforms) Marshal(b []byte) ([]byte, error) { @@ -1021,23 +1831,24 @@ func (m *Ikev2SetIkeTransforms) Marshal(b []byte) ([]byte, error) { } buf := codec.NewBuffer(b) buf.EncodeString(m.Name, 64) - buf.EncodeUint32(m.CryptoAlg) - buf.EncodeUint32(m.CryptoKeySize) - buf.EncodeUint32(m.IntegAlg) - buf.EncodeUint32(m.DhGroup) + buf.EncodeUint8(m.Tr.CryptoAlg) + buf.EncodeUint32(m.Tr.CryptoKeySize) + buf.EncodeUint8(m.Tr.IntegAlg) + buf.EncodeUint8(m.Tr.DhGroup) return buf.Bytes(), nil } func (m *Ikev2SetIkeTransforms) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Name = buf.DecodeString(64) - m.CryptoAlg = buf.DecodeUint32() - m.CryptoKeySize = buf.DecodeUint32() - m.IntegAlg = buf.DecodeUint32() - m.DhGroup = buf.DecodeUint32() + m.Tr.CryptoAlg = buf.DecodeUint8() + m.Tr.CryptoKeySize = buf.DecodeUint32() + m.Tr.IntegAlg = buf.DecodeUint8() + m.Tr.DhGroup = buf.DecodeUint8() return nil } // Ikev2SetIkeTransformsReply defines message 'ikev2_set_ike_transforms_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetIkeTransformsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1071,6 +1882,7 @@ func (m *Ikev2SetIkeTransformsReply) Unmarshal(b []byte) error { } // Ikev2SetLocalKey defines message 'ikev2_set_local_key'. +// InProgress: the message form may change in the future versions type Ikev2SetLocalKey struct { KeyFile string `binapi:"string[256],name=key_file" json:"key_file,omitempty"` } @@ -1104,6 +1916,7 @@ func (m *Ikev2SetLocalKey) Unmarshal(b []byte) error { } // Ikev2SetLocalKeyReply defines message 'ikev2_set_local_key_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetLocalKeyReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1137,15 +1950,15 @@ func (m *Ikev2SetLocalKeyReply) Unmarshal(b []byte) error { } // Ikev2SetResponder defines message 'ikev2_set_responder'. +// InProgress: the message form may change in the future versions type Ikev2SetResponder struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Responder ikev2_types.Ikev2Responder `binapi:"ikev2_responder,name=responder" json:"responder,omitempty"` } func (m *Ikev2SetResponder) Reset() { *m = Ikev2SetResponder{} } func (*Ikev2SetResponder) GetMessageName() string { return "ikev2_set_responder" } -func (*Ikev2SetResponder) GetCrcString() string { return "f0d3dc80" } +func (*Ikev2SetResponder) GetCrcString() string { return "a2055df1" } func (*Ikev2SetResponder) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1154,9 +1967,10 @@ func (m *Ikev2SetResponder) Size() (size int) { if m == nil { return 0 } - size += 64 // m.Name - size += 4 // m.SwIfIndex - size += 1 * 4 // m.Address + size += 64 // m.Name + size += 4 // m.Responder.SwIfIndex + size += 1 // m.Responder.Addr.Af + size += 1 * 16 // m.Responder.Addr.Un return size } func (m *Ikev2SetResponder) Marshal(b []byte) ([]byte, error) { @@ -1165,19 +1979,100 @@ func (m *Ikev2SetResponder) Marshal(b []byte) ([]byte, error) { } buf := codec.NewBuffer(b) buf.EncodeString(m.Name, 64) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeBytes(m.Address[:], 4) + buf.EncodeUint32(uint32(m.Responder.SwIfIndex)) + buf.EncodeUint8(uint8(m.Responder.Addr.Af)) + buf.EncodeBytes(m.Responder.Addr.Un.XXX_UnionData[:], 16) return buf.Bytes(), nil } func (m *Ikev2SetResponder) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Name = buf.DecodeString(64) + m.Responder.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Responder.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Responder.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// Ikev2SetResponderHostname defines message 'ikev2_set_responder_hostname'. +// InProgress: the message form may change in the future versions +type Ikev2SetResponderHostname struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ikev2SetResponderHostname) Reset() { *m = Ikev2SetResponderHostname{} } +func (*Ikev2SetResponderHostname) GetMessageName() string { return "ikev2_set_responder_hostname" } +func (*Ikev2SetResponderHostname) GetCrcString() string { return "350d6949" } +func (*Ikev2SetResponderHostname) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetResponderHostname) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.Name + size += 64 // m.Hostname + size += 4 // m.SwIfIndex + return size +} +func (m *Ikev2SetResponderHostname) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Name, 64) + buf.EncodeString(m.Hostname, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ikev2SetResponderHostname) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.Hostname = buf.DecodeString(64) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - copy(m.Address[:], buf.DecodeBytes(4)) + return nil +} + +// Ikev2SetResponderHostnameReply defines message 'ikev2_set_responder_hostname_reply'. +// InProgress: the message form may change in the future versions +type Ikev2SetResponderHostnameReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetResponderHostnameReply) Reset() { *m = Ikev2SetResponderHostnameReply{} } +func (*Ikev2SetResponderHostnameReply) GetMessageName() string { + return "ikev2_set_responder_hostname_reply" +} +func (*Ikev2SetResponderHostnameReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetResponderHostnameReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetResponderHostnameReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Ikev2SetResponderHostnameReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Ikev2SetResponderHostnameReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } // Ikev2SetResponderReply defines message 'ikev2_set_responder_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetResponderReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1211,6 +2106,7 @@ func (m *Ikev2SetResponderReply) Unmarshal(b []byte) error { } // Ikev2SetSaLifetime defines message 'ikev2_set_sa_lifetime'. +// InProgress: the message form may change in the future versions type Ikev2SetSaLifetime struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` Lifetime uint64 `binapi:"u64,name=lifetime" json:"lifetime,omitempty"` @@ -1260,6 +2156,7 @@ func (m *Ikev2SetSaLifetime) Unmarshal(b []byte) error { } // Ikev2SetSaLifetimeReply defines message 'ikev2_set_sa_lifetime_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetSaLifetimeReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1293,6 +2190,7 @@ func (m *Ikev2SetSaLifetimeReply) Unmarshal(b []byte) error { } // Ikev2SetTunnelInterface defines message 'ikev2_set_tunnel_interface'. +// InProgress: the message form may change in the future versions type Ikev2SetTunnelInterface struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1330,6 +2228,7 @@ func (m *Ikev2SetTunnelInterface) Unmarshal(b []byte) error { } // Ikev2SetTunnelInterfaceReply defines message 'ikev2_set_tunnel_interface_reply'. +// InProgress: the message form may change in the future versions type Ikev2SetTunnelInterfaceReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1364,8 +2263,117 @@ func (m *Ikev2SetTunnelInterfaceReply) Unmarshal(b []byte) error { return nil } +// Ikev2TrafficSelectorDetails defines message 'ikev2_traffic_selector_details'. +// InProgress: the message form may change in the future versions +type Ikev2TrafficSelectorDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Ts ikev2_types.Ikev2Ts `binapi:"ikev2_ts,name=ts" json:"ts,omitempty"` +} + +func (m *Ikev2TrafficSelectorDetails) Reset() { *m = Ikev2TrafficSelectorDetails{} } +func (*Ikev2TrafficSelectorDetails) GetMessageName() string { return "ikev2_traffic_selector_details" } +func (*Ikev2TrafficSelectorDetails) GetCrcString() string { return "518cb06f" } +func (*Ikev2TrafficSelectorDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2TrafficSelectorDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Ts.SaIndex + size += 4 // m.Ts.ChildSaIndex + size += 1 // m.Ts.IsLocal + size += 1 // m.Ts.ProtocolID + size += 2 // m.Ts.StartPort + size += 2 // m.Ts.EndPort + size += 1 // m.Ts.StartAddr.Af + size += 1 * 16 // m.Ts.StartAddr.Un + size += 1 // m.Ts.EndAddr.Af + size += 1 * 16 // m.Ts.EndAddr.Un + return size +} +func (m *Ikev2TrafficSelectorDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Ts.SaIndex) + buf.EncodeUint32(m.Ts.ChildSaIndex) + buf.EncodeBool(m.Ts.IsLocal) + buf.EncodeUint8(m.Ts.ProtocolID) + buf.EncodeUint16(m.Ts.StartPort) + buf.EncodeUint16(m.Ts.EndPort) + buf.EncodeUint8(uint8(m.Ts.StartAddr.Af)) + buf.EncodeBytes(m.Ts.StartAddr.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Ts.EndAddr.Af)) + buf.EncodeBytes(m.Ts.EndAddr.Un.XXX_UnionData[:], 16) + return buf.Bytes(), nil +} +func (m *Ikev2TrafficSelectorDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Ts.SaIndex = buf.DecodeUint32() + m.Ts.ChildSaIndex = buf.DecodeUint32() + m.Ts.IsLocal = buf.DecodeBool() + m.Ts.ProtocolID = buf.DecodeUint8() + m.Ts.StartPort = buf.DecodeUint16() + m.Ts.EndPort = buf.DecodeUint16() + m.Ts.StartAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Ts.StartAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Ts.EndAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Ts.EndAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// Ikev2TrafficSelectorDump defines message 'ikev2_traffic_selector_dump'. +// InProgress: the message form may change in the future versions +type Ikev2TrafficSelectorDump struct { + IsInitiator bool `binapi:"bool,name=is_initiator" json:"is_initiator,omitempty"` + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` + ChildSaIndex uint32 `binapi:"u32,name=child_sa_index" json:"child_sa_index,omitempty"` +} + +func (m *Ikev2TrafficSelectorDump) Reset() { *m = Ikev2TrafficSelectorDump{} } +func (*Ikev2TrafficSelectorDump) GetMessageName() string { return "ikev2_traffic_selector_dump" } +func (*Ikev2TrafficSelectorDump) GetCrcString() string { return "a7385e33" } +func (*Ikev2TrafficSelectorDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2TrafficSelectorDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsInitiator + size += 4 // m.SaIndex + size += 4 // m.ChildSaIndex + return size +} +func (m *Ikev2TrafficSelectorDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsInitiator) + buf.EncodeUint32(m.SaIndex) + buf.EncodeUint32(m.ChildSaIndex) + return buf.Bytes(), nil +} +func (m *Ikev2TrafficSelectorDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsInitiator = buf.DecodeBool() + m.SaIndex = buf.DecodeUint32() + m.ChildSaIndex = buf.DecodeUint32() + return nil +} + func init() { file_ikev2_binapi_init() } func file_ikev2_binapi_init() { + api.RegisterMessage((*Ikev2ChildSaDetails)(nil), "ikev2_child_sa_details_ff67741f") + api.RegisterMessage((*Ikev2ChildSaDump)(nil), "ikev2_child_sa_dump_01eab609") api.RegisterMessage((*Ikev2InitiateDelChildSa)(nil), "ikev2_initiate_del_child_sa_7f004d2e") api.RegisterMessage((*Ikev2InitiateDelChildSaReply)(nil), "ikev2_initiate_del_child_sa_reply_e8d4e804") api.RegisterMessage((*Ikev2InitiateDelIkeSa)(nil), "ikev2_initiate_del_ike_sa_8d125bdd") @@ -1374,10 +2382,16 @@ func file_ikev2_binapi_init() { api.RegisterMessage((*Ikev2InitiateRekeyChildSaReply)(nil), "ikev2_initiate_rekey_child_sa_reply_e8d4e804") api.RegisterMessage((*Ikev2InitiateSaInit)(nil), "ikev2_initiate_sa_init_ebf79a66") api.RegisterMessage((*Ikev2InitiateSaInitReply)(nil), "ikev2_initiate_sa_init_reply_e8d4e804") + api.RegisterMessage((*Ikev2NonceGet)(nil), "ikev2_nonce_get_7fe9ad51") + api.RegisterMessage((*Ikev2NonceGetReply)(nil), "ikev2_nonce_get_reply_1b37a342") api.RegisterMessage((*Ikev2PluginGetVersion)(nil), "ikev2_plugin_get_version_51077d14") api.RegisterMessage((*Ikev2PluginGetVersionReply)(nil), "ikev2_plugin_get_version_reply_9b32cf86") api.RegisterMessage((*Ikev2ProfileAddDel)(nil), "ikev2_profile_add_del_2c925b55") api.RegisterMessage((*Ikev2ProfileAddDelReply)(nil), "ikev2_profile_add_del_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileDetails)(nil), "ikev2_profile_details_670d01d9") + api.RegisterMessage((*Ikev2ProfileDisableNatt)(nil), "ikev2_profile_disable_natt_ebf79a66") + api.RegisterMessage((*Ikev2ProfileDisableNattReply)(nil), "ikev2_profile_disable_natt_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileDump)(nil), "ikev2_profile_dump_51077d14") api.RegisterMessage((*Ikev2ProfileSetAuth)(nil), "ikev2_profile_set_auth_642c97cd") api.RegisterMessage((*Ikev2ProfileSetAuthReply)(nil), "ikev2_profile_set_auth_reply_e8d4e804") api.RegisterMessage((*Ikev2ProfileSetID)(nil), "ikev2_profile_set_id_4d7e2418") @@ -1386,27 +2400,35 @@ func file_ikev2_binapi_init() { api.RegisterMessage((*Ikev2ProfileSetIpsecUDPPortReply)(nil), "ikev2_profile_set_ipsec_udp_port_reply_e8d4e804") api.RegisterMessage((*Ikev2ProfileSetLiveness)(nil), "ikev2_profile_set_liveness_6bdf4d65") api.RegisterMessage((*Ikev2ProfileSetLivenessReply)(nil), "ikev2_profile_set_liveness_reply_e8d4e804") - api.RegisterMessage((*Ikev2ProfileSetTs)(nil), "ikev2_profile_set_ts_64d55c16") + api.RegisterMessage((*Ikev2ProfileSetTs)(nil), "ikev2_profile_set_ts_8eb8cfd1") api.RegisterMessage((*Ikev2ProfileSetTsReply)(nil), "ikev2_profile_set_ts_reply_e8d4e804") api.RegisterMessage((*Ikev2ProfileSetUDPEncap)(nil), "ikev2_profile_set_udp_encap_ebf79a66") api.RegisterMessage((*Ikev2ProfileSetUDPEncapReply)(nil), "ikev2_profile_set_udp_encap_reply_e8d4e804") - api.RegisterMessage((*Ikev2SetEspTransforms)(nil), "ikev2_set_esp_transforms_936a1a37") + api.RegisterMessage((*Ikev2SaDetails)(nil), "ikev2_sa_details_937c22d5") + api.RegisterMessage((*Ikev2SaDump)(nil), "ikev2_sa_dump_51077d14") + api.RegisterMessage((*Ikev2SetEspTransforms)(nil), "ikev2_set_esp_transforms_a63dc205") api.RegisterMessage((*Ikev2SetEspTransformsReply)(nil), "ikev2_set_esp_transforms_reply_e8d4e804") - api.RegisterMessage((*Ikev2SetIkeTransforms)(nil), "ikev2_set_ike_transforms_936a1a37") + api.RegisterMessage((*Ikev2SetIkeTransforms)(nil), "ikev2_set_ike_transforms_076d7378") api.RegisterMessage((*Ikev2SetIkeTransformsReply)(nil), "ikev2_set_ike_transforms_reply_e8d4e804") api.RegisterMessage((*Ikev2SetLocalKey)(nil), "ikev2_set_local_key_799b69ec") api.RegisterMessage((*Ikev2SetLocalKeyReply)(nil), "ikev2_set_local_key_reply_e8d4e804") - api.RegisterMessage((*Ikev2SetResponder)(nil), "ikev2_set_responder_f0d3dc80") + api.RegisterMessage((*Ikev2SetResponder)(nil), "ikev2_set_responder_a2055df1") + api.RegisterMessage((*Ikev2SetResponderHostname)(nil), "ikev2_set_responder_hostname_350d6949") + api.RegisterMessage((*Ikev2SetResponderHostnameReply)(nil), "ikev2_set_responder_hostname_reply_e8d4e804") api.RegisterMessage((*Ikev2SetResponderReply)(nil), "ikev2_set_responder_reply_e8d4e804") api.RegisterMessage((*Ikev2SetSaLifetime)(nil), "ikev2_set_sa_lifetime_7039feaa") api.RegisterMessage((*Ikev2SetSaLifetimeReply)(nil), "ikev2_set_sa_lifetime_reply_e8d4e804") api.RegisterMessage((*Ikev2SetTunnelInterface)(nil), "ikev2_set_tunnel_interface_ca67182c") api.RegisterMessage((*Ikev2SetTunnelInterfaceReply)(nil), "ikev2_set_tunnel_interface_reply_e8d4e804") + api.RegisterMessage((*Ikev2TrafficSelectorDetails)(nil), "ikev2_traffic_selector_details_518cb06f") + api.RegisterMessage((*Ikev2TrafficSelectorDump)(nil), "ikev2_traffic_selector_dump_a7385e33") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*Ikev2ChildSaDetails)(nil), + (*Ikev2ChildSaDump)(nil), (*Ikev2InitiateDelChildSa)(nil), (*Ikev2InitiateDelChildSaReply)(nil), (*Ikev2InitiateDelIkeSa)(nil), @@ -1415,10 +2437,16 @@ func AllMessages() []api.Message { (*Ikev2InitiateRekeyChildSaReply)(nil), (*Ikev2InitiateSaInit)(nil), (*Ikev2InitiateSaInitReply)(nil), + (*Ikev2NonceGet)(nil), + (*Ikev2NonceGetReply)(nil), (*Ikev2PluginGetVersion)(nil), (*Ikev2PluginGetVersionReply)(nil), (*Ikev2ProfileAddDel)(nil), (*Ikev2ProfileAddDelReply)(nil), + (*Ikev2ProfileDetails)(nil), + (*Ikev2ProfileDisableNatt)(nil), + (*Ikev2ProfileDisableNattReply)(nil), + (*Ikev2ProfileDump)(nil), (*Ikev2ProfileSetAuth)(nil), (*Ikev2ProfileSetAuthReply)(nil), (*Ikev2ProfileSetID)(nil), @@ -1431,6 +2459,8 @@ func AllMessages() []api.Message { (*Ikev2ProfileSetTsReply)(nil), (*Ikev2ProfileSetUDPEncap)(nil), (*Ikev2ProfileSetUDPEncapReply)(nil), + (*Ikev2SaDetails)(nil), + (*Ikev2SaDump)(nil), (*Ikev2SetEspTransforms)(nil), (*Ikev2SetEspTransformsReply)(nil), (*Ikev2SetIkeTransforms)(nil), @@ -1438,10 +2468,14 @@ func AllMessages() []api.Message { (*Ikev2SetLocalKey)(nil), (*Ikev2SetLocalKeyReply)(nil), (*Ikev2SetResponder)(nil), + (*Ikev2SetResponderHostname)(nil), + (*Ikev2SetResponderHostnameReply)(nil), (*Ikev2SetResponderReply)(nil), (*Ikev2SetSaLifetime)(nil), (*Ikev2SetSaLifetimeReply)(nil), (*Ikev2SetTunnelInterface)(nil), (*Ikev2SetTunnelInterfaceReply)(nil), + (*Ikev2TrafficSelectorDetails)(nil), + (*Ikev2TrafficSelectorDump)(nil), } } diff --git a/binapi/ikev2/ikev2_rest.ba.go b/binapi/ikev2/ikev2_rest.ba.go deleted file mode 100644 index 9ffdffa..0000000 --- a/binapi/ikev2/ikev2_rest.ba.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ikev2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ikev2_initiate_del_child_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateDelChildSa) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2InitiateDelChildSa(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_initiate_del_ike_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateDelIkeSa) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2InitiateDelIkeSa(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_initiate_rekey_child_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateRekeyChildSa) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2InitiateRekeyChildSa(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_initiate_sa_init", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateSaInit) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2InitiateSaInit(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2PluginGetVersion) - reply, err := rpc.Ikev2PluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_auth", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetAuth) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetAuth(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_id", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetID) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetID(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_ipsec_udp_port", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetIpsecUDPPort) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetIpsecUDPPort(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_liveness", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetLiveness) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetLiveness(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_ts", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetTs) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetTs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_profile_set_udp_encap", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetUDPEncap) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2ProfileSetUDPEncap(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_esp_transforms", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetEspTransforms) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetEspTransforms(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_ike_transforms", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetIkeTransforms) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetIkeTransforms(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_local_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetLocalKey) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetLocalKey(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_responder", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetResponder) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetResponder(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_sa_lifetime", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetSaLifetime) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetSaLifetime(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ikev2_set_tunnel_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetTunnelInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ikev2SetTunnelInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ikev2/ikev2_rpc.ba.go b/binapi/ikev2/ikev2_rpc.ba.go index 59616cb..28ac780 100644 --- a/binapi/ikev2/ikev2_rpc.ba.go +++ b/binapi/ikev2/ikev2_rpc.ba.go @@ -4,29 +4,40 @@ package ikev2 import ( "context" - api "git.fd.io/govpp.git/api" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ikev2. +// RPCService defines RPC service ikev2. type RPCService interface { + Ikev2ChildSaDump(ctx context.Context, in *Ikev2ChildSaDump) (RPCService_Ikev2ChildSaDumpClient, error) Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) + Ikev2NonceGet(ctx context.Context, in *Ikev2NonceGet) (*Ikev2NonceGetReply, error) Ikev2PluginGetVersion(ctx context.Context, in *Ikev2PluginGetVersion) (*Ikev2PluginGetVersionReply, error) Ikev2ProfileAddDel(ctx context.Context, in *Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) + Ikev2ProfileDisableNatt(ctx context.Context, in *Ikev2ProfileDisableNatt) (*Ikev2ProfileDisableNattReply, error) + Ikev2ProfileDump(ctx context.Context, in *Ikev2ProfileDump) (RPCService_Ikev2ProfileDumpClient, error) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ikev2ProfileSetIpsecUDPPort) (*Ikev2ProfileSetIpsecUDPPortReply, error) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2ProfileSetLiveness) (*Ikev2ProfileSetLivenessReply, error) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2ProfileSetUDPEncap) (*Ikev2ProfileSetUDPEncapReply, error) + Ikev2SaDump(ctx context.Context, in *Ikev2SaDump) (RPCService_Ikev2SaDumpClient, error) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) + Ikev2SetResponderHostname(ctx context.Context, in *Ikev2SetResponderHostname) (*Ikev2SetResponderHostnameReply, error) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2SetTunnelInterface) (*Ikev2SetTunnelInterfaceReply, error) + Ikev2TrafficSelectorDump(ctx context.Context, in *Ikev2TrafficSelectorDump) (RPCService_Ikev2TrafficSelectorDumpClient, error) } type serviceClient struct { @@ -37,13 +48,56 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) Ikev2ChildSaDump(ctx context.Context, in *Ikev2ChildSaDump) (RPCService_Ikev2ChildSaDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Ikev2ChildSaDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Ikev2ChildSaDumpClient interface { + Recv() (*Ikev2ChildSaDetails, error) + api.Stream +} + +type serviceClient_Ikev2ChildSaDumpClient struct { + api.Stream +} + +func (c *serviceClient_Ikev2ChildSaDumpClient) Recv() (*Ikev2ChildSaDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Ikev2ChildSaDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + func (c *serviceClient) Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) { out := new(Ikev2InitiateDelChildSaReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) { @@ -52,7 +106,7 @@ func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2Init if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) { @@ -61,7 +115,7 @@ func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) { @@ -70,7 +124,16 @@ func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2Initia if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2NonceGet(ctx context.Context, in *Ikev2NonceGet) (*Ikev2NonceGetReply, error) { + out := new(Ikev2NonceGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2PluginGetVersion(ctx context.Context, in *Ikev2PluginGetVersion) (*Ikev2PluginGetVersionReply, error) { @@ -88,7 +151,59 @@ func (c *serviceClient) Ikev2ProfileAddDel(ctx context.Context, in *Ikev2Profile if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2ProfileDisableNatt(ctx context.Context, in *Ikev2ProfileDisableNatt) (*Ikev2ProfileDisableNattReply, error) { + out := new(Ikev2ProfileDisableNattReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2ProfileDump(ctx context.Context, in *Ikev2ProfileDump) (RPCService_Ikev2ProfileDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Ikev2ProfileDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Ikev2ProfileDumpClient interface { + Recv() (*Ikev2ProfileDetails, error) + api.Stream +} + +type serviceClient_Ikev2ProfileDumpClient struct { + api.Stream +} + +func (c *serviceClient_Ikev2ProfileDumpClient) Recv() (*Ikev2ProfileDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Ikev2ProfileDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) { @@ -97,7 +212,7 @@ func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2Profil if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) { @@ -106,7 +221,7 @@ func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ikev2ProfileSetIpsecUDPPort) (*Ikev2ProfileSetIpsecUDPPortReply, error) { @@ -115,7 +230,7 @@ func (c *serviceClient) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ike if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2ProfileSetLiveness) (*Ikev2ProfileSetLivenessReply, error) { @@ -124,7 +239,7 @@ func (c *serviceClient) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2Pr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) { @@ -133,7 +248,7 @@ func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2ProfileSetUDPEncap) (*Ikev2ProfileSetUDPEncapReply, error) { @@ -142,7 +257,50 @@ func (c *serviceClient) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2Pr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2SaDump(ctx context.Context, in *Ikev2SaDump) (RPCService_Ikev2SaDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Ikev2SaDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Ikev2SaDumpClient interface { + Recv() (*Ikev2SaDetails, error) + api.Stream +} + +type serviceClient_Ikev2SaDumpClient struct { + api.Stream +} + +func (c *serviceClient_Ikev2SaDumpClient) Recv() (*Ikev2SaDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Ikev2SaDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) { @@ -151,7 +309,7 @@ func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) { @@ -160,7 +318,7 @@ func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) { @@ -169,7 +327,7 @@ func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalK if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) { @@ -178,7 +336,16 @@ func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetRespo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2SetResponderHostname(ctx context.Context, in *Ikev2SetResponderHostname) (*Ikev2SetResponderHostnameReply, error) { + out := new(Ikev2SetResponderHostnameReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) { @@ -187,7 +354,7 @@ func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2SetTunnelInterface) (*Ikev2SetTunnelInterfaceReply, error) { @@ -196,5 +363,48 @@ func (c *serviceClient) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2Se if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Ikev2TrafficSelectorDump(ctx context.Context, in *Ikev2TrafficSelectorDump) (RPCService_Ikev2TrafficSelectorDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Ikev2TrafficSelectorDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Ikev2TrafficSelectorDumpClient interface { + Recv() (*Ikev2TrafficSelectorDetails, error) + api.Stream +} + +type serviceClient_Ikev2TrafficSelectorDumpClient struct { + api.Stream +} + +func (c *serviceClient_Ikev2TrafficSelectorDumpClient) Recv() (*Ikev2TrafficSelectorDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Ikev2TrafficSelectorDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } diff --git a/binapi/ikev2_types/ikev2_types.ba.go b/binapi/ikev2_types/ikev2_types.ba.go new file mode 100644 index 0000000..46d33fd --- /dev/null +++ b/binapi/ikev2_types/ikev2_types.ba.go @@ -0,0 +1,167 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/ikev2_types.api.json + +// Package ikev2_types contains generated bindings for API file ikev2_types.api. +// +// Contents: +// 12 structs +// +package ikev2_types + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ikev2_types" + APIVersion = "1.0.0" + VersionCrc = 0xe7510e +) + +// Ikev2Auth defines type 'ikev2_auth'. +type Ikev2Auth struct { + Method uint8 `binapi:"u8,name=method" json:"method,omitempty"` + Hex uint8 `binapi:"u8,name=hex" json:"hex,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"-"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +// Ikev2ChildSa defines type 'ikev2_child_sa'. +type Ikev2ChildSa struct { + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` + ChildSaIndex uint32 `binapi:"u32,name=child_sa_index" json:"child_sa_index,omitempty"` + ISpi uint32 `binapi:"u32,name=i_spi" json:"i_spi,omitempty"` + RSpi uint32 `binapi:"u32,name=r_spi" json:"r_spi,omitempty"` + Keys Ikev2Keys `binapi:"ikev2_keys,name=keys" json:"keys,omitempty"` + Encryption Ikev2SaTransform `binapi:"ikev2_sa_transform,name=encryption" json:"encryption,omitempty"` + Integrity Ikev2SaTransform `binapi:"ikev2_sa_transform,name=integrity" json:"integrity,omitempty"` + Esn Ikev2SaTransform `binapi:"ikev2_sa_transform,name=esn" json:"esn,omitempty"` +} + +// Ikev2EspTransforms defines type 'ikev2_esp_transforms'. +type Ikev2EspTransforms struct { + CryptoAlg uint8 `binapi:"u8,name=crypto_alg" json:"crypto_alg,omitempty"` + CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` + IntegAlg uint8 `binapi:"u8,name=integ_alg" json:"integ_alg,omitempty"` +} + +// Ikev2ID defines type 'ikev2_id'. +type Ikev2ID struct { + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + DataLen uint8 `binapi:"u8,name=data_len" json:"data_len,omitempty"` + Data string `binapi:"string[64],name=data" json:"data,omitempty"` +} + +// Ikev2IkeTransforms defines type 'ikev2_ike_transforms'. +type Ikev2IkeTransforms struct { + CryptoAlg uint8 `binapi:"u8,name=crypto_alg" json:"crypto_alg,omitempty"` + CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` + IntegAlg uint8 `binapi:"u8,name=integ_alg" json:"integ_alg,omitempty"` + DhGroup uint8 `binapi:"u8,name=dh_group" json:"dh_group,omitempty"` +} + +// Ikev2Keys defines type 'ikev2_keys'. +type Ikev2Keys struct { + SkD []byte `binapi:"u8[64],name=sk_d" json:"sk_d,omitempty"` + SkDLen uint8 `binapi:"u8,name=sk_d_len" json:"sk_d_len,omitempty"` + SkAi []byte `binapi:"u8[64],name=sk_ai" json:"sk_ai,omitempty"` + SkAiLen uint8 `binapi:"u8,name=sk_ai_len" json:"sk_ai_len,omitempty"` + SkAr []byte `binapi:"u8[64],name=sk_ar" json:"sk_ar,omitempty"` + SkArLen uint8 `binapi:"u8,name=sk_ar_len" json:"sk_ar_len,omitempty"` + SkEi []byte `binapi:"u8[64],name=sk_ei" json:"sk_ei,omitempty"` + SkEiLen uint8 `binapi:"u8,name=sk_ei_len" json:"sk_ei_len,omitempty"` + SkEr []byte `binapi:"u8[64],name=sk_er" json:"sk_er,omitempty"` + SkErLen uint8 `binapi:"u8,name=sk_er_len" json:"sk_er_len,omitempty"` + SkPi []byte `binapi:"u8[64],name=sk_pi" json:"sk_pi,omitempty"` + SkPiLen uint8 `binapi:"u8,name=sk_pi_len" json:"sk_pi_len,omitempty"` + SkPr []byte `binapi:"u8[64],name=sk_pr" json:"sk_pr,omitempty"` + SkPrLen uint8 `binapi:"u8,name=sk_pr_len" json:"sk_pr_len,omitempty"` +} + +// Ikev2Profile defines type 'ikev2_profile'. +type Ikev2Profile struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + LocID Ikev2ID `binapi:"ikev2_id,name=loc_id" json:"loc_id,omitempty"` + RemID Ikev2ID `binapi:"ikev2_id,name=rem_id" json:"rem_id,omitempty"` + LocTs Ikev2Ts `binapi:"ikev2_ts,name=loc_ts" json:"loc_ts,omitempty"` + RemTs Ikev2Ts `binapi:"ikev2_ts,name=rem_ts" json:"rem_ts,omitempty"` + Responder Ikev2Responder `binapi:"ikev2_responder,name=responder" json:"responder,omitempty"` + IkeTs Ikev2IkeTransforms `binapi:"ikev2_ike_transforms,name=ike_ts" json:"ike_ts,omitempty"` + EspTs Ikev2EspTransforms `binapi:"ikev2_esp_transforms,name=esp_ts" json:"esp_ts,omitempty"` + Lifetime uint64 `binapi:"u64,name=lifetime" json:"lifetime,omitempty"` + LifetimeMaxdata uint64 `binapi:"u64,name=lifetime_maxdata" json:"lifetime_maxdata,omitempty"` + LifetimeJitter uint32 `binapi:"u32,name=lifetime_jitter" json:"lifetime_jitter,omitempty"` + Handover uint32 `binapi:"u32,name=handover" json:"handover,omitempty"` + IpsecOverUDPPort uint16 `binapi:"u16,name=ipsec_over_udp_port" json:"ipsec_over_udp_port,omitempty"` + TunItf uint32 `binapi:"u32,name=tun_itf" json:"tun_itf,omitempty"` + UDPEncap bool `binapi:"bool,name=udp_encap" json:"udp_encap,omitempty"` + NattDisabled bool `binapi:"bool,name=natt_disabled" json:"natt_disabled,omitempty"` + Auth Ikev2Auth `binapi:"ikev2_auth,name=auth" json:"auth,omitempty"` +} + +// Ikev2Responder defines type 'ikev2_responder'. +type Ikev2Responder struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr ip_types.Address `binapi:"address,name=addr" json:"addr,omitempty"` +} + +// Ikev2Sa defines type 'ikev2_sa'. +type Ikev2Sa struct { + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` + ProfileIndex uint32 `binapi:"u32,name=profile_index" json:"profile_index,omitempty"` + Ispi uint64 `binapi:"u64,name=ispi" json:"ispi,omitempty"` + Rspi uint64 `binapi:"u64,name=rspi" json:"rspi,omitempty"` + Iaddr ip_types.Address `binapi:"address,name=iaddr" json:"iaddr,omitempty"` + Raddr ip_types.Address `binapi:"address,name=raddr" json:"raddr,omitempty"` + Keys Ikev2Keys `binapi:"ikev2_keys,name=keys" json:"keys,omitempty"` + IID Ikev2ID `binapi:"ikev2_id,name=i_id" json:"i_id,omitempty"` + RID Ikev2ID `binapi:"ikev2_id,name=r_id" json:"r_id,omitempty"` + Encryption Ikev2SaTransform `binapi:"ikev2_sa_transform,name=encryption" json:"encryption,omitempty"` + Integrity Ikev2SaTransform `binapi:"ikev2_sa_transform,name=integrity" json:"integrity,omitempty"` + Prf Ikev2SaTransform `binapi:"ikev2_sa_transform,name=prf" json:"prf,omitempty"` + Dh Ikev2SaTransform `binapi:"ikev2_sa_transform,name=dh" json:"dh,omitempty"` + Stats Ikev2SaStats `binapi:"ikev2_sa_stats,name=stats" json:"stats,omitempty"` +} + +// Ikev2SaStats defines type 'ikev2_sa_stats'. +type Ikev2SaStats struct { + NKeepalives uint16 `binapi:"u16,name=n_keepalives" json:"n_keepalives,omitempty"` + NRekeyReq uint16 `binapi:"u16,name=n_rekey_req" json:"n_rekey_req,omitempty"` + NSaInitReq uint16 `binapi:"u16,name=n_sa_init_req" json:"n_sa_init_req,omitempty"` + NSaAuthReq uint16 `binapi:"u16,name=n_sa_auth_req" json:"n_sa_auth_req,omitempty"` + NRetransmit uint16 `binapi:"u16,name=n_retransmit" json:"n_retransmit,omitempty"` + NInitSaRetransmit uint16 `binapi:"u16,name=n_init_sa_retransmit" json:"n_init_sa_retransmit,omitempty"` +} + +// Ikev2SaTransform defines type 'ikev2_sa_transform'. +type Ikev2SaTransform struct { + TransformType uint8 `binapi:"u8,name=transform_type" json:"transform_type,omitempty"` + TransformID uint16 `binapi:"u16,name=transform_id" json:"transform_id,omitempty"` + KeyLen uint16 `binapi:"u16,name=key_len" json:"key_len,omitempty"` + KeyTrunc uint16 `binapi:"u16,name=key_trunc" json:"key_trunc,omitempty"` + BlockSize uint16 `binapi:"u16,name=block_size" json:"block_size,omitempty"` + DhGroup uint8 `binapi:"u8,name=dh_group" json:"dh_group,omitempty"` +} + +// Ikev2Ts defines type 'ikev2_ts'. +type Ikev2Ts struct { + SaIndex uint32 `binapi:"u32,name=sa_index" json:"sa_index,omitempty"` + ChildSaIndex uint32 `binapi:"u32,name=child_sa_index" json:"child_sa_index,omitempty"` + IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` + ProtocolID uint8 `binapi:"u8,name=protocol_id" json:"protocol_id,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` + StartAddr ip_types.Address `binapi:"address,name=start_addr" json:"start_addr,omitempty"` + EndAddr ip_types.Address `binapi:"address,name=end_addr" json:"end_addr,omitempty"` +} diff --git a/binapi/interface/interface.ba.go b/binapi/interface/interface.ba.go index 822c325..9561eff 100644 --- a/binapi/interface/interface.ba.go +++ b/binapi/interface/interface.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/interface.api.json // Package interfaces contains generated bindings for API file interface.api. // // Contents: -// 57 messages +// 66 messages // package interfaces import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,8 +27,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "interface" - APIVersion = "3.2.2" - VersionCrc = 0x58d4cf5a + APIVersion = "3.2.3" + VersionCrc = 0x13ab947a ) // CollectDetailedInterfaceStats defines message 'collect_detailed_interface_stats'. @@ -264,7 +264,7 @@ type CreateSubif struct { func (m *CreateSubif) Reset() { *m = CreateSubif{} } func (*CreateSubif) GetMessageName() string { return "create_subif" } -func (*CreateSubif) GetCrcString() string { return "cb371063" } +func (*CreateSubif) GetCrcString() string { return "790ca755" } func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } @@ -695,7 +695,7 @@ type SwInterfaceAddDelAddress struct { func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } -func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } +func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5463d73b" } func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1075,7 +1075,7 @@ type SwInterfaceDetails struct { func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } -func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } +func (*SwInterfaceDetails) GetCrcString() string { return "6c221fc7" } func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1236,7 +1236,7 @@ type SwInterfaceEvent struct { func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } -func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } +func (*SwInterfaceEvent) GetCrcString() string { return "2d3d95a7" } func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -1429,7 +1429,7 @@ func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDet func (*SwInterfaceRxPlacementDetails) GetMessageName() string { return "sw_interface_rx_placement_details" } -func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "9e44a7ce" } func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1505,7 +1505,7 @@ type SwInterfaceSetFlags struct { func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } -func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } +func (*SwInterfaceSetFlags) GetCrcString() string { return "f5aec1b8" } func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1567,6 +1567,78 @@ func (m *SwInterfaceSetFlagsReply) Unmarshal(b []byte) error { return nil } +// SwInterfaceSetInterfaceName defines message 'sw_interface_set_interface_name'. +type SwInterfaceSetInterfaceName struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *SwInterfaceSetInterfaceName) Reset() { *m = SwInterfaceSetInterfaceName{} } +func (*SwInterfaceSetInterfaceName) GetMessageName() string { return "sw_interface_set_interface_name" } +func (*SwInterfaceSetInterfaceName) GetCrcString() string { return "45a1d548" } +func (*SwInterfaceSetInterfaceName) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetInterfaceName) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 64 // m.Name + return size +} +func (m *SwInterfaceSetInterfaceName) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetInterfaceName) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Name = buf.DecodeString(64) + return nil +} + +// SwInterfaceSetInterfaceNameReply defines message 'sw_interface_set_interface_name_reply'. +type SwInterfaceSetInterfaceNameReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetInterfaceNameReply) Reset() { *m = SwInterfaceSetInterfaceNameReply{} } +func (*SwInterfaceSetInterfaceNameReply) GetMessageName() string { + return "sw_interface_set_interface_name_reply" +} +func (*SwInterfaceSetInterfaceNameReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetInterfaceNameReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetInterfaceNameReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetInterfaceNameReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetInterfaceNameReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceSetIPDirectedBroadcast defines message 'sw_interface_set_ip_directed_broadcast'. type SwInterfaceSetIPDirectedBroadcast struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1651,7 +1723,7 @@ type SwInterfaceSetMacAddress struct { func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } -func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } +func (*SwInterfaceSetMacAddress) GetCrcString() string { return "c536e7eb" } func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1794,6 +1866,76 @@ func (m *SwInterfaceSetMtuReply) Unmarshal(b []byte) error { return nil } +// SwInterfaceSetPromisc defines message 'sw_interface_set_promisc'. +type SwInterfaceSetPromisc struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PromiscOn bool `binapi:"bool,name=promisc_on" json:"promisc_on,omitempty"` +} + +func (m *SwInterfaceSetPromisc) Reset() { *m = SwInterfaceSetPromisc{} } +func (*SwInterfaceSetPromisc) GetMessageName() string { return "sw_interface_set_promisc" } +func (*SwInterfaceSetPromisc) GetCrcString() string { return "d40860d4" } +func (*SwInterfaceSetPromisc) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetPromisc) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.PromiscOn + return size +} +func (m *SwInterfaceSetPromisc) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.PromiscOn) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetPromisc) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PromiscOn = buf.DecodeBool() + return nil +} + +// SwInterfaceSetPromiscReply defines message 'sw_interface_set_promisc_reply'. +type SwInterfaceSetPromiscReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetPromiscReply) Reset() { *m = SwInterfaceSetPromiscReply{} } +func (*SwInterfaceSetPromiscReply) GetMessageName() string { return "sw_interface_set_promisc_reply" } +func (*SwInterfaceSetPromiscReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetPromiscReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetPromiscReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetPromiscReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetPromiscReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceSetRxMode defines message 'sw_interface_set_rx_mode'. type SwInterfaceSetRxMode struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1804,7 +1946,7 @@ type SwInterfaceSetRxMode struct { func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } -func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } +func (*SwInterfaceSetRxMode) GetCrcString() string { return "b04d1cfe" } func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2026,6 +2168,95 @@ func (m *SwInterfaceSetTableReply) Unmarshal(b []byte) error { return nil } +// SwInterfaceSetTxPlacement defines message 'sw_interface_set_tx_placement'. +type SwInterfaceSetTxPlacement struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + ArraySize uint32 `binapi:"u32,name=array_size" json:"-"` + Threads []uint32 `binapi:"u32[array_size],name=threads" json:"threads,omitempty"` +} + +func (m *SwInterfaceSetTxPlacement) Reset() { *m = SwInterfaceSetTxPlacement{} } +func (*SwInterfaceSetTxPlacement) GetMessageName() string { return "sw_interface_set_tx_placement" } +func (*SwInterfaceSetTxPlacement) GetCrcString() string { return "4e0cd5ff" } +func (*SwInterfaceSetTxPlacement) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetTxPlacement) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 4 // m.ArraySize + size += 4 * len(m.Threads) // m.Threads + return size +} +func (m *SwInterfaceSetTxPlacement) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.QueueID) + buf.EncodeUint32(uint32(len(m.Threads))) + for i := 0; i < len(m.Threads); i++ { + var x uint32 + if i < len(m.Threads) { + x = uint32(m.Threads[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceSetTxPlacement) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.ArraySize = buf.DecodeUint32() + m.Threads = make([]uint32, m.ArraySize) + for i := 0; i < len(m.Threads); i++ { + m.Threads[i] = buf.DecodeUint32() + } + return nil +} + +// SwInterfaceSetTxPlacementReply defines message 'sw_interface_set_tx_placement_reply'. +type SwInterfaceSetTxPlacementReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetTxPlacementReply) Reset() { *m = SwInterfaceSetTxPlacementReply{} } +func (*SwInterfaceSetTxPlacementReply) GetMessageName() string { + return "sw_interface_set_tx_placement_reply" +} +func (*SwInterfaceSetTxPlacementReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetTxPlacementReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetTxPlacementReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetTxPlacementReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetTxPlacementReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceSetUnnumbered defines message 'sw_interface_set_unnumbered'. type SwInterfaceSetUnnumbered struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -2035,7 +2266,7 @@ type SwInterfaceSetUnnumbered struct { func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } -func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } +func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "154a6439" } func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2176,6 +2407,142 @@ func (m *SwInterfaceTagAddDelReply) Unmarshal(b []byte) error { return nil } +// SwInterfaceTxPlacementDetails defines message 'sw_interface_tx_placement_details'. +type SwInterfaceTxPlacementDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Shared uint8 `binapi:"u8,name=shared" json:"shared,omitempty"` + ArraySize uint32 `binapi:"u32,name=array_size" json:"-"` + Threads []uint32 `binapi:"u32[array_size],name=threads" json:"threads,omitempty"` +} + +func (m *SwInterfaceTxPlacementDetails) Reset() { *m = SwInterfaceTxPlacementDetails{} } +func (*SwInterfaceTxPlacementDetails) GetMessageName() string { + return "sw_interface_tx_placement_details" +} +func (*SwInterfaceTxPlacementDetails) GetCrcString() string { return "00381a2e" } +func (*SwInterfaceTxPlacementDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceTxPlacementDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 1 // m.Shared + size += 4 // m.ArraySize + size += 4 * len(m.Threads) // m.Threads + return size +} +func (m *SwInterfaceTxPlacementDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.QueueID) + buf.EncodeUint8(m.Shared) + buf.EncodeUint32(uint32(len(m.Threads))) + for i := 0; i < len(m.Threads); i++ { + var x uint32 + if i < len(m.Threads) { + x = uint32(m.Threads[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceTxPlacementDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.Shared = buf.DecodeUint8() + m.ArraySize = buf.DecodeUint32() + m.Threads = make([]uint32, m.ArraySize) + for i := 0; i < len(m.Threads); i++ { + m.Threads[i] = buf.DecodeUint32() + } + return nil +} + +// SwInterfaceTxPlacementGet defines message 'sw_interface_tx_placement_get'. +type SwInterfaceTxPlacementGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceTxPlacementGet) Reset() { *m = SwInterfaceTxPlacementGet{} } +func (*SwInterfaceTxPlacementGet) GetMessageName() string { return "sw_interface_tx_placement_get" } +func (*SwInterfaceTxPlacementGet) GetCrcString() string { return "47250981" } +func (*SwInterfaceTxPlacementGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceTxPlacementGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceTxPlacementGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceTxPlacementGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceTxPlacementGetReply defines message 'sw_interface_tx_placement_get_reply'. +type SwInterfaceTxPlacementGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *SwInterfaceTxPlacementGetReply) Reset() { *m = SwInterfaceTxPlacementGetReply{} } +func (*SwInterfaceTxPlacementGetReply) GetMessageName() string { + return "sw_interface_tx_placement_get_reply" +} +func (*SwInterfaceTxPlacementGetReply) GetCrcString() string { return "53b48f5d" } +func (*SwInterfaceTxPlacementGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceTxPlacementGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *SwInterfaceTxPlacementGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *SwInterfaceTxPlacementGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + // WantInterfaceEvents defines message 'want_interface_events'. type WantInterfaceEvents struct { EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` @@ -2254,7 +2621,7 @@ func file_interfaces_binapi_init() { api.RegisterMessage((*CreateLoopbackInstance)(nil), "create_loopback_instance_d36a3ee2") api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "create_loopback_instance_reply_5383d31f") api.RegisterMessage((*CreateLoopbackReply)(nil), "create_loopback_reply_5383d31f") - api.RegisterMessage((*CreateSubif)(nil), "create_subif_cb371063") + api.RegisterMessage((*CreateSubif)(nil), "create_subif_790ca755") api.RegisterMessage((*CreateSubifReply)(nil), "create_subif_reply_5383d31f") api.RegisterMessage((*CreateVlanSubif)(nil), "create_vlan_subif_af34ac8b") api.RegisterMessage((*CreateVlanSubifReply)(nil), "create_vlan_subif_reply_5383d31f") @@ -2266,7 +2633,7 @@ func file_interfaces_binapi_init() { api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "hw_interface_set_mtu_reply_e8d4e804") api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface_name_renumber_2b8858b8") api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface_name_renumber_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "sw_interface_add_del_address_5803d5c4") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "sw_interface_add_del_address_5463d73b") api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "sw_interface_add_del_address_reply_e8d4e804") api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "sw_interface_add_del_mac_address_638bb9f4") api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "sw_interface_add_del_mac_address_reply_e8d4e804") @@ -2276,33 +2643,42 @@ func file_interfaces_binapi_init() { api.RegisterMessage((*SwInterfaceAddressReplaceEndReply)(nil), "sw_interface_address_replace_end_reply_e8d4e804") api.RegisterMessage((*SwInterfaceClearStats)(nil), "sw_interface_clear_stats_f9e6675e") api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "sw_interface_clear_stats_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceDetails)(nil), "sw_interface_details_17b69fa2") + api.RegisterMessage((*SwInterfaceDetails)(nil), "sw_interface_details_6c221fc7") api.RegisterMessage((*SwInterfaceDump)(nil), "sw_interface_dump_aa610c27") - api.RegisterMessage((*SwInterfaceEvent)(nil), "sw_interface_event_f709f78d") + api.RegisterMessage((*SwInterfaceEvent)(nil), "sw_interface_event_2d3d95a7") api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "sw_interface_get_mac_address_f9e6675e") api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "sw_interface_get_mac_address_reply_40ef2c08") api.RegisterMessage((*SwInterfaceGetTable)(nil), "sw_interface_get_table_2d033de4") api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "sw_interface_get_table_reply_a6eb0109") - api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "sw_interface_rx_placement_details_f6d7d024") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "sw_interface_rx_placement_details_9e44a7ce") api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "sw_interface_rx_placement_dump_f9e6675e") - api.RegisterMessage((*SwInterfaceSetFlags)(nil), "sw_interface_set_flags_6a2b491a") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "sw_interface_set_flags_f5aec1b8") api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "sw_interface_set_flags_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetInterfaceName)(nil), "sw_interface_set_interface_name_45a1d548") + api.RegisterMessage((*SwInterfaceSetInterfaceNameReply)(nil), "sw_interface_set_interface_name_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "sw_interface_set_ip_directed_broadcast_ae6cfcfb") api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "sw_interface_set_ip_directed_broadcast_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "sw_interface_set_mac_address_6aca746a") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "sw_interface_set_mac_address_c536e7eb") api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "sw_interface_set_mac_address_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetMtu)(nil), "sw_interface_set_mtu_5cbe85e5") api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "sw_interface_set_mtu_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "sw_interface_set_rx_mode_780f5cee") + api.RegisterMessage((*SwInterfaceSetPromisc)(nil), "sw_interface_set_promisc_d40860d4") + api.RegisterMessage((*SwInterfaceSetPromiscReply)(nil), "sw_interface_set_promisc_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "sw_interface_set_rx_mode_b04d1cfe") api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "sw_interface_set_rx_mode_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "sw_interface_set_rx_placement_db65f3c9") api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "sw_interface_set_rx_placement_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetTable)(nil), "sw_interface_set_table_df42a577") api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "sw_interface_set_table_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "sw_interface_set_unnumbered_938ef33b") + api.RegisterMessage((*SwInterfaceSetTxPlacement)(nil), "sw_interface_set_tx_placement_4e0cd5ff") + api.RegisterMessage((*SwInterfaceSetTxPlacementReply)(nil), "sw_interface_set_tx_placement_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "sw_interface_set_unnumbered_154a6439") api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "sw_interface_set_unnumbered_reply_e8d4e804") api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "sw_interface_tag_add_del_426f8bc1") api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "sw_interface_tag_add_del_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceTxPlacementDetails)(nil), "sw_interface_tx_placement_details_00381a2e") + api.RegisterMessage((*SwInterfaceTxPlacementGet)(nil), "sw_interface_tx_placement_get_47250981") + api.RegisterMessage((*SwInterfaceTxPlacementGetReply)(nil), "sw_interface_tx_placement_get_reply_53b48f5d") api.RegisterMessage((*WantInterfaceEvents)(nil), "want_interface_events_476f5a08") api.RegisterMessage((*WantInterfaceEventsReply)(nil), "want_interface_events_reply_e8d4e804") } @@ -2349,22 +2725,31 @@ func AllMessages() []api.Message { (*SwInterfaceRxPlacementDump)(nil), (*SwInterfaceSetFlags)(nil), (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetInterfaceName)(nil), + (*SwInterfaceSetInterfaceNameReply)(nil), (*SwInterfaceSetIPDirectedBroadcast)(nil), (*SwInterfaceSetIPDirectedBroadcastReply)(nil), (*SwInterfaceSetMacAddress)(nil), (*SwInterfaceSetMacAddressReply)(nil), (*SwInterfaceSetMtu)(nil), (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetPromisc)(nil), + (*SwInterfaceSetPromiscReply)(nil), (*SwInterfaceSetRxMode)(nil), (*SwInterfaceSetRxModeReply)(nil), (*SwInterfaceSetRxPlacement)(nil), (*SwInterfaceSetRxPlacementReply)(nil), (*SwInterfaceSetTable)(nil), (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetTxPlacement)(nil), + (*SwInterfaceSetTxPlacementReply)(nil), (*SwInterfaceSetUnnumbered)(nil), (*SwInterfaceSetUnnumberedReply)(nil), (*SwInterfaceTagAddDel)(nil), (*SwInterfaceTagAddDelReply)(nil), + (*SwInterfaceTxPlacementDetails)(nil), + (*SwInterfaceTxPlacementGet)(nil), + (*SwInterfaceTxPlacementGetReply)(nil), (*WantInterfaceEvents)(nil), (*WantInterfaceEventsReply)(nil), } diff --git a/binapi/interface/interface_rest.ba.go b/binapi/interface/interface_rest.ba.go deleted file mode 100644 index da5b899..0000000 --- a/binapi/interface/interface_rest.ba.go +++ /dev/null @@ -1,594 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package interfaces - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/collect_detailed_interface_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(CollectDetailedInterfaceStats) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CollectDetailedInterfaceStats(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/create_loopback", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateLoopback) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CreateLoopback(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/create_loopback_instance", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateLoopbackInstance) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CreateLoopbackInstance(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/create_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateSubif) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CreateSubif(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/create_vlan_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateVlanSubif) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CreateVlanSubif(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/delete_loopback", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteLoopback) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DeleteLoopback(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/delete_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteSubif) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DeleteSubif(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/hw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { - var request = new(HwInterfaceSetMtu) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.HwInterfaceSetMtu(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/interface_name_renumber", func(w http.ResponseWriter, req *http.Request) { - var request = new(InterfaceNameRenumber) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.InterfaceNameRenumber(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_add_del_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddDelAddress) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceAddDelAddress(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_add_del_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddDelMacAddress) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceAddDelMacAddress(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_address_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddressReplaceBegin) - reply, err := rpc.SwInterfaceAddressReplaceBegin(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_address_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddressReplaceEnd) - reply, err := rpc.SwInterfaceAddressReplaceEnd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_clear_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceClearStats) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceClearStats(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_get_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceGetMacAddress) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceGetMacAddress(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_get_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceGetTable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceGetTable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetFlags) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetFlags(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_ip_directed_broadcast", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetIPDirectedBroadcast) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetIPDirectedBroadcast(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMacAddress) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetMacAddress(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMtu) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetMtu(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_rx_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetRxMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetRxMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_rx_placement", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetRxPlacement) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetRxPlacement(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetTable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetTable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_unnumbered", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetUnnumbered) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetUnnumbered(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_tag_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceTagAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceTagAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_interface_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantInterfaceEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantInterfaceEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/interface/interface_rpc.ba.go b/binapi/interface/interface_rpc.ba.go index 6dc6a43..a175403 100644 --- a/binapi/interface/interface_rpc.ba.go +++ b/binapi/interface/interface_rpc.ba.go @@ -5,12 +5,13 @@ package interfaces import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service interface. +// RPCService defines RPC service interface. type RPCService interface { CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) @@ -31,14 +32,18 @@ type RPCService interface { SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetInterfaceName(ctx context.Context, in *SwInterfaceSetInterfaceName) (*SwInterfaceSetInterfaceNameReply, error) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetPromisc(ctx context.Context, in *SwInterfaceSetPromisc) (*SwInterfaceSetPromiscReply, error) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetTxPlacement(ctx context.Context, in *SwInterfaceSetTxPlacement) (*SwInterfaceSetTxPlacementReply, error) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + SwInterfaceTxPlacementGet(ctx context.Context, in *SwInterfaceTxPlacementGet) (RPCService_SwInterfaceTxPlacementGetClient, error) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) } @@ -56,7 +61,7 @@ func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *C if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { @@ -65,7 +70,7 @@ func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { @@ -74,7 +79,7 @@ func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { @@ -83,7 +88,7 @@ func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*Crea if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { @@ -92,7 +97,7 @@ func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { @@ -101,7 +106,7 @@ func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { @@ -110,7 +115,7 @@ func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*Dele if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { @@ -119,7 +124,7 @@ func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { @@ -128,7 +133,7 @@ func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *Interface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { @@ -137,7 +142,7 @@ func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { @@ -146,7 +151,7 @@ func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) { @@ -155,7 +160,7 @@ func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) { @@ -164,7 +169,7 @@ func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { @@ -173,7 +178,7 @@ func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) { @@ -185,7 +190,7 @@ func (c *serviceClient) SwInterfaceDump(ctx context.Context, in *SwInterfaceDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -208,7 +213,11 @@ func (c *serviceClient_SwInterfaceDumpClient) Recv() (*SwInterfaceDetails, error switch m := msg.(type) { case *SwInterfaceDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -221,7 +230,7 @@ func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { @@ -230,7 +239,7 @@ func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) { @@ -242,7 +251,7 @@ func (c *serviceClient) SwInterfaceRxPlacementDump(ctx context.Context, in *SwIn if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -265,7 +274,11 @@ func (c *serviceClient_SwInterfaceRxPlacementDumpClient) Recv() (*SwInterfaceRxP switch m := msg.(type) { case *SwInterfaceRxPlacementDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -278,7 +291,16 @@ func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwInterfaceSetInterfaceName(ctx context.Context, in *SwInterfaceSetInterfaceName) (*SwInterfaceSetInterfaceNameReply, error) { + out := new(SwInterfaceSetInterfaceNameReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { @@ -287,7 +309,7 @@ func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { @@ -296,7 +318,7 @@ func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { @@ -305,7 +327,16 @@ func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwInterfaceSetPromisc(ctx context.Context, in *SwInterfaceSetPromisc) (*SwInterfaceSetPromiscReply, error) { + out := new(SwInterfaceSetPromiscReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { @@ -314,7 +345,7 @@ func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { @@ -323,7 +354,7 @@ func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { @@ -332,7 +363,16 @@ func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwInterfaceSetTxPlacement(ctx context.Context, in *SwInterfaceSetTxPlacement) (*SwInterfaceSetTxPlacementReply, error) { + out := new(SwInterfaceSetTxPlacementReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { @@ -341,7 +381,7 @@ func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { @@ -350,7 +390,47 @@ func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwInterfaceTxPlacementGet(ctx context.Context, in *SwInterfaceTxPlacementGet) (RPCService_SwInterfaceTxPlacementGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceTxPlacementGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceTxPlacementGetClient interface { + Recv() (*SwInterfaceTxPlacementDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceTxPlacementGetClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceTxPlacementGetClient) Recv() (*SwInterfaceTxPlacementDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceTxPlacementDetails: + return m, nil + case *SwInterfaceTxPlacementGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { @@ -359,5 +439,5 @@ func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/interface_types/interface_types.ba.go b/binapi/interface_types/interface_types.ba.go index 607dc9b..a00d5cf 100644 --- a/binapi/interface_types/interface_types.ba.go +++ b/binapi/interface_types/interface_types.ba.go @@ -1,20 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/interface_types.api.json // Package interface_types contains generated bindings for API file interface_types.api. // // Contents: // 1 alias -// 6 enums +// 7 enums // package interface_types import ( - api "git.fd.io/govpp.git/api" "strconv" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -23,6 +24,39 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "interface_types" + APIVersion = "1.0.0" + VersionCrc = 0x7f2ba79a +) + +// Direction defines enum 'direction'. +type Direction uint8 + +const ( + RX Direction = 0 + TX Direction = 1 +) + +var ( + Direction_name = map[uint8]string{ + 0: "RX", + 1: "TX", + } + Direction_value = map[string]uint8{ + "RX": 0, + "TX": 1, + } +) + +func (x Direction) String() string { + s, ok := Direction_name[uint8(x)] + if ok { + return s + } + return "Direction(" + strconv.Itoa(int(x)) + ")" +} + // IfStatusFlags defines enum 'if_status_flags'. type IfStatusFlags uint32 diff --git a/binapi/ioam_cache/ioam_cache.ba.go b/binapi/ioam_cache/ioam_cache.ba.go index 2f9f0ef..22da832 100644 --- a/binapi/ioam_cache/ioam_cache.ba.go +++ b/binapi/ioam_cache/ioam_cache.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/ioam_cache.api.json // Package ioam_cache contains generated bindings for API file ioam_cache.api. @@ -12,8 +12,8 @@ package ioam_cache import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/ioam_cache/ioam_cache_rest.ba.go b/binapi/ioam_cache/ioam_cache_rest.ba.go deleted file mode 100644 index 4090307..0000000 --- a/binapi/ioam_cache/ioam_cache_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_cache - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_cache_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamCacheIP6EnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IoamCacheIP6EnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ioam_cache/ioam_cache_rpc.ba.go b/binapi/ioam_cache/ioam_cache_rpc.ba.go index 33a721f..619181a 100644 --- a/binapi/ioam_cache/ioam_cache_rpc.ba.go +++ b/binapi/ioam_cache/ioam_cache_rpc.ba.go @@ -4,10 +4,11 @@ package ioam_cache import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service ioam_cache. +// RPCService defines RPC service ioam_cache. type RPCService interface { IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) IoamCacheIP6EnableDisable(ctx context.Context, in *IoamC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ioam_export/ioam_export.ba.go b/binapi/ioam_export/ioam_export.ba.go index 47dd4e2..59fe4d0 100644 --- a/binapi/ioam_export/ioam_export.ba.go +++ b/binapi/ioam_export/ioam_export.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/ioam_export.api.json // Package ioam_export contains generated bindings for API file ioam_export.api. @@ -12,9 +12,9 @@ package ioam_export import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ioam_export" APIVersion = "1.0.0" - VersionCrc = 0x56bd3b73 + VersionCrc = 0x26bebf64 ) // IoamExportIP6EnableDisable defines message 'ioam_export_ip6_enable_disable'. @@ -38,7 +38,7 @@ type IoamExportIP6EnableDisable struct { func (m *IoamExportIP6EnableDisable) Reset() { *m = IoamExportIP6EnableDisable{} } func (*IoamExportIP6EnableDisable) GetMessageName() string { return "ioam_export_ip6_enable_disable" } -func (*IoamExportIP6EnableDisable) GetCrcString() string { return "e4d4ebfa" } +func (*IoamExportIP6EnableDisable) GetCrcString() string { return "d4c76d3a" } func (*IoamExportIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -107,7 +107,7 @@ func (m *IoamExportIP6EnableDisableReply) Unmarshal(b []byte) error { func init() { file_ioam_export_binapi_init() } func file_ioam_export_binapi_init() { - api.RegisterMessage((*IoamExportIP6EnableDisable)(nil), "ioam_export_ip6_enable_disable_e4d4ebfa") + api.RegisterMessage((*IoamExportIP6EnableDisable)(nil), "ioam_export_ip6_enable_disable_d4c76d3a") api.RegisterMessage((*IoamExportIP6EnableDisableReply)(nil), "ioam_export_ip6_enable_disable_reply_e8d4e804") } diff --git a/binapi/ioam_export/ioam_export_rest.ba.go b/binapi/ioam_export/ioam_export_rest.ba.go deleted file mode 100644 index 06ee0bc..0000000 --- a/binapi/ioam_export/ioam_export_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_export_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamExportIP6EnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IoamExportIP6EnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ioam_export/ioam_export_rpc.ba.go b/binapi/ioam_export/ioam_export_rpc.ba.go index 584a563..32170e8 100644 --- a/binapi/ioam_export/ioam_export_rpc.ba.go +++ b/binapi/ioam_export/ioam_export_rpc.ba.go @@ -4,10 +4,11 @@ package ioam_export import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service ioam_export. +// RPCService defines RPC service ioam_export. type RPCService interface { IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) IoamExportIP6EnableDisable(ctx context.Context, in *Ioam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go index 7d1bb35..78541c3 100644 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/ioam_vxlan_gpe.api.json // Package ioam_vxlan_gpe contains generated bindings for API file ioam_vxlan_gpe.api. @@ -12,9 +12,9 @@ package ioam_vxlan_gpe import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ioam_vxlan_gpe" APIVersion = "1.0.0" - VersionCrc = 0xe60c2de2 + VersionCrc = 0xb49eb0b9 ) // VxlanGpeIoamDisable defines message 'vxlan_gpe_ioam_disable'. @@ -181,7 +181,7 @@ type VxlanGpeIoamTransitDisable struct { func (m *VxlanGpeIoamTransitDisable) Reset() { *m = VxlanGpeIoamTransitDisable{} } func (*VxlanGpeIoamTransitDisable) GetMessageName() string { return "vxlan_gpe_ioam_transit_disable" } -func (*VxlanGpeIoamTransitDisable) GetCrcString() string { return "553f5b7b" } +func (*VxlanGpeIoamTransitDisable) GetCrcString() string { return "3d3ec657" } func (*VxlanGpeIoamTransitDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -256,7 +256,7 @@ type VxlanGpeIoamTransitEnable struct { func (m *VxlanGpeIoamTransitEnable) Reset() { *m = VxlanGpeIoamTransitEnable{} } func (*VxlanGpeIoamTransitEnable) GetMessageName() string { return "vxlan_gpe_ioam_transit_enable" } -func (*VxlanGpeIoamTransitEnable) GetCrcString() string { return "553f5b7b" } +func (*VxlanGpeIoamTransitEnable) GetCrcString() string { return "3d3ec657" } func (*VxlanGpeIoamTransitEnable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -332,7 +332,7 @@ type VxlanGpeIoamVniDisable struct { func (m *VxlanGpeIoamVniDisable) Reset() { *m = VxlanGpeIoamVniDisable{} } func (*VxlanGpeIoamVniDisable) GetMessageName() string { return "vxlan_gpe_ioam_vni_disable" } -func (*VxlanGpeIoamVniDisable) GetCrcString() string { return "997161fb" } +func (*VxlanGpeIoamVniDisable) GetCrcString() string { return "0fbb5fb1" } func (*VxlanGpeIoamVniDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -414,7 +414,7 @@ type VxlanGpeIoamVniEnable struct { func (m *VxlanGpeIoamVniEnable) Reset() { *m = VxlanGpeIoamVniEnable{} } func (*VxlanGpeIoamVniEnable) GetMessageName() string { return "vxlan_gpe_ioam_vni_enable" } -func (*VxlanGpeIoamVniEnable) GetCrcString() string { return "997161fb" } +func (*VxlanGpeIoamVniEnable) GetCrcString() string { return "0fbb5fb1" } func (*VxlanGpeIoamVniEnable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -491,13 +491,13 @@ func file_ioam_vxlan_gpe_binapi_init() { api.RegisterMessage((*VxlanGpeIoamDisableReply)(nil), "vxlan_gpe_ioam_disable_reply_e8d4e804") api.RegisterMessage((*VxlanGpeIoamEnable)(nil), "vxlan_gpe_ioam_enable_2481bef7") api.RegisterMessage((*VxlanGpeIoamEnableReply)(nil), "vxlan_gpe_ioam_enable_reply_e8d4e804") - api.RegisterMessage((*VxlanGpeIoamTransitDisable)(nil), "vxlan_gpe_ioam_transit_disable_553f5b7b") + api.RegisterMessage((*VxlanGpeIoamTransitDisable)(nil), "vxlan_gpe_ioam_transit_disable_3d3ec657") api.RegisterMessage((*VxlanGpeIoamTransitDisableReply)(nil), "vxlan_gpe_ioam_transit_disable_reply_e8d4e804") - api.RegisterMessage((*VxlanGpeIoamTransitEnable)(nil), "vxlan_gpe_ioam_transit_enable_553f5b7b") + api.RegisterMessage((*VxlanGpeIoamTransitEnable)(nil), "vxlan_gpe_ioam_transit_enable_3d3ec657") api.RegisterMessage((*VxlanGpeIoamTransitEnableReply)(nil), "vxlan_gpe_ioam_transit_enable_reply_e8d4e804") - api.RegisterMessage((*VxlanGpeIoamVniDisable)(nil), "vxlan_gpe_ioam_vni_disable_997161fb") + api.RegisterMessage((*VxlanGpeIoamVniDisable)(nil), "vxlan_gpe_ioam_vni_disable_0fbb5fb1") api.RegisterMessage((*VxlanGpeIoamVniDisableReply)(nil), "vxlan_gpe_ioam_vni_disable_reply_e8d4e804") - api.RegisterMessage((*VxlanGpeIoamVniEnable)(nil), "vxlan_gpe_ioam_vni_enable_997161fb") + api.RegisterMessage((*VxlanGpeIoamVniEnable)(nil), "vxlan_gpe_ioam_vni_enable_0fbb5fb1") api.RegisterMessage((*VxlanGpeIoamVniEnableReply)(nil), "vxlan_gpe_ioam_vni_enable_reply_e8d4e804") } diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go deleted file mode 100644 index bc34d36..0000000 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_vxlan_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vxlan_gpe_ioam_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_ioam_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_ioam_transit_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamTransitDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamTransitDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_ioam_transit_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamTransitEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamTransitEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_ioam_vni_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamVniDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamVniDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_ioam_vni_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamVniEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamVniEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go index e06b33a..eec10c7 100644 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go @@ -4,10 +4,11 @@ package ioam_vxlan_gpe import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service ioam_vxlan_gpe. +// RPCService defines RPC service ioam_vxlan_gpe. type RPCService interface { VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoamDisable) (*VxlanGpeIoamDisableReply, error) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) @@ -31,7 +32,7 @@ func (c *serviceClient) VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) { @@ -40,7 +41,7 @@ func (c *serviceClient) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamTransitDisable(ctx context.Context, in *VxlanGpeIoamTransitDisable) (*VxlanGpeIoamTransitDisableReply, error) { @@ -49,7 +50,7 @@ func (c *serviceClient) VxlanGpeIoamTransitDisable(ctx context.Context, in *Vxla if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamTransitEnable(ctx context.Context, in *VxlanGpeIoamTransitEnable) (*VxlanGpeIoamTransitEnableReply, error) { @@ -58,7 +59,7 @@ func (c *serviceClient) VxlanGpeIoamTransitEnable(ctx context.Context, in *Vxlan if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpeIoamVniDisable) (*VxlanGpeIoamVniDisableReply, error) { @@ -67,7 +68,7 @@ func (c *serviceClient) VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeIoamVniEnable) (*VxlanGpeIoamVniEnableReply, error) { @@ -76,5 +77,5 @@ func (c *serviceClient) VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip/ip.ba.go b/binapi/ip/ip.ba.go index df5b593..78ea15e 100644 --- a/binapi/ip/ip.ba.go +++ b/binapi/ip/ip.ba.go @@ -1,27 +1,28 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ip.api.json // Package ip contains generated bindings for API file ip.api. // // Contents: -// 1 enum -// 4 structs -// 60 messages +// 2 enums +// 7 structs +// 87 messages // package ip import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - mfib_types "git.fd.io/govpp.git/binapi/mfib_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + fib_types "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + mfib_types "go.fd.io/govpp/binapi/mfib_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -32,8 +33,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ip" - APIVersion = "3.0.1" - VersionCrc = 0x765d74b1 + APIVersion = "3.2.0" + VersionCrc = 0x557b5866 ) // IPReassType defines enum 'ip_reass_type'. @@ -63,14 +64,87 @@ func (x IPReassType) String() string { return "IPReassType(" + strconv.Itoa(int(x)) + ")" } +// IPFlowHashConfig defines enum 'ip_flow_hash_config'. +type IPFlowHashConfig uint32 + +const ( + IP_API_FLOW_HASH_SRC_IP IPFlowHashConfig = 1 + IP_API_FLOW_HASH_DST_IP IPFlowHashConfig = 2 + IP_API_FLOW_HASH_SRC_PORT IPFlowHashConfig = 4 + IP_API_FLOW_HASH_DST_PORT IPFlowHashConfig = 8 + IP_API_FLOW_HASH_PROTO IPFlowHashConfig = 16 + IP_API_FLOW_HASH_REVERSE IPFlowHashConfig = 32 + IP_API_FLOW_HASH_SYMETRIC IPFlowHashConfig = 64 + IP_API_FLOW_HASH_FLOW_LABEL IPFlowHashConfig = 128 +) + +var ( + IPFlowHashConfig_name = map[uint32]string{ + 1: "IP_API_FLOW_HASH_SRC_IP", + 2: "IP_API_FLOW_HASH_DST_IP", + 4: "IP_API_FLOW_HASH_SRC_PORT", + 8: "IP_API_FLOW_HASH_DST_PORT", + 16: "IP_API_FLOW_HASH_PROTO", + 32: "IP_API_FLOW_HASH_REVERSE", + 64: "IP_API_FLOW_HASH_SYMETRIC", + 128: "IP_API_FLOW_HASH_FLOW_LABEL", + } + IPFlowHashConfig_value = map[string]uint32{ + "IP_API_FLOW_HASH_SRC_IP": 1, + "IP_API_FLOW_HASH_DST_IP": 2, + "IP_API_FLOW_HASH_SRC_PORT": 4, + "IP_API_FLOW_HASH_DST_PORT": 8, + "IP_API_FLOW_HASH_PROTO": 16, + "IP_API_FLOW_HASH_REVERSE": 32, + "IP_API_FLOW_HASH_SYMETRIC": 64, + "IP_API_FLOW_HASH_FLOW_LABEL": 128, + } +) + +func (x IPFlowHashConfig) String() string { + s, ok := IPFlowHashConfig_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IPFlowHashConfig_name[uint32(n)] + if ok { + return s + } + return "IPFlowHashConfig(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + // IPMroute defines type 'ip_mroute'. type IPMroute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Prefix ip_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` - Paths []mfib_types.MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags mfib_types.MfibEntryFlags `binapi:"mfib_entry_flags,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix ip_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []mfib_types.MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// IPPathMtu defines type 'ip_path_mtu'. +type IPPathMtu struct { + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + Context uint32 `binapi:"u32,name=context" json:"context,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` + PathMtu uint16 `binapi:"u16,name=path_mtu" json:"path_mtu,omitempty"` } // IPRoute defines type 'ip_route'. @@ -82,6 +156,16 @@ type IPRoute struct { Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` } +// IPRouteV2 defines type 'ip_route_v2'. +type IPRouteV2 struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Src uint8 `binapi:"u8,name=src" json:"src,omitempty"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + // IPTable defines type 'ip_table'. type IPTable struct { TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` @@ -96,6 +180,165 @@ type PuntRedirect struct { Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` } +// PuntRedirectV2 defines type 'punt_redirect_v2'. +type PuntRedirectV2 struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index,default=4294967295" json:"rx_sw_if_index,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + NPaths uint32 `binapi:"u32,name=n_paths" json:"-"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// AddDelIPPuntRedirectV2 defines message 'add_del_ip_punt_redirect_v2'. +type AddDelIPPuntRedirectV2 struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Punt PuntRedirectV2 `binapi:"punt_redirect_v2,name=punt" json:"punt,omitempty"` +} + +func (m *AddDelIPPuntRedirectV2) Reset() { *m = AddDelIPPuntRedirectV2{} } +func (*AddDelIPPuntRedirectV2) GetMessageName() string { return "add_del_ip_punt_redirect_v2" } +func (*AddDelIPPuntRedirectV2) GetCrcString() string { return "9e804227" } +func (*AddDelIPPuntRedirectV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AddDelIPPuntRedirectV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Punt.RxSwIfIndex + size += 1 // m.Punt.Af + size += 4 // m.Punt.NPaths + for j2 := 0; j2 < len(m.Punt.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Punt.Paths) { + s2 = m.Punt.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + size += 1 // s2.LabelStack[j3].IsUniform + size += 4 // s2.LabelStack[j3].Label + size += 1 // s2.LabelStack[j3].TTL + size += 1 // s2.LabelStack[j3].Exp + } + } + return size +} +func (m *AddDelIPPuntRedirectV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex)) + buf.EncodeUint8(uint8(m.Punt.Af)) + buf.EncodeUint32(uint32(len(m.Punt.Paths))) + for j1 := 0; j1 < len(m.Punt.Paths); j1++ { + var v1 fib_types.FibPath // Paths + if j1 < len(m.Punt.Paths) { + v1 = m.Punt.Paths[j1] + } + buf.EncodeUint32(v1.SwIfIndex) + buf.EncodeUint32(v1.TableID) + buf.EncodeUint32(v1.RpfID) + buf.EncodeUint8(v1.Weight) + buf.EncodeUint8(v1.Preference) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) + buf.EncodeUint32(v1.Nh.ViaLabel) + buf.EncodeUint32(v1.Nh.ObjID) + buf.EncodeUint32(v1.Nh.ClassifyTableIndex) + buf.EncodeUint8(v1.NLabels) + for j2 := 0; j2 < 16; j2++ { + buf.EncodeUint8(v1.LabelStack[j2].IsUniform) + buf.EncodeUint32(v1.LabelStack[j2].Label) + buf.EncodeUint8(v1.LabelStack[j2].TTL) + buf.EncodeUint8(v1.LabelStack[j2].Exp) + } + } + return buf.Bytes(), nil +} +func (m *AddDelIPPuntRedirectV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.Punt.NPaths = buf.DecodeUint32() + m.Punt.Paths = make([]fib_types.FibPath, m.Punt.NPaths) + for j1 := 0; j1 < len(m.Punt.Paths); j1++ { + m.Punt.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Punt.Paths[j1].TableID = buf.DecodeUint32() + m.Punt.Paths[j1].RpfID = buf.DecodeUint32() + m.Punt.Paths[j1].Weight = buf.DecodeUint8() + m.Punt.Paths[j1].Preference = buf.DecodeUint8() + m.Punt.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Punt.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Punt.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Punt.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Punt.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Punt.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Punt.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Punt.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Punt.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Punt.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Punt.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Punt.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// AddDelIPPuntRedirectV2Reply defines message 'add_del_ip_punt_redirect_v2_reply'. +type AddDelIPPuntRedirectV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AddDelIPPuntRedirectV2Reply) Reset() { *m = AddDelIPPuntRedirectV2Reply{} } +func (*AddDelIPPuntRedirectV2Reply) GetMessageName() string { + return "add_del_ip_punt_redirect_v2_reply" +} +func (*AddDelIPPuntRedirectV2Reply) GetCrcString() string { return "e8d4e804" } +func (*AddDelIPPuntRedirectV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AddDelIPPuntRedirectV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *AddDelIPPuntRedirectV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *AddDelIPPuntRedirectV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // IoamDisable defines message 'ioam_disable'. type IoamDisable struct { ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` @@ -256,7 +499,7 @@ type IPAddressDetails struct { func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } -func (*IPAddressDetails) GetCrcString() string { return "b1199745" } +func (*IPAddressDetails) GetCrcString() string { return "ee29b797" } func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -337,7 +580,7 @@ type IPContainerProxyAddDel struct { func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } -func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } +func (*IPContainerProxyAddDel) GetCrcString() string { return "7df1dff1" } func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -418,7 +661,7 @@ type IPContainerProxyDetails struct { func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } -func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } +func (*IPContainerProxyDetails) GetCrcString() string { return "a8085523" } func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -559,7 +802,7 @@ type IPMrouteAddDel struct { func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } -func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } +func (*IPMrouteAddDel) GetCrcString() string { return "0dd7e790" } func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -615,7 +858,7 @@ func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { buf.EncodeBool(m.IsAdd) buf.EncodeBool(m.IsMultipath) buf.EncodeUint32(m.Route.TableID) - buf.EncodeUint32(m.Route.EntryFlags) + buf.EncodeUint32(uint32(m.Route.EntryFlags)) buf.EncodeUint32(m.Route.RpfID) buf.EncodeUint8(uint8(m.Route.Prefix.Af)) buf.EncodeUint16(m.Route.Prefix.GrpAddressLength) @@ -655,7 +898,7 @@ func (m *IPMrouteAddDel) Unmarshal(b []byte) error { m.IsAdd = buf.DecodeBool() m.IsMultipath = buf.DecodeBool() m.Route.TableID = buf.DecodeUint32() - m.Route.EntryFlags = buf.DecodeUint32() + m.Route.EntryFlags = mfib_types.MfibEntryFlags(buf.DecodeUint32()) m.Route.RpfID = buf.DecodeUint32() m.Route.Prefix.Af = ip_types.AddressFamily(buf.DecodeUint8()) m.Route.Prefix.GrpAddressLength = buf.DecodeUint16() @@ -732,7 +975,7 @@ type IPMrouteDetails struct { func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } -func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } +func (*IPMrouteDetails) GetCrcString() string { return "c5cb23fc" } func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -784,7 +1027,7 @@ func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { } buf := codec.NewBuffer(b) buf.EncodeUint32(m.Route.TableID) - buf.EncodeUint32(m.Route.EntryFlags) + buf.EncodeUint32(uint32(m.Route.EntryFlags)) buf.EncodeUint32(m.Route.RpfID) buf.EncodeUint8(uint8(m.Route.Prefix.Af)) buf.EncodeUint16(m.Route.Prefix.GrpAddressLength) @@ -822,7 +1065,7 @@ func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { func (m *IPMrouteDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Route.TableID = buf.DecodeUint32() - m.Route.EntryFlags = buf.DecodeUint32() + m.Route.EntryFlags = mfib_types.MfibEntryFlags(buf.DecodeUint32()) m.Route.RpfID = buf.DecodeUint32() m.Route.Prefix.Af = ip_types.AddressFamily(buf.DecodeUint8()) m.Route.Prefix.GrpAddressLength = buf.DecodeUint16() @@ -960,6 +1203,325 @@ func (m *IPMtableDump) Unmarshal(b []byte) error { return nil } +// IPPathMtuDetails defines message 'ip_path_mtu_details'. +type IPPathMtuDetails struct { + Pmtu IPPathMtu `binapi:"ip_path_mtu,name=pmtu" json:"pmtu,omitempty"` +} + +func (m *IPPathMtuDetails) Reset() { *m = IPPathMtuDetails{} } +func (*IPPathMtuDetails) GetMessageName() string { return "ip_path_mtu_details" } +func (*IPPathMtuDetails) GetCrcString() string { return "ac9539a7" } +func (*IPPathMtuDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPathMtuDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Pmtu.ClientIndex + size += 4 // m.Pmtu.Context + size += 4 // m.Pmtu.TableID + size += 1 // m.Pmtu.Nh.Af + size += 1 * 16 // m.Pmtu.Nh.Un + size += 2 // m.Pmtu.PathMtu + return size +} +func (m *IPPathMtuDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Pmtu.ClientIndex) + buf.EncodeUint32(m.Pmtu.Context) + buf.EncodeUint32(m.Pmtu.TableID) + buf.EncodeUint8(uint8(m.Pmtu.Nh.Af)) + buf.EncodeBytes(m.Pmtu.Nh.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.Pmtu.PathMtu) + return buf.Bytes(), nil +} +func (m *IPPathMtuDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pmtu.ClientIndex = buf.DecodeUint32() + m.Pmtu.Context = buf.DecodeUint32() + m.Pmtu.TableID = buf.DecodeUint32() + m.Pmtu.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pmtu.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pmtu.PathMtu = buf.DecodeUint16() + return nil +} + +// IPPathMtuGet defines message 'ip_path_mtu_get'. +type IPPathMtuGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *IPPathMtuGet) Reset() { *m = IPPathMtuGet{} } +func (*IPPathMtuGet) GetMessageName() string { return "ip_path_mtu_get" } +func (*IPPathMtuGet) GetCrcString() string { return "f75ba505" } +func (*IPPathMtuGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPathMtuGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *IPPathMtuGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *IPPathMtuGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// IPPathMtuGetReply defines message 'ip_path_mtu_get_reply'. +type IPPathMtuGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *IPPathMtuGetReply) Reset() { *m = IPPathMtuGetReply{} } +func (*IPPathMtuGetReply) GetMessageName() string { return "ip_path_mtu_get_reply" } +func (*IPPathMtuGetReply) GetCrcString() string { return "53b48f5d" } +func (*IPPathMtuGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPathMtuGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *IPPathMtuGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *IPPathMtuGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +// IPPathMtuReplaceBegin defines message 'ip_path_mtu_replace_begin'. +type IPPathMtuReplaceBegin struct{} + +func (m *IPPathMtuReplaceBegin) Reset() { *m = IPPathMtuReplaceBegin{} } +func (*IPPathMtuReplaceBegin) GetMessageName() string { return "ip_path_mtu_replace_begin" } +func (*IPPathMtuReplaceBegin) GetCrcString() string { return "51077d14" } +func (*IPPathMtuReplaceBegin) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPathMtuReplaceBegin) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *IPPathMtuReplaceBegin) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *IPPathMtuReplaceBegin) Unmarshal(b []byte) error { + return nil +} + +// IPPathMtuReplaceBeginReply defines message 'ip_path_mtu_replace_begin_reply'. +type IPPathMtuReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPathMtuReplaceBeginReply) Reset() { *m = IPPathMtuReplaceBeginReply{} } +func (*IPPathMtuReplaceBeginReply) GetMessageName() string { return "ip_path_mtu_replace_begin_reply" } +func (*IPPathMtuReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*IPPathMtuReplaceBeginReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPathMtuReplaceBeginReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IPPathMtuReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IPPathMtuReplaceBeginReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IPPathMtuReplaceEnd defines message 'ip_path_mtu_replace_end'. +type IPPathMtuReplaceEnd struct{} + +func (m *IPPathMtuReplaceEnd) Reset() { *m = IPPathMtuReplaceEnd{} } +func (*IPPathMtuReplaceEnd) GetMessageName() string { return "ip_path_mtu_replace_end" } +func (*IPPathMtuReplaceEnd) GetCrcString() string { return "51077d14" } +func (*IPPathMtuReplaceEnd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPathMtuReplaceEnd) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *IPPathMtuReplaceEnd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *IPPathMtuReplaceEnd) Unmarshal(b []byte) error { + return nil +} + +// IPPathMtuReplaceEndReply defines message 'ip_path_mtu_replace_end_reply'. +type IPPathMtuReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPathMtuReplaceEndReply) Reset() { *m = IPPathMtuReplaceEndReply{} } +func (*IPPathMtuReplaceEndReply) GetMessageName() string { return "ip_path_mtu_replace_end_reply" } +func (*IPPathMtuReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*IPPathMtuReplaceEndReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPathMtuReplaceEndReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IPPathMtuReplaceEndReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IPPathMtuReplaceEndReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IPPathMtuUpdate defines message 'ip_path_mtu_update'. +type IPPathMtuUpdate struct { + Pmtu IPPathMtu `binapi:"ip_path_mtu,name=pmtu" json:"pmtu,omitempty"` +} + +func (m *IPPathMtuUpdate) Reset() { *m = IPPathMtuUpdate{} } +func (*IPPathMtuUpdate) GetMessageName() string { return "ip_path_mtu_update" } +func (*IPPathMtuUpdate) GetCrcString() string { return "10bbe5cb" } +func (*IPPathMtuUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPathMtuUpdate) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Pmtu.ClientIndex + size += 4 // m.Pmtu.Context + size += 4 // m.Pmtu.TableID + size += 1 // m.Pmtu.Nh.Af + size += 1 * 16 // m.Pmtu.Nh.Un + size += 2 // m.Pmtu.PathMtu + return size +} +func (m *IPPathMtuUpdate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Pmtu.ClientIndex) + buf.EncodeUint32(m.Pmtu.Context) + buf.EncodeUint32(m.Pmtu.TableID) + buf.EncodeUint8(uint8(m.Pmtu.Nh.Af)) + buf.EncodeBytes(m.Pmtu.Nh.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.Pmtu.PathMtu) + return buf.Bytes(), nil +} +func (m *IPPathMtuUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pmtu.ClientIndex = buf.DecodeUint32() + m.Pmtu.Context = buf.DecodeUint32() + m.Pmtu.TableID = buf.DecodeUint32() + m.Pmtu.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pmtu.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pmtu.PathMtu = buf.DecodeUint16() + return nil +} + +// IPPathMtuUpdateReply defines message 'ip_path_mtu_update_reply'. +type IPPathMtuUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPathMtuUpdateReply) Reset() { *m = IPPathMtuUpdateReply{} } +func (*IPPathMtuUpdateReply) GetMessageName() string { return "ip_path_mtu_update_reply" } +func (*IPPathMtuUpdateReply) GetCrcString() string { return "e8d4e804" } +func (*IPPathMtuUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPathMtuUpdateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IPPathMtuUpdateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IPPathMtuUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // IPPuntPolice defines message 'ip_punt_police'. type IPPuntPolice struct { PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` @@ -1035,6 +1597,7 @@ func (m *IPPuntPoliceReply) Unmarshal(b []byte) error { } // IPPuntRedirect defines message 'ip_punt_redirect'. +// Deprecated: the message will be removed in the future versions type IPPuntRedirect struct { Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` @@ -1042,7 +1605,7 @@ type IPPuntRedirect struct { func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } -func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } +func (*IPPuntRedirect) GetCrcString() string { return "6580f635" } func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1087,7 +1650,7 @@ type IPPuntRedirectDetails struct { func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } -func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } +func (*IPPuntRedirectDetails) GetCrcString() string { return "2cef63e7" } func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1160,6 +1723,7 @@ func (m *IPPuntRedirectDump) Unmarshal(b []byte) error { } // IPPuntRedirectReply defines message 'ip_punt_redirect_reply'. +// Deprecated: the message will be removed in the future versions type IPPuntRedirectReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1192,6 +1756,155 @@ func (m *IPPuntRedirectReply) Unmarshal(b []byte) error { return nil } +// IPPuntRedirectV2Details defines message 'ip_punt_redirect_v2_details'. +type IPPuntRedirectV2Details struct { + Punt PuntRedirectV2 `binapi:"punt_redirect_v2,name=punt" json:"punt,omitempty"` +} + +func (m *IPPuntRedirectV2Details) Reset() { *m = IPPuntRedirectV2Details{} } +func (*IPPuntRedirectV2Details) GetMessageName() string { return "ip_punt_redirect_v2_details" } +func (*IPPuntRedirectV2Details) GetCrcString() string { return "7ba42e1d" } +func (*IPPuntRedirectV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPuntRedirectV2Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Punt.RxSwIfIndex + size += 1 // m.Punt.Af + size += 4 // m.Punt.NPaths + for j2 := 0; j2 < len(m.Punt.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Punt.Paths) { + s2 = m.Punt.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + size += 1 // s2.LabelStack[j3].IsUniform + size += 4 // s2.LabelStack[j3].Label + size += 1 // s2.LabelStack[j3].TTL + size += 1 // s2.LabelStack[j3].Exp + } + } + return size +} +func (m *IPPuntRedirectV2Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex)) + buf.EncodeUint8(uint8(m.Punt.Af)) + buf.EncodeUint32(uint32(len(m.Punt.Paths))) + for j1 := 0; j1 < len(m.Punt.Paths); j1++ { + var v1 fib_types.FibPath // Paths + if j1 < len(m.Punt.Paths) { + v1 = m.Punt.Paths[j1] + } + buf.EncodeUint32(v1.SwIfIndex) + buf.EncodeUint32(v1.TableID) + buf.EncodeUint32(v1.RpfID) + buf.EncodeUint8(v1.Weight) + buf.EncodeUint8(v1.Preference) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) + buf.EncodeUint32(v1.Nh.ViaLabel) + buf.EncodeUint32(v1.Nh.ObjID) + buf.EncodeUint32(v1.Nh.ClassifyTableIndex) + buf.EncodeUint8(v1.NLabels) + for j2 := 0; j2 < 16; j2++ { + buf.EncodeUint8(v1.LabelStack[j2].IsUniform) + buf.EncodeUint32(v1.LabelStack[j2].Label) + buf.EncodeUint8(v1.LabelStack[j2].TTL) + buf.EncodeUint8(v1.LabelStack[j2].Exp) + } + } + return buf.Bytes(), nil +} +func (m *IPPuntRedirectV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.Punt.NPaths = buf.DecodeUint32() + m.Punt.Paths = make([]fib_types.FibPath, m.Punt.NPaths) + for j1 := 0; j1 < len(m.Punt.Paths); j1++ { + m.Punt.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Punt.Paths[j1].TableID = buf.DecodeUint32() + m.Punt.Paths[j1].RpfID = buf.DecodeUint32() + m.Punt.Paths[j1].Weight = buf.DecodeUint8() + m.Punt.Paths[j1].Preference = buf.DecodeUint8() + m.Punt.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Punt.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Punt.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Punt.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Punt.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Punt.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Punt.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Punt.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Punt.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Punt.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Punt.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Punt.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPPuntRedirectV2Dump defines message 'ip_punt_redirect_v2_dump'. +type IPPuntRedirectV2Dump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` +} + +func (m *IPPuntRedirectV2Dump) Reset() { *m = IPPuntRedirectV2Dump{} } +func (*IPPuntRedirectV2Dump) GetMessageName() string { return "ip_punt_redirect_v2_dump" } +func (*IPPuntRedirectV2Dump) GetCrcString() string { return "d817a484" } +func (*IPPuntRedirectV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPuntRedirectV2Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.Af + return size +} +func (m *IPPuntRedirectV2Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Af)) + return buf.Bytes(), nil +} +func (m *IPPuntRedirectV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + return nil +} + // IPReassemblyEnableDisable defines message 'ip_reassembly_enable_disable'. type IPReassemblyEnableDisable struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1202,7 +1915,7 @@ type IPReassemblyEnableDisable struct { func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } -func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } +func (*IPReassemblyEnableDisable) GetCrcString() string { return "eb77968d" } func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1457,7 +2170,7 @@ type IPRouteAddDel struct { func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } -func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } +func (*IPRouteAddDel) GetCrcString() string { return "b8ecfe0d" } func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1614,6 +2327,177 @@ func (m *IPRouteAddDelReply) Unmarshal(b []byte) error { return nil } +// IPRouteAddDelV2 defines message 'ip_route_add_del_v2'. +// InProgress: the message form may change in the future versions +type IPRouteAddDelV2 struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPRouteV2 `binapi:"ip_route_v2,name=route" json:"route,omitempty"` +} + +func (m *IPRouteAddDelV2) Reset() { *m = IPRouteAddDelV2{} } +func (*IPRouteAddDelV2) GetMessageName() string { return "ip_route_add_del_v2" } +func (*IPRouteAddDelV2) GetCrcString() string { return "521ef330" } +func (*IPRouteAddDelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteAddDelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.IsMultipath + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + size += 1 // m.Route.Src + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + size += 1 // s2.LabelStack[j3].IsUniform + size += 4 // s2.LabelStack[j3].Label + size += 1 // s2.LabelStack[j3].TTL + size += 1 // s2.LabelStack[j3].Exp + } + } + return size +} +func (m *IPRouteAddDelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsMultipath) + buf.EncodeUint32(m.Route.TableID) + buf.EncodeUint32(m.Route.StatsIndex) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Route.Prefix.Len) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + buf.EncodeUint8(m.Route.Src) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath // Paths + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(v1.SwIfIndex) + buf.EncodeUint32(v1.TableID) + buf.EncodeUint32(v1.RpfID) + buf.EncodeUint8(v1.Weight) + buf.EncodeUint8(v1.Preference) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) + buf.EncodeUint32(v1.Nh.ViaLabel) + buf.EncodeUint32(v1.Nh.ObjID) + buf.EncodeUint32(v1.Nh.ClassifyTableIndex) + buf.EncodeUint8(v1.NLabels) + for j2 := 0; j2 < 16; j2++ { + buf.EncodeUint8(v1.LabelStack[j2].IsUniform) + buf.EncodeUint32(v1.LabelStack[j2].Label) + buf.EncodeUint8(v1.LabelStack[j2].TTL) + buf.EncodeUint8(v1.LabelStack[j2].Exp) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteAddDelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsMultipath = buf.DecodeBool() + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Src = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPRouteAddDelV2Reply defines message 'ip_route_add_del_v2_reply'. +// InProgress: the message form may change in the future versions +type IPRouteAddDelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPRouteAddDelV2Reply) Reset() { *m = IPRouteAddDelV2Reply{} } +func (*IPRouteAddDelV2Reply) GetMessageName() string { return "ip_route_add_del_v2_reply" } +func (*IPRouteAddDelV2Reply) GetCrcString() string { return "1992deab" } +func (*IPRouteAddDelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteAddDelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *IPRouteAddDelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatsIndex) + return buf.Bytes(), nil +} +func (m *IPRouteAddDelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatsIndex = buf.DecodeUint32() + return nil +} + // IPRouteDetails defines message 'ip_route_details'. type IPRouteDetails struct { Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` @@ -1621,7 +2505,7 @@ type IPRouteDetails struct { func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } -func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } +func (*IPRouteDetails) GetCrcString() string { return "bda8f315" } func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1783,7 +2667,7 @@ type IPRouteLookup struct { func (m *IPRouteLookup) Reset() { *m = IPRouteLookup{} } func (*IPRouteLookup) GetMessageName() string { return "ip_route_lookup" } -func (*IPRouteLookup) GetCrcString() string { return "e2986185" } +func (*IPRouteLookup) GetCrcString() string { return "710d6471" } func (*IPRouteLookup) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1829,7 +2713,7 @@ type IPRouteLookupReply struct { func (m *IPRouteLookupReply) Reset() { *m = IPRouteLookupReply{} } func (*IPRouteLookupReply) GetMessageName() string { return "ip_route_lookup_reply" } -func (*IPRouteLookupReply) GetCrcString() string { return "ae99de8e" } +func (*IPRouteLookupReply) GetCrcString() string { return "5d8febcb" } func (*IPRouteLookupReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1946,6 +2830,352 @@ func (m *IPRouteLookupReply) Unmarshal(b []byte) error { return nil } +// IPRouteLookupV2 defines message 'ip_route_lookup_v2'. +// InProgress: the message form may change in the future versions +type IPRouteLookupV2 struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPRouteLookupV2) Reset() { *m = IPRouteLookupV2{} } +func (*IPRouteLookupV2) GetMessageName() string { return "ip_route_lookup_v2" } +func (*IPRouteLookupV2) GetCrcString() string { return "710d6471" } +func (*IPRouteLookupV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteLookupV2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.TableID + size += 1 // m.Exact + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *IPRouteLookupV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.TableID) + buf.EncodeUint8(m.Exact) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Prefix.Len) + return buf.Bytes(), nil +} +func (m *IPRouteLookupV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.Exact = buf.DecodeUint8() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IPRouteLookupV2Reply defines message 'ip_route_lookup_v2_reply'. +// InProgress: the message form may change in the future versions +type IPRouteLookupV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Route IPRouteV2 `binapi:"ip_route_v2,name=route" json:"route,omitempty"` +} + +func (m *IPRouteLookupV2Reply) Reset() { *m = IPRouteLookupV2Reply{} } +func (*IPRouteLookupV2Reply) GetMessageName() string { return "ip_route_lookup_v2_reply" } +func (*IPRouteLookupV2Reply) GetCrcString() string { return "84cc9e03" } +func (*IPRouteLookupV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteLookupV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + size += 1 // m.Route.Src + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + size += 1 // s2.LabelStack[j3].IsUniform + size += 4 // s2.LabelStack[j3].Label + size += 1 // s2.LabelStack[j3].TTL + size += 1 // s2.LabelStack[j3].Exp + } + } + return size +} +func (m *IPRouteLookupV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Route.TableID) + buf.EncodeUint32(m.Route.StatsIndex) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Route.Prefix.Len) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + buf.EncodeUint8(m.Route.Src) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath // Paths + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(v1.SwIfIndex) + buf.EncodeUint32(v1.TableID) + buf.EncodeUint32(v1.RpfID) + buf.EncodeUint8(v1.Weight) + buf.EncodeUint8(v1.Preference) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) + buf.EncodeUint32(v1.Nh.ViaLabel) + buf.EncodeUint32(v1.Nh.ObjID) + buf.EncodeUint32(v1.Nh.ClassifyTableIndex) + buf.EncodeUint8(v1.NLabels) + for j2 := 0; j2 < 16; j2++ { + buf.EncodeUint8(v1.LabelStack[j2].IsUniform) + buf.EncodeUint32(v1.LabelStack[j2].Label) + buf.EncodeUint8(v1.LabelStack[j2].TTL) + buf.EncodeUint8(v1.LabelStack[j2].Exp) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteLookupV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Src = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPRouteV2Details defines message 'ip_route_v2_details'. +// InProgress: the message form may change in the future versions +type IPRouteV2Details struct { + Route IPRouteV2 `binapi:"ip_route_v2,name=route" json:"route,omitempty"` +} + +func (m *IPRouteV2Details) Reset() { *m = IPRouteV2Details{} } +func (*IPRouteV2Details) GetMessageName() string { return "ip_route_v2_details" } +func (*IPRouteV2Details) GetCrcString() string { return "b09aa6c0" } +func (*IPRouteV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteV2Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + size += 1 // m.Route.Src + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + size += 1 // s2.LabelStack[j3].IsUniform + size += 4 // s2.LabelStack[j3].Label + size += 1 // s2.LabelStack[j3].TTL + size += 1 // s2.LabelStack[j3].Exp + } + } + return size +} +func (m *IPRouteV2Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Route.TableID) + buf.EncodeUint32(m.Route.StatsIndex) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Route.Prefix.Len) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + buf.EncodeUint8(m.Route.Src) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath // Paths + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(v1.SwIfIndex) + buf.EncodeUint32(v1.TableID) + buf.EncodeUint32(v1.RpfID) + buf.EncodeUint8(v1.Weight) + buf.EncodeUint8(v1.Preference) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) + buf.EncodeUint32(v1.Nh.ViaLabel) + buf.EncodeUint32(v1.Nh.ObjID) + buf.EncodeUint32(v1.Nh.ClassifyTableIndex) + buf.EncodeUint8(v1.NLabels) + for j2 := 0; j2 < 16; j2++ { + buf.EncodeUint8(v1.LabelStack[j2].IsUniform) + buf.EncodeUint32(v1.LabelStack[j2].Label) + buf.EncodeUint8(v1.LabelStack[j2].TTL) + buf.EncodeUint8(v1.LabelStack[j2].Exp) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Src = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPRouteV2Dump defines message 'ip_route_v2_dump'. +// InProgress: the message form may change in the future versions +type IPRouteV2Dump struct { + Src uint8 `binapi:"u8,name=src" json:"src,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPRouteV2Dump) Reset() { *m = IPRouteV2Dump{} } +func (*IPRouteV2Dump) GetMessageName() string { return "ip_route_v2_dump" } +func (*IPRouteV2Dump) GetCrcString() string { return "d16f72e6" } +func (*IPRouteV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteV2Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Src + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPRouteV2Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Src) + buf.EncodeUint32(m.Table.TableID) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPRouteV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Src = buf.DecodeUint8() + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + // IPSourceAndPortRangeCheckAddDel defines message 'ip_source_and_port_range_check_add_del'. type IPSourceAndPortRangeCheckAddDel struct { IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` @@ -1960,7 +3190,7 @@ func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeChe func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { return "ip_source_and_port_range_check_add_del" } -func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } +func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "92a067e3" } func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2230,6 +3460,88 @@ func (m *IPTableAddDelReply) Unmarshal(b []byte) error { return nil } +// IPTableAllocate defines message 'ip_table_allocate'. +type IPTableAllocate struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableAllocate) Reset() { *m = IPTableAllocate{} } +func (*IPTableAllocate) GetMessageName() string { return "ip_table_allocate" } +func (*IPTableAllocate) GetCrcString() string { return "b9d2e09e" } +func (*IPTableAllocate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableAllocate) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableAllocate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Table.TableID) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableAllocate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableAllocateReply defines message 'ip_table_allocate_reply'. +type IPTableAllocateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableAllocateReply) Reset() { *m = IPTableAllocateReply{} } +func (*IPTableAllocateReply) GetMessageName() string { return "ip_table_allocate_reply" } +func (*IPTableAllocateReply) GetCrcString() string { return "1728303a" } +func (*IPTableAllocateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableAllocateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableAllocateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Table.TableID) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableAllocateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + // IPTableDetails defines message 'ip_table_details'. type IPTableDetails struct { Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` @@ -2520,7 +3832,7 @@ type IPUnnumberedDetails struct { func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } -func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } +func (*IPUnnumberedDetails) GetCrcString() string { return "cc59bd42" } func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2593,7 +3905,7 @@ type MfibSignalDetails struct { func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } -func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } +func (*MfibSignalDetails) GetCrcString() string { return "6f4a4cfb" } func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2669,6 +3981,7 @@ func (m *MfibSignalDump) Unmarshal(b []byte) error { } // SetIPFlowHash defines message 'set_ip_flow_hash'. +// Deprecated: the message will be removed in the future versions type SetIPFlowHash struct { VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` @@ -2734,6 +4047,7 @@ func (m *SetIPFlowHash) Unmarshal(b []byte) error { } // SetIPFlowHashReply defines message 'set_ip_flow_hash_reply'. +// Deprecated: the message will be removed in the future versions type SetIPFlowHashReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -2766,6 +4080,146 @@ func (m *SetIPFlowHashReply) Unmarshal(b []byte) error { return nil } +// SetIPFlowHashRouterID defines message 'set_ip_flow_hash_router_id'. +type SetIPFlowHashRouterID struct { + RouterID uint32 `binapi:"u32,name=router_id" json:"router_id,omitempty"` +} + +func (m *SetIPFlowHashRouterID) Reset() { *m = SetIPFlowHashRouterID{} } +func (*SetIPFlowHashRouterID) GetMessageName() string { return "set_ip_flow_hash_router_id" } +func (*SetIPFlowHashRouterID) GetCrcString() string { return "03e4f48e" } +func (*SetIPFlowHashRouterID) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetIPFlowHashRouterID) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.RouterID + return size +} +func (m *SetIPFlowHashRouterID) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.RouterID) + return buf.Bytes(), nil +} +func (m *SetIPFlowHashRouterID) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RouterID = buf.DecodeUint32() + return nil +} + +// SetIPFlowHashRouterIDReply defines message 'set_ip_flow_hash_router_id_reply'. +type SetIPFlowHashRouterIDReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIPFlowHashRouterIDReply) Reset() { *m = SetIPFlowHashRouterIDReply{} } +func (*SetIPFlowHashRouterIDReply) GetMessageName() string { return "set_ip_flow_hash_router_id_reply" } +func (*SetIPFlowHashRouterIDReply) GetCrcString() string { return "e8d4e804" } +func (*SetIPFlowHashRouterIDReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetIPFlowHashRouterIDReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SetIPFlowHashRouterIDReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SetIPFlowHashRouterIDReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SetIPFlowHashV2 defines message 'set_ip_flow_hash_v2'. +type SetIPFlowHashV2 struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + FlowHashConfig IPFlowHashConfig `binapi:"ip_flow_hash_config,name=flow_hash_config" json:"flow_hash_config,omitempty"` +} + +func (m *SetIPFlowHashV2) Reset() { *m = SetIPFlowHashV2{} } +func (*SetIPFlowHashV2) GetMessageName() string { return "set_ip_flow_hash_v2" } +func (*SetIPFlowHashV2) GetCrcString() string { return "6d132100" } +func (*SetIPFlowHashV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetIPFlowHashV2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.TableID + size += 1 // m.Af + size += 4 // m.FlowHashConfig + return size +} +func (m *SetIPFlowHashV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.TableID) + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.FlowHashConfig)) + return buf.Bytes(), nil +} +func (m *SetIPFlowHashV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.FlowHashConfig = IPFlowHashConfig(buf.DecodeUint32()) + return nil +} + +// SetIPFlowHashV2Reply defines message 'set_ip_flow_hash_v2_reply'. +type SetIPFlowHashV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIPFlowHashV2Reply) Reset() { *m = SetIPFlowHashV2Reply{} } +func (*SetIPFlowHashV2Reply) GetMessageName() string { return "set_ip_flow_hash_v2_reply" } +func (*SetIPFlowHashV2Reply) GetCrcString() string { return "e8d4e804" } +func (*SetIPFlowHashV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetIPFlowHashV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SetIPFlowHashV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SetIPFlowHashV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceIP6EnableDisable defines message 'sw_interface_ip6_enable_disable'. type SwInterfaceIP6EnableDisable struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -2838,6 +4292,82 @@ func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(b []byte) error { return nil } +// SwInterfaceIP6GetLinkLocalAddress defines message 'sw_interface_ip6_get_link_local_address'. +type SwInterfaceIP6GetLinkLocalAddress struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceIP6GetLinkLocalAddress) Reset() { *m = SwInterfaceIP6GetLinkLocalAddress{} } +func (*SwInterfaceIP6GetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_get_link_local_address" +} +func (*SwInterfaceIP6GetLinkLocalAddress) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceIP6GetLinkLocalAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceIP6GetLinkLocalAddress) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceIP6GetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6GetLinkLocalAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceIP6GetLinkLocalAddressReply defines message 'sw_interface_ip6_get_link_local_address_reply'. +type SwInterfaceIP6GetLinkLocalAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP ip_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *SwInterfaceIP6GetLinkLocalAddressReply) Reset() { + *m = SwInterfaceIP6GetLinkLocalAddressReply{} +} +func (*SwInterfaceIP6GetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_get_link_local_address_reply" +} +func (*SwInterfaceIP6GetLinkLocalAddressReply) GetCrcString() string { return "d16b7130" } +func (*SwInterfaceIP6GetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6GetLinkLocalAddressReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 16 // m.IP + return size +} +func (m *SwInterfaceIP6GetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.IP[:], 16) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6GetLinkLocalAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.IP[:], buf.DecodeBytes(16)) + return nil +} + // SwInterfaceIP6SetLinkLocalAddress defines message 'sw_interface_ip6_set_link_local_address'. type SwInterfaceIP6SetLinkLocalAddress struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -2848,7 +4378,7 @@ func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLink func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { return "sw_interface_ip6_set_link_local_address" } -func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "1c10f15f" } func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2916,48 +4446,69 @@ func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(b []byte) error { func init() { file_ip_binapi_init() } func file_ip_binapi_init() { + api.RegisterMessage((*AddDelIPPuntRedirectV2)(nil), "add_del_ip_punt_redirect_v2_9e804227") + api.RegisterMessage((*AddDelIPPuntRedirectV2Reply)(nil), "add_del_ip_punt_redirect_v2_reply_e8d4e804") api.RegisterMessage((*IoamDisable)(nil), "ioam_disable_6b16a45e") api.RegisterMessage((*IoamDisableReply)(nil), "ioam_disable_reply_e8d4e804") api.RegisterMessage((*IoamEnable)(nil), "ioam_enable_51ccd868") api.RegisterMessage((*IoamEnableReply)(nil), "ioam_enable_reply_e8d4e804") - api.RegisterMessage((*IPAddressDetails)(nil), "ip_address_details_b1199745") + api.RegisterMessage((*IPAddressDetails)(nil), "ip_address_details_ee29b797") api.RegisterMessage((*IPAddressDump)(nil), "ip_address_dump_2d033de4") - api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip_container_proxy_add_del_91189f40") + api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip_container_proxy_add_del_7df1dff1") api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip_container_proxy_add_del_reply_e8d4e804") - api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip_container_proxy_details_0ee460e8") + api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip_container_proxy_details_a8085523") api.RegisterMessage((*IPContainerProxyDump)(nil), "ip_container_proxy_dump_51077d14") api.RegisterMessage((*IPDetails)(nil), "ip_details_eb152d07") api.RegisterMessage((*IPDump)(nil), "ip_dump_98d231ca") - api.RegisterMessage((*IPMrouteAddDel)(nil), "ip_mroute_add_del_f6627d17") + api.RegisterMessage((*IPMrouteAddDel)(nil), "ip_mroute_add_del_0dd7e790") api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip_mroute_add_del_reply_1992deab") - api.RegisterMessage((*IPMrouteDetails)(nil), "ip_mroute_details_c1cb4b44") + api.RegisterMessage((*IPMrouteDetails)(nil), "ip_mroute_details_c5cb23fc") api.RegisterMessage((*IPMrouteDump)(nil), "ip_mroute_dump_b9d2e09e") api.RegisterMessage((*IPMtableDetails)(nil), "ip_mtable_details_b9d2e09e") api.RegisterMessage((*IPMtableDump)(nil), "ip_mtable_dump_51077d14") + api.RegisterMessage((*IPPathMtuDetails)(nil), "ip_path_mtu_details_ac9539a7") + api.RegisterMessage((*IPPathMtuGet)(nil), "ip_path_mtu_get_f75ba505") + api.RegisterMessage((*IPPathMtuGetReply)(nil), "ip_path_mtu_get_reply_53b48f5d") + api.RegisterMessage((*IPPathMtuReplaceBegin)(nil), "ip_path_mtu_replace_begin_51077d14") + api.RegisterMessage((*IPPathMtuReplaceBeginReply)(nil), "ip_path_mtu_replace_begin_reply_e8d4e804") + api.RegisterMessage((*IPPathMtuReplaceEnd)(nil), "ip_path_mtu_replace_end_51077d14") + api.RegisterMessage((*IPPathMtuReplaceEndReply)(nil), "ip_path_mtu_replace_end_reply_e8d4e804") + api.RegisterMessage((*IPPathMtuUpdate)(nil), "ip_path_mtu_update_10bbe5cb") + api.RegisterMessage((*IPPathMtuUpdateReply)(nil), "ip_path_mtu_update_reply_e8d4e804") api.RegisterMessage((*IPPuntPolice)(nil), "ip_punt_police_db867cea") api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip_punt_police_reply_e8d4e804") - api.RegisterMessage((*IPPuntRedirect)(nil), "ip_punt_redirect_a9a5592c") - api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip_punt_redirect_details_3924f5d3") + api.RegisterMessage((*IPPuntRedirect)(nil), "ip_punt_redirect_6580f635") + api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip_punt_redirect_details_2cef63e7") api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip_punt_redirect_dump_2d033de4") api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip_punt_redirect_reply_e8d4e804") - api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip_reassembly_enable_disable_885c85a6") + api.RegisterMessage((*IPPuntRedirectV2Details)(nil), "ip_punt_redirect_v2_details_7ba42e1d") + api.RegisterMessage((*IPPuntRedirectV2Dump)(nil), "ip_punt_redirect_v2_dump_d817a484") + api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip_reassembly_enable_disable_eb77968d") api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip_reassembly_enable_disable_reply_e8d4e804") api.RegisterMessage((*IPReassemblyGet)(nil), "ip_reassembly_get_ea13ff63") api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip_reassembly_get_reply_d5eb8d34") api.RegisterMessage((*IPReassemblySet)(nil), "ip_reassembly_set_16467d25") api.RegisterMessage((*IPReassemblySetReply)(nil), "ip_reassembly_set_reply_e8d4e804") - api.RegisterMessage((*IPRouteAddDel)(nil), "ip_route_add_del_c1ff832d") + api.RegisterMessage((*IPRouteAddDel)(nil), "ip_route_add_del_b8ecfe0d") api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip_route_add_del_reply_1992deab") - api.RegisterMessage((*IPRouteDetails)(nil), "ip_route_details_d1ffaae1") + api.RegisterMessage((*IPRouteAddDelV2)(nil), "ip_route_add_del_v2_521ef330") + api.RegisterMessage((*IPRouteAddDelV2Reply)(nil), "ip_route_add_del_v2_reply_1992deab") + api.RegisterMessage((*IPRouteDetails)(nil), "ip_route_details_bda8f315") api.RegisterMessage((*IPRouteDump)(nil), "ip_route_dump_b9d2e09e") - api.RegisterMessage((*IPRouteLookup)(nil), "ip_route_lookup_e2986185") - api.RegisterMessage((*IPRouteLookupReply)(nil), "ip_route_lookup_reply_ae99de8e") - api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip_source_and_port_range_check_add_del_8bfc76f2") + api.RegisterMessage((*IPRouteLookup)(nil), "ip_route_lookup_710d6471") + api.RegisterMessage((*IPRouteLookupReply)(nil), "ip_route_lookup_reply_5d8febcb") + api.RegisterMessage((*IPRouteLookupV2)(nil), "ip_route_lookup_v2_710d6471") + api.RegisterMessage((*IPRouteLookupV2Reply)(nil), "ip_route_lookup_v2_reply_84cc9e03") + api.RegisterMessage((*IPRouteV2Details)(nil), "ip_route_v2_details_b09aa6c0") + api.RegisterMessage((*IPRouteV2Dump)(nil), "ip_route_v2_dump_d16f72e6") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip_source_and_port_range_check_add_del_92a067e3") api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip_source_and_port_range_check_add_del_reply_e8d4e804") api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip_source_and_port_range_check_interface_add_del_e1ba8987") api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip_source_and_port_range_check_interface_add_del_reply_e8d4e804") api.RegisterMessage((*IPTableAddDel)(nil), "ip_table_add_del_0ffdaec0") api.RegisterMessage((*IPTableAddDelReply)(nil), "ip_table_add_del_reply_e8d4e804") + api.RegisterMessage((*IPTableAllocate)(nil), "ip_table_allocate_b9d2e09e") + api.RegisterMessage((*IPTableAllocateReply)(nil), "ip_table_allocate_reply_1728303a") api.RegisterMessage((*IPTableDetails)(nil), "ip_table_details_c79fca0f") api.RegisterMessage((*IPTableDump)(nil), "ip_table_dump_51077d14") api.RegisterMessage((*IPTableFlush)(nil), "ip_table_flush_b9d2e09e") @@ -2966,21 +4517,29 @@ func file_ip_binapi_init() { api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip_table_replace_begin_reply_e8d4e804") api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip_table_replace_end_b9d2e09e") api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip_table_replace_end_reply_e8d4e804") - api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip_unnumbered_details_aa12a483") + api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip_unnumbered_details_cc59bd42") api.RegisterMessage((*IPUnnumberedDump)(nil), "ip_unnumbered_dump_f9e6675e") - api.RegisterMessage((*MfibSignalDetails)(nil), "mfib_signal_details_64398a9a") + api.RegisterMessage((*MfibSignalDetails)(nil), "mfib_signal_details_6f4a4cfb") api.RegisterMessage((*MfibSignalDump)(nil), "mfib_signal_dump_51077d14") api.RegisterMessage((*SetIPFlowHash)(nil), "set_ip_flow_hash_084ee09e") api.RegisterMessage((*SetIPFlowHashReply)(nil), "set_ip_flow_hash_reply_e8d4e804") + api.RegisterMessage((*SetIPFlowHashRouterID)(nil), "set_ip_flow_hash_router_id_03e4f48e") + api.RegisterMessage((*SetIPFlowHashRouterIDReply)(nil), "set_ip_flow_hash_router_id_reply_e8d4e804") + api.RegisterMessage((*SetIPFlowHashV2)(nil), "set_ip_flow_hash_v2_6d132100") + api.RegisterMessage((*SetIPFlowHashV2Reply)(nil), "set_ip_flow_hash_v2_reply_e8d4e804") api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "sw_interface_ip6_enable_disable_ae6cfcfb") api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "sw_interface_ip6_enable_disable_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "sw_interface_ip6_set_link_local_address_2931d9fa") + api.RegisterMessage((*SwInterfaceIP6GetLinkLocalAddress)(nil), "sw_interface_ip6_get_link_local_address_f9e6675e") + api.RegisterMessage((*SwInterfaceIP6GetLinkLocalAddressReply)(nil), "sw_interface_ip6_get_link_local_address_reply_d16b7130") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "sw_interface_ip6_set_link_local_address_1c10f15f") api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "sw_interface_ip6_set_link_local_address_reply_e8d4e804") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*AddDelIPPuntRedirectV2)(nil), + (*AddDelIPPuntRedirectV2Reply)(nil), (*IoamDisable)(nil), (*IoamDisableReply)(nil), (*IoamEnable)(nil), @@ -2999,12 +4558,23 @@ func AllMessages() []api.Message { (*IPMrouteDump)(nil), (*IPMtableDetails)(nil), (*IPMtableDump)(nil), + (*IPPathMtuDetails)(nil), + (*IPPathMtuGet)(nil), + (*IPPathMtuGetReply)(nil), + (*IPPathMtuReplaceBegin)(nil), + (*IPPathMtuReplaceBeginReply)(nil), + (*IPPathMtuReplaceEnd)(nil), + (*IPPathMtuReplaceEndReply)(nil), + (*IPPathMtuUpdate)(nil), + (*IPPathMtuUpdateReply)(nil), (*IPPuntPolice)(nil), (*IPPuntPoliceReply)(nil), (*IPPuntRedirect)(nil), (*IPPuntRedirectDetails)(nil), (*IPPuntRedirectDump)(nil), (*IPPuntRedirectReply)(nil), + (*IPPuntRedirectV2Details)(nil), + (*IPPuntRedirectV2Dump)(nil), (*IPReassemblyEnableDisable)(nil), (*IPReassemblyEnableDisableReply)(nil), (*IPReassemblyGet)(nil), @@ -3013,16 +4583,24 @@ func AllMessages() []api.Message { (*IPReassemblySetReply)(nil), (*IPRouteAddDel)(nil), (*IPRouteAddDelReply)(nil), + (*IPRouteAddDelV2)(nil), + (*IPRouteAddDelV2Reply)(nil), (*IPRouteDetails)(nil), (*IPRouteDump)(nil), (*IPRouteLookup)(nil), (*IPRouteLookupReply)(nil), + (*IPRouteLookupV2)(nil), + (*IPRouteLookupV2Reply)(nil), + (*IPRouteV2Details)(nil), + (*IPRouteV2Dump)(nil), (*IPSourceAndPortRangeCheckAddDel)(nil), (*IPSourceAndPortRangeCheckAddDelReply)(nil), (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), (*IPTableAddDel)(nil), (*IPTableAddDelReply)(nil), + (*IPTableAllocate)(nil), + (*IPTableAllocateReply)(nil), (*IPTableDetails)(nil), (*IPTableDump)(nil), (*IPTableFlush)(nil), @@ -3037,8 +4615,14 @@ func AllMessages() []api.Message { (*MfibSignalDump)(nil), (*SetIPFlowHash)(nil), (*SetIPFlowHashReply)(nil), + (*SetIPFlowHashRouterID)(nil), + (*SetIPFlowHashRouterIDReply)(nil), + (*SetIPFlowHashV2)(nil), + (*SetIPFlowHashV2Reply)(nil), (*SwInterfaceIP6EnableDisable)(nil), (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6GetLinkLocalAddress)(nil), + (*SwInterfaceIP6GetLinkLocalAddressReply)(nil), (*SwInterfaceIP6SetLinkLocalAddress)(nil), (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), } diff --git a/binapi/ip/ip_rest.ba.go b/binapi/ip/ip_rest.ba.go deleted file mode 100644 index 245ffed..0000000 --- a/binapi/ip/ip_rest.ba.go +++ /dev/null @@ -1,474 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IoamDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ioam_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IoamEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_container_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPContainerProxyAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPContainerProxyAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_mroute_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPMrouteAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPMrouteAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_punt_police", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPPuntPolice) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPPuntPolice(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_punt_redirect", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPPuntRedirect) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPPuntRedirect(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_reassembly_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblyEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPReassemblyEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_reassembly_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblyGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPReassemblyGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_reassembly_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblySet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPReassemblySet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPRouteAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPRouteAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_route_lookup", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPRouteLookup) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPRouteLookup(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_source_and_port_range_check_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPSourceAndPortRangeCheckAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPSourceAndPortRangeCheckAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_source_and_port_range_check_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPSourceAndPortRangeCheckInterfaceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPSourceAndPortRangeCheckInterfaceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_table_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableFlush) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPTableFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_table_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableReplaceBegin) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPTableReplaceBegin(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_table_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableReplaceEnd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPTableReplaceEnd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/set_ip_flow_hash", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIPFlowHash) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SetIPFlowHash(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6EnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceIP6EnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_ip6_set_link_local_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6SetLinkLocalAddress) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceIP6SetLinkLocalAddress(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ip/ip_rpc.ba.go b/binapi/ip/ip_rpc.ba.go index f50c660..d1b9dad 100644 --- a/binapi/ip/ip_rpc.ba.go +++ b/binapi/ip/ip_rpc.ba.go @@ -5,13 +5,15 @@ package ip import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ip. +// RPCService defines RPC service ip. type RPCService interface { + AddDelIPPuntRedirectV2(ctx context.Context, in *AddDelIPPuntRedirectV2) (*AddDelIPPuntRedirectV2Reply, error) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) IPAddressDump(ctx context.Context, in *IPAddressDump) (RPCService_IPAddressDumpClient, error) @@ -21,18 +23,27 @@ type RPCService interface { IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPCService_IPMrouteDumpClient, error) IPMtableDump(ctx context.Context, in *IPMtableDump) (RPCService_IPMtableDumpClient, error) + IPPathMtuGet(ctx context.Context, in *IPPathMtuGet) (RPCService_IPPathMtuGetClient, error) + IPPathMtuReplaceBegin(ctx context.Context, in *IPPathMtuReplaceBegin) (*IPPathMtuReplaceBeginReply, error) + IPPathMtuReplaceEnd(ctx context.Context, in *IPPathMtuReplaceEnd) (*IPPathMtuReplaceEndReply, error) + IPPathMtuUpdate(ctx context.Context, in *IPPathMtuUpdate) (*IPPathMtuUpdateReply, error) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) IPPuntRedirectDump(ctx context.Context, in *IPPuntRedirectDump) (RPCService_IPPuntRedirectDumpClient, error) + IPPuntRedirectV2Dump(ctx context.Context, in *IPPuntRedirectV2Dump) (RPCService_IPPuntRedirectV2DumpClient, error) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPRouteAddDelV2(ctx context.Context, in *IPRouteAddDelV2) (*IPRouteAddDelV2Reply, error) IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCService_IPRouteDumpClient, error) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) + IPRouteLookupV2(ctx context.Context, in *IPRouteLookupV2) (*IPRouteLookupV2Reply, error) + IPRouteV2Dump(ctx context.Context, in *IPRouteV2Dump) (RPCService_IPRouteV2DumpClient, error) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + IPTableAllocate(ctx context.Context, in *IPTableAllocate) (*IPTableAllocateReply, error) IPTableDump(ctx context.Context, in *IPTableDump) (RPCService_IPTableDumpClient, error) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) @@ -40,7 +51,10 @@ type RPCService interface { IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDump) (RPCService_IPUnnumberedDumpClient, error) MfibSignalDump(ctx context.Context, in *MfibSignalDump) (RPCService_MfibSignalDumpClient, error) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SetIPFlowHashRouterID(ctx context.Context, in *SetIPFlowHashRouterID) (*SetIPFlowHashRouterIDReply, error) + SetIPFlowHashV2(ctx context.Context, in *SetIPFlowHashV2) (*SetIPFlowHashV2Reply, error) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6GetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6GetLinkLocalAddress) (*SwInterfaceIP6GetLinkLocalAddressReply, error) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) } @@ -52,13 +66,22 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) AddDelIPPuntRedirectV2(ctx context.Context, in *AddDelIPPuntRedirectV2) (*AddDelIPPuntRedirectV2Reply, error) { + out := new(AddDelIPPuntRedirectV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { out := new(IoamDisableReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { @@ -67,7 +90,7 @@ func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPAddressDump(ctx context.Context, in *IPAddressDump) (RPCService_IPAddressDumpClient, error) { @@ -79,7 +102,7 @@ func (c *serviceClient) IPAddressDump(ctx context.Context, in *IPAddressDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -102,7 +125,11 @@ func (c *serviceClient_IPAddressDumpClient) Recv() (*IPAddressDetails, error) { switch m := msg.(type) { case *IPAddressDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -115,7 +142,7 @@ func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPContainerProxyDump(ctx context.Context, in *IPContainerProxyDump) (RPCService_IPContainerProxyDumpClient, error) { @@ -127,7 +154,7 @@ func (c *serviceClient) IPContainerProxyDump(ctx context.Context, in *IPContaine if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -150,7 +177,11 @@ func (c *serviceClient_IPContainerProxyDumpClient) Recv() (*IPContainerProxyDeta switch m := msg.(type) { case *IPContainerProxyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -166,7 +197,7 @@ func (c *serviceClient) IPDump(ctx context.Context, in *IPDump) (RPCService_IPDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -189,7 +220,11 @@ func (c *serviceClient_IPDumpClient) Recv() (*IPDetails, error) { switch m := msg.(type) { case *IPDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -202,7 +237,7 @@ func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPCService_IPMrouteDumpClient, error) { @@ -214,7 +249,7 @@ func (c *serviceClient) IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -237,7 +272,11 @@ func (c *serviceClient_IPMrouteDumpClient) Recv() (*IPMrouteDetails, error) { switch m := msg.(type) { case *IPMrouteDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -253,7 +292,7 @@ func (c *serviceClient) IPMtableDump(ctx context.Context, in *IPMtableDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -276,20 +315,91 @@ func (c *serviceClient_IPMtableDumpClient) Recv() (*IPMtableDetails, error) { switch m := msg.(type) { case *IPMtableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPPathMtuGet(ctx context.Context, in *IPPathMtuGet) (RPCService_IPPathMtuGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPPathMtuGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPPathMtuGetClient interface { + Recv() (*IPPathMtuDetails, error) + api.Stream +} + +type serviceClient_IPPathMtuGetClient struct { + api.Stream +} + +func (c *serviceClient_IPPathMtuGetClient) Recv() (*IPPathMtuDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPPathMtuDetails: + return m, nil + case *IPPathMtuGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) IPPathMtuReplaceBegin(ctx context.Context, in *IPPathMtuReplaceBegin) (*IPPathMtuReplaceBeginReply, error) { + out := new(IPPathMtuReplaceBeginReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPPathMtuReplaceEnd(ctx context.Context, in *IPPathMtuReplaceEnd) (*IPPathMtuReplaceEndReply, error) { + out := new(IPPathMtuReplaceEndReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPPathMtuUpdate(ctx context.Context, in *IPPathMtuUpdate) (*IPPathMtuUpdateReply, error) { + out := new(IPPathMtuUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { out := new(IPPuntPoliceReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { @@ -298,7 +408,7 @@ func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPPuntRedirectDump(ctx context.Context, in *IPPuntRedirectDump) (RPCService_IPPuntRedirectDumpClient, error) { @@ -310,7 +420,7 @@ func (c *serviceClient) IPPuntRedirectDump(ctx context.Context, in *IPPuntRedire if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -333,7 +443,54 @@ func (c *serviceClient_IPPuntRedirectDumpClient) Recv() (*IPPuntRedirectDetails, switch m := msg.(type) { case *IPPuntRedirectDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPPuntRedirectV2Dump(ctx context.Context, in *IPPuntRedirectV2Dump) (RPCService_IPPuntRedirectV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPPuntRedirectV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPPuntRedirectV2DumpClient interface { + Recv() (*IPPuntRedirectV2Details, error) + api.Stream +} + +type serviceClient_IPPuntRedirectV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_IPPuntRedirectV2DumpClient) Recv() (*IPPuntRedirectV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPPuntRedirectV2Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -346,7 +503,7 @@ func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPRea if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { @@ -355,7 +512,7 @@ func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { @@ -364,7 +521,7 @@ func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { @@ -373,7 +530,16 @@ func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPRouteAddDelV2(ctx context.Context, in *IPRouteAddDelV2) (*IPRouteAddDelV2Reply, error) { + out := new(IPRouteAddDelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCService_IPRouteDumpClient, error) { @@ -385,7 +551,7 @@ func (c *serviceClient) IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -408,7 +574,11 @@ func (c *serviceClient_IPRouteDumpClient) Recv() (*IPRouteDetails, error) { switch m := msg.(type) { case *IPRouteDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -421,7 +591,59 @@ func (c *serviceClient) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPRouteLookupV2(ctx context.Context, in *IPRouteLookupV2) (*IPRouteLookupV2Reply, error) { + out := new(IPRouteLookupV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPRouteV2Dump(ctx context.Context, in *IPRouteV2Dump) (RPCService_IPRouteV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPRouteV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPRouteV2DumpClient interface { + Recv() (*IPRouteV2Details, error) + api.Stream +} + +type serviceClient_IPRouteV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_IPRouteV2DumpClient) Recv() (*IPRouteV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPRouteV2Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { @@ -430,7 +652,7 @@ func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { @@ -439,7 +661,7 @@ func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Con if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { @@ -448,7 +670,16 @@ func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IPTableAllocate(ctx context.Context, in *IPTableAllocate) (*IPTableAllocateReply, error) { + out := new(IPTableAllocateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableDump(ctx context.Context, in *IPTableDump) (RPCService_IPTableDumpClient, error) { @@ -460,7 +691,7 @@ func (c *serviceClient) IPTableDump(ctx context.Context, in *IPTableDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -483,7 +714,11 @@ func (c *serviceClient_IPTableDumpClient) Recv() (*IPTableDetails, error) { switch m := msg.(type) { case *IPTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -496,7 +731,7 @@ func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { @@ -505,7 +740,7 @@ func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableRepl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { @@ -514,7 +749,7 @@ func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDump) (RPCService_IPUnnumberedDumpClient, error) { @@ -526,7 +761,7 @@ func (c *serviceClient) IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -549,7 +784,11 @@ func (c *serviceClient_IPUnnumberedDumpClient) Recv() (*IPUnnumberedDetails, err switch m := msg.(type) { case *IPUnnumberedDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -565,7 +804,7 @@ func (c *serviceClient) MfibSignalDump(ctx context.Context, in *MfibSignalDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -588,7 +827,11 @@ func (c *serviceClient_MfibSignalDumpClient) Recv() (*MfibSignalDetails, error) switch m := msg.(type) { case *MfibSignalDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -601,7 +844,25 @@ func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SetIPFlowHashRouterID(ctx context.Context, in *SetIPFlowHashRouterID) (*SetIPFlowHashRouterIDReply, error) { + out := new(SetIPFlowHashRouterIDReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SetIPFlowHashV2(ctx context.Context, in *SetIPFlowHashV2) (*SetIPFlowHashV2Reply, error) { + out := new(SetIPFlowHashV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { @@ -610,7 +871,16 @@ func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) SwInterfaceIP6GetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6GetLinkLocalAddress) (*SwInterfaceIP6GetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6GetLinkLocalAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { @@ -619,5 +889,5 @@ func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip6_nd/ip6_nd.ba.go b/binapi/ip6_nd/ip6_nd.ba.go index a5f308e..9db08c3 100644 --- a/binapi/ip6_nd/ip6_nd.ba.go +++ b/binapi/ip6_nd/ip6_nd.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ip6_nd.api.json // Package ip6_nd contains generated bindings for API file ip6_nd.api. // // Contents: // 1 struct -// 13 messages +// 15 messages // package ip6_nd import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ip6_nd" APIVersion = "1.0.0" - VersionCrc = 0x877c10de + VersionCrc = 0x64750117 ) // IP6RaPrefixInfo defines type 'ip6_ra_prefix_info'. @@ -55,7 +55,7 @@ type IP6RaEvent struct { func (m *IP6RaEvent) Reset() { *m = IP6RaEvent{} } func (*IP6RaEvent) GetMessageName() string { return "ip6_ra_event" } -func (*IP6RaEvent) GetCrcString() string { return "47e8cfbe" } +func (*IP6RaEvent) GetCrcString() string { return "0364c1c5" } func (*IP6RaEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -148,7 +148,7 @@ type IP6ndProxyAddDel struct { func (m *IP6ndProxyAddDel) Reset() { *m = IP6ndProxyAddDel{} } func (*IP6ndProxyAddDel) GetMessageName() string { return "ip6nd_proxy_add_del" } -func (*IP6ndProxyAddDel) GetCrcString() string { return "3fdf6659" } +func (*IP6ndProxyAddDel) GetCrcString() string { return "c2e4a686" } func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -221,7 +221,7 @@ type IP6ndProxyDetails struct { func (m *IP6ndProxyDetails) Reset() { *m = IP6ndProxyDetails{} } func (*IP6ndProxyDetails) GetMessageName() string { return "ip6nd_proxy_details" } -func (*IP6ndProxyDetails) GetCrcString() string { return "d35be8ff" } +func (*IP6ndProxyDetails) GetCrcString() string { return "30b9ff4a" } func (*IP6ndProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -277,6 +277,78 @@ func (m *IP6ndProxyDump) Unmarshal(b []byte) error { return nil } +// IP6ndProxyEnableDisable defines message 'ip6nd_proxy_enable_disable'. +type IP6ndProxyEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *IP6ndProxyEnableDisable) Reset() { *m = IP6ndProxyEnableDisable{} } +func (*IP6ndProxyEnableDisable) GetMessageName() string { return "ip6nd_proxy_enable_disable" } +func (*IP6ndProxyEnableDisable) GetCrcString() string { return "7daa1e3a" } +func (*IP6ndProxyEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6ndProxyEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsEnable + return size +} +func (m *IP6ndProxyEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *IP6ndProxyEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// IP6ndProxyEnableDisableReply defines message 'ip6nd_proxy_enable_disable_reply'. +type IP6ndProxyEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6ndProxyEnableDisableReply) Reset() { *m = IP6ndProxyEnableDisableReply{} } +func (*IP6ndProxyEnableDisableReply) GetMessageName() string { + return "ip6nd_proxy_enable_disable_reply" +} +func (*IP6ndProxyEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IP6ndProxyEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6ndProxyEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IP6ndProxyEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IP6ndProxyEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // IP6ndSendRouterSolicitation defines message 'ip6nd_send_router_solicitation'. type IP6ndSendRouterSolicitation struct { Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` @@ -501,7 +573,7 @@ type SwInterfaceIP6ndRaPrefix struct { func (m *SwInterfaceIP6ndRaPrefix) Reset() { *m = SwInterfaceIP6ndRaPrefix{} } func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { return "sw_interface_ip6nd_ra_prefix" } -func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { return "e098785f" } +func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { return "82cc1b28" } func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { return api.RequestMessage } @@ -667,16 +739,18 @@ func (m *WantIP6RaEventsReply) Unmarshal(b []byte) error { func init() { file_ip6_nd_binapi_init() } func file_ip6_nd_binapi_init() { - api.RegisterMessage((*IP6RaEvent)(nil), "ip6_ra_event_47e8cfbe") - api.RegisterMessage((*IP6ndProxyAddDel)(nil), "ip6nd_proxy_add_del_3fdf6659") + api.RegisterMessage((*IP6RaEvent)(nil), "ip6_ra_event_0364c1c5") + api.RegisterMessage((*IP6ndProxyAddDel)(nil), "ip6nd_proxy_add_del_c2e4a686") api.RegisterMessage((*IP6ndProxyAddDelReply)(nil), "ip6nd_proxy_add_del_reply_e8d4e804") - api.RegisterMessage((*IP6ndProxyDetails)(nil), "ip6nd_proxy_details_d35be8ff") + api.RegisterMessage((*IP6ndProxyDetails)(nil), "ip6nd_proxy_details_30b9ff4a") api.RegisterMessage((*IP6ndProxyDump)(nil), "ip6nd_proxy_dump_51077d14") + api.RegisterMessage((*IP6ndProxyEnableDisable)(nil), "ip6nd_proxy_enable_disable_7daa1e3a") + api.RegisterMessage((*IP6ndProxyEnableDisableReply)(nil), "ip6nd_proxy_enable_disable_reply_e8d4e804") api.RegisterMessage((*IP6ndSendRouterSolicitation)(nil), "ip6nd_send_router_solicitation_e5de609c") api.RegisterMessage((*IP6ndSendRouterSolicitationReply)(nil), "ip6nd_send_router_solicitation_reply_e8d4e804") api.RegisterMessage((*SwInterfaceIP6ndRaConfig)(nil), "sw_interface_ip6nd_ra_config_3eb00b1c") api.RegisterMessage((*SwInterfaceIP6ndRaConfigReply)(nil), "sw_interface_ip6nd_ra_config_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceIP6ndRaPrefix)(nil), "sw_interface_ip6nd_ra_prefix_e098785f") + api.RegisterMessage((*SwInterfaceIP6ndRaPrefix)(nil), "sw_interface_ip6nd_ra_prefix_82cc1b28") api.RegisterMessage((*SwInterfaceIP6ndRaPrefixReply)(nil), "sw_interface_ip6nd_ra_prefix_reply_e8d4e804") api.RegisterMessage((*WantIP6RaEvents)(nil), "want_ip6_ra_events_3ec6d6c2") api.RegisterMessage((*WantIP6RaEventsReply)(nil), "want_ip6_ra_events_reply_e8d4e804") @@ -690,6 +764,8 @@ func AllMessages() []api.Message { (*IP6ndProxyAddDelReply)(nil), (*IP6ndProxyDetails)(nil), (*IP6ndProxyDump)(nil), + (*IP6ndProxyEnableDisable)(nil), + (*IP6ndProxyEnableDisableReply)(nil), (*IP6ndSendRouterSolicitation)(nil), (*IP6ndSendRouterSolicitationReply)(nil), (*SwInterfaceIP6ndRaConfig)(nil), diff --git a/binapi/ip6_nd/ip6_nd_rest.ba.go b/binapi/ip6_nd/ip6_nd_rest.ba.go deleted file mode 100644 index 2bd060d..0000000 --- a/binapi/ip6_nd/ip6_nd_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip6_nd - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip6nd_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6ndProxyAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IP6ndProxyAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip6nd_send_router_solicitation", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6ndSendRouterSolicitation) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IP6ndSendRouterSolicitation(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_ip6nd_ra_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6ndRaConfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceIP6ndRaConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_ip6nd_ra_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6ndRaPrefix) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceIP6ndRaPrefix(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_ip6_ra_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIP6RaEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantIP6RaEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ip6_nd/ip6_nd_rpc.ba.go b/binapi/ip6_nd/ip6_nd_rpc.ba.go index 3bfbac0..43b85bd 100644 --- a/binapi/ip6_nd/ip6_nd_rpc.ba.go +++ b/binapi/ip6_nd/ip6_nd_rpc.ba.go @@ -5,15 +5,17 @@ package ip6_nd import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ip6_nd. +// RPCService defines RPC service ip6_nd. type RPCService interface { IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) + IP6ndProxyEnableDisable(ctx context.Context, in *IP6ndProxyEnableDisable) (*IP6ndProxyEnableDisableReply, error) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) @@ -34,7 +36,7 @@ func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) { @@ -46,7 +48,7 @@ func (c *serviceClient) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -69,20 +71,33 @@ func (c *serviceClient_IP6ndProxyDumpClient) Recv() (*IP6ndProxyDetails, error) switch m := msg.(type) { case *IP6ndProxyDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) IP6ndProxyEnableDisable(ctx context.Context, in *IP6ndProxyEnableDisable) (*IP6ndProxyEnableDisableReply, error) { + out := new(IP6ndProxyEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { out := new(IP6ndSendRouterSolicitationReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { @@ -91,7 +106,7 @@ func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { @@ -100,7 +115,7 @@ func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { @@ -109,5 +124,5 @@ func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip_neighbor/ip_neighbor.ba.go b/binapi/ip_neighbor/ip_neighbor.ba.go index b4da5b1..b737957 100644 --- a/binapi/ip_neighbor/ip_neighbor.ba.go +++ b/binapi/ip_neighbor/ip_neighbor.ba.go @@ -1,25 +1,26 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ip_neighbor.api.json // Package ip_neighbor contains generated bindings for API file ip_neighbor.api. // // Contents: -// 1 enum +// 2 enums // 1 struct -// 15 messages +// 18 messages // package ip_neighbor import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -31,9 +32,55 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ip_neighbor" APIVersion = "1.0.0" - VersionCrc = 0xe6512b94 + VersionCrc = 0xfde4a69a +) + +// IPNeighborEventFlags defines enum 'ip_neighbor_event_flags'. +type IPNeighborEventFlags uint32 + +const ( + IP_NEIGHBOR_API_EVENT_FLAG_ADDED IPNeighborEventFlags = 1 + IP_NEIGHBOR_API_EVENT_FLAG_REMOVED IPNeighborEventFlags = 2 ) +var ( + IPNeighborEventFlags_name = map[uint32]string{ + 1: "IP_NEIGHBOR_API_EVENT_FLAG_ADDED", + 2: "IP_NEIGHBOR_API_EVENT_FLAG_REMOVED", + } + IPNeighborEventFlags_value = map[string]uint32{ + "IP_NEIGHBOR_API_EVENT_FLAG_ADDED": 1, + "IP_NEIGHBOR_API_EVENT_FLAG_REMOVED": 2, + } +) + +func (x IPNeighborEventFlags) String() string { + s, ok := IPNeighborEventFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IPNeighborEventFlags_name[uint32(n)] + if ok { + return s + } + return "IPNeighborEventFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + // IPNeighborFlags defines enum 'ip_neighbor_flags'. type IPNeighborFlags uint8 @@ -99,7 +146,7 @@ type IPNeighborAddDel struct { func (m *IPNeighborAddDel) Reset() { *m = IPNeighborAddDel{} } func (*IPNeighborAddDel) GetMessageName() string { return "ip_neighbor_add_del" } -func (*IPNeighborAddDel) GetCrcString() string { return "105518b6" } +func (*IPNeighborAddDel) GetCrcString() string { return "0607c257" } func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -263,7 +310,7 @@ type IPNeighborDetails struct { func (m *IPNeighborDetails) Reset() { *m = IPNeighborDetails{} } func (*IPNeighborDetails) GetMessageName() string { return "ip_neighbor_details" } -func (*IPNeighborDetails) GetCrcString() string { return "870e80b9" } +func (*IPNeighborDetails) GetCrcString() string { return "e29d79f0" } func (*IPNeighborDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -312,7 +359,7 @@ type IPNeighborDump struct { func (m *IPNeighborDump) Reset() { *m = IPNeighborDump{} } func (*IPNeighborDump) GetMessageName() string { return "ip_neighbor_dump" } -func (*IPNeighborDump) GetCrcString() string { return "cd831298" } +func (*IPNeighborDump) GetCrcString() string { return "d817a484" } func (*IPNeighborDump) GetMessageType() api.MessageType { return api.RequestMessage } @@ -342,6 +389,7 @@ func (m *IPNeighborDump) Unmarshal(b []byte) error { } // IPNeighborEvent defines message 'ip_neighbor_event'. +// Deprecated: the message will be removed in the future versions type IPNeighborEvent struct { PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` Neighbor IPNeighbor `binapi:"ip_neighbor,name=neighbor" json:"neighbor,omitempty"` @@ -349,7 +397,7 @@ type IPNeighborEvent struct { func (m *IPNeighborEvent) Reset() { *m = IPNeighborEvent{} } func (*IPNeighborEvent) GetMessageName() string { return "ip_neighbor_event" } -func (*IPNeighborEvent) GetCrcString() string { return "83933131" } +func (*IPNeighborEvent) GetCrcString() string { return "bdb092b2" } func (*IPNeighborEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -390,6 +438,59 @@ func (m *IPNeighborEvent) Unmarshal(b []byte) error { return nil } +// IPNeighborEventV2 defines message 'ip_neighbor_event_v2'. +type IPNeighborEventV2 struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + Flags IPNeighborEventFlags `binapi:"ip_neighbor_event_flags,name=flags" json:"flags,omitempty"` + Neighbor IPNeighbor `binapi:"ip_neighbor,name=neighbor" json:"neighbor,omitempty"` +} + +func (m *IPNeighborEventV2) Reset() { *m = IPNeighborEventV2{} } +func (*IPNeighborEventV2) GetMessageName() string { return "ip_neighbor_event_v2" } +func (*IPNeighborEventV2) GetCrcString() string { return "c1d53dc0" } +func (*IPNeighborEventV2) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *IPNeighborEventV2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.Flags + size += 4 // m.Neighbor.SwIfIndex + size += 1 // m.Neighbor.Flags + size += 1 * 6 // m.Neighbor.MacAddress + size += 1 // m.Neighbor.IPAddress.Af + size += 1 * 16 // m.Neighbor.IPAddress.Un + return size +} +func (m *IPNeighborEventV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex)) + buf.EncodeUint8(uint8(m.Neighbor.Flags)) + buf.EncodeBytes(m.Neighbor.MacAddress[:], 6) + buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af)) + buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 16) + return buf.Bytes(), nil +} +func (m *IPNeighborEventV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.Flags = IPNeighborEventFlags(buf.DecodeUint32()) + m.Neighbor.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Neighbor.Flags = IPNeighborFlags(buf.DecodeUint8()) + copy(m.Neighbor.MacAddress[:], buf.DecodeBytes(6)) + m.Neighbor.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Neighbor.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + // IPNeighborFlush defines message 'ip_neighbor_flush'. type IPNeighborFlush struct { Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` @@ -581,6 +682,7 @@ func (m *IPNeighborReplaceEndReply) Unmarshal(b []byte) error { } // WantIPNeighborEvents defines message 'want_ip_neighbor_events'. +// Deprecated: the message will be removed in the future versions type WantIPNeighborEvents struct { Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` @@ -590,7 +692,7 @@ type WantIPNeighborEvents struct { func (m *WantIPNeighborEvents) Reset() { *m = WantIPNeighborEvents{} } func (*WantIPNeighborEvents) GetMessageName() string { return "want_ip_neighbor_events" } -func (*WantIPNeighborEvents) GetCrcString() string { return "1a312870" } +func (*WantIPNeighborEvents) GetCrcString() string { return "73e70a86" } func (*WantIPNeighborEvents) GetMessageType() api.MessageType { return api.RequestMessage } @@ -629,6 +731,7 @@ func (m *WantIPNeighborEvents) Unmarshal(b []byte) error { } // WantIPNeighborEventsReply defines message 'want_ip_neighbor_events_reply'. +// Deprecated: the message will be removed in the future versions type WantIPNeighborEventsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -661,23 +764,109 @@ func (m *WantIPNeighborEventsReply) Unmarshal(b []byte) error { return nil } +// WantIPNeighborEventsV2 defines message 'want_ip_neighbor_events_v2'. +type WantIPNeighborEventsV2 struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` +} + +func (m *WantIPNeighborEventsV2) Reset() { *m = WantIPNeighborEventsV2{} } +func (*WantIPNeighborEventsV2) GetMessageName() string { return "want_ip_neighbor_events_v2" } +func (*WantIPNeighborEventsV2) GetCrcString() string { return "73e70a86" } +func (*WantIPNeighborEventsV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantIPNeighborEventsV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Enable + size += 4 // m.PID + size += 1 // m.IP.Af + size += 1 * 16 // m.IP.Un + size += 4 // m.SwIfIndex + return size +} +func (m *WantIPNeighborEventsV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.Enable) + buf.EncodeUint32(m.PID) + buf.EncodeUint8(uint8(m.IP.Af)) + buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *WantIPNeighborEventsV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + m.IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// WantIPNeighborEventsV2Reply defines message 'want_ip_neighbor_events_v2_reply'. +type WantIPNeighborEventsV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantIPNeighborEventsV2Reply) Reset() { *m = WantIPNeighborEventsV2Reply{} } +func (*WantIPNeighborEventsV2Reply) GetMessageName() string { + return "want_ip_neighbor_events_v2_reply" +} +func (*WantIPNeighborEventsV2Reply) GetCrcString() string { return "e8d4e804" } +func (*WantIPNeighborEventsV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantIPNeighborEventsV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantIPNeighborEventsV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WantIPNeighborEventsV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_ip_neighbor_binapi_init() } func file_ip_neighbor_binapi_init() { - api.RegisterMessage((*IPNeighborAddDel)(nil), "ip_neighbor_add_del_105518b6") + api.RegisterMessage((*IPNeighborAddDel)(nil), "ip_neighbor_add_del_0607c257") api.RegisterMessage((*IPNeighborAddDelReply)(nil), "ip_neighbor_add_del_reply_1992deab") api.RegisterMessage((*IPNeighborConfig)(nil), "ip_neighbor_config_f4a5cf44") api.RegisterMessage((*IPNeighborConfigReply)(nil), "ip_neighbor_config_reply_e8d4e804") - api.RegisterMessage((*IPNeighborDetails)(nil), "ip_neighbor_details_870e80b9") - api.RegisterMessage((*IPNeighborDump)(nil), "ip_neighbor_dump_cd831298") - api.RegisterMessage((*IPNeighborEvent)(nil), "ip_neighbor_event_83933131") + api.RegisterMessage((*IPNeighborDetails)(nil), "ip_neighbor_details_e29d79f0") + api.RegisterMessage((*IPNeighborDump)(nil), "ip_neighbor_dump_d817a484") + api.RegisterMessage((*IPNeighborEvent)(nil), "ip_neighbor_event_bdb092b2") + api.RegisterMessage((*IPNeighborEventV2)(nil), "ip_neighbor_event_v2_c1d53dc0") api.RegisterMessage((*IPNeighborFlush)(nil), "ip_neighbor_flush_16aa35d2") api.RegisterMessage((*IPNeighborFlushReply)(nil), "ip_neighbor_flush_reply_e8d4e804") api.RegisterMessage((*IPNeighborReplaceBegin)(nil), "ip_neighbor_replace_begin_51077d14") api.RegisterMessage((*IPNeighborReplaceBeginReply)(nil), "ip_neighbor_replace_begin_reply_e8d4e804") api.RegisterMessage((*IPNeighborReplaceEnd)(nil), "ip_neighbor_replace_end_51077d14") api.RegisterMessage((*IPNeighborReplaceEndReply)(nil), "ip_neighbor_replace_end_reply_e8d4e804") - api.RegisterMessage((*WantIPNeighborEvents)(nil), "want_ip_neighbor_events_1a312870") + api.RegisterMessage((*WantIPNeighborEvents)(nil), "want_ip_neighbor_events_73e70a86") api.RegisterMessage((*WantIPNeighborEventsReply)(nil), "want_ip_neighbor_events_reply_e8d4e804") + api.RegisterMessage((*WantIPNeighborEventsV2)(nil), "want_ip_neighbor_events_v2_73e70a86") + api.RegisterMessage((*WantIPNeighborEventsV2Reply)(nil), "want_ip_neighbor_events_v2_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -690,6 +879,7 @@ func AllMessages() []api.Message { (*IPNeighborDetails)(nil), (*IPNeighborDump)(nil), (*IPNeighborEvent)(nil), + (*IPNeighborEventV2)(nil), (*IPNeighborFlush)(nil), (*IPNeighborFlushReply)(nil), (*IPNeighborReplaceBegin)(nil), @@ -698,5 +888,7 @@ func AllMessages() []api.Message { (*IPNeighborReplaceEndReply)(nil), (*WantIPNeighborEvents)(nil), (*WantIPNeighborEventsReply)(nil), + (*WantIPNeighborEventsV2)(nil), + (*WantIPNeighborEventsV2Reply)(nil), } } diff --git a/binapi/ip_neighbor/ip_neighbor_rest.ba.go b/binapi/ip_neighbor/ip_neighbor_rest.ba.go deleted file mode 100644 index 7db4694..0000000 --- a/binapi/ip_neighbor/ip_neighbor_rest.ba.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip_neighbor - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip_neighbor_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPNeighborAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_neighbor_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborConfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPNeighborConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_neighbor_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborFlush) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IPNeighborFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_neighbor_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborReplaceBegin) - reply, err := rpc.IPNeighborReplaceBegin(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ip_neighbor_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborReplaceEnd) - reply, err := rpc.IPNeighborReplaceEnd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_ip_neighbor_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIPNeighborEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantIPNeighborEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ip_neighbor/ip_neighbor_rpc.ba.go b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go index 86589dd..00c2e45 100644 --- a/binapi/ip_neighbor/ip_neighbor_rpc.ba.go +++ b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go @@ -5,12 +5,13 @@ package ip_neighbor import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ip_neighbor. +// RPCService defines RPC service ip_neighbor. type RPCService interface { IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) @@ -19,6 +20,7 @@ type RPCService interface { IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) + WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error) } type serviceClient struct { @@ -35,7 +37,7 @@ func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) { @@ -44,7 +46,7 @@ func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) { @@ -56,7 +58,7 @@ func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -79,7 +81,11 @@ func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) switch m := msg.(type) { case *IPNeighborDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -92,7 +98,7 @@ func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) { @@ -101,7 +107,7 @@ func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighb if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) { @@ -110,7 +116,7 @@ func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighbor if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) { @@ -119,5 +125,14 @@ func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeig if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error) { + out := new(WantIPNeighborEventsV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip_types/ip_types.ba.go b/binapi/ip_types/ip_types.ba.go index 9cb2e13..fb36a4a 100644 --- a/binapi/ip_types/ip_types.ba.go +++ b/binapi/ip_types/ip_types.ba.go @@ -1,26 +1,27 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ip_types.api.json // Package ip_types contains generated bindings for API file ip_types.api. // // Contents: // 5 aliases -// 4 enums -// 6 structs +// 5 enums +// 8 structs // 1 union // package ip_types import ( "fmt" - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" "net" "strconv" "strings" + + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,6 +30,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "ip_types" + APIVersion = "3.0.0" + VersionCrc = 0xfee023ed +) + // AddressFamily defines enum 'address_family'. type AddressFamily uint8 @@ -173,6 +180,42 @@ func (x IPEcn) String() string { return "IPEcn(" + strconv.Itoa(int(x)) + ")" } +// IPFeatureLocation defines enum 'ip_feature_location'. +type IPFeatureLocation uint8 + +const ( + IP_API_FEATURE_INPUT IPFeatureLocation = 0 + IP_API_FEATURE_OUTPUT IPFeatureLocation = 1 + IP_API_FEATURE_LOCAL IPFeatureLocation = 2 + IP_API_FEATURE_PUNT IPFeatureLocation = 3 + IP_API_FEATURE_DROP IPFeatureLocation = 4 +) + +var ( + IPFeatureLocation_name = map[uint8]string{ + 0: "IP_API_FEATURE_INPUT", + 1: "IP_API_FEATURE_OUTPUT", + 2: "IP_API_FEATURE_LOCAL", + 3: "IP_API_FEATURE_PUNT", + 4: "IP_API_FEATURE_DROP", + } + IPFeatureLocation_value = map[string]uint8{ + "IP_API_FEATURE_INPUT": 0, + "IP_API_FEATURE_OUTPUT": 1, + "IP_API_FEATURE_LOCAL": 2, + "IP_API_FEATURE_PUNT": 3, + "IP_API_FEATURE_DROP": 4, + } +) + +func (x IPFeatureLocation) String() string { + s, ok := IPFeatureLocation_name[uint8(x)] + if ok { + return s + } + return "IPFeatureLocation(" + strconv.Itoa(int(x)) + ")" +} + // IPProto defines enum 'ip_proto'. type IPProto uint8 @@ -243,12 +286,15 @@ func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) { } return AddressWithPrefix(prefix), nil } + func (x AddressWithPrefix) String() string { return Prefix(x).String() } + func (x *AddressWithPrefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *AddressWithPrefix) UnmarshalText(text []byte) error { prefix, err := ParseAddressWithPrefix(string(text)) if err != nil { @@ -274,12 +320,15 @@ func ParseIP4Address(s string) (IP4Address, error) { func (x IP4Address) ToIP() net.IP { return net.IP(x[:]).To4() } + func (x IP4Address) String() string { return x.ToIP().String() } + func (x *IP4Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP4Address) UnmarshalText(text []byte) error { ipaddr, err := ParseIP4Address(string(text)) if err != nil { @@ -308,12 +357,15 @@ func ParseIP6Address(s string) (IP6Address, error) { func (x IP6Address) ToIP() net.IP { return net.IP(x[:]).To16() } + func (x IP6Address) String() string { return x.ToIP().String() } + func (x *IP6Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP6Address) UnmarshalText(text []byte) error { ipaddr, err := ParseIP6Address(string(text)) if err != nil { @@ -337,6 +389,10 @@ func ParseAddress(s string) (Address, error) { if ip == nil { return Address{}, fmt.Errorf("invalid address: %s", s) } + return AddressFromIP(ip), nil +} + +func AddressFromIP(ip net.IP) Address { var addr Address if ip.To4() == nil { addr.Af = ADDRESS_IP6 @@ -349,8 +405,9 @@ func ParseAddress(s string) (Address, error) { copy(ip4[:], ip.To4()) addr.Un.SetIP4(ip4) } - return addr, nil + return addr } + func (x Address) ToIP() net.IP { if x.Af == ADDRESS_IP6 { ip6 := x.Un.GetIP6() @@ -360,12 +417,15 @@ func (x Address) ToIP() net.IP { return net.IP(ip4[:]).To4() } } + func (x Address) String() string { return x.ToIP().String() } + func (x *Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *Address) UnmarshalText(text []byte) error { addr, err := ParseAddress(string(text)) if err != nil { @@ -375,6 +435,12 @@ func (x *Address) UnmarshalText(text []byte) error { return nil } +// IP4AddressAndMask defines type 'ip4_address_and_mask'. +type IP4AddressAndMask struct { + Addr IP4Address `binapi:"ip4_address,name=addr" json:"addr,omitempty"` + Mask IP4Address `binapi:"ip4_address,name=mask" json:"mask,omitempty"` +} + // IP4Prefix defines type 'ip4_prefix'. type IP4Prefix struct { Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` @@ -408,18 +474,22 @@ func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { } return prefix, nil } + func (x IP4Prefix) ToIPNet() *net.IPNet { mask := net.CIDRMask(int(x.Len), 32) ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x IP4Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *IP4Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP4Prefix) UnmarshalText(text []byte) error { prefix, err := ParseIP4Prefix(string(text)) if err != nil { @@ -429,6 +499,12 @@ func (x *IP4Prefix) UnmarshalText(text []byte) error { return nil } +// IP6AddressAndMask defines type 'ip6_address_and_mask'. +type IP6AddressAndMask struct { + Addr IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` + Mask IP6Address `binapi:"ip6_address,name=mask" json:"mask,omitempty"` +} + // IP6Prefix defines type 'ip6_prefix'. type IP6Prefix struct { Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` @@ -462,18 +538,22 @@ func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { } return prefix, nil } + func (x IP6Prefix) ToIPNet() *net.IPNet { mask := net.CIDRMask(int(x.Len), 128) ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x IP6Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *IP6Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP6Prefix) UnmarshalText(text []byte) error { prefix, err := ParseIP6Prefix(string(text)) if err != nil { @@ -524,6 +604,7 @@ func ParsePrefix(ip string) (prefix Prefix, err error) { } return prefix, nil } + func (x Prefix) ToIPNet() *net.IPNet { var mask net.IPMask if x.Address.Af == ADDRESS_IP4 { @@ -534,13 +615,16 @@ func (x Prefix) ToIPNet() *net.IPNet { ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *Prefix) UnmarshalText(text []byte) error { prefix, err := ParsePrefix(string(text)) if err != nil { @@ -558,8 +642,9 @@ type PrefixMatcher struct { // AddressUnion defines union 'address_union'. type AddressUnion struct { - // IP4 *IP4Address - // IP6 *IP6Address + // AddressUnion can be one of: + // - IP4 *IP4Address + // - IP6 *IP6Address XXX_UnionData [16]byte } diff --git a/binapi/ipfix_export/ipfix_export.ba.go b/binapi/ipfix_export/ipfix_export.ba.go index e173058..b8b8d0a 100644 --- a/binapi/ipfix_export/ipfix_export.ba.go +++ b/binapi/ipfix_export/ipfix_export.ba.go @@ -1,20 +1,20 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ipfix_export.api.json // Package ipfix_export contains generated bindings for API file ipfix_export.api. // // Contents: -// 14 messages +// 19 messages // package ipfix_export import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -25,10 +25,143 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ipfix_export" - APIVersion = "2.0.1" - VersionCrc = 0xb7e9cad2 + APIVersion = "2.0.3" + VersionCrc = 0x63e0810a ) +// IpfixAllExporterDetails defines message 'ipfix_all_exporter_details'. +type IpfixAllExporterDetails struct { + CollectorAddress ip_types.Address `binapi:"address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port" json:"collector_port,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` + TemplateInterval uint32 `binapi:"u32,name=template_interval" json:"template_interval,omitempty"` + UDPChecksum bool `binapi:"bool,name=udp_checksum" json:"udp_checksum,omitempty"` +} + +func (m *IpfixAllExporterDetails) Reset() { *m = IpfixAllExporterDetails{} } +func (*IpfixAllExporterDetails) GetMessageName() string { return "ipfix_all_exporter_details" } +func (*IpfixAllExporterDetails) GetCrcString() string { return "0dedbfe4" } +func (*IpfixAllExporterDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixAllExporterDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.CollectorAddress.Af + size += 1 * 16 // m.CollectorAddress.Un + size += 2 // m.CollectorPort + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 4 // m.VrfID + size += 4 // m.PathMtu + size += 4 // m.TemplateInterval + size += 1 // m.UDPChecksum + return size +} +func (m *IpfixAllExporterDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.CollectorAddress.Af)) + buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.CollectorPort) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint32(m.PathMtu) + buf.EncodeUint32(m.TemplateInterval) + buf.EncodeBool(m.UDPChecksum) + return buf.Bytes(), nil +} +func (m *IpfixAllExporterDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CollectorAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.CollectorAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.CollectorPort = buf.DecodeUint16() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.PathMtu = buf.DecodeUint32() + m.TemplateInterval = buf.DecodeUint32() + m.UDPChecksum = buf.DecodeBool() + return nil +} + +// IpfixAllExporterGet defines message 'ipfix_all_exporter_get'. +type IpfixAllExporterGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *IpfixAllExporterGet) Reset() { *m = IpfixAllExporterGet{} } +func (*IpfixAllExporterGet) GetMessageName() string { return "ipfix_all_exporter_get" } +func (*IpfixAllExporterGet) GetCrcString() string { return "f75ba505" } +func (*IpfixAllExporterGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixAllExporterGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *IpfixAllExporterGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *IpfixAllExporterGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// IpfixAllExporterGetReply defines message 'ipfix_all_exporter_get_reply'. +type IpfixAllExporterGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *IpfixAllExporterGetReply) Reset() { *m = IpfixAllExporterGetReply{} } +func (*IpfixAllExporterGetReply) GetMessageName() string { return "ipfix_all_exporter_get_reply" } +func (*IpfixAllExporterGetReply) GetCrcString() string { return "53b48f5d" } +func (*IpfixAllExporterGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixAllExporterGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *IpfixAllExporterGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *IpfixAllExporterGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + // IpfixClassifyStreamDetails defines message 'ipfix_classify_stream_details'. type IpfixClassifyStreamDetails struct { DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` @@ -241,6 +374,112 @@ func (m *IpfixClassifyTableDump) Unmarshal(b []byte) error { return nil } +// IpfixExporterCreateDelete defines message 'ipfix_exporter_create_delete'. +type IpfixExporterCreateDelete struct { + IsCreate bool `binapi:"bool,name=is_create" json:"is_create,omitempty"` + CollectorAddress ip_types.Address `binapi:"address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port" json:"collector_port,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` + TemplateInterval uint32 `binapi:"u32,name=template_interval" json:"template_interval,omitempty"` + UDPChecksum bool `binapi:"bool,name=udp_checksum" json:"udp_checksum,omitempty"` +} + +func (m *IpfixExporterCreateDelete) Reset() { *m = IpfixExporterCreateDelete{} } +func (*IpfixExporterCreateDelete) GetMessageName() string { return "ipfix_exporter_create_delete" } +func (*IpfixExporterCreateDelete) GetCrcString() string { return "0753a768" } +func (*IpfixExporterCreateDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixExporterCreateDelete) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsCreate + size += 1 // m.CollectorAddress.Af + size += 1 * 16 // m.CollectorAddress.Un + size += 2 // m.CollectorPort + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 4 // m.VrfID + size += 4 // m.PathMtu + size += 4 // m.TemplateInterval + size += 1 // m.UDPChecksum + return size +} +func (m *IpfixExporterCreateDelete) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsCreate) + buf.EncodeUint8(uint8(m.CollectorAddress.Af)) + buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.CollectorPort) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint32(m.PathMtu) + buf.EncodeUint32(m.TemplateInterval) + buf.EncodeBool(m.UDPChecksum) + return buf.Bytes(), nil +} +func (m *IpfixExporterCreateDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsCreate = buf.DecodeBool() + m.CollectorAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.CollectorAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.CollectorPort = buf.DecodeUint16() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.PathMtu = buf.DecodeUint32() + m.TemplateInterval = buf.DecodeUint32() + m.UDPChecksum = buf.DecodeBool() + return nil +} + +// IpfixExporterCreateDeleteReply defines message 'ipfix_exporter_create_delete_reply'. +type IpfixExporterCreateDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpfixExporterCreateDeleteReply) Reset() { *m = IpfixExporterCreateDeleteReply{} } +func (*IpfixExporterCreateDeleteReply) GetMessageName() string { + return "ipfix_exporter_create_delete_reply" +} +func (*IpfixExporterCreateDeleteReply) GetCrcString() string { return "9ffac24b" } +func (*IpfixExporterCreateDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixExporterCreateDeleteReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpfixExporterCreateDeleteReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpfixExporterCreateDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + // IpfixExporterDetails defines message 'ipfix_exporter_details'. type IpfixExporterDetails struct { CollectorAddress ip_types.Address `binapi:"address,name=collector_address" json:"collector_address,omitempty"` @@ -254,7 +493,7 @@ type IpfixExporterDetails struct { func (m *IpfixExporterDetails) Reset() { *m = IpfixExporterDetails{} } func (*IpfixExporterDetails) GetMessageName() string { return "ipfix_exporter_details" } -func (*IpfixExporterDetails) GetCrcString() string { return "11e07413" } +func (*IpfixExporterDetails) GetCrcString() string { return "0dedbfe4" } func (*IpfixExporterDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -474,7 +713,7 @@ type SetIpfixExporter struct { func (m *SetIpfixExporter) Reset() { *m = SetIpfixExporter{} } func (*SetIpfixExporter) GetMessageName() string { return "set_ipfix_exporter" } -func (*SetIpfixExporter) GetCrcString() string { return "69284e07" } +func (*SetIpfixExporter) GetCrcString() string { return "5530c8a0" } func (*SetIpfixExporter) GetMessageType() api.MessageType { return api.RequestMessage } @@ -559,31 +798,41 @@ func (m *SetIpfixExporterReply) Unmarshal(b []byte) error { func init() { file_ipfix_export_binapi_init() } func file_ipfix_export_binapi_init() { + api.RegisterMessage((*IpfixAllExporterDetails)(nil), "ipfix_all_exporter_details_0dedbfe4") + api.RegisterMessage((*IpfixAllExporterGet)(nil), "ipfix_all_exporter_get_f75ba505") + api.RegisterMessage((*IpfixAllExporterGetReply)(nil), "ipfix_all_exporter_get_reply_53b48f5d") api.RegisterMessage((*IpfixClassifyStreamDetails)(nil), "ipfix_classify_stream_details_2903539d") api.RegisterMessage((*IpfixClassifyStreamDump)(nil), "ipfix_classify_stream_dump_51077d14") api.RegisterMessage((*IpfixClassifyTableAddDel)(nil), "ipfix_classify_table_add_del_3e449bb9") api.RegisterMessage((*IpfixClassifyTableAddDelReply)(nil), "ipfix_classify_table_add_del_reply_e8d4e804") api.RegisterMessage((*IpfixClassifyTableDetails)(nil), "ipfix_classify_table_details_1af8c28c") api.RegisterMessage((*IpfixClassifyTableDump)(nil), "ipfix_classify_table_dump_51077d14") - api.RegisterMessage((*IpfixExporterDetails)(nil), "ipfix_exporter_details_11e07413") + api.RegisterMessage((*IpfixExporterCreateDelete)(nil), "ipfix_exporter_create_delete_0753a768") + api.RegisterMessage((*IpfixExporterCreateDeleteReply)(nil), "ipfix_exporter_create_delete_reply_9ffac24b") + api.RegisterMessage((*IpfixExporterDetails)(nil), "ipfix_exporter_details_0dedbfe4") api.RegisterMessage((*IpfixExporterDump)(nil), "ipfix_exporter_dump_51077d14") api.RegisterMessage((*IpfixFlush)(nil), "ipfix_flush_51077d14") api.RegisterMessage((*IpfixFlushReply)(nil), "ipfix_flush_reply_e8d4e804") api.RegisterMessage((*SetIpfixClassifyStream)(nil), "set_ipfix_classify_stream_c9cbe053") api.RegisterMessage((*SetIpfixClassifyStreamReply)(nil), "set_ipfix_classify_stream_reply_e8d4e804") - api.RegisterMessage((*SetIpfixExporter)(nil), "set_ipfix_exporter_69284e07") + api.RegisterMessage((*SetIpfixExporter)(nil), "set_ipfix_exporter_5530c8a0") api.RegisterMessage((*SetIpfixExporterReply)(nil), "set_ipfix_exporter_reply_e8d4e804") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*IpfixAllExporterDetails)(nil), + (*IpfixAllExporterGet)(nil), + (*IpfixAllExporterGetReply)(nil), (*IpfixClassifyStreamDetails)(nil), (*IpfixClassifyStreamDump)(nil), (*IpfixClassifyTableAddDel)(nil), (*IpfixClassifyTableAddDelReply)(nil), (*IpfixClassifyTableDetails)(nil), (*IpfixClassifyTableDump)(nil), + (*IpfixExporterCreateDelete)(nil), + (*IpfixExporterCreateDeleteReply)(nil), (*IpfixExporterDetails)(nil), (*IpfixExporterDump)(nil), (*IpfixFlush)(nil), diff --git a/binapi/ipfix_export/ipfix_export_rest.ba.go b/binapi/ipfix_export/ipfix_export_rest.ba.go deleted file mode 100644 index 65407bf..0000000 --- a/binapi/ipfix_export/ipfix_export_rest.ba.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipfix_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipfix_classify_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpfixClassifyTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpfixClassifyTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipfix_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpfixFlush) - reply, err := rpc.IpfixFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/set_ipfix_classify_stream", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIpfixClassifyStream) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SetIpfixClassifyStream(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/set_ipfix_exporter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIpfixExporter) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SetIpfixExporter(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ipfix_export/ipfix_export_rpc.ba.go b/binapi/ipfix_export/ipfix_export_rpc.ba.go index 4c0dd27..f34b4e6 100644 --- a/binapi/ipfix_export/ipfix_export_rpc.ba.go +++ b/binapi/ipfix_export/ipfix_export_rpc.ba.go @@ -5,16 +5,19 @@ package ipfix_export import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ipfix_export. +// RPCService defines RPC service ipfix_export. type RPCService interface { + IpfixAllExporterGet(ctx context.Context, in *IpfixAllExporterGet) (RPCService_IpfixAllExporterGetClient, error) IpfixClassifyStreamDump(ctx context.Context, in *IpfixClassifyStreamDump) (RPCService_IpfixClassifyStreamDumpClient, error) IpfixClassifyTableAddDel(ctx context.Context, in *IpfixClassifyTableAddDel) (*IpfixClassifyTableAddDelReply, error) IpfixClassifyTableDump(ctx context.Context, in *IpfixClassifyTableDump) (RPCService_IpfixClassifyTableDumpClient, error) + IpfixExporterCreateDelete(ctx context.Context, in *IpfixExporterCreateDelete) (*IpfixExporterCreateDeleteReply, error) IpfixExporterDump(ctx context.Context, in *IpfixExporterDump) (RPCService_IpfixExporterDumpClient, error) IpfixFlush(ctx context.Context, in *IpfixFlush) (*IpfixFlushReply, error) SetIpfixClassifyStream(ctx context.Context, in *SetIpfixClassifyStream) (*SetIpfixClassifyStreamReply, error) @@ -29,6 +32,46 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) IpfixAllExporterGet(ctx context.Context, in *IpfixAllExporterGet) (RPCService_IpfixAllExporterGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpfixAllExporterGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpfixAllExporterGetClient interface { + Recv() (*IpfixAllExporterDetails, error) + api.Stream +} + +type serviceClient_IpfixAllExporterGetClient struct { + api.Stream +} + +func (c *serviceClient_IpfixAllExporterGetClient) Recv() (*IpfixAllExporterDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpfixAllExporterDetails: + return m, nil + case *IpfixAllExporterGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + func (c *serviceClient) IpfixClassifyStreamDump(ctx context.Context, in *IpfixClassifyStreamDump) (RPCService_IpfixClassifyStreamDumpClient, error) { stream, err := c.conn.NewStream(ctx) if err != nil { @@ -38,7 +81,7 @@ func (c *serviceClient) IpfixClassifyStreamDump(ctx context.Context, in *IpfixCl if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -61,7 +104,11 @@ func (c *serviceClient_IpfixClassifyStreamDumpClient) Recv() (*IpfixClassifyStre switch m := msg.(type) { case *IpfixClassifyStreamDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -74,7 +121,7 @@ func (c *serviceClient) IpfixClassifyTableAddDel(ctx context.Context, in *IpfixC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpfixClassifyTableDump(ctx context.Context, in *IpfixClassifyTableDump) (RPCService_IpfixClassifyTableDumpClient, error) { @@ -86,7 +133,7 @@ func (c *serviceClient) IpfixClassifyTableDump(ctx context.Context, in *IpfixCla if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -109,13 +156,26 @@ func (c *serviceClient_IpfixClassifyTableDumpClient) Recv() (*IpfixClassifyTable switch m := msg.(type) { case *IpfixClassifyTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) IpfixExporterCreateDelete(ctx context.Context, in *IpfixExporterCreateDelete) (*IpfixExporterCreateDeleteReply, error) { + out := new(IpfixExporterCreateDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) IpfixExporterDump(ctx context.Context, in *IpfixExporterDump) (RPCService_IpfixExporterDumpClient, error) { stream, err := c.conn.NewStream(ctx) if err != nil { @@ -125,7 +185,7 @@ func (c *serviceClient) IpfixExporterDump(ctx context.Context, in *IpfixExporter if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -148,7 +208,11 @@ func (c *serviceClient_IpfixExporterDumpClient) Recv() (*IpfixExporterDetails, e switch m := msg.(type) { case *IpfixExporterDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -161,7 +225,7 @@ func (c *serviceClient) IpfixFlush(ctx context.Context, in *IpfixFlush) (*IpfixF if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetIpfixClassifyStream(ctx context.Context, in *SetIpfixClassifyStream) (*SetIpfixClassifyStreamReply, error) { @@ -170,7 +234,7 @@ func (c *serviceClient) SetIpfixClassifyStream(ctx context.Context, in *SetIpfix if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetIpfixExporter(ctx context.Context, in *SetIpfixExporter) (*SetIpfixExporterReply, error) { @@ -179,5 +243,5 @@ func (c *serviceClient) SetIpfixExporter(ctx context.Context, in *SetIpfixExport if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ipip/ipip.ba.go b/binapi/ipip/ipip.ba.go index 05821cb..8b3c1f3 100644 --- a/binapi/ipip/ipip.ba.go +++ b/binapi/ipip/ipip.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ipip.api.json // Package ipip contains generated bindings for API file ipip.api. @@ -13,11 +13,11 @@ package ipip import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + tunnel_types "go.fd.io/govpp/binapi/tunnel_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,8 +28,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ipip" - APIVersion = "2.0.1" - VersionCrc = 0xa095e728 + APIVersion = "2.0.2" + VersionCrc = 0x4609caba ) // IpipTunnel defines type 'ipip_tunnel'. @@ -57,7 +57,7 @@ type Ipip6rdAddTunnel struct { func (m *Ipip6rdAddTunnel) Reset() { *m = Ipip6rdAddTunnel{} } func (*Ipip6rdAddTunnel) GetMessageName() string { return "ipip_6rd_add_tunnel" } -func (*Ipip6rdAddTunnel) GetCrcString() string { return "56e93cc0" } +func (*Ipip6rdAddTunnel) GetCrcString() string { return "b9ec1863" } func (*Ipip6rdAddTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -217,7 +217,7 @@ type IpipAddTunnel struct { func (m *IpipAddTunnel) Reset() { *m = IpipAddTunnel{} } func (*IpipAddTunnel) GetMessageName() string { return "ipip_add_tunnel" } -func (*IpipAddTunnel) GetCrcString() string { return "a9decfcd" } +func (*IpipAddTunnel) GetCrcString() string { return "2ac399f5" } func (*IpipAddTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -380,7 +380,7 @@ type IpipTunnelDetails struct { func (m *IpipTunnelDetails) Reset() { *m = IpipTunnelDetails{} } func (*IpipTunnelDetails) GetMessageName() string { return "ipip_tunnel_details" } -func (*IpipTunnelDetails) GetCrcString() string { return "53236d75" } +func (*IpipTunnelDetails) GetCrcString() string { return "d31cb34e" } func (*IpipTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -468,15 +468,15 @@ func (m *IpipTunnelDump) Unmarshal(b []byte) error { func init() { file_ipip_binapi_init() } func file_ipip_binapi_init() { - api.RegisterMessage((*Ipip6rdAddTunnel)(nil), "ipip_6rd_add_tunnel_56e93cc0") + api.RegisterMessage((*Ipip6rdAddTunnel)(nil), "ipip_6rd_add_tunnel_b9ec1863") api.RegisterMessage((*Ipip6rdAddTunnelReply)(nil), "ipip_6rd_add_tunnel_reply_5383d31f") api.RegisterMessage((*Ipip6rdDelTunnel)(nil), "ipip_6rd_del_tunnel_f9e6675e") api.RegisterMessage((*Ipip6rdDelTunnelReply)(nil), "ipip_6rd_del_tunnel_reply_e8d4e804") - api.RegisterMessage((*IpipAddTunnel)(nil), "ipip_add_tunnel_a9decfcd") + api.RegisterMessage((*IpipAddTunnel)(nil), "ipip_add_tunnel_2ac399f5") api.RegisterMessage((*IpipAddTunnelReply)(nil), "ipip_add_tunnel_reply_5383d31f") api.RegisterMessage((*IpipDelTunnel)(nil), "ipip_del_tunnel_f9e6675e") api.RegisterMessage((*IpipDelTunnelReply)(nil), "ipip_del_tunnel_reply_e8d4e804") - api.RegisterMessage((*IpipTunnelDetails)(nil), "ipip_tunnel_details_53236d75") + api.RegisterMessage((*IpipTunnelDetails)(nil), "ipip_tunnel_details_d31cb34e") api.RegisterMessage((*IpipTunnelDump)(nil), "ipip_tunnel_dump_f9e6675e") } diff --git a/binapi/ipip/ipip_rest.ba.go b/binapi/ipip/ipip_rest.ba.go deleted file mode 100644 index 63fe220..0000000 --- a/binapi/ipip/ipip_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipip - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipip_6rd_add_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ipip6rdAddTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ipip6rdAddTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipip_6rd_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ipip6rdDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Ipip6rdDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipip_add_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpipAddTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpipAddTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipip_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpipDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpipDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ipip/ipip_rpc.ba.go b/binapi/ipip/ipip_rpc.ba.go index bab3b22..54fd4cd 100644 --- a/binapi/ipip/ipip_rpc.ba.go +++ b/binapi/ipip/ipip_rpc.ba.go @@ -5,12 +5,13 @@ package ipip import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ipip. +// RPCService defines RPC service ipip. type RPCService interface { Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) @@ -33,7 +34,7 @@ func (c *serviceClient) Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) { @@ -42,7 +43,7 @@ func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error) { @@ -51,7 +52,7 @@ func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error) { @@ -60,7 +61,7 @@ func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, error) { @@ -72,7 +73,7 @@ func (c *serviceClient) IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -95,7 +96,11 @@ func (c *serviceClient_IpipTunnelDumpClient) Recv() (*IpipTunnelDetails, error) switch m := msg.(type) { case *IpipTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/ipsec/ipsec.ba.go b/binapi/ipsec/ipsec.ba.go index 6a6abde..b096a9d 100644 --- a/binapi/ipsec/ipsec.ba.go +++ b/binapi/ipsec/ipsec.ba.go @@ -1,25 +1,27 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ipsec.api.json // Package ipsec contains generated bindings for API file ipsec.api. // // Contents: // 1 enum -// 2 structs -// 30 messages +// 3 structs +// 46 messages // package ipsec import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - ipsec_types "git.fd.io/govpp.git/binapi/ipsec_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + ipsec_types "go.fd.io/govpp/binapi/ipsec_types" + tunnel_types "go.fd.io/govpp/binapi/tunnel_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,8 +32,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ipsec" - APIVersion = "3.0.2" - VersionCrc = 0x6a839805 + APIVersion = "5.0.2" + VersionCrc = 0x6b08e91e ) // IpsecSpdAction defines enum 'ipsec_spd_action'. @@ -67,6 +69,13 @@ func (x IpsecSpdAction) String() string { return "IpsecSpdAction(" + strconv.Itoa(int(x)) + ")" } +// IpsecItf defines type 'ipsec_itf'. +type IpsecItf struct { + UserInstance uint32 `binapi:"u32,name=user_instance,default=4294967295" json:"user_instance,omitempty"` + Mode tunnel_types.TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + // IpsecSpdEntry defines type 'ipsec_spd_entry'. type IpsecSpdEntry struct { SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` @@ -242,7 +251,222 @@ func (m *IpsecInterfaceAddDelSpdReply) Unmarshal(b []byte) error { return nil } +// IpsecItfCreate defines message 'ipsec_itf_create'. +type IpsecItfCreate struct { + Itf IpsecItf `binapi:"ipsec_itf,name=itf" json:"itf,omitempty"` +} + +func (m *IpsecItfCreate) Reset() { *m = IpsecItfCreate{} } +func (*IpsecItfCreate) GetMessageName() string { return "ipsec_itf_create" } +func (*IpsecItfCreate) GetCrcString() string { return "6f50b3bc" } +func (*IpsecItfCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecItfCreate) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Itf.UserInstance + size += 1 // m.Itf.Mode + size += 4 // m.Itf.SwIfIndex + return size +} +func (m *IpsecItfCreate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Itf.UserInstance) + buf.EncodeUint8(uint8(m.Itf.Mode)) + buf.EncodeUint32(uint32(m.Itf.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecItfCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Itf.UserInstance = buf.DecodeUint32() + m.Itf.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Itf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecItfCreateReply defines message 'ipsec_itf_create_reply'. +type IpsecItfCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecItfCreateReply) Reset() { *m = IpsecItfCreateReply{} } +func (*IpsecItfCreateReply) GetMessageName() string { return "ipsec_itf_create_reply" } +func (*IpsecItfCreateReply) GetCrcString() string { return "5383d31f" } +func (*IpsecItfCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecItfCreateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecItfCreateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecItfCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecItfDelete defines message 'ipsec_itf_delete'. +type IpsecItfDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecItfDelete) Reset() { *m = IpsecItfDelete{} } +func (*IpsecItfDelete) GetMessageName() string { return "ipsec_itf_delete" } +func (*IpsecItfDelete) GetCrcString() string { return "f9e6675e" } +func (*IpsecItfDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecItfDelete) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecItfDelete) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecItfDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecItfDeleteReply defines message 'ipsec_itf_delete_reply'. +type IpsecItfDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecItfDeleteReply) Reset() { *m = IpsecItfDeleteReply{} } +func (*IpsecItfDeleteReply) GetMessageName() string { return "ipsec_itf_delete_reply" } +func (*IpsecItfDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecItfDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecItfDeleteReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecItfDeleteReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IpsecItfDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecItfDetails defines message 'ipsec_itf_details'. +type IpsecItfDetails struct { + Itf IpsecItf `binapi:"ipsec_itf,name=itf" json:"itf,omitempty"` +} + +func (m *IpsecItfDetails) Reset() { *m = IpsecItfDetails{} } +func (*IpsecItfDetails) GetMessageName() string { return "ipsec_itf_details" } +func (*IpsecItfDetails) GetCrcString() string { return "548a73b8" } +func (*IpsecItfDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecItfDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Itf.UserInstance + size += 1 // m.Itf.Mode + size += 4 // m.Itf.SwIfIndex + return size +} +func (m *IpsecItfDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Itf.UserInstance) + buf.EncodeUint8(uint8(m.Itf.Mode)) + buf.EncodeUint32(uint32(m.Itf.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecItfDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Itf.UserInstance = buf.DecodeUint32() + m.Itf.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Itf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecItfDump defines message 'ipsec_itf_dump'. +type IpsecItfDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecItfDump) Reset() { *m = IpsecItfDump{} } +func (*IpsecItfDump) GetMessageName() string { return "ipsec_itf_dump" } +func (*IpsecItfDump) GetCrcString() string { return "f9e6675e" } +func (*IpsecItfDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecItfDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecItfDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecItfDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // IpsecSaDetails defines message 'ipsec_sa_details'. +// Deprecated: the message will be removed in the future versions type IpsecSaDetails struct { Entry ipsec_types.IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -255,7 +479,7 @@ type IpsecSaDetails struct { func (m *IpsecSaDetails) Reset() { *m = IpsecSaDetails{} } func (*IpsecSaDetails) GetMessageName() string { return "ipsec_sa_details" } -func (*IpsecSaDetails) GetCrcString() string { return "b30c7f41" } +func (*IpsecSaDetails) GetCrcString() string { return "345d14a7" } func (*IpsecSaDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -353,6 +577,7 @@ func (m *IpsecSaDetails) Unmarshal(b []byte) error { } // IpsecSaDump defines message 'ipsec_sa_dump'. +// Deprecated: the message will be removed in the future versions type IpsecSaDump struct { SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` } @@ -385,7 +610,424 @@ func (m *IpsecSaDump) Unmarshal(b []byte) error { return nil } +// IpsecSaV2Details defines message 'ipsec_sa_v2_details'. +type IpsecSaV2Details struct { + Entry ipsec_types.IpsecSadEntryV2 `binapi:"ipsec_sad_entry_v2,name=entry" json:"entry,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + SeqOutbound uint64 `binapi:"u64,name=seq_outbound" json:"seq_outbound,omitempty"` + LastSeqInbound uint64 `binapi:"u64,name=last_seq_inbound" json:"last_seq_inbound,omitempty"` + ReplayWindow uint64 `binapi:"u64,name=replay_window" json:"replay_window,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSaV2Details) Reset() { *m = IpsecSaV2Details{} } +func (*IpsecSaV2Details) GetMessageName() string { return "ipsec_sa_v2_details" } +func (*IpsecSaV2Details) GetCrcString() string { return "e2130051" } +func (*IpsecSaV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSaV2Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 1 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 1 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 1 // m.Entry.TunnelFlags + size += 1 // m.Entry.Dscp + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + size += 4 // m.SwIfIndex + size += 4 // m.Salt + size += 8 // m.SeqOutbound + size += 8 // m.LastSeqInbound + size += 8 // m.ReplayWindow + size += 4 // m.StatIndex + return size +} +func (m *IpsecSaV2Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.TunnelFlags)) + buf.EncodeUint8(uint8(m.Entry.Dscp)) + buf.EncodeUint32(m.Entry.TxTableID) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint16(m.Entry.UDPSrcPort) + buf.EncodeUint16(m.Entry.UDPDstPort) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.Salt) + buf.EncodeUint64(m.SeqOutbound) + buf.EncodeUint64(m.LastSeqInbound) + buf.EncodeUint64(m.ReplayWindow) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSaV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelFlags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Entry.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Salt = buf.DecodeUint32() + m.SeqOutbound = buf.DecodeUint64() + m.LastSeqInbound = buf.DecodeUint64() + m.ReplayWindow = buf.DecodeUint64() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSaV2Dump defines message 'ipsec_sa_v2_dump'. +type IpsecSaV2Dump struct { + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSaV2Dump) Reset() { *m = IpsecSaV2Dump{} } +func (*IpsecSaV2Dump) GetMessageName() string { return "ipsec_sa_v2_dump" } +func (*IpsecSaV2Dump) GetCrcString() string { return "2076c2f4" } +func (*IpsecSaV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSaV2Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SaID + return size +} +func (m *IpsecSaV2Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SaID) + return buf.Bytes(), nil +} +func (m *IpsecSaV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSaV3Details defines message 'ipsec_sa_v3_details'. +type IpsecSaV3Details struct { + Entry ipsec_types.IpsecSadEntryV3 `binapi:"ipsec_sad_entry_v3,name=entry" json:"entry,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SeqOutbound uint64 `binapi:"u64,name=seq_outbound" json:"seq_outbound,omitempty"` + LastSeqInbound uint64 `binapi:"u64,name=last_seq_inbound" json:"last_seq_inbound,omitempty"` + ReplayWindow uint64 `binapi:"u64,name=replay_window" json:"replay_window,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSaV3Details) Reset() { *m = IpsecSaV3Details{} } +func (*IpsecSaV3Details) GetMessageName() string { return "ipsec_sa_v3_details" } +func (*IpsecSaV3Details) GetCrcString() string { return "2fc991ee" } +func (*IpsecSaV3Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSaV3Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 4 // m.Entry.Tunnel.Instance + size += 1 // m.Entry.Tunnel.Src.Af + size += 1 * 16 // m.Entry.Tunnel.Src.Un + size += 1 // m.Entry.Tunnel.Dst.Af + size += 1 * 16 // m.Entry.Tunnel.Dst.Un + size += 4 // m.Entry.Tunnel.SwIfIndex + size += 4 // m.Entry.Tunnel.TableID + size += 1 // m.Entry.Tunnel.EncapDecapFlags + size += 1 // m.Entry.Tunnel.Mode + size += 1 // m.Entry.Tunnel.Flags + size += 1 // m.Entry.Tunnel.Dscp + size += 1 // m.Entry.Tunnel.HopLimit + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + size += 4 // m.SwIfIndex + size += 8 // m.SeqOutbound + size += 8 // m.LastSeqInbound + size += 8 // m.ReplayWindow + size += 4 // m.StatIndex + return size +} +func (m *IpsecSaV3Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint32(m.Entry.Tunnel.Instance) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Src.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.Tunnel.SwIfIndex)) + buf.EncodeUint32(m.Entry.Tunnel.TableID) + buf.EncodeUint8(uint8(m.Entry.Tunnel.EncapDecapFlags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Flags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dscp)) + buf.EncodeUint8(m.Entry.Tunnel.HopLimit) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint16(m.Entry.UDPSrcPort) + buf.EncodeUint16(m.Entry.UDPDstPort) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint64(m.SeqOutbound) + buf.EncodeUint64(m.LastSeqInbound) + buf.EncodeUint64(m.ReplayWindow) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSaV3Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.Tunnel.Instance = buf.DecodeUint32() + m.Entry.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entry.Tunnel.TableID = buf.DecodeUint32() + m.Entry.Tunnel.EncapDecapFlags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Entry.Tunnel.Flags = tunnel_types.TunnelFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Entry.Tunnel.HopLimit = buf.DecodeUint8() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SeqOutbound = buf.DecodeUint64() + m.LastSeqInbound = buf.DecodeUint64() + m.ReplayWindow = buf.DecodeUint64() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSaV3Dump defines message 'ipsec_sa_v3_dump'. +type IpsecSaV3Dump struct { + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSaV3Dump) Reset() { *m = IpsecSaV3Dump{} } +func (*IpsecSaV3Dump) GetMessageName() string { return "ipsec_sa_v3_dump" } +func (*IpsecSaV3Dump) GetCrcString() string { return "2076c2f4" } +func (*IpsecSaV3Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSaV3Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SaID + return size +} +func (m *IpsecSaV3Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SaID) + return buf.Bytes(), nil +} +func (m *IpsecSaV3Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAdd defines message 'ipsec_sad_entry_add'. +type IpsecSadEntryAdd struct { + Entry ipsec_types.IpsecSadEntryV3 `binapi:"ipsec_sad_entry_v3,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSadEntryAdd) Reset() { *m = IpsecSadEntryAdd{} } +func (*IpsecSadEntryAdd) GetMessageName() string { return "ipsec_sad_entry_add" } +func (*IpsecSadEntryAdd) GetCrcString() string { return "50229353" } +func (*IpsecSadEntryAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryAdd) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 4 // m.Entry.Tunnel.Instance + size += 1 // m.Entry.Tunnel.Src.Af + size += 1 * 16 // m.Entry.Tunnel.Src.Un + size += 1 // m.Entry.Tunnel.Dst.Af + size += 1 * 16 // m.Entry.Tunnel.Dst.Un + size += 4 // m.Entry.Tunnel.SwIfIndex + size += 4 // m.Entry.Tunnel.TableID + size += 1 // m.Entry.Tunnel.EncapDecapFlags + size += 1 // m.Entry.Tunnel.Mode + size += 1 // m.Entry.Tunnel.Flags + size += 1 // m.Entry.Tunnel.Dscp + size += 1 // m.Entry.Tunnel.HopLimit + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + return size +} +func (m *IpsecSadEntryAdd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint32(m.Entry.Tunnel.Instance) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Src.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.Tunnel.SwIfIndex)) + buf.EncodeUint32(m.Entry.Tunnel.TableID) + buf.EncodeUint8(uint8(m.Entry.Tunnel.EncapDecapFlags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Flags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dscp)) + buf.EncodeUint8(m.Entry.Tunnel.HopLimit) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint16(m.Entry.UDPSrcPort) + buf.EncodeUint16(m.Entry.UDPDstPort) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.Tunnel.Instance = buf.DecodeUint32() + m.Entry.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entry.Tunnel.TableID = buf.DecodeUint32() + m.Entry.Tunnel.EncapDecapFlags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Entry.Tunnel.Flags = tunnel_types.TunnelFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Entry.Tunnel.HopLimit = buf.DecodeUint8() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + return nil +} + // IpsecSadEntryAddDel defines message 'ipsec_sad_entry_add_del'. +// Deprecated: the message will be removed in the future versions type IpsecSadEntryAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` Entry ipsec_types.IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` @@ -393,7 +1035,7 @@ type IpsecSadEntryAddDel struct { func (m *IpsecSadEntryAddDel) Reset() { *m = IpsecSadEntryAddDel{} } func (*IpsecSadEntryAddDel) GetMessageName() string { return "ipsec_sad_entry_add_del" } -func (*IpsecSadEntryAddDel) GetCrcString() string { return "b8def364" } +func (*IpsecSadEntryAddDel) GetCrcString() string { return "ab64b5c6" } func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -476,6 +1118,7 @@ func (m *IpsecSadEntryAddDel) Unmarshal(b []byte) error { } // IpsecSadEntryAddDelReply defines message 'ipsec_sad_entry_add_del_reply'. +// Deprecated: the message will be removed in the future versions type IpsecSadEntryAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` @@ -512,6 +1155,390 @@ func (m *IpsecSadEntryAddDelReply) Unmarshal(b []byte) error { return nil } +// IpsecSadEntryAddDelV2 defines message 'ipsec_sad_entry_add_del_v2'. +type IpsecSadEntryAddDelV2 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Entry ipsec_types.IpsecSadEntryV2 `binapi:"ipsec_sad_entry_v2,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSadEntryAddDelV2) Reset() { *m = IpsecSadEntryAddDelV2{} } +func (*IpsecSadEntryAddDelV2) GetMessageName() string { return "ipsec_sad_entry_add_del_v2" } +func (*IpsecSadEntryAddDelV2) GetCrcString() string { return "aca78b27" } +func (*IpsecSadEntryAddDelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryAddDelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 1 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 1 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 1 // m.Entry.TunnelFlags + size += 1 // m.Entry.Dscp + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + return size +} +func (m *IpsecSadEntryAddDelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.TunnelFlags)) + buf.EncodeUint8(uint8(m.Entry.Dscp)) + buf.EncodeUint32(m.Entry.TxTableID) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint16(m.Entry.UDPSrcPort) + buf.EncodeUint16(m.Entry.UDPDstPort) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelFlags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Entry.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + return nil +} + +// IpsecSadEntryAddDelV2Reply defines message 'ipsec_sad_entry_add_del_v2_reply'. +type IpsecSadEntryAddDelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSadEntryAddDelV2Reply) Reset() { *m = IpsecSadEntryAddDelV2Reply{} } +func (*IpsecSadEntryAddDelV2Reply) GetMessageName() string { return "ipsec_sad_entry_add_del_v2_reply" } +func (*IpsecSadEntryAddDelV2Reply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSadEntryAddDelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryAddDelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSadEntryAddDelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAddDelV3 defines message 'ipsec_sad_entry_add_del_v3'. +type IpsecSadEntryAddDelV3 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Entry ipsec_types.IpsecSadEntryV3 `binapi:"ipsec_sad_entry_v3,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSadEntryAddDelV3) Reset() { *m = IpsecSadEntryAddDelV3{} } +func (*IpsecSadEntryAddDelV3) GetMessageName() string { return "ipsec_sad_entry_add_del_v3" } +func (*IpsecSadEntryAddDelV3) GetCrcString() string { return "c77ebd92" } +func (*IpsecSadEntryAddDelV3) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryAddDelV3) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 4 // m.Entry.Tunnel.Instance + size += 1 // m.Entry.Tunnel.Src.Af + size += 1 * 16 // m.Entry.Tunnel.Src.Un + size += 1 // m.Entry.Tunnel.Dst.Af + size += 1 * 16 // m.Entry.Tunnel.Dst.Un + size += 4 // m.Entry.Tunnel.SwIfIndex + size += 4 // m.Entry.Tunnel.TableID + size += 1 // m.Entry.Tunnel.EncapDecapFlags + size += 1 // m.Entry.Tunnel.Mode + size += 1 // m.Entry.Tunnel.Flags + size += 1 // m.Entry.Tunnel.Dscp + size += 1 // m.Entry.Tunnel.HopLimit + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + return size +} +func (m *IpsecSadEntryAddDelV3) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint32(m.Entry.Tunnel.Instance) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Src.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.Tunnel.SwIfIndex)) + buf.EncodeUint32(m.Entry.Tunnel.TableID) + buf.EncodeUint8(uint8(m.Entry.Tunnel.EncapDecapFlags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Flags)) + buf.EncodeUint8(uint8(m.Entry.Tunnel.Dscp)) + buf.EncodeUint8(m.Entry.Tunnel.HopLimit) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint16(m.Entry.UDPSrcPort) + buf.EncodeUint16(m.Entry.UDPDstPort) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelV3) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.Tunnel.Instance = buf.DecodeUint32() + m.Entry.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entry.Tunnel.TableID = buf.DecodeUint32() + m.Entry.Tunnel.EncapDecapFlags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Entry.Tunnel.Flags = tunnel_types.TunnelFlags(buf.DecodeUint8()) + m.Entry.Tunnel.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Entry.Tunnel.HopLimit = buf.DecodeUint8() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + return nil +} + +// IpsecSadEntryAddDelV3Reply defines message 'ipsec_sad_entry_add_del_v3_reply'. +type IpsecSadEntryAddDelV3Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSadEntryAddDelV3Reply) Reset() { *m = IpsecSadEntryAddDelV3Reply{} } +func (*IpsecSadEntryAddDelV3Reply) GetMessageName() string { return "ipsec_sad_entry_add_del_v3_reply" } +func (*IpsecSadEntryAddDelV3Reply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSadEntryAddDelV3Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryAddDelV3Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSadEntryAddDelV3Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelV3Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAddReply defines message 'ipsec_sad_entry_add_reply'. +type IpsecSadEntryAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSadEntryAddReply) Reset() { *m = IpsecSadEntryAddReply{} } +func (*IpsecSadEntryAddReply) GetMessageName() string { return "ipsec_sad_entry_add_reply" } +func (*IpsecSadEntryAddReply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSadEntryAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryAddReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSadEntryAddReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryDel defines message 'ipsec_sad_entry_del'. +type IpsecSadEntryDel struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *IpsecSadEntryDel) Reset() { *m = IpsecSadEntryDel{} } +func (*IpsecSadEntryDel) GetMessageName() string { return "ipsec_sad_entry_del" } +func (*IpsecSadEntryDel) GetCrcString() string { return "3a91bde5" } +func (*IpsecSadEntryDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.ID + return size +} +func (m *IpsecSadEntryDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.ID) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryDelReply defines message 'ipsec_sad_entry_del_reply'. +type IpsecSadEntryDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSadEntryDelReply) Reset() { *m = IpsecSadEntryDelReply{} } +func (*IpsecSadEntryDelReply) GetMessageName() string { return "ipsec_sad_entry_del_reply" } +func (*IpsecSadEntryDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSadEntryDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecSadEntryDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // IpsecSelectBackend defines message 'ipsec_select_backend'. type IpsecSelectBackend struct { Protocol ipsec_types.IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` @@ -582,6 +1609,72 @@ func (m *IpsecSelectBackendReply) Unmarshal(b []byte) error { return nil } +// IpsecSetAsyncMode defines message 'ipsec_set_async_mode'. +type IpsecSetAsyncMode struct { + AsyncEnable bool `binapi:"bool,name=async_enable" json:"async_enable,omitempty"` +} + +func (m *IpsecSetAsyncMode) Reset() { *m = IpsecSetAsyncMode{} } +func (*IpsecSetAsyncMode) GetMessageName() string { return "ipsec_set_async_mode" } +func (*IpsecSetAsyncMode) GetCrcString() string { return "a6465f7c" } +func (*IpsecSetAsyncMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSetAsyncMode) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.AsyncEnable + return size +} +func (m *IpsecSetAsyncMode) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.AsyncEnable) + return buf.Bytes(), nil +} +func (m *IpsecSetAsyncMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AsyncEnable = buf.DecodeBool() + return nil +} + +// IpsecSetAsyncModeReply defines message 'ipsec_set_async_mode_reply'. +type IpsecSetAsyncModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSetAsyncModeReply) Reset() { *m = IpsecSetAsyncModeReply{} } +func (*IpsecSetAsyncModeReply) GetMessageName() string { return "ipsec_set_async_mode_reply" } +func (*IpsecSetAsyncModeReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSetAsyncModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSetAsyncModeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecSetAsyncModeReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *IpsecSetAsyncModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // IpsecSpdAddDel defines message 'ipsec_spd_add_del'. type IpsecSpdAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` @@ -659,7 +1752,7 @@ type IpsecSpdDetails struct { func (m *IpsecSpdDetails) Reset() { *m = IpsecSpdDetails{} } func (*IpsecSpdDetails) GetMessageName() string { return "ipsec_spd_details" } -func (*IpsecSpdDetails) GetCrcString() string { return "f2222790" } +func (*IpsecSpdDetails) GetCrcString() string { return "5813d7a2" } func (*IpsecSpdDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -781,7 +1874,7 @@ type IpsecSpdEntryAddDel struct { func (m *IpsecSpdEntryAddDel) Reset() { *m = IpsecSpdEntryAddDel{} } func (*IpsecSpdEntryAddDel) GetMessageName() string { return "ipsec_spd_entry_add_del" } -func (*IpsecSpdEntryAddDel) GetCrcString() string { return "9f384b8d" } +func (*IpsecSpdEntryAddDel) GetCrcString() string { return "338b7411" } func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1036,244 +2129,6 @@ func (m *IpsecSpdsDump) Unmarshal(b []byte) error { return nil } -// IpsecTunnelIfAddDel defines message 'ipsec_tunnel_if_add_del'. -type IpsecTunnelIfAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Esn bool `binapi:"bool,name=esn" json:"esn,omitempty"` - AntiReplay bool `binapi:"bool,name=anti_replay" json:"anti_replay,omitempty"` - LocalIP ip_types.Address `binapi:"address,name=local_ip" json:"local_ip,omitempty"` - RemoteIP ip_types.Address `binapi:"address,name=remote_ip" json:"remote_ip,omitempty"` - LocalSpi uint32 `binapi:"u32,name=local_spi" json:"local_spi,omitempty"` - RemoteSpi uint32 `binapi:"u32,name=remote_spi" json:"remote_spi,omitempty"` - CryptoAlg uint8 `binapi:"u8,name=crypto_alg" json:"crypto_alg,omitempty"` - LocalCryptoKeyLen uint8 `binapi:"u8,name=local_crypto_key_len" json:"local_crypto_key_len,omitempty"` - LocalCryptoKey []byte `binapi:"u8[128],name=local_crypto_key" json:"local_crypto_key,omitempty"` - RemoteCryptoKeyLen uint8 `binapi:"u8,name=remote_crypto_key_len" json:"remote_crypto_key_len,omitempty"` - RemoteCryptoKey []byte `binapi:"u8[128],name=remote_crypto_key" json:"remote_crypto_key,omitempty"` - IntegAlg uint8 `binapi:"u8,name=integ_alg" json:"integ_alg,omitempty"` - LocalIntegKeyLen uint8 `binapi:"u8,name=local_integ_key_len" json:"local_integ_key_len,omitempty"` - LocalIntegKey []byte `binapi:"u8[128],name=local_integ_key" json:"local_integ_key,omitempty"` - RemoteIntegKeyLen uint8 `binapi:"u8,name=remote_integ_key_len" json:"remote_integ_key_len,omitempty"` - RemoteIntegKey []byte `binapi:"u8[128],name=remote_integ_key" json:"remote_integ_key,omitempty"` - Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` - ShowInstance uint32 `binapi:"u32,name=show_instance" json:"show_instance,omitempty"` - UDPEncap bool `binapi:"bool,name=udp_encap" json:"udp_encap,omitempty"` - TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` - Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` -} - -func (m *IpsecTunnelIfAddDel) Reset() { *m = IpsecTunnelIfAddDel{} } -func (*IpsecTunnelIfAddDel) GetMessageName() string { return "ipsec_tunnel_if_add_del" } -func (*IpsecTunnelIfAddDel) GetCrcString() string { return "2b135e68" } -func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *IpsecTunnelIfAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 // m.Esn - size += 1 // m.AntiReplay - size += 1 // m.LocalIP.Af - size += 1 * 16 // m.LocalIP.Un - size += 1 // m.RemoteIP.Af - size += 1 * 16 // m.RemoteIP.Un - size += 4 // m.LocalSpi - size += 4 // m.RemoteSpi - size += 1 // m.CryptoAlg - size += 1 // m.LocalCryptoKeyLen - size += 1 * 128 // m.LocalCryptoKey - size += 1 // m.RemoteCryptoKeyLen - size += 1 * 128 // m.RemoteCryptoKey - size += 1 // m.IntegAlg - size += 1 // m.LocalIntegKeyLen - size += 1 * 128 // m.LocalIntegKey - size += 1 // m.RemoteIntegKeyLen - size += 1 * 128 // m.RemoteIntegKey - size += 1 // m.Renumber - size += 4 // m.ShowInstance - size += 1 // m.UDPEncap - size += 4 // m.TxTableID - size += 4 // m.Salt - return size -} -func (m *IpsecTunnelIfAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeBool(m.Esn) - buf.EncodeBool(m.AntiReplay) - buf.EncodeUint8(uint8(m.LocalIP.Af)) - buf.EncodeBytes(m.LocalIP.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(m.RemoteIP.Af)) - buf.EncodeBytes(m.RemoteIP.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(m.LocalSpi) - buf.EncodeUint32(m.RemoteSpi) - buf.EncodeUint8(m.CryptoAlg) - buf.EncodeUint8(m.LocalCryptoKeyLen) - buf.EncodeBytes(m.LocalCryptoKey, 128) - buf.EncodeUint8(m.RemoteCryptoKeyLen) - buf.EncodeBytes(m.RemoteCryptoKey, 128) - buf.EncodeUint8(m.IntegAlg) - buf.EncodeUint8(m.LocalIntegKeyLen) - buf.EncodeBytes(m.LocalIntegKey, 128) - buf.EncodeUint8(m.RemoteIntegKeyLen) - buf.EncodeBytes(m.RemoteIntegKey, 128) - buf.EncodeBool(m.Renumber) - buf.EncodeUint32(m.ShowInstance) - buf.EncodeBool(m.UDPEncap) - buf.EncodeUint32(m.TxTableID) - buf.EncodeUint32(m.Salt) - return buf.Bytes(), nil -} -func (m *IpsecTunnelIfAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Esn = buf.DecodeBool() - m.AntiReplay = buf.DecodeBool() - m.LocalIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.LocalIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.RemoteIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.RemoteIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.LocalSpi = buf.DecodeUint32() - m.RemoteSpi = buf.DecodeUint32() - m.CryptoAlg = buf.DecodeUint8() - m.LocalCryptoKeyLen = buf.DecodeUint8() - m.LocalCryptoKey = make([]byte, 128) - copy(m.LocalCryptoKey, buf.DecodeBytes(len(m.LocalCryptoKey))) - m.RemoteCryptoKeyLen = buf.DecodeUint8() - m.RemoteCryptoKey = make([]byte, 128) - copy(m.RemoteCryptoKey, buf.DecodeBytes(len(m.RemoteCryptoKey))) - m.IntegAlg = buf.DecodeUint8() - m.LocalIntegKeyLen = buf.DecodeUint8() - m.LocalIntegKey = make([]byte, 128) - copy(m.LocalIntegKey, buf.DecodeBytes(len(m.LocalIntegKey))) - m.RemoteIntegKeyLen = buf.DecodeUint8() - m.RemoteIntegKey = make([]byte, 128) - copy(m.RemoteIntegKey, buf.DecodeBytes(len(m.RemoteIntegKey))) - m.Renumber = buf.DecodeBool() - m.ShowInstance = buf.DecodeUint32() - m.UDPEncap = buf.DecodeBool() - m.TxTableID = buf.DecodeUint32() - m.Salt = buf.DecodeUint32() - return nil -} - -// IpsecTunnelIfAddDelReply defines message 'ipsec_tunnel_if_add_del_reply'. -type IpsecTunnelIfAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *IpsecTunnelIfAddDelReply) Reset() { *m = IpsecTunnelIfAddDelReply{} } -func (*IpsecTunnelIfAddDelReply) GetMessageName() string { return "ipsec_tunnel_if_add_del_reply" } -func (*IpsecTunnelIfAddDelReply) GetCrcString() string { return "5383d31f" } -func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IpsecTunnelIfAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.SwIfIndex - return size -} -func (m *IpsecTunnelIfAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *IpsecTunnelIfAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// IpsecTunnelIfSetSa defines message 'ipsec_tunnel_if_set_sa'. -type IpsecTunnelIfSetSa struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` - IsOutbound uint8 `binapi:"u8,name=is_outbound" json:"is_outbound,omitempty"` -} - -func (m *IpsecTunnelIfSetSa) Reset() { *m = IpsecTunnelIfSetSa{} } -func (*IpsecTunnelIfSetSa) GetMessageName() string { return "ipsec_tunnel_if_set_sa" } -func (*IpsecTunnelIfSetSa) GetCrcString() string { return "f2f87112" } -func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *IpsecTunnelIfSetSa) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.SaID - size += 1 // m.IsOutbound - return size -} -func (m *IpsecTunnelIfSetSa) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(m.SaID) - buf.EncodeUint8(m.IsOutbound) - return buf.Bytes(), nil -} -func (m *IpsecTunnelIfSetSa) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.SaID = buf.DecodeUint32() - m.IsOutbound = buf.DecodeUint8() - return nil -} - -// IpsecTunnelIfSetSaReply defines message 'ipsec_tunnel_if_set_sa_reply'. -type IpsecTunnelIfSetSaReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IpsecTunnelIfSetSaReply) Reset() { *m = IpsecTunnelIfSetSaReply{} } -func (*IpsecTunnelIfSetSaReply) GetMessageName() string { return "ipsec_tunnel_if_set_sa_reply" } -func (*IpsecTunnelIfSetSaReply) GetCrcString() string { return "e8d4e804" } -func (*IpsecTunnelIfSetSaReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IpsecTunnelIfSetSaReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *IpsecTunnelIfSetSaReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *IpsecTunnelIfSetSaReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - // IpsecTunnelProtectDel defines message 'ipsec_tunnel_protect_del'. type IpsecTunnelProtectDel struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -1282,7 +2137,7 @@ type IpsecTunnelProtectDel struct { func (m *IpsecTunnelProtectDel) Reset() { *m = IpsecTunnelProtectDel{} } func (*IpsecTunnelProtectDel) GetMessageName() string { return "ipsec_tunnel_protect_del" } -func (*IpsecTunnelProtectDel) GetCrcString() string { return "ddd2ba36" } +func (*IpsecTunnelProtectDel) GetCrcString() string { return "cd239930" } func (*IpsecTunnelProtectDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1354,7 +2209,7 @@ type IpsecTunnelProtectDetails struct { func (m *IpsecTunnelProtectDetails) Reset() { *m = IpsecTunnelProtectDetails{} } func (*IpsecTunnelProtectDetails) GetMessageName() string { return "ipsec_tunnel_protect_details" } -func (*IpsecTunnelProtectDetails) GetCrcString() string { return "ac6c823b" } +func (*IpsecTunnelProtectDetails) GetCrcString() string { return "21663a50" } func (*IpsecTunnelProtectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1444,7 +2299,7 @@ type IpsecTunnelProtectUpdate struct { func (m *IpsecTunnelProtectUpdate) Reset() { *m = IpsecTunnelProtectUpdate{} } func (*IpsecTunnelProtectUpdate) GetMessageName() string { return "ipsec_tunnel_protect_update" } -func (*IpsecTunnelProtectUpdate) GetCrcString() string { return "143f155d" } +func (*IpsecTunnelProtectUpdate) GetCrcString() string { return "30d5f133" } func (*IpsecTunnelProtectUpdate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1535,31 +2390,47 @@ func file_ipsec_binapi_init() { api.RegisterMessage((*IpsecBackendDump)(nil), "ipsec_backend_dump_51077d14") api.RegisterMessage((*IpsecInterfaceAddDelSpd)(nil), "ipsec_interface_add_del_spd_80f80cbb") api.RegisterMessage((*IpsecInterfaceAddDelSpdReply)(nil), "ipsec_interface_add_del_spd_reply_e8d4e804") - api.RegisterMessage((*IpsecSaDetails)(nil), "ipsec_sa_details_b30c7f41") + api.RegisterMessage((*IpsecItfCreate)(nil), "ipsec_itf_create_6f50b3bc") + api.RegisterMessage((*IpsecItfCreateReply)(nil), "ipsec_itf_create_reply_5383d31f") + api.RegisterMessage((*IpsecItfDelete)(nil), "ipsec_itf_delete_f9e6675e") + api.RegisterMessage((*IpsecItfDeleteReply)(nil), "ipsec_itf_delete_reply_e8d4e804") + api.RegisterMessage((*IpsecItfDetails)(nil), "ipsec_itf_details_548a73b8") + api.RegisterMessage((*IpsecItfDump)(nil), "ipsec_itf_dump_f9e6675e") + api.RegisterMessage((*IpsecSaDetails)(nil), "ipsec_sa_details_345d14a7") api.RegisterMessage((*IpsecSaDump)(nil), "ipsec_sa_dump_2076c2f4") - api.RegisterMessage((*IpsecSadEntryAddDel)(nil), "ipsec_sad_entry_add_del_b8def364") + api.RegisterMessage((*IpsecSaV2Details)(nil), "ipsec_sa_v2_details_e2130051") + api.RegisterMessage((*IpsecSaV2Dump)(nil), "ipsec_sa_v2_dump_2076c2f4") + api.RegisterMessage((*IpsecSaV3Details)(nil), "ipsec_sa_v3_details_2fc991ee") + api.RegisterMessage((*IpsecSaV3Dump)(nil), "ipsec_sa_v3_dump_2076c2f4") + api.RegisterMessage((*IpsecSadEntryAdd)(nil), "ipsec_sad_entry_add_50229353") + api.RegisterMessage((*IpsecSadEntryAddDel)(nil), "ipsec_sad_entry_add_del_ab64b5c6") api.RegisterMessage((*IpsecSadEntryAddDelReply)(nil), "ipsec_sad_entry_add_del_reply_9ffac24b") + api.RegisterMessage((*IpsecSadEntryAddDelV2)(nil), "ipsec_sad_entry_add_del_v2_aca78b27") + api.RegisterMessage((*IpsecSadEntryAddDelV2Reply)(nil), "ipsec_sad_entry_add_del_v2_reply_9ffac24b") + api.RegisterMessage((*IpsecSadEntryAddDelV3)(nil), "ipsec_sad_entry_add_del_v3_c77ebd92") + api.RegisterMessage((*IpsecSadEntryAddDelV3Reply)(nil), "ipsec_sad_entry_add_del_v3_reply_9ffac24b") + api.RegisterMessage((*IpsecSadEntryAddReply)(nil), "ipsec_sad_entry_add_reply_9ffac24b") + api.RegisterMessage((*IpsecSadEntryDel)(nil), "ipsec_sad_entry_del_3a91bde5") + api.RegisterMessage((*IpsecSadEntryDelReply)(nil), "ipsec_sad_entry_del_reply_e8d4e804") api.RegisterMessage((*IpsecSelectBackend)(nil), "ipsec_select_backend_5bcfd3b7") api.RegisterMessage((*IpsecSelectBackendReply)(nil), "ipsec_select_backend_reply_e8d4e804") + api.RegisterMessage((*IpsecSetAsyncMode)(nil), "ipsec_set_async_mode_a6465f7c") + api.RegisterMessage((*IpsecSetAsyncModeReply)(nil), "ipsec_set_async_mode_reply_e8d4e804") api.RegisterMessage((*IpsecSpdAddDel)(nil), "ipsec_spd_add_del_20e89a95") api.RegisterMessage((*IpsecSpdAddDelReply)(nil), "ipsec_spd_add_del_reply_e8d4e804") - api.RegisterMessage((*IpsecSpdDetails)(nil), "ipsec_spd_details_f2222790") + api.RegisterMessage((*IpsecSpdDetails)(nil), "ipsec_spd_details_5813d7a2") api.RegisterMessage((*IpsecSpdDump)(nil), "ipsec_spd_dump_afefbf7d") - api.RegisterMessage((*IpsecSpdEntryAddDel)(nil), "ipsec_spd_entry_add_del_9f384b8d") + api.RegisterMessage((*IpsecSpdEntryAddDel)(nil), "ipsec_spd_entry_add_del_338b7411") api.RegisterMessage((*IpsecSpdEntryAddDelReply)(nil), "ipsec_spd_entry_add_del_reply_9ffac24b") api.RegisterMessage((*IpsecSpdInterfaceDetails)(nil), "ipsec_spd_interface_details_7a0bcf3e") api.RegisterMessage((*IpsecSpdInterfaceDump)(nil), "ipsec_spd_interface_dump_8971de19") api.RegisterMessage((*IpsecSpdsDetails)(nil), "ipsec_spds_details_a04bb254") api.RegisterMessage((*IpsecSpdsDump)(nil), "ipsec_spds_dump_51077d14") - api.RegisterMessage((*IpsecTunnelIfAddDel)(nil), "ipsec_tunnel_if_add_del_2b135e68") - api.RegisterMessage((*IpsecTunnelIfAddDelReply)(nil), "ipsec_tunnel_if_add_del_reply_5383d31f") - api.RegisterMessage((*IpsecTunnelIfSetSa)(nil), "ipsec_tunnel_if_set_sa_f2f87112") - api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec_tunnel_if_set_sa_reply_e8d4e804") - api.RegisterMessage((*IpsecTunnelProtectDel)(nil), "ipsec_tunnel_protect_del_ddd2ba36") + api.RegisterMessage((*IpsecTunnelProtectDel)(nil), "ipsec_tunnel_protect_del_cd239930") api.RegisterMessage((*IpsecTunnelProtectDelReply)(nil), "ipsec_tunnel_protect_del_reply_e8d4e804") - api.RegisterMessage((*IpsecTunnelProtectDetails)(nil), "ipsec_tunnel_protect_details_ac6c823b") + api.RegisterMessage((*IpsecTunnelProtectDetails)(nil), "ipsec_tunnel_protect_details_21663a50") api.RegisterMessage((*IpsecTunnelProtectDump)(nil), "ipsec_tunnel_protect_dump_f9e6675e") - api.RegisterMessage((*IpsecTunnelProtectUpdate)(nil), "ipsec_tunnel_protect_update_143f155d") + api.RegisterMessage((*IpsecTunnelProtectUpdate)(nil), "ipsec_tunnel_protect_update_30d5f133") api.RegisterMessage((*IpsecTunnelProtectUpdateReply)(nil), "ipsec_tunnel_protect_update_reply_e8d4e804") } @@ -1570,12 +2441,32 @@ func AllMessages() []api.Message { (*IpsecBackendDump)(nil), (*IpsecInterfaceAddDelSpd)(nil), (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecItfCreate)(nil), + (*IpsecItfCreateReply)(nil), + (*IpsecItfDelete)(nil), + (*IpsecItfDeleteReply)(nil), + (*IpsecItfDetails)(nil), + (*IpsecItfDump)(nil), (*IpsecSaDetails)(nil), (*IpsecSaDump)(nil), + (*IpsecSaV2Details)(nil), + (*IpsecSaV2Dump)(nil), + (*IpsecSaV3Details)(nil), + (*IpsecSaV3Dump)(nil), + (*IpsecSadEntryAdd)(nil), (*IpsecSadEntryAddDel)(nil), (*IpsecSadEntryAddDelReply)(nil), + (*IpsecSadEntryAddDelV2)(nil), + (*IpsecSadEntryAddDelV2Reply)(nil), + (*IpsecSadEntryAddDelV3)(nil), + (*IpsecSadEntryAddDelV3Reply)(nil), + (*IpsecSadEntryAddReply)(nil), + (*IpsecSadEntryDel)(nil), + (*IpsecSadEntryDelReply)(nil), (*IpsecSelectBackend)(nil), (*IpsecSelectBackendReply)(nil), + (*IpsecSetAsyncMode)(nil), + (*IpsecSetAsyncModeReply)(nil), (*IpsecSpdAddDel)(nil), (*IpsecSpdAddDelReply)(nil), (*IpsecSpdDetails)(nil), @@ -1586,10 +2477,6 @@ func AllMessages() []api.Message { (*IpsecSpdInterfaceDump)(nil), (*IpsecSpdsDetails)(nil), (*IpsecSpdsDump)(nil), - (*IpsecTunnelIfAddDel)(nil), - (*IpsecTunnelIfAddDelReply)(nil), - (*IpsecTunnelIfSetSa)(nil), - (*IpsecTunnelIfSetSaReply)(nil), (*IpsecTunnelProtectDel)(nil), (*IpsecTunnelProtectDelReply)(nil), (*IpsecTunnelProtectDetails)(nil), diff --git a/binapi/ipsec/ipsec_rest.ba.go b/binapi/ipsec/ipsec_rest.ba.go deleted file mode 100644 index 166ebcd..0000000 --- a/binapi/ipsec/ipsec_rest.ba.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipsec - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipsec_interface_add_del_spd", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecInterfaceAddDelSpd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecInterfaceAddDelSpd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_sad_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSadEntryAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecSadEntryAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_select_backend", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSelectBackend) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecSelectBackend(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_spd_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSpdAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecSpdAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_spd_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSpdEntryAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecSpdEntryAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_tunnel_if_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelIfAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecTunnelIfAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_tunnel_if_set_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelIfSetSa) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecTunnelIfSetSa(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_tunnel_protect_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelProtectDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecTunnelProtectDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/ipsec_tunnel_protect_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelProtectUpdate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IpsecTunnelProtectUpdate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/ipsec/ipsec_rpc.ba.go b/binapi/ipsec/ipsec_rpc.ba.go index c2d2af8..f2f063b 100644 --- a/binapi/ipsec/ipsec_rpc.ba.go +++ b/binapi/ipsec/ipsec_rpc.ba.go @@ -5,25 +5,34 @@ package ipsec import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service ipsec. +// RPCService defines RPC service ipsec. type RPCService interface { IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecItfCreate(ctx context.Context, in *IpsecItfCreate) (*IpsecItfCreateReply, error) + IpsecItfDelete(ctx context.Context, in *IpsecItfDelete) (*IpsecItfDeleteReply, error) + IpsecItfDump(ctx context.Context, in *IpsecItfDump) (RPCService_IpsecItfDumpClient, error) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) + IpsecSaV2Dump(ctx context.Context, in *IpsecSaV2Dump) (RPCService_IpsecSaV2DumpClient, error) + IpsecSaV3Dump(ctx context.Context, in *IpsecSaV3Dump) (RPCService_IpsecSaV3DumpClient, error) + IpsecSadEntryAdd(ctx context.Context, in *IpsecSadEntryAdd) (*IpsecSadEntryAddReply, error) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) + IpsecSadEntryAddDelV2(ctx context.Context, in *IpsecSadEntryAddDelV2) (*IpsecSadEntryAddDelV2Reply, error) + IpsecSadEntryAddDelV3(ctx context.Context, in *IpsecSadEntryAddDelV3) (*IpsecSadEntryAddDelV3Reply, error) + IpsecSadEntryDel(ctx context.Context, in *IpsecSadEntryDel) (*IpsecSadEntryDelReply, error) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSetAsyncMode(ctx context.Context, in *IpsecSetAsyncMode) (*IpsecSetAsyncModeReply, error) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (RPCService_IpsecSpdsDumpClient, error) - IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) - IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) @@ -46,7 +55,7 @@ func (c *serviceClient) IpsecBackendDump(ctx context.Context, in *IpsecBackendDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -69,7 +78,11 @@ func (c *serviceClient_IpsecBackendDumpClient) Recv() (*IpsecBackendDetails, err switch m := msg.(type) { case *IpsecBackendDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -82,7 +95,68 @@ func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecIn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecItfCreate(ctx context.Context, in *IpsecItfCreate) (*IpsecItfCreateReply, error) { + out := new(IpsecItfCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecItfDelete(ctx context.Context, in *IpsecItfDelete) (*IpsecItfDeleteReply, error) { + out := new(IpsecItfDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecItfDump(ctx context.Context, in *IpsecItfDump) (RPCService_IpsecItfDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecItfDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecItfDumpClient interface { + Recv() (*IpsecItfDetails, error) + api.Stream +} + +type serviceClient_IpsecItfDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecItfDumpClient) Recv() (*IpsecItfDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecItfDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } func (c *serviceClient) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) { @@ -94,7 +168,7 @@ func (c *serviceClient) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -117,20 +191,146 @@ func (c *serviceClient_IpsecSaDumpClient) Recv() (*IpsecSaDetails, error) { switch m := msg.(type) { case *IpsecSaDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSaV2Dump(ctx context.Context, in *IpsecSaV2Dump) (RPCService_IpsecSaV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSaV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSaV2DumpClient interface { + Recv() (*IpsecSaV2Details, error) + api.Stream +} + +type serviceClient_IpsecSaV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSaV2DumpClient) Recv() (*IpsecSaV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSaV2Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) IpsecSaV3Dump(ctx context.Context, in *IpsecSaV3Dump) (RPCService_IpsecSaV3DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSaV3DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSaV3DumpClient interface { + Recv() (*IpsecSaV3Details, error) + api.Stream +} + +type serviceClient_IpsecSaV3DumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSaV3DumpClient) Recv() (*IpsecSaV3Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSaV3Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSadEntryAdd(ctx context.Context, in *IpsecSadEntryAdd) (*IpsecSadEntryAddReply, error) { + out := new(IpsecSadEntryAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) { out := new(IpsecSadEntryAddDelReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecSadEntryAddDelV2(ctx context.Context, in *IpsecSadEntryAddDelV2) (*IpsecSadEntryAddDelV2Reply, error) { + out := new(IpsecSadEntryAddDelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecSadEntryAddDelV3(ctx context.Context, in *IpsecSadEntryAddDelV3) (*IpsecSadEntryAddDelV3Reply, error) { + out := new(IpsecSadEntryAddDelV3Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecSadEntryDel(ctx context.Context, in *IpsecSadEntryDel) (*IpsecSadEntryDelReply, error) { + out := new(IpsecSadEntryDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { @@ -139,7 +339,16 @@ func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectB if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) IpsecSetAsyncMode(ctx context.Context, in *IpsecSetAsyncMode) (*IpsecSetAsyncModeReply, error) { + out := new(IpsecSetAsyncModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { @@ -148,7 +357,7 @@ func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) { @@ -160,7 +369,7 @@ func (c *serviceClient) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -183,7 +392,11 @@ func (c *serviceClient_IpsecSpdDumpClient) Recv() (*IpsecSpdDetails, error) { switch m := msg.(type) { case *IpsecSpdDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -196,7 +409,7 @@ func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEnt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) { @@ -208,7 +421,7 @@ func (c *serviceClient) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdI if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -231,7 +444,11 @@ func (c *serviceClient_IpsecSpdInterfaceDumpClient) Recv() (*IpsecSpdInterfaceDe switch m := msg.(type) { case *IpsecSpdInterfaceDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -247,7 +464,7 @@ func (c *serviceClient) IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -270,38 +487,24 @@ func (c *serviceClient_IpsecSpdsDumpClient) Recv() (*IpsecSpdsDetails, error) { switch m := msg.(type) { case *IpsecSpdsDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } -func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { - out := new(IpsecTunnelIfAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { - out := new(IpsecTunnelIfSetSaReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) { out := new(IpsecTunnelProtectDelReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) { @@ -313,7 +516,7 @@ func (c *serviceClient) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTun if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -336,7 +539,11 @@ func (c *serviceClient_IpsecTunnelProtectDumpClient) Recv() (*IpsecTunnelProtect switch m := msg.(type) { case *IpsecTunnelProtectDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -349,5 +556,5 @@ func (c *serviceClient) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ipsec_types/ipsec_types.ba.go b/binapi/ipsec_types/ipsec_types.ba.go index 149c35f..b8c0848 100644 --- a/binapi/ipsec_types/ipsec_types.ba.go +++ b/binapi/ipsec_types/ipsec_types.ba.go @@ -1,21 +1,24 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/ipsec_types.api.json // Package ipsec_types contains generated bindings for API file ipsec_types.api. // // Contents: // 4 enums -// 2 structs +// 4 structs // package ipsec_types import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + tunnel_types "go.fd.io/govpp/binapi/tunnel_types" ) // This is a compile-time assertion to ensure that this generated file @@ -24,6 +27,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "ipsec_types" + APIVersion = "3.0.1" + VersionCrc = 0x48f74470 +) + // IpsecCryptoAlg defines enum 'ipsec_crypto_alg'. type IpsecCryptoAlg uint32 @@ -161,17 +170,19 @@ const ( IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 IpsecSadFlags = 8 IPSEC_API_SAD_FLAG_UDP_ENCAP IpsecSadFlags = 16 IPSEC_API_SAD_FLAG_IS_INBOUND IpsecSadFlags = 64 + IPSEC_API_SAD_FLAG_ASYNC IpsecSadFlags = 128 ) var ( IpsecSadFlags_name = map[uint32]string{ - 0: "IPSEC_API_SAD_FLAG_NONE", - 1: "IPSEC_API_SAD_FLAG_USE_ESN", - 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", - 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", - 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", - 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", - 64: "IPSEC_API_SAD_FLAG_IS_INBOUND", + 0: "IPSEC_API_SAD_FLAG_NONE", + 1: "IPSEC_API_SAD_FLAG_USE_ESN", + 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", + 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", + 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", + 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", + 64: "IPSEC_API_SAD_FLAG_IS_INBOUND", + 128: "IPSEC_API_SAD_FLAG_ASYNC", } IpsecSadFlags_value = map[string]uint32{ "IPSEC_API_SAD_FLAG_NONE": 0, @@ -181,6 +192,7 @@ var ( "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6": 8, "IPSEC_API_SAD_FLAG_UDP_ENCAP": 16, "IPSEC_API_SAD_FLAG_IS_INBOUND": 64, + "IPSEC_API_SAD_FLAG_ASYNC": 128, } ) @@ -229,6 +241,42 @@ type IpsecSadEntry struct { UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=4500" json:"udp_dst_port,omitempty"` } +// IpsecSadEntryV2 defines type 'ipsec_sad_entry_v2'. +type IpsecSadEntryV2 struct { + SadID uint32 `binapi:"u32,name=sad_id" json:"sad_id,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + CryptoAlgorithm IpsecCryptoAlg `binapi:"ipsec_crypto_alg,name=crypto_algorithm" json:"crypto_algorithm,omitempty"` + CryptoKey Key `binapi:"key,name=crypto_key" json:"crypto_key,omitempty"` + IntegrityAlgorithm IpsecIntegAlg `binapi:"ipsec_integ_alg,name=integrity_algorithm" json:"integrity_algorithm,omitempty"` + IntegrityKey Key `binapi:"key,name=integrity_key" json:"integrity_key,omitempty"` + Flags IpsecSadFlags `binapi:"ipsec_sad_flags,name=flags" json:"flags,omitempty"` + TunnelSrc ip_types.Address `binapi:"address,name=tunnel_src" json:"tunnel_src,omitempty"` + TunnelDst ip_types.Address `binapi:"address,name=tunnel_dst" json:"tunnel_dst,omitempty"` + TunnelFlags tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=tunnel_flags" json:"tunnel_flags,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` + TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + UDPSrcPort uint16 `binapi:"u16,name=udp_src_port,default=4500" json:"udp_src_port,omitempty"` + UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=4500" json:"udp_dst_port,omitempty"` +} + +// IpsecSadEntryV3 defines type 'ipsec_sad_entry_v3'. +type IpsecSadEntryV3 struct { + SadID uint32 `binapi:"u32,name=sad_id" json:"sad_id,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + CryptoAlgorithm IpsecCryptoAlg `binapi:"ipsec_crypto_alg,name=crypto_algorithm" json:"crypto_algorithm,omitempty"` + CryptoKey Key `binapi:"key,name=crypto_key" json:"crypto_key,omitempty"` + IntegrityAlgorithm IpsecIntegAlg `binapi:"ipsec_integ_alg,name=integrity_algorithm" json:"integrity_algorithm,omitempty"` + IntegrityKey Key `binapi:"key,name=integrity_key" json:"integrity_key,omitempty"` + Flags IpsecSadFlags `binapi:"ipsec_sad_flags,name=flags" json:"flags,omitempty"` + Tunnel tunnel_types.Tunnel `binapi:"tunnel,name=tunnel" json:"tunnel,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + UDPSrcPort uint16 `binapi:"u16,name=udp_src_port,default=4500" json:"udp_src_port,omitempty"` + UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=4500" json:"udp_dst_port,omitempty"` +} + // Key defines type 'key'. type Key struct { Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` diff --git a/binapi/l2/l2.ba.go b/binapi/l2/l2.ba.go index 7413635..df379d3 100644 --- a/binapi/l2/l2.ba.go +++ b/binapi/l2/l2.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/l2.api.json // Package l2 contains generated bindings for API file l2.api. @@ -9,17 +9,18 @@ // Contents: // 3 enums // 3 structs -// 54 messages +// 62 messages // package l2 import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,8 +31,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "l2" - APIVersion = "3.0.0" - VersionCrc = 0x58ce8a6b + APIVersion = "3.1.0" + VersionCrc = 0xfc6b8fd2 ) // BdFlags defines enum 'bd_flags'. @@ -185,7 +186,7 @@ type BdIPMacAddDel struct { func (m *BdIPMacAddDel) Reset() { *m = BdIPMacAddDel{} } func (*BdIPMacAddDel) GetMessageName() string { return "bd_ip_mac_add_del" } -func (*BdIPMacAddDel) GetCrcString() string { return "5f2b84e2" } +func (*BdIPMacAddDel) GetCrcString() string { return "0257c869" } func (*BdIPMacAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -263,7 +264,7 @@ type BdIPMacDetails struct { func (m *BdIPMacDetails) Reset() { *m = BdIPMacDetails{} } func (*BdIPMacDetails) GetMessageName() string { return "bd_ip_mac_details" } -func (*BdIPMacDetails) GetCrcString() string { return "a52f8044" } +func (*BdIPMacDetails) GetCrcString() string { return "545af86a" } func (*BdIPMacDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -518,7 +519,7 @@ type BridgeDomainDetails struct { func (m *BridgeDomainDetails) Reset() { *m = BridgeDomainDetails{} } func (*BridgeDomainDetails) GetMessageName() string { return "bridge_domain_details" } -func (*BridgeDomainDetails) GetCrcString() string { return "979f549d" } +func (*BridgeDomainDetails) GetCrcString() string { return "0fa506fd" } func (*BridgeDomainDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -639,6 +640,148 @@ func (m *BridgeDomainDump) Unmarshal(b []byte) error { return nil } +// BridgeDomainSetDefaultLearnLimit defines message 'bridge_domain_set_default_learn_limit'. +type BridgeDomainSetDefaultLearnLimit struct { + LearnLimit uint32 `binapi:"u32,name=learn_limit" json:"learn_limit,omitempty"` +} + +func (m *BridgeDomainSetDefaultLearnLimit) Reset() { *m = BridgeDomainSetDefaultLearnLimit{} } +func (*BridgeDomainSetDefaultLearnLimit) GetMessageName() string { + return "bridge_domain_set_default_learn_limit" +} +func (*BridgeDomainSetDefaultLearnLimit) GetCrcString() string { return "f097ffce" } +func (*BridgeDomainSetDefaultLearnLimit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeDomainSetDefaultLearnLimit) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.LearnLimit + return size +} +func (m *BridgeDomainSetDefaultLearnLimit) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.LearnLimit) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetDefaultLearnLimit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LearnLimit = buf.DecodeUint32() + return nil +} + +// BridgeDomainSetDefaultLearnLimitReply defines message 'bridge_domain_set_default_learn_limit_reply'. +type BridgeDomainSetDefaultLearnLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BridgeDomainSetDefaultLearnLimitReply) Reset() { *m = BridgeDomainSetDefaultLearnLimitReply{} } +func (*BridgeDomainSetDefaultLearnLimitReply) GetMessageName() string { + return "bridge_domain_set_default_learn_limit_reply" +} +func (*BridgeDomainSetDefaultLearnLimitReply) GetCrcString() string { return "e8d4e804" } +func (*BridgeDomainSetDefaultLearnLimitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeDomainSetDefaultLearnLimitReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *BridgeDomainSetDefaultLearnLimitReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetDefaultLearnLimitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// BridgeDomainSetLearnLimit defines message 'bridge_domain_set_learn_limit'. +type BridgeDomainSetLearnLimit struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + LearnLimit uint32 `binapi:"u32,name=learn_limit" json:"learn_limit,omitempty"` +} + +func (m *BridgeDomainSetLearnLimit) Reset() { *m = BridgeDomainSetLearnLimit{} } +func (*BridgeDomainSetLearnLimit) GetMessageName() string { return "bridge_domain_set_learn_limit" } +func (*BridgeDomainSetLearnLimit) GetCrcString() string { return "89c52b5f" } +func (*BridgeDomainSetLearnLimit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeDomainSetLearnLimit) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.BdID + size += 4 // m.LearnLimit + return size +} +func (m *BridgeDomainSetLearnLimit) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.BdID) + buf.EncodeUint32(m.LearnLimit) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetLearnLimit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.LearnLimit = buf.DecodeUint32() + return nil +} + +// BridgeDomainSetLearnLimitReply defines message 'bridge_domain_set_learn_limit_reply'. +type BridgeDomainSetLearnLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BridgeDomainSetLearnLimitReply) Reset() { *m = BridgeDomainSetLearnLimitReply{} } +func (*BridgeDomainSetLearnLimitReply) GetMessageName() string { + return "bridge_domain_set_learn_limit_reply" +} +func (*BridgeDomainSetLearnLimitReply) GetCrcString() string { return "e8d4e804" } +func (*BridgeDomainSetLearnLimitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeDomainSetLearnLimitReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *BridgeDomainSetLearnLimitReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetLearnLimitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // BridgeDomainSetMacAge defines message 'bridge_domain_set_mac_age'. type BridgeDomainSetMacAge struct { BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` @@ -937,7 +1080,7 @@ type L2ArpTermEvent struct { func (m *L2ArpTermEvent) Reset() { *m = L2ArpTermEvent{} } func (*L2ArpTermEvent) GetMessageName() string { return "l2_arp_term_event" } -func (*L2ArpTermEvent) GetCrcString() string { return "85ff71ea" } +func (*L2ArpTermEvent) GetCrcString() string { return "6963e07a" } func (*L2ArpTermEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -1047,7 +1190,7 @@ type L2FibTableDetails struct { func (m *L2FibTableDetails) Reset() { *m = L2FibTableDetails{} } func (*L2FibTableDetails) GetMessageName() string { return "l2_fib_table_details" } -func (*L2FibTableDetails) GetCrcString() string { return "e8d2fc72" } +func (*L2FibTableDetails) GetCrcString() string { return "a44ef6b8" } func (*L2FibTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1282,7 +1425,7 @@ type L2InterfacePbbTagRewrite struct { func (m *L2InterfacePbbTagRewrite) Reset() { *m = L2InterfacePbbTagRewrite{} } func (*L2InterfacePbbTagRewrite) GetMessageName() string { return "l2_interface_pbb_tag_rewrite" } -func (*L2InterfacePbbTagRewrite) GetCrcString() string { return "612efa5a" } +func (*L2InterfacePbbTagRewrite) GetCrcString() string { return "38e802a8" } func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1454,7 +1597,7 @@ type L2MacsEvent struct { func (m *L2MacsEvent) Reset() { *m = L2MacsEvent{} } func (*L2MacsEvent) GetMessageName() string { return "l2_macs_event" } -func (*L2MacsEvent) GetCrcString() string { return "2eadfc8b" } +func (*L2MacsEvent) GetCrcString() string { return "44b8fd64" } func (*L2MacsEvent) GetMessageType() api.MessageType { return api.EventMessage } @@ -1520,7 +1663,7 @@ type L2PatchAddDel struct { func (m *L2PatchAddDel) Reset() { *m = L2PatchAddDel{} } func (*L2PatchAddDel) GetMessageName() string { return "l2_patch_add_del" } -func (*L2PatchAddDel) GetCrcString() string { return "522f3445" } +func (*L2PatchAddDel) GetCrcString() string { return "a1f6a6f3" } func (*L2PatchAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1593,7 +1736,7 @@ type L2XconnectDetails struct { func (m *L2XconnectDetails) Reset() { *m = L2XconnectDetails{} } func (*L2XconnectDetails) GetMessageName() string { return "l2_xconnect_details" } -func (*L2XconnectDetails) GetCrcString() string { return "c8aa6b37" } +func (*L2XconnectDetails) GetCrcString() string { return "472b6b67" } func (*L2XconnectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1662,7 +1805,7 @@ type L2fibAddDel struct { func (m *L2fibAddDel) Reset() { *m = L2fibAddDel{} } func (*L2fibAddDel) GetMessageName() string { return "l2fib_add_del" } -func (*L2fibAddDel) GetCrcString() string { return "f29d796c" } +func (*L2fibAddDel) GetCrcString() string { return "eddda487" } func (*L2fibAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1931,6 +2074,72 @@ func (m *L2fibFlushIntReply) Unmarshal(b []byte) error { return nil } +// L2fibSetScanDelay defines message 'l2fib_set_scan_delay'. +type L2fibSetScanDelay struct { + ScanDelay uint16 `binapi:"u16,name=scan_delay,default=10" json:"scan_delay,omitempty"` +} + +func (m *L2fibSetScanDelay) Reset() { *m = L2fibSetScanDelay{} } +func (*L2fibSetScanDelay) GetMessageName() string { return "l2fib_set_scan_delay" } +func (*L2fibSetScanDelay) GetCrcString() string { return "a3b968a4" } +func (*L2fibSetScanDelay) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2fibSetScanDelay) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.ScanDelay + return size +} +func (m *L2fibSetScanDelay) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.ScanDelay) + return buf.Bytes(), nil +} +func (m *L2fibSetScanDelay) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ScanDelay = buf.DecodeUint16() + return nil +} + +// L2fibSetScanDelayReply defines message 'l2fib_set_scan_delay_reply'. +type L2fibSetScanDelayReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2fibSetScanDelayReply) Reset() { *m = L2fibSetScanDelayReply{} } +func (*L2fibSetScanDelayReply) GetMessageName() string { return "l2fib_set_scan_delay_reply" } +func (*L2fibSetScanDelayReply) GetCrcString() string { return "e8d4e804" } +func (*L2fibSetScanDelayReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2fibSetScanDelayReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *L2fibSetScanDelayReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *L2fibSetScanDelayReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceSetL2Bridge defines message 'sw_interface_set_l2_bridge'. type SwInterfaceSetL2Bridge struct { RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` @@ -1942,7 +2151,7 @@ type SwInterfaceSetL2Bridge struct { func (m *SwInterfaceSetL2Bridge) Reset() { *m = SwInterfaceSetL2Bridge{} } func (*SwInterfaceSetL2Bridge) GetMessageName() string { return "sw_interface_set_l2_bridge" } -func (*SwInterfaceSetL2Bridge) GetCrcString() string { return "2e483cd0" } +func (*SwInterfaceSetL2Bridge) GetCrcString() string { return "d0678b13" } func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2024,7 +2233,7 @@ type SwInterfaceSetL2Xconnect struct { func (m *SwInterfaceSetL2Xconnect) Reset() { *m = SwInterfaceSetL2Xconnect{} } func (*SwInterfaceSetL2Xconnect) GetMessageName() string { return "sw_interface_set_l2_xconnect" } -func (*SwInterfaceSetL2Xconnect) GetCrcString() string { return "1aaa2dbb" } +func (*SwInterfaceSetL2Xconnect) GetCrcString() string { return "4fa28a85" } func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2232,6 +2441,7 @@ func (m *WantL2ArpTermEventsReply) Unmarshal(b []byte) error { } // WantL2MacsEvents defines message 'want_l2_macs_events'. +// Deprecated: the message will be removed in the future versions type WantL2MacsEvents struct { LearnLimit uint32 `binapi:"u32,name=learn_limit,default=1000" json:"learn_limit,omitempty"` ScanDelay uint8 `binapi:"u8,name=scan_delay,default=10" json:"scan_delay,omitempty"` @@ -2280,7 +2490,82 @@ func (m *WantL2MacsEvents) Unmarshal(b []byte) error { return nil } +// WantL2MacsEvents2 defines message 'want_l2_macs_events2'. +type WantL2MacsEvents2 struct { + MaxMacsInEvent uint8 `binapi:"u8,name=max_macs_in_event,default=10" json:"max_macs_in_event,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable,default=true" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantL2MacsEvents2) Reset() { *m = WantL2MacsEvents2{} } +func (*WantL2MacsEvents2) GetMessageName() string { return "want_l2_macs_events2" } +func (*WantL2MacsEvents2) GetCrcString() string { return "cc1377b0" } +func (*WantL2MacsEvents2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantL2MacsEvents2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.MaxMacsInEvent + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantL2MacsEvents2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.MaxMacsInEvent) + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *WantL2MacsEvents2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MaxMacsInEvent = buf.DecodeUint8() + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantL2MacsEvents2Reply defines message 'want_l2_macs_events2_reply'. +type WantL2MacsEvents2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantL2MacsEvents2Reply) Reset() { *m = WantL2MacsEvents2Reply{} } +func (*WantL2MacsEvents2Reply) GetMessageName() string { return "want_l2_macs_events2_reply" } +func (*WantL2MacsEvents2Reply) GetCrcString() string { return "e8d4e804" } +func (*WantL2MacsEvents2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantL2MacsEvents2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantL2MacsEvents2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WantL2MacsEvents2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // WantL2MacsEventsReply defines message 'want_l2_macs_events_reply'. +// Deprecated: the message will be removed in the future versions type WantL2MacsEventsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -2315,16 +2600,20 @@ func (m *WantL2MacsEventsReply) Unmarshal(b []byte) error { func init() { file_l2_binapi_init() } func file_l2_binapi_init() { - api.RegisterMessage((*BdIPMacAddDel)(nil), "bd_ip_mac_add_del_5f2b84e2") + api.RegisterMessage((*BdIPMacAddDel)(nil), "bd_ip_mac_add_del_0257c869") api.RegisterMessage((*BdIPMacAddDelReply)(nil), "bd_ip_mac_add_del_reply_e8d4e804") - api.RegisterMessage((*BdIPMacDetails)(nil), "bd_ip_mac_details_a52f8044") + api.RegisterMessage((*BdIPMacDetails)(nil), "bd_ip_mac_details_545af86a") api.RegisterMessage((*BdIPMacDump)(nil), "bd_ip_mac_dump_c25fdce6") api.RegisterMessage((*BdIPMacFlush)(nil), "bd_ip_mac_flush_c25fdce6") api.RegisterMessage((*BdIPMacFlushReply)(nil), "bd_ip_mac_flush_reply_e8d4e804") api.RegisterMessage((*BridgeDomainAddDel)(nil), "bridge_domain_add_del_600b7170") api.RegisterMessage((*BridgeDomainAddDelReply)(nil), "bridge_domain_add_del_reply_e8d4e804") - api.RegisterMessage((*BridgeDomainDetails)(nil), "bridge_domain_details_979f549d") + api.RegisterMessage((*BridgeDomainDetails)(nil), "bridge_domain_details_0fa506fd") api.RegisterMessage((*BridgeDomainDump)(nil), "bridge_domain_dump_74396a43") + api.RegisterMessage((*BridgeDomainSetDefaultLearnLimit)(nil), "bridge_domain_set_default_learn_limit_f097ffce") + api.RegisterMessage((*BridgeDomainSetDefaultLearnLimitReply)(nil), "bridge_domain_set_default_learn_limit_reply_e8d4e804") + api.RegisterMessage((*BridgeDomainSetLearnLimit)(nil), "bridge_domain_set_learn_limit_89c52b5f") + api.RegisterMessage((*BridgeDomainSetLearnLimitReply)(nil), "bridge_domain_set_learn_limit_reply_e8d4e804") api.RegisterMessage((*BridgeDomainSetMacAge)(nil), "bridge_domain_set_mac_age_b537ad7b") api.RegisterMessage((*BridgeDomainSetMacAgeReply)(nil), "bridge_domain_set_mac_age_reply_e8d4e804") api.RegisterMessage((*BridgeFlags)(nil), "bridge_flags_1b0c5fbd") @@ -2333,25 +2622,25 @@ func file_l2_binapi_init() { api.RegisterMessage((*BviCreateReply)(nil), "bvi_create_reply_5383d31f") api.RegisterMessage((*BviDelete)(nil), "bvi_delete_f9e6675e") api.RegisterMessage((*BviDeleteReply)(nil), "bvi_delete_reply_e8d4e804") - api.RegisterMessage((*L2ArpTermEvent)(nil), "l2_arp_term_event_85ff71ea") + api.RegisterMessage((*L2ArpTermEvent)(nil), "l2_arp_term_event_6963e07a") api.RegisterMessage((*L2FibClearTable)(nil), "l2_fib_clear_table_51077d14") api.RegisterMessage((*L2FibClearTableReply)(nil), "l2_fib_clear_table_reply_e8d4e804") - api.RegisterMessage((*L2FibTableDetails)(nil), "l2_fib_table_details_e8d2fc72") + api.RegisterMessage((*L2FibTableDetails)(nil), "l2_fib_table_details_a44ef6b8") api.RegisterMessage((*L2FibTableDump)(nil), "l2_fib_table_dump_c25fdce6") api.RegisterMessage((*L2Flags)(nil), "l2_flags_fc41cfe8") api.RegisterMessage((*L2FlagsReply)(nil), "l2_flags_reply_29b2a2b3") api.RegisterMessage((*L2InterfaceEfpFilter)(nil), "l2_interface_efp_filter_5501adee") api.RegisterMessage((*L2InterfaceEfpFilterReply)(nil), "l2_interface_efp_filter_reply_e8d4e804") - api.RegisterMessage((*L2InterfacePbbTagRewrite)(nil), "l2_interface_pbb_tag_rewrite_612efa5a") + api.RegisterMessage((*L2InterfacePbbTagRewrite)(nil), "l2_interface_pbb_tag_rewrite_38e802a8") api.RegisterMessage((*L2InterfacePbbTagRewriteReply)(nil), "l2_interface_pbb_tag_rewrite_reply_e8d4e804") api.RegisterMessage((*L2InterfaceVlanTagRewrite)(nil), "l2_interface_vlan_tag_rewrite_62cc0bbc") api.RegisterMessage((*L2InterfaceVlanTagRewriteReply)(nil), "l2_interface_vlan_tag_rewrite_reply_e8d4e804") - api.RegisterMessage((*L2MacsEvent)(nil), "l2_macs_event_2eadfc8b") - api.RegisterMessage((*L2PatchAddDel)(nil), "l2_patch_add_del_522f3445") + api.RegisterMessage((*L2MacsEvent)(nil), "l2_macs_event_44b8fd64") + api.RegisterMessage((*L2PatchAddDel)(nil), "l2_patch_add_del_a1f6a6f3") api.RegisterMessage((*L2PatchAddDelReply)(nil), "l2_patch_add_del_reply_e8d4e804") - api.RegisterMessage((*L2XconnectDetails)(nil), "l2_xconnect_details_c8aa6b37") + api.RegisterMessage((*L2XconnectDetails)(nil), "l2_xconnect_details_472b6b67") api.RegisterMessage((*L2XconnectDump)(nil), "l2_xconnect_dump_51077d14") - api.RegisterMessage((*L2fibAddDel)(nil), "l2fib_add_del_f29d796c") + api.RegisterMessage((*L2fibAddDel)(nil), "l2fib_add_del_eddda487") api.RegisterMessage((*L2fibAddDelReply)(nil), "l2fib_add_del_reply_e8d4e804") api.RegisterMessage((*L2fibFlushAll)(nil), "l2fib_flush_all_51077d14") api.RegisterMessage((*L2fibFlushAllReply)(nil), "l2fib_flush_all_reply_e8d4e804") @@ -2359,15 +2648,19 @@ func file_l2_binapi_init() { api.RegisterMessage((*L2fibFlushBdReply)(nil), "l2fib_flush_bd_reply_e8d4e804") api.RegisterMessage((*L2fibFlushInt)(nil), "l2fib_flush_int_f9e6675e") api.RegisterMessage((*L2fibFlushIntReply)(nil), "l2fib_flush_int_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetL2Bridge)(nil), "sw_interface_set_l2_bridge_2e483cd0") + api.RegisterMessage((*L2fibSetScanDelay)(nil), "l2fib_set_scan_delay_a3b968a4") + api.RegisterMessage((*L2fibSetScanDelayReply)(nil), "l2fib_set_scan_delay_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetL2Bridge)(nil), "sw_interface_set_l2_bridge_d0678b13") api.RegisterMessage((*SwInterfaceSetL2BridgeReply)(nil), "sw_interface_set_l2_bridge_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetL2Xconnect)(nil), "sw_interface_set_l2_xconnect_1aaa2dbb") + api.RegisterMessage((*SwInterfaceSetL2Xconnect)(nil), "sw_interface_set_l2_xconnect_4fa28a85") api.RegisterMessage((*SwInterfaceSetL2XconnectReply)(nil), "sw_interface_set_l2_xconnect_reply_e8d4e804") api.RegisterMessage((*SwInterfaceSetVpath)(nil), "sw_interface_set_vpath_ae6cfcfb") api.RegisterMessage((*SwInterfaceSetVpathReply)(nil), "sw_interface_set_vpath_reply_e8d4e804") api.RegisterMessage((*WantL2ArpTermEvents)(nil), "want_l2_arp_term_events_3ec6d6c2") api.RegisterMessage((*WantL2ArpTermEventsReply)(nil), "want_l2_arp_term_events_reply_e8d4e804") api.RegisterMessage((*WantL2MacsEvents)(nil), "want_l2_macs_events_9aabdfde") + api.RegisterMessage((*WantL2MacsEvents2)(nil), "want_l2_macs_events2_cc1377b0") + api.RegisterMessage((*WantL2MacsEvents2Reply)(nil), "want_l2_macs_events2_reply_e8d4e804") api.RegisterMessage((*WantL2MacsEventsReply)(nil), "want_l2_macs_events_reply_e8d4e804") } @@ -2384,6 +2677,10 @@ func AllMessages() []api.Message { (*BridgeDomainAddDelReply)(nil), (*BridgeDomainDetails)(nil), (*BridgeDomainDump)(nil), + (*BridgeDomainSetDefaultLearnLimit)(nil), + (*BridgeDomainSetDefaultLearnLimitReply)(nil), + (*BridgeDomainSetLearnLimit)(nil), + (*BridgeDomainSetLearnLimitReply)(nil), (*BridgeDomainSetMacAge)(nil), (*BridgeDomainSetMacAgeReply)(nil), (*BridgeFlags)(nil), @@ -2418,6 +2715,8 @@ func AllMessages() []api.Message { (*L2fibFlushBdReply)(nil), (*L2fibFlushInt)(nil), (*L2fibFlushIntReply)(nil), + (*L2fibSetScanDelay)(nil), + (*L2fibSetScanDelayReply)(nil), (*SwInterfaceSetL2Bridge)(nil), (*SwInterfaceSetL2BridgeReply)(nil), (*SwInterfaceSetL2Xconnect)(nil), @@ -2427,6 +2726,8 @@ func AllMessages() []api.Message { (*WantL2ArpTermEvents)(nil), (*WantL2ArpTermEventsReply)(nil), (*WantL2MacsEvents)(nil), + (*WantL2MacsEvents2)(nil), + (*WantL2MacsEvents2Reply)(nil), (*WantL2MacsEventsReply)(nil), } } diff --git a/binapi/l2/l2_rest.ba.go b/binapi/l2/l2_rest.ba.go deleted file mode 100644 index f12ab06..0000000 --- a/binapi/l2/l2_rest.ba.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bd_ip_mac_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BdIPMacAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BdIPMacAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bd_ip_mac_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(BdIPMacFlush) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BdIPMacFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bridge_domain_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeDomainAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BridgeDomainAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bridge_domain_set_mac_age", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeDomainSetMacAge) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BridgeDomainSetMacAge(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bridge_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeFlags) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BridgeFlags(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bvi_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(BviCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BviCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/bvi_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(BviDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.BviDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_fib_clear_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2FibClearTable) - reply, err := rpc.L2FibClearTable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2Flags) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2Flags(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_interface_efp_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfaceEfpFilter) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2InterfaceEfpFilter(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_interface_pbb_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfacePbbTagRewrite) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2InterfacePbbTagRewrite(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_interface_vlan_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfaceVlanTagRewrite) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2InterfaceVlanTagRewrite(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2_patch_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2PatchAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2PatchAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2fib_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2fibAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2fib_flush_all", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushAll) - reply, err := rpc.L2fibFlushAll(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2fib_flush_bd", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushBd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2fibFlushBd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2fib_flush_int", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushInt) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2fibFlushInt(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_l2_bridge", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetL2Bridge) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetL2Bridge(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_l2_xconnect", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetL2Xconnect) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetL2Xconnect(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_vpath", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVpath) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetVpath(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_l2_arp_term_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantL2ArpTermEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantL2ArpTermEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/want_l2_macs_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantL2MacsEvents) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.WantL2MacsEvents(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/l2/l2_rpc.ba.go b/binapi/l2/l2_rpc.ba.go index b319c4e..69763ca 100644 --- a/binapi/l2/l2_rpc.ba.go +++ b/binapi/l2/l2_rpc.ba.go @@ -5,18 +5,21 @@ package l2 import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service l2. +// RPCService defines RPC service l2. type RPCService interface { BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) BridgeDomainDump(ctx context.Context, in *BridgeDomainDump) (RPCService_BridgeDomainDumpClient, error) + BridgeDomainSetDefaultLearnLimit(ctx context.Context, in *BridgeDomainSetDefaultLearnLimit) (*BridgeDomainSetDefaultLearnLimitReply, error) + BridgeDomainSetLearnLimit(ctx context.Context, in *BridgeDomainSetLearnLimit) (*BridgeDomainSetLearnLimitReply, error) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) @@ -33,11 +36,13 @@ type RPCService interface { L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) + L2fibSetScanDelay(ctx context.Context, in *L2fibSetScanDelay) (*L2fibSetScanDelayReply, error) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTermEvents) (*WantL2ArpTermEventsReply, error) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) + WantL2MacsEvents2(ctx context.Context, in *WantL2MacsEvents2) (*WantL2MacsEvents2Reply, error) } type serviceClient struct { @@ -54,7 +59,7 @@ func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) { @@ -66,7 +71,7 @@ func (c *serviceClient) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -89,7 +94,11 @@ func (c *serviceClient_BdIPMacDumpClient) Recv() (*BdIPMacDetails, error) { switch m := msg.(type) { case *BdIPMacDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -102,7 +111,7 @@ func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*Bd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { @@ -111,7 +120,7 @@ func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomain if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeDomainDump(ctx context.Context, in *BridgeDomainDump) (RPCService_BridgeDomainDumpClient, error) { @@ -123,7 +132,7 @@ func (c *serviceClient) BridgeDomainDump(ctx context.Context, in *BridgeDomainDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -146,20 +155,42 @@ func (c *serviceClient_BridgeDomainDumpClient) Recv() (*BridgeDomainDetails, err switch m := msg.(type) { case *BridgeDomainDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) BridgeDomainSetDefaultLearnLimit(ctx context.Context, in *BridgeDomainSetDefaultLearnLimit) (*BridgeDomainSetDefaultLearnLimitReply, error) { + out := new(BridgeDomainSetDefaultLearnLimitReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) BridgeDomainSetLearnLimit(ctx context.Context, in *BridgeDomainSetLearnLimit) (*BridgeDomainSetLearnLimitReply, error) { + out := new(BridgeDomainSetLearnLimitReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) { out := new(BridgeDomainSetMacAgeReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { @@ -168,7 +199,7 @@ func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*Brid if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) { @@ -177,7 +208,7 @@ func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) { @@ -186,7 +217,7 @@ func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDelet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { @@ -195,7 +226,7 @@ func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2FibTableDump(ctx context.Context, in *L2FibTableDump) (RPCService_L2FibTableDumpClient, error) { @@ -207,7 +238,7 @@ func (c *serviceClient) L2FibTableDump(ctx context.Context, in *L2FibTableDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -230,7 +261,11 @@ func (c *serviceClient_L2FibTableDumpClient) Recv() (*L2FibTableDetails, error) switch m := msg.(type) { case *L2FibTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -243,7 +278,7 @@ func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { @@ -252,7 +287,7 @@ func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2Interfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { @@ -261,7 +296,7 @@ func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2Inte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { @@ -270,7 +305,7 @@ func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2Int if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { @@ -279,7 +314,7 @@ func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2XconnectDump(ctx context.Context, in *L2XconnectDump) (RPCService_L2XconnectDumpClient, error) { @@ -291,7 +326,7 @@ func (c *serviceClient) L2XconnectDump(ctx context.Context, in *L2XconnectDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -314,7 +349,11 @@ func (c *serviceClient_L2XconnectDumpClient) Recv() (*L2XconnectDetails, error) switch m := msg.(type) { case *L2XconnectDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -327,7 +366,7 @@ func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { @@ -336,7 +375,7 @@ func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { @@ -345,7 +384,7 @@ func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { @@ -354,7 +393,16 @@ func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) L2fibSetScanDelay(ctx context.Context, in *L2fibSetScanDelay) (*L2fibSetScanDelayReply, error) { + out := new(L2fibSetScanDelayReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { @@ -363,7 +411,7 @@ func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { @@ -372,7 +420,7 @@ func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { @@ -381,7 +429,7 @@ func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTermEvents) (*WantL2ArpTermEventsReply, error) { @@ -390,7 +438,7 @@ func (c *serviceClient) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { @@ -399,5 +447,14 @@ func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEven if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WantL2MacsEvents2(ctx context.Context, in *WantL2MacsEvents2) (*WantL2MacsEvents2Reply, error) { + out := new(WantL2MacsEvents2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/l2e/l2e.ba.go b/binapi/l2e/l2e.ba.go deleted file mode 100644 index c1b2a76..0000000 --- a/binapi/l2e/l2e.ba.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/l2e.api.json - -// Package l2e contains generated bindings for API file l2e.api. -// -// Contents: -// 2 messages -// -package l2e - -import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "l2e" - APIVersion = "1.0.0" - VersionCrc = 0x7c918b8 -) - -// L2Emulation defines message 'l2_emulation'. -type L2Emulation struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *L2Emulation) Reset() { *m = L2Emulation{} } -func (*L2Emulation) GetMessageName() string { return "l2_emulation" } -func (*L2Emulation) GetCrcString() string { return "ae6cfcfb" } -func (*L2Emulation) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *L2Emulation) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 1 // m.Enable - return size -} -func (m *L2Emulation) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeBool(m.Enable) - return buf.Bytes(), nil -} -func (m *L2Emulation) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Enable = buf.DecodeBool() - return nil -} - -// L2EmulationReply defines message 'l2_emulation_reply'. -type L2EmulationReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *L2EmulationReply) Reset() { *m = L2EmulationReply{} } -func (*L2EmulationReply) GetMessageName() string { return "l2_emulation_reply" } -func (*L2EmulationReply) GetCrcString() string { return "e8d4e804" } -func (*L2EmulationReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *L2EmulationReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *L2EmulationReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *L2EmulationReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -func init() { file_l2e_binapi_init() } -func file_l2e_binapi_init() { - api.RegisterMessage((*L2Emulation)(nil), "l2_emulation_ae6cfcfb") - api.RegisterMessage((*L2EmulationReply)(nil), "l2_emulation_reply_e8d4e804") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*L2Emulation)(nil), - (*L2EmulationReply)(nil), - } -} diff --git a/binapi/l2e/l2e_rest.ba.go b/binapi/l2e/l2e_rest.ba.go deleted file mode 100644 index 23bc249..0000000 --- a/binapi/l2e/l2e_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2e - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l2_emulation", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2Emulation) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2Emulation(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/l2tp/l2tp.ba.go b/binapi/l2tp/l2tp.ba.go index 6737baa..15cbe43 100644 --- a/binapi/l2tp/l2tp.ba.go +++ b/binapi/l2tp/l2tp.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/l2tp.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/l2tp.api.json // Package l2tp contains generated bindings for API file l2tp.api. // @@ -13,12 +13,13 @@ package l2tp import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "l2tp" APIVersion = "2.0.0" - VersionCrc = 0xb018cef7 + VersionCrc = 0x256cef81 ) // L2tLookupKey defines enum 'l2t_lookup_key'. @@ -77,7 +78,7 @@ type L2tpv3CreateTunnel struct { func (m *L2tpv3CreateTunnel) Reset() { *m = L2tpv3CreateTunnel{} } func (*L2tpv3CreateTunnel) GetMessageName() string { return "l2tpv3_create_tunnel" } -func (*L2tpv3CreateTunnel) GetCrcString() string { return "596892cb" } +func (*L2tpv3CreateTunnel) GetCrcString() string { return "15bed0c2" } func (*L2tpv3CreateTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -396,7 +397,7 @@ type SwIfL2tpv3TunnelDetails struct { func (m *SwIfL2tpv3TunnelDetails) Reset() { *m = SwIfL2tpv3TunnelDetails{} } func (*SwIfL2tpv3TunnelDetails) GetMessageName() string { return "sw_if_l2tpv3_tunnel_details" } -func (*SwIfL2tpv3TunnelDetails) GetCrcString() string { return "1dab5c7e" } +func (*SwIfL2tpv3TunnelDetails) GetCrcString() string { return "50b88993" } func (*SwIfL2tpv3TunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -490,7 +491,7 @@ func (m *SwIfL2tpv3TunnelDump) Unmarshal(b []byte) error { func init() { file_l2tp_binapi_init() } func file_l2tp_binapi_init() { - api.RegisterMessage((*L2tpv3CreateTunnel)(nil), "l2tpv3_create_tunnel_596892cb") + api.RegisterMessage((*L2tpv3CreateTunnel)(nil), "l2tpv3_create_tunnel_15bed0c2") api.RegisterMessage((*L2tpv3CreateTunnelReply)(nil), "l2tpv3_create_tunnel_reply_5383d31f") api.RegisterMessage((*L2tpv3InterfaceEnableDisable)(nil), "l2tpv3_interface_enable_disable_3865946c") api.RegisterMessage((*L2tpv3InterfaceEnableDisableReply)(nil), "l2tpv3_interface_enable_disable_reply_e8d4e804") @@ -498,7 +499,7 @@ func file_l2tp_binapi_init() { api.RegisterMessage((*L2tpv3SetLookupKeyReply)(nil), "l2tpv3_set_lookup_key_reply_e8d4e804") api.RegisterMessage((*L2tpv3SetTunnelCookies)(nil), "l2tpv3_set_tunnel_cookies_b3f4faf7") api.RegisterMessage((*L2tpv3SetTunnelCookiesReply)(nil), "l2tpv3_set_tunnel_cookies_reply_e8d4e804") - api.RegisterMessage((*SwIfL2tpv3TunnelDetails)(nil), "sw_if_l2tpv3_tunnel_details_1dab5c7e") + api.RegisterMessage((*SwIfL2tpv3TunnelDetails)(nil), "sw_if_l2tpv3_tunnel_details_50b88993") api.RegisterMessage((*SwIfL2tpv3TunnelDump)(nil), "sw_if_l2tpv3_tunnel_dump_51077d14") } diff --git a/binapi/l2tp/l2tp_rest.ba.go b/binapi/l2tp/l2tp_rest.ba.go deleted file mode 100644 index ac1119f..0000000 --- a/binapi/l2tp/l2tp_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2tp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l2tpv3_create_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3CreateTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2tpv3CreateTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2tpv3_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3InterfaceEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2tpv3InterfaceEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2tpv3_set_lookup_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3SetLookupKey) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2tpv3SetLookupKey(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l2tpv3_set_tunnel_cookies", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3SetTunnelCookies) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L2tpv3SetTunnelCookies(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/l2tp/l2tp_rpc.ba.go b/binapi/l2tp/l2tp_rpc.ba.go index 9fb250a..51815b4 100644 --- a/binapi/l2tp/l2tp_rpc.ba.go +++ b/binapi/l2tp/l2tp_rpc.ba.go @@ -5,12 +5,13 @@ package l2tp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service l2tp. +// RPCService defines RPC service l2tp. type RPCService interface { L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3CreateTunnel) (*L2tpv3CreateTunnelReply, error) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) @@ -33,7 +34,7 @@ func (c *serviceClient) L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3Create if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) { @@ -42,7 +43,7 @@ func (c *serviceClient) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLookupKey) (*L2tpv3SetLookupKeyReply, error) { @@ -51,7 +52,7 @@ func (c *serviceClient) L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLoo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3SetTunnelCookies) (*L2tpv3SetTunnelCookiesReply, error) { @@ -60,7 +61,7 @@ func (c *serviceClient) L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3Se if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwIfL2tpv3TunnelDump(ctx context.Context, in *SwIfL2tpv3TunnelDump) (RPCService_SwIfL2tpv3TunnelDumpClient, error) { @@ -72,7 +73,7 @@ func (c *serviceClient) SwIfL2tpv3TunnelDump(ctx context.Context, in *SwIfL2tpv3 if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -95,7 +96,11 @@ func (c *serviceClient_SwIfL2tpv3TunnelDumpClient) Recv() (*SwIfL2tpv3TunnelDeta switch m := msg.(type) { case *SwIfL2tpv3TunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/l3xc/l3xc.ba.go b/binapi/l3xc/l3xc.ba.go index 3dbcfba..77c323b 100644 --- a/binapi/l3xc/l3xc.ba.go +++ b/binapi/l3xc/l3xc.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/l3xc.api.json // Package l3xc contains generated bindings for API file l3xc.api. @@ -13,11 +13,11 @@ package l3xc import ( - api "git.fd.io/govpp.git/api" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - _ "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + fib_types "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "l3xc" APIVersion = "1.0.1" - VersionCrc = 0xaf18effb + VersionCrc = 0x520bfc6e ) // L3xc defines type 'l3xc'. @@ -117,7 +117,7 @@ type L3xcDetails struct { func (m *L3xcDetails) Reset() { *m = L3xcDetails{} } func (*L3xcDetails) GetMessageName() string { return "l3xc_details" } -func (*L3xcDetails) GetCrcString() string { return "d4f69627" } +func (*L3xcDetails) GetCrcString() string { return "bc5bf852" } func (*L3xcDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -326,7 +326,7 @@ type L3xcUpdate struct { func (m *L3xcUpdate) Reset() { *m = L3xcUpdate{} } func (*L3xcUpdate) GetMessageName() string { return "l3xc_update" } -func (*L3xcUpdate) GetCrcString() string { return "0787b1d3" } +func (*L3xcUpdate) GetCrcString() string { return "e96aabdf" } func (*L3xcUpdate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -472,11 +472,11 @@ func init() { file_l3xc_binapi_init() } func file_l3xc_binapi_init() { api.RegisterMessage((*L3xcDel)(nil), "l3xc_del_e7dbef91") api.RegisterMessage((*L3xcDelReply)(nil), "l3xc_del_reply_e8d4e804") - api.RegisterMessage((*L3xcDetails)(nil), "l3xc_details_d4f69627") + api.RegisterMessage((*L3xcDetails)(nil), "l3xc_details_bc5bf852") api.RegisterMessage((*L3xcDump)(nil), "l3xc_dump_f9e6675e") api.RegisterMessage((*L3xcPluginGetVersion)(nil), "l3xc_plugin_get_version_51077d14") api.RegisterMessage((*L3xcPluginGetVersionReply)(nil), "l3xc_plugin_get_version_reply_9b32cf86") - api.RegisterMessage((*L3xcUpdate)(nil), "l3xc_update_0787b1d3") + api.RegisterMessage((*L3xcUpdate)(nil), "l3xc_update_e96aabdf") api.RegisterMessage((*L3xcUpdateReply)(nil), "l3xc_update_reply_1992deab") } diff --git a/binapi/l3xc/l3xc_rest.ba.go b/binapi/l3xc/l3xc_rest.ba.go deleted file mode 100644 index 2b2c9ba..0000000 --- a/binapi/l3xc/l3xc_rest.ba.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l3xc - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l3xc_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L3xcDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l3xc_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcPluginGetVersion) - reply, err := rpc.L3xcPluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/l3xc_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcUpdate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.L3xcUpdate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/l3xc/l3xc_rpc.ba.go b/binapi/l3xc/l3xc_rpc.ba.go index 74940a2..8128e71 100644 --- a/binapi/l3xc/l3xc_rpc.ba.go +++ b/binapi/l3xc/l3xc_rpc.ba.go @@ -5,12 +5,13 @@ package l3xc import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service l3xc. +// RPCService defines RPC service l3xc. type RPCService interface { L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) @@ -32,7 +33,7 @@ func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) { @@ -44,7 +45,7 @@ func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -67,7 +68,11 @@ func (c *serviceClient_L3xcDumpClient) Recv() (*L3xcDetails, error) { switch m := msg.(type) { case *L3xcDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -89,5 +94,5 @@ func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lacp/lacp.ba.go b/binapi/lacp/lacp.ba.go index f1a9457..02e1667 100644 --- a/binapi/lacp/lacp.ba.go +++ b/binapi/lacp/lacp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/lacp.api.json // Package lacp contains generated bindings for API file lacp.api. @@ -12,10 +12,10 @@ package lacp import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "lacp" APIVersion = "2.0.0" - VersionCrc = 0x461bf09e + VersionCrc = 0xe1609dab ) // SwInterfaceLacpDetails defines message 'sw_interface_lacp_details'. @@ -55,7 +55,7 @@ type SwInterfaceLacpDetails struct { func (m *SwInterfaceLacpDetails) Reset() { *m = SwInterfaceLacpDetails{} } func (*SwInterfaceLacpDetails) GetMessageName() string { return "sw_interface_lacp_details" } -func (*SwInterfaceLacpDetails) GetCrcString() string { return "745ae0ba" } +func (*SwInterfaceLacpDetails) GetCrcString() string { return "d9a83d2f" } func (*SwInterfaceLacpDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -164,7 +164,7 @@ func (m *SwInterfaceLacpDump) Unmarshal(b []byte) error { func init() { file_lacp_binapi_init() } func file_lacp_binapi_init() { - api.RegisterMessage((*SwInterfaceLacpDetails)(nil), "sw_interface_lacp_details_745ae0ba") + api.RegisterMessage((*SwInterfaceLacpDetails)(nil), "sw_interface_lacp_details_d9a83d2f") api.RegisterMessage((*SwInterfaceLacpDump)(nil), "sw_interface_lacp_dump_51077d14") } diff --git a/binapi/lacp/lacp_rest.ba.go b/binapi/lacp/lacp_rest.ba.go deleted file mode 100644 index 3512a0d..0000000 --- a/binapi/lacp/lacp_rest.ba.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lacp - -import ( - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lacp/lacp_rpc.ba.go b/binapi/lacp/lacp_rpc.ba.go index 00a00b5..41296ab 100644 --- a/binapi/lacp/lacp_rpc.ba.go +++ b/binapi/lacp/lacp_rpc.ba.go @@ -5,12 +5,13 @@ package lacp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service lacp. +// RPCService defines RPC service lacp. type RPCService interface { SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error) } @@ -32,7 +33,7 @@ func (c *serviceClient) SwInterfaceLacpDump(ctx context.Context, in *SwInterface if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -55,7 +56,11 @@ func (c *serviceClient_SwInterfaceLacpDumpClient) Recv() (*SwInterfaceLacpDetail switch m := msg.(type) { case *SwInterfaceLacpDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/lb/lb.ba.go b/binapi/lb/lb.ba.go index 9fdfc7f..035a9bd 100644 --- a/binapi/lb/lb.ba.go +++ b/binapi/lb/lb.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/lb.api.json // Package lb contains generated bindings for API file lb.api. @@ -12,11 +12,11 @@ package lb import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - lb_types "git.fd.io/govpp.git/binapi/lb_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + lb_types "go.fd.io/govpp/binapi/lb_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "lb" APIVersion = "1.0.0" - VersionCrc = 0x5e4e85b1 + VersionCrc = 0x50c0a6c9 ) // LbAddDelAs defines message 'lb_add_del_as'. @@ -43,7 +43,7 @@ type LbAddDelAs struct { func (m *LbAddDelAs) Reset() { *m = LbAddDelAs{} } func (*LbAddDelAs) GetMessageName() string { return "lb_add_del_as" } -func (*LbAddDelAs) GetCrcString() string { return "78628987" } +func (*LbAddDelAs) GetCrcString() string { return "35d72500" } func (*LbAddDelAs) GetMessageType() api.MessageType { return api.RequestMessage } @@ -282,7 +282,7 @@ type LbAddDelVip struct { func (m *LbAddDelVip) Reset() { *m = LbAddDelVip{} } func (*LbAddDelVip) GetMessageName() string { return "lb_add_del_vip" } -func (*LbAddDelVip) GetCrcString() string { return "d15b7ddc" } +func (*LbAddDelVip) GetCrcString() string { return "6fa569c7" } func (*LbAddDelVip) GetMessageType() api.MessageType { return api.RequestMessage } @@ -384,7 +384,7 @@ type LbAsDetails struct { func (m *LbAsDetails) Reset() { *m = LbAsDetails{} } func (*LbAsDetails) GetMessageName() string { return "lb_as_details" } -func (*LbAsDetails) GetCrcString() string { return "9c39f60e" } +func (*LbAsDetails) GetCrcString() string { return "8d24c29e" } func (*LbAsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -491,7 +491,7 @@ type LbConf struct { func (m *LbConf) Reset() { *m = LbConf{} } func (*LbConf) GetMessageName() string { return "lb_conf" } -func (*LbConf) GetCrcString() string { return "22ddb739" } +func (*LbConf) GetCrcString() string { return "56cd3261" } func (*LbConf) GetMessageType() api.MessageType { return api.RequestMessage } @@ -651,7 +651,7 @@ type LbVipDetails struct { func (m *LbVipDetails) Reset() { *m = LbVipDetails{} } func (*LbVipDetails) GetMessageName() string { return "lb_vip_details" } -func (*LbVipDetails) GetCrcString() string { return "08f39bed" } +func (*LbVipDetails) GetCrcString() string { return "1329ec9b" } func (*LbVipDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -714,7 +714,7 @@ type LbVipDump struct { func (m *LbVipDump) Reset() { *m = LbVipDump{} } func (*LbVipDump) GetMessageName() string { return "lb_vip_dump" } -func (*LbVipDump) GetCrcString() string { return "c7bcb124" } +func (*LbVipDump) GetCrcString() string { return "56110cb7" } func (*LbVipDump) GetMessageType() api.MessageType { return api.RequestMessage } @@ -760,22 +760,22 @@ func (m *LbVipDump) Unmarshal(b []byte) error { func init() { file_lb_binapi_init() } func file_lb_binapi_init() { - api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_78628987") + api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_35d72500") api.RegisterMessage((*LbAddDelAsReply)(nil), "lb_add_del_as_reply_e8d4e804") api.RegisterMessage((*LbAddDelIntfNat4)(nil), "lb_add_del_intf_nat4_47d6e753") api.RegisterMessage((*LbAddDelIntfNat4Reply)(nil), "lb_add_del_intf_nat4_reply_e8d4e804") api.RegisterMessage((*LbAddDelIntfNat6)(nil), "lb_add_del_intf_nat6_47d6e753") api.RegisterMessage((*LbAddDelIntfNat6Reply)(nil), "lb_add_del_intf_nat6_reply_e8d4e804") - api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_d15b7ddc") + api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_6fa569c7") api.RegisterMessage((*LbAddDelVipReply)(nil), "lb_add_del_vip_reply_e8d4e804") - api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_9c39f60e") + api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_8d24c29e") api.RegisterMessage((*LbAsDump)(nil), "lb_as_dump_1063f819") - api.RegisterMessage((*LbConf)(nil), "lb_conf_22ddb739") + api.RegisterMessage((*LbConf)(nil), "lb_conf_56cd3261") api.RegisterMessage((*LbConfReply)(nil), "lb_conf_reply_e8d4e804") api.RegisterMessage((*LbFlushVip)(nil), "lb_flush_vip_1063f819") api.RegisterMessage((*LbFlushVipReply)(nil), "lb_flush_vip_reply_e8d4e804") - api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_08f39bed") - api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_c7bcb124") + api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_1329ec9b") + api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_56110cb7") } // Messages returns list of all messages in this module. diff --git a/binapi/lb/lb_rest.ba.go b/binapi/lb/lb_rest.ba.go deleted file mode 100644 index ea7fad8..0000000 --- a/binapi/lb/lb_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lb - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lb_add_del_as", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelAs) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbAddDelAs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lb_add_del_intf_nat4", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelIntfNat4) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbAddDelIntfNat4(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lb_add_del_intf_nat6", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelIntfNat6) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbAddDelIntfNat6(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lb_add_del_vip", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelVip) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbAddDelVip(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lb_conf", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbConf) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbConf(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lb_flush_vip", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbFlushVip) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LbFlushVip(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lb/lb_rpc.ba.go b/binapi/lb/lb_rpc.ba.go index c28bb47..c520f58 100644 --- a/binapi/lb/lb_rpc.ba.go +++ b/binapi/lb/lb_rpc.ba.go @@ -5,12 +5,13 @@ package lb import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service lb. +// RPCService defines RPC service lb. type RPCService interface { LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) @@ -36,7 +37,7 @@ func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) { @@ -45,7 +46,7 @@ func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) { @@ -54,7 +55,7 @@ func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) { @@ -63,7 +64,7 @@ func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) { @@ -75,7 +76,7 @@ func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -98,7 +99,11 @@ func (c *serviceClient_LbAsDumpClient) Recv() (*LbAsDetails, error) { switch m := msg.(type) { case *LbAsDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -111,7 +116,7 @@ func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, e if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) { @@ -120,7 +125,7 @@ func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlus if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) { @@ -132,7 +137,7 @@ func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCServic if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -155,7 +160,11 @@ func (c *serviceClient_LbVipDumpClient) Recv() (*LbVipDetails, error) { switch m := msg.(type) { case *LbVipDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/lb_types/lb_types.ba.go b/binapi/lb_types/lb_types.ba.go index 209b07e..e8e8c8a 100644 --- a/binapi/lb_types/lb_types.ba.go +++ b/binapi/lb_types/lb_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/lb_types.api.json // Package lb_types contains generated bindings for API file lb_types.api. @@ -13,9 +13,10 @@ package lb_types import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" "strconv" + + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -24,6 +25,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "lb_types" + APIVersion = "1.0.0" + VersionCrc = 0xba19340c +) + // LbEncapType defines enum 'lb_encap_type'. type LbEncapType uint32 diff --git a/binapi/lcp/lcp.ba.go b/binapi/lcp/lcp.ba.go new file mode 100644 index 0000000..2d90af0 --- /dev/null +++ b/binapi/lcp/lcp.ba.go @@ -0,0 +1,639 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/lcp.api.json + +// Package lcp contains generated bindings for API file lcp.api. +// +// Contents: +// 1 enum +// 15 messages +// +package lcp + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lcp" + APIVersion = "1.0.0" + VersionCrc = 0xd6fdb642 +) + +// LcpItfHostType defines enum 'lcp_itf_host_type'. +type LcpItfHostType uint8 + +const ( + LCP_API_ITF_HOST_TAP LcpItfHostType = 0 + LCP_API_ITF_HOST_TUN LcpItfHostType = 1 +) + +var ( + LcpItfHostType_name = map[uint8]string{ + 0: "LCP_API_ITF_HOST_TAP", + 1: "LCP_API_ITF_HOST_TUN", + } + LcpItfHostType_value = map[string]uint8{ + "LCP_API_ITF_HOST_TAP": 0, + "LCP_API_ITF_HOST_TUN": 1, + } +) + +func (x LcpItfHostType) String() string { + s, ok := LcpItfHostType_name[uint8(x)] + if ok { + return s + } + return "LcpItfHostType(" + strconv.Itoa(int(x)) + ")" +} + +// LcpDefaultNsGet defines message 'lcp_default_ns_get'. +type LcpDefaultNsGet struct{} + +func (m *LcpDefaultNsGet) Reset() { *m = LcpDefaultNsGet{} } +func (*LcpDefaultNsGet) GetMessageName() string { return "lcp_default_ns_get" } +func (*LcpDefaultNsGet) GetCrcString() string { return "51077d14" } +func (*LcpDefaultNsGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpDefaultNsGet) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *LcpDefaultNsGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *LcpDefaultNsGet) Unmarshal(b []byte) error { + return nil +} + +// LcpDefaultNsGetReply defines message 'lcp_default_ns_get_reply'. +type LcpDefaultNsGetReply struct { + Namespace string `binapi:"string[32],name=namespace" json:"namespace,omitempty"` +} + +func (m *LcpDefaultNsGetReply) Reset() { *m = LcpDefaultNsGetReply{} } +func (*LcpDefaultNsGetReply) GetMessageName() string { return "lcp_default_ns_get_reply" } +func (*LcpDefaultNsGetReply) GetCrcString() string { return "eaeef6d3" } +func (*LcpDefaultNsGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpDefaultNsGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 32 // m.Namespace + return size +} +func (m *LcpDefaultNsGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Namespace, 32) + return buf.Bytes(), nil +} +func (m *LcpDefaultNsGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Namespace = buf.DecodeString(32) + return nil +} + +// LcpDefaultNsSet defines message 'lcp_default_ns_set'. +type LcpDefaultNsSet struct { + Namespace string `binapi:"string[32],name=namespace" json:"namespace,omitempty"` +} + +func (m *LcpDefaultNsSet) Reset() { *m = LcpDefaultNsSet{} } +func (*LcpDefaultNsSet) GetMessageName() string { return "lcp_default_ns_set" } +func (*LcpDefaultNsSet) GetCrcString() string { return "b561a74a" } +func (*LcpDefaultNsSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpDefaultNsSet) Size() (size int) { + if m == nil { + return 0 + } + size += 32 // m.Namespace + return size +} +func (m *LcpDefaultNsSet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Namespace, 32) + return buf.Bytes(), nil +} +func (m *LcpDefaultNsSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Namespace = buf.DecodeString(32) + return nil +} + +// LcpDefaultNsSetReply defines message 'lcp_default_ns_set_reply'. +type LcpDefaultNsSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LcpDefaultNsSetReply) Reset() { *m = LcpDefaultNsSetReply{} } +func (*LcpDefaultNsSetReply) GetMessageName() string { return "lcp_default_ns_set_reply" } +func (*LcpDefaultNsSetReply) GetCrcString() string { return "e8d4e804" } +func (*LcpDefaultNsSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpDefaultNsSetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *LcpDefaultNsSetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *LcpDefaultNsSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// LcpItfPairAddDel defines message 'lcp_itf_pair_add_del'. +type LcpItfPairAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[16],name=host_if_name" json:"host_if_name,omitempty"` + HostIfType LcpItfHostType `binapi:"lcp_itf_host_type,name=host_if_type" json:"host_if_type,omitempty"` + Namespace string `binapi:"string[32],name=namespace" json:"namespace,omitempty"` +} + +func (m *LcpItfPairAddDel) Reset() { *m = LcpItfPairAddDel{} } +func (*LcpItfPairAddDel) GetMessageName() string { return "lcp_itf_pair_add_del" } +func (*LcpItfPairAddDel) GetCrcString() string { return "f3157f59" } +func (*LcpItfPairAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpItfPairAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 16 // m.HostIfName + size += 1 // m.HostIfType + size += 32 // m.Namespace + return size +} +func (m *LcpItfPairAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.HostIfName, 16) + buf.EncodeUint8(uint8(m.HostIfType)) + buf.EncodeString(m.Namespace, 32) + return buf.Bytes(), nil +} +func (m *LcpItfPairAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.HostIfName = buf.DecodeString(16) + m.HostIfType = LcpItfHostType(buf.DecodeUint8()) + m.Namespace = buf.DecodeString(32) + return nil +} + +// LcpItfPairAddDelReply defines message 'lcp_itf_pair_add_del_reply'. +type LcpItfPairAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LcpItfPairAddDelReply) Reset() { *m = LcpItfPairAddDelReply{} } +func (*LcpItfPairAddDelReply) GetMessageName() string { return "lcp_itf_pair_add_del_reply" } +func (*LcpItfPairAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*LcpItfPairAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *LcpItfPairAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *LcpItfPairAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// LcpItfPairAddDelV2 defines message 'lcp_itf_pair_add_del_v2'. +type LcpItfPairAddDelV2 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[16],name=host_if_name" json:"host_if_name,omitempty"` + HostIfType LcpItfHostType `binapi:"lcp_itf_host_type,name=host_if_type" json:"host_if_type,omitempty"` + Namespace string `binapi:"string[32],name=namespace" json:"namespace,omitempty"` +} + +func (m *LcpItfPairAddDelV2) Reset() { *m = LcpItfPairAddDelV2{} } +func (*LcpItfPairAddDelV2) GetMessageName() string { return "lcp_itf_pair_add_del_v2" } +func (*LcpItfPairAddDelV2) GetCrcString() string { return "f3157f59" } +func (*LcpItfPairAddDelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpItfPairAddDelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 16 // m.HostIfName + size += 1 // m.HostIfType + size += 32 // m.Namespace + return size +} +func (m *LcpItfPairAddDelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.HostIfName, 16) + buf.EncodeUint8(uint8(m.HostIfType)) + buf.EncodeString(m.Namespace, 32) + return buf.Bytes(), nil +} +func (m *LcpItfPairAddDelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.HostIfName = buf.DecodeString(16) + m.HostIfType = LcpItfHostType(buf.DecodeUint8()) + m.Namespace = buf.DecodeString(32) + return nil +} + +// LcpItfPairAddDelV2Reply defines message 'lcp_itf_pair_add_del_v2_reply'. +type LcpItfPairAddDelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + HostSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=host_sw_if_index" json:"host_sw_if_index,omitempty"` +} + +func (m *LcpItfPairAddDelV2Reply) Reset() { *m = LcpItfPairAddDelV2Reply{} } +func (*LcpItfPairAddDelV2Reply) GetMessageName() string { return "lcp_itf_pair_add_del_v2_reply" } +func (*LcpItfPairAddDelV2Reply) GetCrcString() string { return "39452f52" } +func (*LcpItfPairAddDelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairAddDelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.HostSwIfIndex + return size +} +func (m *LcpItfPairAddDelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.HostSwIfIndex)) + return buf.Bytes(), nil +} +func (m *LcpItfPairAddDelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.HostSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// LcpItfPairDetails defines message 'lcp_itf_pair_details'. +type LcpItfPairDetails struct { + PhySwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=phy_sw_if_index" json:"phy_sw_if_index,omitempty"` + HostSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=host_sw_if_index" json:"host_sw_if_index,omitempty"` + VifIndex uint32 `binapi:"u32,name=vif_index" json:"vif_index,omitempty"` + HostIfName string `binapi:"string[16],name=host_if_name" json:"host_if_name,omitempty"` + HostIfType LcpItfHostType `binapi:"lcp_itf_host_type,name=host_if_type" json:"host_if_type,omitempty"` + Namespace string `binapi:"string[32],name=namespace" json:"namespace,omitempty"` +} + +func (m *LcpItfPairDetails) Reset() { *m = LcpItfPairDetails{} } +func (*LcpItfPairDetails) GetMessageName() string { return "lcp_itf_pair_details" } +func (*LcpItfPairDetails) GetCrcString() string { return "5a95842f" } +func (*LcpItfPairDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PhySwIfIndex + size += 4 // m.HostSwIfIndex + size += 4 // m.VifIndex + size += 16 // m.HostIfName + size += 1 // m.HostIfType + size += 32 // m.Namespace + return size +} +func (m *LcpItfPairDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.PhySwIfIndex)) + buf.EncodeUint32(uint32(m.HostSwIfIndex)) + buf.EncodeUint32(m.VifIndex) + buf.EncodeString(m.HostIfName, 16) + buf.EncodeUint8(uint8(m.HostIfType)) + buf.EncodeString(m.Namespace, 32) + return buf.Bytes(), nil +} +func (m *LcpItfPairDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PhySwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.HostSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VifIndex = buf.DecodeUint32() + m.HostIfName = buf.DecodeString(16) + m.HostIfType = LcpItfHostType(buf.DecodeUint8()) + m.Namespace = buf.DecodeString(32) + return nil +} + +// LcpItfPairGet defines message 'lcp_itf_pair_get'. +type LcpItfPairGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *LcpItfPairGet) Reset() { *m = LcpItfPairGet{} } +func (*LcpItfPairGet) GetMessageName() string { return "lcp_itf_pair_get" } +func (*LcpItfPairGet) GetCrcString() string { return "f75ba505" } +func (*LcpItfPairGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpItfPairGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *LcpItfPairGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *LcpItfPairGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// LcpItfPairGetReply defines message 'lcp_itf_pair_get_reply'. +type LcpItfPairGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *LcpItfPairGetReply) Reset() { *m = LcpItfPairGetReply{} } +func (*LcpItfPairGetReply) GetMessageName() string { return "lcp_itf_pair_get_reply" } +func (*LcpItfPairGetReply) GetCrcString() string { return "53b48f5d" } +func (*LcpItfPairGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *LcpItfPairGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *LcpItfPairGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +// LcpItfPairReplaceBegin defines message 'lcp_itf_pair_replace_begin'. +type LcpItfPairReplaceBegin struct{} + +func (m *LcpItfPairReplaceBegin) Reset() { *m = LcpItfPairReplaceBegin{} } +func (*LcpItfPairReplaceBegin) GetMessageName() string { return "lcp_itf_pair_replace_begin" } +func (*LcpItfPairReplaceBegin) GetCrcString() string { return "51077d14" } +func (*LcpItfPairReplaceBegin) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpItfPairReplaceBegin) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *LcpItfPairReplaceBegin) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *LcpItfPairReplaceBegin) Unmarshal(b []byte) error { + return nil +} + +// LcpItfPairReplaceBeginReply defines message 'lcp_itf_pair_replace_begin_reply'. +type LcpItfPairReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LcpItfPairReplaceBeginReply) Reset() { *m = LcpItfPairReplaceBeginReply{} } +func (*LcpItfPairReplaceBeginReply) GetMessageName() string { + return "lcp_itf_pair_replace_begin_reply" +} +func (*LcpItfPairReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*LcpItfPairReplaceBeginReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairReplaceBeginReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *LcpItfPairReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *LcpItfPairReplaceBeginReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// LcpItfPairReplaceEnd defines message 'lcp_itf_pair_replace_end'. +type LcpItfPairReplaceEnd struct{} + +func (m *LcpItfPairReplaceEnd) Reset() { *m = LcpItfPairReplaceEnd{} } +func (*LcpItfPairReplaceEnd) GetMessageName() string { return "lcp_itf_pair_replace_end" } +func (*LcpItfPairReplaceEnd) GetCrcString() string { return "51077d14" } +func (*LcpItfPairReplaceEnd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LcpItfPairReplaceEnd) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *LcpItfPairReplaceEnd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *LcpItfPairReplaceEnd) Unmarshal(b []byte) error { + return nil +} + +// LcpItfPairReplaceEndReply defines message 'lcp_itf_pair_replace_end_reply'. +type LcpItfPairReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LcpItfPairReplaceEndReply) Reset() { *m = LcpItfPairReplaceEndReply{} } +func (*LcpItfPairReplaceEndReply) GetMessageName() string { return "lcp_itf_pair_replace_end_reply" } +func (*LcpItfPairReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*LcpItfPairReplaceEndReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LcpItfPairReplaceEndReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *LcpItfPairReplaceEndReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *LcpItfPairReplaceEndReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_lcp_binapi_init() } +func file_lcp_binapi_init() { + api.RegisterMessage((*LcpDefaultNsGet)(nil), "lcp_default_ns_get_51077d14") + api.RegisterMessage((*LcpDefaultNsGetReply)(nil), "lcp_default_ns_get_reply_eaeef6d3") + api.RegisterMessage((*LcpDefaultNsSet)(nil), "lcp_default_ns_set_b561a74a") + api.RegisterMessage((*LcpDefaultNsSetReply)(nil), "lcp_default_ns_set_reply_e8d4e804") + api.RegisterMessage((*LcpItfPairAddDel)(nil), "lcp_itf_pair_add_del_f3157f59") + api.RegisterMessage((*LcpItfPairAddDelReply)(nil), "lcp_itf_pair_add_del_reply_e8d4e804") + api.RegisterMessage((*LcpItfPairAddDelV2)(nil), "lcp_itf_pair_add_del_v2_f3157f59") + api.RegisterMessage((*LcpItfPairAddDelV2Reply)(nil), "lcp_itf_pair_add_del_v2_reply_39452f52") + api.RegisterMessage((*LcpItfPairDetails)(nil), "lcp_itf_pair_details_5a95842f") + api.RegisterMessage((*LcpItfPairGet)(nil), "lcp_itf_pair_get_f75ba505") + api.RegisterMessage((*LcpItfPairGetReply)(nil), "lcp_itf_pair_get_reply_53b48f5d") + api.RegisterMessage((*LcpItfPairReplaceBegin)(nil), "lcp_itf_pair_replace_begin_51077d14") + api.RegisterMessage((*LcpItfPairReplaceBeginReply)(nil), "lcp_itf_pair_replace_begin_reply_e8d4e804") + api.RegisterMessage((*LcpItfPairReplaceEnd)(nil), "lcp_itf_pair_replace_end_51077d14") + api.RegisterMessage((*LcpItfPairReplaceEndReply)(nil), "lcp_itf_pair_replace_end_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*LcpDefaultNsGet)(nil), + (*LcpDefaultNsGetReply)(nil), + (*LcpDefaultNsSet)(nil), + (*LcpDefaultNsSetReply)(nil), + (*LcpItfPairAddDel)(nil), + (*LcpItfPairAddDelReply)(nil), + (*LcpItfPairAddDelV2)(nil), + (*LcpItfPairAddDelV2Reply)(nil), + (*LcpItfPairDetails)(nil), + (*LcpItfPairGet)(nil), + (*LcpItfPairGetReply)(nil), + (*LcpItfPairReplaceBegin)(nil), + (*LcpItfPairReplaceBeginReply)(nil), + (*LcpItfPairReplaceEnd)(nil), + (*LcpItfPairReplaceEndReply)(nil), + } +} diff --git a/binapi/lcp/lcp_rpc.ba.go b/binapi/lcp/lcp_rpc.ba.go new file mode 100644 index 0000000..1010d03 --- /dev/null +++ b/binapi/lcp/lcp_rpc.ba.go @@ -0,0 +1,124 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lcp + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service lcp. +type RPCService interface { + LcpDefaultNsGet(ctx context.Context, in *LcpDefaultNsGet) (*LcpDefaultNsGetReply, error) + LcpDefaultNsSet(ctx context.Context, in *LcpDefaultNsSet) (*LcpDefaultNsSetReply, error) + LcpItfPairAddDel(ctx context.Context, in *LcpItfPairAddDel) (*LcpItfPairAddDelReply, error) + LcpItfPairAddDelV2(ctx context.Context, in *LcpItfPairAddDelV2) (*LcpItfPairAddDelV2Reply, error) + LcpItfPairGet(ctx context.Context, in *LcpItfPairGet) (RPCService_LcpItfPairGetClient, error) + LcpItfPairReplaceBegin(ctx context.Context, in *LcpItfPairReplaceBegin) (*LcpItfPairReplaceBeginReply, error) + LcpItfPairReplaceEnd(ctx context.Context, in *LcpItfPairReplaceEnd) (*LcpItfPairReplaceEndReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) LcpDefaultNsGet(ctx context.Context, in *LcpDefaultNsGet) (*LcpDefaultNsGetReply, error) { + out := new(LcpDefaultNsGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LcpDefaultNsSet(ctx context.Context, in *LcpDefaultNsSet) (*LcpDefaultNsSetReply, error) { + out := new(LcpDefaultNsSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) LcpItfPairAddDel(ctx context.Context, in *LcpItfPairAddDel) (*LcpItfPairAddDelReply, error) { + out := new(LcpItfPairAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) LcpItfPairAddDelV2(ctx context.Context, in *LcpItfPairAddDelV2) (*LcpItfPairAddDelV2Reply, error) { + out := new(LcpItfPairAddDelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) LcpItfPairGet(ctx context.Context, in *LcpItfPairGet) (RPCService_LcpItfPairGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LcpItfPairGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LcpItfPairGetClient interface { + Recv() (*LcpItfPairDetails, error) + api.Stream +} + +type serviceClient_LcpItfPairGetClient struct { + api.Stream +} + +func (c *serviceClient_LcpItfPairGetClient) Recv() (*LcpItfPairDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LcpItfPairDetails: + return m, nil + case *LcpItfPairGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LcpItfPairReplaceBegin(ctx context.Context, in *LcpItfPairReplaceBegin) (*LcpItfPairReplaceBeginReply, error) { + out := new(LcpItfPairReplaceBeginReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) LcpItfPairReplaceEnd(ctx context.Context, in *LcpItfPairReplaceEnd) (*LcpItfPairReplaceEndReply, error) { + out := new(LcpItfPairReplaceEndReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/lisp/lisp.ba.go b/binapi/lisp/lisp.ba.go index 3358e61..e692816 100644 --- a/binapi/lisp/lisp.ba.go +++ b/binapi/lisp/lisp.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/lisp.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/lisp.api.json // Package lisp contains generated bindings for API file lisp.api. // @@ -14,13 +14,14 @@ package lisp import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - lisp_types "git.fd.io/govpp.git/binapi/lisp_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + lisp_types "go.fd.io/govpp/binapi/lisp_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -32,7 +33,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "lisp" APIVersion = "2.0.0" - VersionCrc = 0xf2d169ad + VersionCrc = 0xcb04530f ) // LispLocatorSetFilter defines enum 'lisp_locator_set_filter'. @@ -81,7 +82,7 @@ type LispAddDelAdjacency struct { func (m *LispAddDelAdjacency) Reset() { *m = LispAddDelAdjacency{} } func (*LispAddDelAdjacency) GetMessageName() string { return "lisp_add_del_adjacency" } -func (*LispAddDelAdjacency) GetCrcString() string { return "cf5edb61" } +func (*LispAddDelAdjacency) GetCrcString() string { return "2ce0e6f6" } func (*LispAddDelAdjacency) GetMessageType() api.MessageType { return api.RequestMessage } @@ -90,12 +91,12 @@ func (m *LispAddDelAdjacency) Size() (size int) { if m == nil { return 0 } - size += 1 // m.IsAdd - size += 4 // m.Vni - size += 1 // m.Reid.Type - size += 1 * 6 // m.Reid.Address - size += 1 // m.Leid.Type - size += 1 * 6 // m.Leid.Address + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 1 // m.Reid.Type + size += 1 * 18 // m.Reid.Address + size += 1 // m.Leid.Type + size += 1 * 18 // m.Leid.Address return size } func (m *LispAddDelAdjacency) Marshal(b []byte) ([]byte, error) { @@ -106,9 +107,9 @@ func (m *LispAddDelAdjacency) Marshal(b []byte) ([]byte, error) { buf.EncodeBool(m.IsAdd) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Reid.Type)) - buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Leid.Type)) - buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 18) return buf.Bytes(), nil } func (m *LispAddDelAdjacency) Unmarshal(b []byte) error { @@ -116,9 +117,9 @@ func (m *LispAddDelAdjacency) Unmarshal(b []byte) error { m.IsAdd = buf.DecodeBool() m.Vni = buf.DecodeUint32() m.Reid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Leid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) return nil } @@ -166,7 +167,7 @@ type LispAddDelLocalEid struct { func (m *LispAddDelLocalEid) Reset() { *m = LispAddDelLocalEid{} } func (*LispAddDelLocalEid) GetMessageName() string { return "lisp_add_del_local_eid" } -func (*LispAddDelLocalEid) GetCrcString() string { return "21f573bd" } +func (*LispAddDelLocalEid) GetCrcString() string { return "4e5a83a2" } func (*LispAddDelLocalEid) GetMessageType() api.MessageType { return api.RequestMessage } @@ -177,7 +178,7 @@ func (m *LispAddDelLocalEid) Size() (size int) { } size += 1 // m.IsAdd size += 1 // m.Eid.Type - size += 1 * 6 // m.Eid.Address + size += 1 * 18 // m.Eid.Address size += 64 // m.LocatorSetName size += 4 // m.Vni size += 1 // m.Key.ID @@ -191,7 +192,7 @@ func (m *LispAddDelLocalEid) Marshal(b []byte) ([]byte, error) { buf := codec.NewBuffer(b) buf.EncodeBool(m.IsAdd) buf.EncodeUint8(uint8(m.Eid.Type)) - buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 18) buf.EncodeString(m.LocatorSetName, 64) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Key.ID)) @@ -202,7 +203,7 @@ func (m *LispAddDelLocalEid) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.LocatorSetName = buf.DecodeString(64) m.Vni = buf.DecodeUint32() m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) @@ -512,7 +513,7 @@ type LispAddDelMapResolver struct { func (m *LispAddDelMapResolver) Reset() { *m = LispAddDelMapResolver{} } func (*LispAddDelMapResolver) GetMessageName() string { return "lisp_add_del_map_resolver" } -func (*LispAddDelMapResolver) GetCrcString() string { return "6598ea7c" } +func (*LispAddDelMapResolver) GetCrcString() string { return "ce19e32d" } func (*LispAddDelMapResolver) GetMessageType() api.MessageType { return api.RequestMessage } @@ -585,7 +586,7 @@ type LispAddDelMapServer struct { func (m *LispAddDelMapServer) Reset() { *m = LispAddDelMapServer{} } func (*LispAddDelMapServer) GetMessageName() string { return "lisp_add_del_map_server" } -func (*LispAddDelMapServer) GetCrcString() string { return "6598ea7c" } +func (*LispAddDelMapServer) GetCrcString() string { return "ce19e32d" } func (*LispAddDelMapServer) GetMessageType() api.MessageType { return api.RequestMessage } @@ -665,7 +666,7 @@ type LispAddDelRemoteMapping struct { func (m *LispAddDelRemoteMapping) Reset() { *m = LispAddDelRemoteMapping{} } func (*LispAddDelRemoteMapping) GetMessageName() string { return "lisp_add_del_remote_mapping" } -func (*LispAddDelRemoteMapping) GetCrcString() string { return "fae8ed77" } +func (*LispAddDelRemoteMapping) GetCrcString() string { return "6d5c789e" } func (*LispAddDelRemoteMapping) GetMessageType() api.MessageType { return api.RequestMessage } @@ -674,16 +675,16 @@ func (m *LispAddDelRemoteMapping) Size() (size int) { if m == nil { return 0 } - size += 1 // m.IsAdd - size += 1 // m.IsSrcDst - size += 1 // m.DelAll - size += 4 // m.Vni - size += 1 // m.Action - size += 1 // m.Deid.Type - size += 1 * 6 // m.Deid.Address - size += 1 // m.Seid.Type - size += 1 * 6 // m.Seid.Address - size += 4 // m.RlocNum + size += 1 // m.IsAdd + size += 1 // m.IsSrcDst + size += 1 // m.DelAll + size += 4 // m.Vni + size += 1 // m.Action + size += 1 // m.Deid.Type + size += 1 * 18 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 18 // m.Seid.Address + size += 4 // m.RlocNum for j1 := 0; j1 < len(m.Rlocs); j1++ { var s1 lisp_types.RemoteLocator _ = s1 @@ -708,9 +709,9 @@ func (m *LispAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) { buf.EncodeUint32(m.Vni) buf.EncodeUint8(m.Action) buf.EncodeUint8(uint8(m.Deid.Type)) - buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Seid.Type)) - buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(uint32(len(m.Rlocs))) for j0 := 0; j0 < len(m.Rlocs); j0++ { var v0 lisp_types.RemoteLocator // Rlocs @@ -732,9 +733,9 @@ func (m *LispAddDelRemoteMapping) Unmarshal(b []byte) error { m.Vni = buf.DecodeUint32() m.Action = buf.DecodeUint8() m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.RlocNum = buf.DecodeUint32() m.Rlocs = make([]lisp_types.RemoteLocator, m.RlocNum) for j0 := 0; j0 < len(m.Rlocs); j0++ { @@ -823,7 +824,7 @@ type LispAdjacenciesGetReply struct { func (m *LispAdjacenciesGetReply) Reset() { *m = LispAdjacenciesGetReply{} } func (*LispAdjacenciesGetReply) GetMessageName() string { return "lisp_adjacencies_get_reply" } -func (*LispAdjacenciesGetReply) GetCrcString() string { return "3f97bcdd" } +func (*LispAdjacenciesGetReply) GetCrcString() string { return "807257bf" } func (*LispAdjacenciesGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -840,10 +841,10 @@ func (m *LispAdjacenciesGetReply) Size() (size int) { if j1 < len(m.Adjacencies) { s1 = m.Adjacencies[j1] } - size += 1 // s1.Reid.Type - size += 1 * 6 // s1.Reid.Address - size += 1 // s1.Leid.Type - size += 1 * 6 // s1.Leid.Address + size += 1 // s1.Reid.Type + size += 1 * 18 // s1.Reid.Address + size += 1 // s1.Leid.Type + size += 1 * 18 // s1.Leid.Address } return size } @@ -860,9 +861,9 @@ func (m *LispAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) { v0 = m.Adjacencies[j0] } buf.EncodeUint8(uint8(v0.Reid.Type)) - buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(v0.Leid.Type)) - buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 18) } return buf.Bytes(), nil } @@ -873,9 +874,9 @@ func (m *LispAdjacenciesGetReply) Unmarshal(b []byte) error { m.Adjacencies = make([]LispAdjacency, m.Count) for j0 := 0; j0 < len(m.Adjacencies); j0++ { m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Adjacencies[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) } return nil } @@ -974,7 +975,7 @@ type LispEidTableDetails struct { func (m *LispEidTableDetails) Reset() { *m = LispEidTableDetails{} } func (*LispEidTableDetails) GetMessageName() string { return "lisp_eid_table_details" } -func (*LispEidTableDetails) GetCrcString() string { return "4bc32e3a" } +func (*LispEidTableDetails) GetCrcString() string { return "1c29f792" } func (*LispEidTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -989,9 +990,9 @@ func (m *LispEidTableDetails) Size() (size int) { size += 1 // m.IsSrcDst size += 4 // m.Vni size += 1 // m.Deid.Type - size += 1 * 6 // m.Deid.Address + size += 1 * 18 // m.Deid.Address size += 1 // m.Seid.Type - size += 1 * 6 // m.Seid.Address + size += 1 * 18 // m.Seid.Address size += 4 // m.TTL size += 1 // m.Authoritative size += 1 // m.Key.ID @@ -1009,9 +1010,9 @@ func (m *LispEidTableDetails) Marshal(b []byte) ([]byte, error) { buf.EncodeBool(m.IsSrcDst) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Deid.Type)) - buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Seid.Type)) - buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(m.TTL) buf.EncodeUint8(m.Authoritative) buf.EncodeUint8(uint8(m.Key.ID)) @@ -1026,9 +1027,9 @@ func (m *LispEidTableDetails) Unmarshal(b []byte) error { m.IsSrcDst = buf.DecodeBool() m.Vni = buf.DecodeUint32() m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.TTL = buf.DecodeUint32() m.Authoritative = buf.DecodeUint8() m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) @@ -1048,7 +1049,7 @@ type LispEidTableDump struct { func (m *LispEidTableDump) Reset() { *m = LispEidTableDump{} } func (*LispEidTableDump) GetMessageName() string { return "lisp_eid_table_dump" } -func (*LispEidTableDump) GetCrcString() string { return "b959b73b" } +func (*LispEidTableDump) GetCrcString() string { return "629468b5" } func (*LispEidTableDump) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1057,12 +1058,12 @@ func (m *LispEidTableDump) Size() (size int) { if m == nil { return 0 } - size += 1 // m.EidSet - size += 1 // m.PrefixLength - size += 4 // m.Vni - size += 1 // m.Eid.Type - size += 1 * 6 // m.Eid.Address - size += 1 // m.Filter + size += 1 // m.EidSet + size += 1 // m.PrefixLength + size += 4 // m.Vni + size += 1 // m.Eid.Type + size += 1 * 18 // m.Eid.Address + size += 1 // m.Filter return size } func (m *LispEidTableDump) Marshal(b []byte) ([]byte, error) { @@ -1074,7 +1075,7 @@ func (m *LispEidTableDump) Marshal(b []byte) ([]byte, error) { buf.EncodeUint8(m.PrefixLength) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Eid.Type)) - buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Filter)) return buf.Bytes(), nil } @@ -1084,7 +1085,7 @@ func (m *LispEidTableDump) Unmarshal(b []byte) error { m.PrefixLength = buf.DecodeUint8() m.Vni = buf.DecodeUint32() m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Filter = LispLocatorSetFilter(buf.DecodeUint8()) return nil } @@ -1362,7 +1363,7 @@ type LispLocatorDetails struct { func (m *LispLocatorDetails) Reset() { *m = LispLocatorDetails{} } func (*LispLocatorDetails) GetMessageName() string { return "lisp_locator_details" } -func (*LispLocatorDetails) GetCrcString() string { return "c0c4c2a7" } +func (*LispLocatorDetails) GetCrcString() string { return "2c620ffe" } func (*LispLocatorDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1657,7 +1658,7 @@ type LispMapResolverDetails struct { func (m *LispMapResolverDetails) Reset() { *m = LispMapResolverDetails{} } func (*LispMapResolverDetails) GetMessageName() string { return "lisp_map_resolver_details" } -func (*LispMapResolverDetails) GetCrcString() string { return "82a09deb" } +func (*LispMapResolverDetails) GetCrcString() string { return "3e78fc57" } func (*LispMapResolverDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1720,7 +1721,7 @@ type LispMapServerDetails struct { func (m *LispMapServerDetails) Reset() { *m = LispMapServerDetails{} } func (*LispMapServerDetails) GetMessageName() string { return "lisp_map_server_details" } -func (*LispMapServerDetails) GetCrcString() string { return "82a09deb" } +func (*LispMapServerDetails) GetCrcString() string { return "3e78fc57" } func (*LispMapServerDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1922,7 +1923,7 @@ type LispUsePetr struct { func (m *LispUsePetr) Reset() { *m = LispUsePetr{} } func (*LispUsePetr) GetMessageName() string { return "lisp_use_petr" } -func (*LispUsePetr) GetCrcString() string { return "9e141831" } +func (*LispUsePetr) GetCrcString() string { return "d87dbad9" } func (*LispUsePetr) GetMessageType() api.MessageType { return api.RequestMessage } @@ -2017,7 +2018,7 @@ func (m *ShowLispMapRegisterState) Unmarshal(b []byte) error { // ShowLispMapRegisterStateReply defines message 'show_lisp_map_register_state_reply'. type ShowLispMapRegisterStateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled" json:"is_enabled,omitempty"` } func (m *ShowLispMapRegisterStateReply) Reset() { *m = ShowLispMapRegisterStateReply{} } @@ -2217,7 +2218,7 @@ func (m *ShowLispRlocProbeState) Unmarshal(b []byte) error { // ShowLispRlocProbeStateReply defines message 'show_lisp_rloc_probe_state_reply'. type ShowLispRlocProbeStateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled" json:"is_enabled,omitempty"` } func (m *ShowLispRlocProbeStateReply) Reset() { *m = ShowLispRlocProbeStateReply{} } @@ -2351,13 +2352,13 @@ func (m *ShowLispUsePetr) Unmarshal(b []byte) error { // ShowLispUsePetrReply defines message 'show_lisp_use_petr_reply'. type ShowLispUsePetrReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - IsPetrEnable bool `binapi:"bool,name=is_petr_enable,default=true" json:"is_petr_enable,omitempty"` + IsPetrEnable bool `binapi:"bool,name=is_petr_enable" json:"is_petr_enable,omitempty"` IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` } func (m *ShowLispUsePetrReply) Reset() { *m = ShowLispUsePetrReply{} } func (*ShowLispUsePetrReply) GetMessageName() string { return "show_lisp_use_petr_reply" } -func (*ShowLispUsePetrReply) GetCrcString() string { return "dcad8a81" } +func (*ShowLispUsePetrReply) GetCrcString() string { return "22b9a4b0" } func (*ShowLispUsePetrReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2394,9 +2395,9 @@ func (m *ShowLispUsePetrReply) Unmarshal(b []byte) error { func init() { file_lisp_binapi_init() } func file_lisp_binapi_init() { - api.RegisterMessage((*LispAddDelAdjacency)(nil), "lisp_add_del_adjacency_cf5edb61") + api.RegisterMessage((*LispAddDelAdjacency)(nil), "lisp_add_del_adjacency_2ce0e6f6") api.RegisterMessage((*LispAddDelAdjacencyReply)(nil), "lisp_add_del_adjacency_reply_e8d4e804") - api.RegisterMessage((*LispAddDelLocalEid)(nil), "lisp_add_del_local_eid_21f573bd") + api.RegisterMessage((*LispAddDelLocalEid)(nil), "lisp_add_del_local_eid_4e5a83a2") api.RegisterMessage((*LispAddDelLocalEidReply)(nil), "lisp_add_del_local_eid_reply_e8d4e804") api.RegisterMessage((*LispAddDelLocator)(nil), "lisp_add_del_locator_af4d8f13") api.RegisterMessage((*LispAddDelLocatorReply)(nil), "lisp_add_del_locator_reply_e8d4e804") @@ -2404,18 +2405,18 @@ func file_lisp_binapi_init() { api.RegisterMessage((*LispAddDelLocatorSetReply)(nil), "lisp_add_del_locator_set_reply_b6666db4") api.RegisterMessage((*LispAddDelMapRequestItrRlocs)(nil), "lisp_add_del_map_request_itr_rlocs_6be88e45") api.RegisterMessage((*LispAddDelMapRequestItrRlocsReply)(nil), "lisp_add_del_map_request_itr_rlocs_reply_e8d4e804") - api.RegisterMessage((*LispAddDelMapResolver)(nil), "lisp_add_del_map_resolver_6598ea7c") + api.RegisterMessage((*LispAddDelMapResolver)(nil), "lisp_add_del_map_resolver_ce19e32d") api.RegisterMessage((*LispAddDelMapResolverReply)(nil), "lisp_add_del_map_resolver_reply_e8d4e804") - api.RegisterMessage((*LispAddDelMapServer)(nil), "lisp_add_del_map_server_6598ea7c") + api.RegisterMessage((*LispAddDelMapServer)(nil), "lisp_add_del_map_server_ce19e32d") api.RegisterMessage((*LispAddDelMapServerReply)(nil), "lisp_add_del_map_server_reply_e8d4e804") - api.RegisterMessage((*LispAddDelRemoteMapping)(nil), "lisp_add_del_remote_mapping_fae8ed77") + api.RegisterMessage((*LispAddDelRemoteMapping)(nil), "lisp_add_del_remote_mapping_6d5c789e") api.RegisterMessage((*LispAddDelRemoteMappingReply)(nil), "lisp_add_del_remote_mapping_reply_e8d4e804") api.RegisterMessage((*LispAdjacenciesGet)(nil), "lisp_adjacencies_get_8d1f2fe9") - api.RegisterMessage((*LispAdjacenciesGetReply)(nil), "lisp_adjacencies_get_reply_3f97bcdd") + api.RegisterMessage((*LispAdjacenciesGetReply)(nil), "lisp_adjacencies_get_reply_807257bf") api.RegisterMessage((*LispEidTableAddDelMap)(nil), "lisp_eid_table_add_del_map_9481416b") api.RegisterMessage((*LispEidTableAddDelMapReply)(nil), "lisp_eid_table_add_del_map_reply_e8d4e804") - api.RegisterMessage((*LispEidTableDetails)(nil), "lisp_eid_table_details_4bc32e3a") - api.RegisterMessage((*LispEidTableDump)(nil), "lisp_eid_table_dump_b959b73b") + api.RegisterMessage((*LispEidTableDetails)(nil), "lisp_eid_table_details_1c29f792") + api.RegisterMessage((*LispEidTableDump)(nil), "lisp_eid_table_dump_629468b5") api.RegisterMessage((*LispEidTableMapDetails)(nil), "lisp_eid_table_map_details_0b6859e2") api.RegisterMessage((*LispEidTableMapDump)(nil), "lisp_eid_table_map_dump_d6cf0c3d") api.RegisterMessage((*LispEidTableVniDetails)(nil), "lisp_eid_table_vni_details_64abc01e") @@ -2424,7 +2425,7 @@ func file_lisp_binapi_init() { api.RegisterMessage((*LispEnableDisableReply)(nil), "lisp_enable_disable_reply_e8d4e804") api.RegisterMessage((*LispGetMapRequestItrRlocs)(nil), "lisp_get_map_request_itr_rlocs_51077d14") api.RegisterMessage((*LispGetMapRequestItrRlocsReply)(nil), "lisp_get_map_request_itr_rlocs_reply_76580f3a") - api.RegisterMessage((*LispLocatorDetails)(nil), "lisp_locator_details_c0c4c2a7") + api.RegisterMessage((*LispLocatorDetails)(nil), "lisp_locator_details_2c620ffe") api.RegisterMessage((*LispLocatorDump)(nil), "lisp_locator_dump_b954fad7") api.RegisterMessage((*LispLocatorSetDetails)(nil), "lisp_locator_set_details_5b33a105") api.RegisterMessage((*LispLocatorSetDump)(nil), "lisp_locator_set_dump_c2cb5922") @@ -2432,15 +2433,15 @@ func file_lisp_binapi_init() { api.RegisterMessage((*LispMapRegisterEnableDisableReply)(nil), "lisp_map_register_enable_disable_reply_e8d4e804") api.RegisterMessage((*LispMapRequestMode)(nil), "lisp_map_request_mode_f43c26ae") api.RegisterMessage((*LispMapRequestModeReply)(nil), "lisp_map_request_mode_reply_e8d4e804") - api.RegisterMessage((*LispMapResolverDetails)(nil), "lisp_map_resolver_details_82a09deb") + api.RegisterMessage((*LispMapResolverDetails)(nil), "lisp_map_resolver_details_3e78fc57") api.RegisterMessage((*LispMapResolverDump)(nil), "lisp_map_resolver_dump_51077d14") - api.RegisterMessage((*LispMapServerDetails)(nil), "lisp_map_server_details_82a09deb") + api.RegisterMessage((*LispMapServerDetails)(nil), "lisp_map_server_details_3e78fc57") api.RegisterMessage((*LispMapServerDump)(nil), "lisp_map_server_dump_51077d14") api.RegisterMessage((*LispPitrSetLocatorSet)(nil), "lisp_pitr_set_locator_set_486e2b76") api.RegisterMessage((*LispPitrSetLocatorSetReply)(nil), "lisp_pitr_set_locator_set_reply_e8d4e804") api.RegisterMessage((*LispRlocProbeEnableDisable)(nil), "lisp_rloc_probe_enable_disable_c264d7bf") api.RegisterMessage((*LispRlocProbeEnableDisableReply)(nil), "lisp_rloc_probe_enable_disable_reply_e8d4e804") - api.RegisterMessage((*LispUsePetr)(nil), "lisp_use_petr_9e141831") + api.RegisterMessage((*LispUsePetr)(nil), "lisp_use_petr_d87dbad9") api.RegisterMessage((*LispUsePetrReply)(nil), "lisp_use_petr_reply_e8d4e804") api.RegisterMessage((*ShowLispMapRegisterState)(nil), "show_lisp_map_register_state_51077d14") api.RegisterMessage((*ShowLispMapRegisterStateReply)(nil), "show_lisp_map_register_state_reply_e33a377b") @@ -2453,7 +2454,7 @@ func file_lisp_binapi_init() { api.RegisterMessage((*ShowLispStatus)(nil), "show_lisp_status_51077d14") api.RegisterMessage((*ShowLispStatusReply)(nil), "show_lisp_status_reply_9e8f10c0") api.RegisterMessage((*ShowLispUsePetr)(nil), "show_lisp_use_petr_51077d14") - api.RegisterMessage((*ShowLispUsePetrReply)(nil), "show_lisp_use_petr_reply_dcad8a81") + api.RegisterMessage((*ShowLispUsePetrReply)(nil), "show_lisp_use_petr_reply_22b9a4b0") } // Messages returns list of all messages in this module. diff --git a/binapi/lisp/lisp_rest.ba.go b/binapi/lisp/lisp_rest.ba.go deleted file mode 100644 index 024d6f5..0000000 --- a/binapi/lisp/lisp_rest.ba.go +++ /dev/null @@ -1,480 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lisp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lisp_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelAdjacency) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelAdjacency(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocalEid) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelLocalEid(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_locator", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocator) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelLocator(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocatorSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelLocatorSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapRequestItrRlocs) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelMapRequestItrRlocs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapResolver) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelMapResolver(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapServer) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelMapServer(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelRemoteMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAddDelRemoteMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAdjacenciesGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispAdjacenciesGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispEidTableAddDelMap) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispEidTableAddDelMap(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispGetMapRequestItrRlocs) - reply, err := rpc.LispGetMapRequestItrRlocs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispMapRegisterEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispMapRegisterEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispMapRequestMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispMapRequestMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispPitrSetLocatorSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispPitrSetLocatorSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispRlocProbeEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispRlocProbeEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispUsePetr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LispUsePetr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_map_register_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispMapRegisterState) - reply, err := rpc.ShowLispMapRegisterState(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispMapRequestMode) - reply, err := rpc.ShowLispMapRequestMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_pitr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispPitr) - reply, err := rpc.ShowLispPitr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispRlocProbeState) - reply, err := rpc.ShowLispRlocProbeState(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_status", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispStatus) - reply, err := rpc.ShowLispStatus(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispUsePetr) - reply, err := rpc.ShowLispUsePetr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lisp/lisp_rpc.ba.go b/binapi/lisp/lisp_rpc.ba.go index 1c82bdf..92a752b 100644 --- a/binapi/lisp/lisp_rpc.ba.go +++ b/binapi/lisp/lisp_rpc.ba.go @@ -5,12 +5,13 @@ package lisp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service lisp. +// RPCService defines RPC service lisp. type RPCService interface { LispAddDelAdjacency(ctx context.Context, in *LispAddDelAdjacency) (*LispAddDelAdjacencyReply, error) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) @@ -58,7 +59,7 @@ func (c *serviceClient) LispAddDelAdjacency(ctx context.Context, in *LispAddDelA if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) { @@ -67,7 +68,7 @@ func (c *serviceClient) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocator(ctx context.Context, in *LispAddDelLocator) (*LispAddDelLocatorReply, error) { @@ -76,7 +77,7 @@ func (c *serviceClient) LispAddDelLocator(ctx context.Context, in *LispAddDelLoc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocatorSet(ctx context.Context, in *LispAddDelLocatorSet) (*LispAddDelLocatorSetReply, error) { @@ -85,7 +86,7 @@ func (c *serviceClient) LispAddDelLocatorSet(ctx context.Context, in *LispAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapRequestItrRlocs(ctx context.Context, in *LispAddDelMapRequestItrRlocs) (*LispAddDelMapRequestItrRlocsReply, error) { @@ -94,7 +95,7 @@ func (c *serviceClient) LispAddDelMapRequestItrRlocs(ctx context.Context, in *Li if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapResolver(ctx context.Context, in *LispAddDelMapResolver) (*LispAddDelMapResolverReply, error) { @@ -103,7 +104,7 @@ func (c *serviceClient) LispAddDelMapResolver(ctx context.Context, in *LispAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapServer(ctx context.Context, in *LispAddDelMapServer) (*LispAddDelMapServerReply, error) { @@ -112,7 +113,7 @@ func (c *serviceClient) LispAddDelMapServer(ctx context.Context, in *LispAddDelM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelRemoteMapping(ctx context.Context, in *LispAddDelRemoteMapping) (*LispAddDelRemoteMappingReply, error) { @@ -121,7 +122,7 @@ func (c *serviceClient) LispAddDelRemoteMapping(ctx context.Context, in *LispAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAdjacenciesGet(ctx context.Context, in *LispAdjacenciesGet) (*LispAdjacenciesGetReply, error) { @@ -130,7 +131,7 @@ func (c *serviceClient) LispAdjacenciesGet(ctx context.Context, in *LispAdjacenc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispEidTableAddDelMap(ctx context.Context, in *LispEidTableAddDelMap) (*LispEidTableAddDelMapReply, error) { @@ -139,7 +140,7 @@ func (c *serviceClient) LispEidTableAddDelMap(ctx context.Context, in *LispEidTa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispEidTableDump(ctx context.Context, in *LispEidTableDump) (RPCService_LispEidTableDumpClient, error) { @@ -151,7 +152,7 @@ func (c *serviceClient) LispEidTableDump(ctx context.Context, in *LispEidTableDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -174,7 +175,11 @@ func (c *serviceClient_LispEidTableDumpClient) Recv() (*LispEidTableDetails, err switch m := msg.(type) { case *LispEidTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -190,7 +195,7 @@ func (c *serviceClient) LispEidTableMapDump(ctx context.Context, in *LispEidTabl if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -213,7 +218,11 @@ func (c *serviceClient_LispEidTableMapDumpClient) Recv() (*LispEidTableMapDetail switch m := msg.(type) { case *LispEidTableMapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -229,7 +238,7 @@ func (c *serviceClient) LispEidTableVniDump(ctx context.Context, in *LispEidTabl if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -252,7 +261,11 @@ func (c *serviceClient_LispEidTableVniDumpClient) Recv() (*LispEidTableVniDetail switch m := msg.(type) { case *LispEidTableVniDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -265,7 +278,7 @@ func (c *serviceClient) LispEnableDisable(ctx context.Context, in *LispEnableDis if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispGetMapRequestItrRlocs(ctx context.Context, in *LispGetMapRequestItrRlocs) (*LispGetMapRequestItrRlocsReply, error) { @@ -274,7 +287,7 @@ func (c *serviceClient) LispGetMapRequestItrRlocs(ctx context.Context, in *LispG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispLocatorDump(ctx context.Context, in *LispLocatorDump) (RPCService_LispLocatorDumpClient, error) { @@ -286,7 +299,7 @@ func (c *serviceClient) LispLocatorDump(ctx context.Context, in *LispLocatorDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -309,7 +322,11 @@ func (c *serviceClient_LispLocatorDumpClient) Recv() (*LispLocatorDetails, error switch m := msg.(type) { case *LispLocatorDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -325,7 +342,7 @@ func (c *serviceClient) LispLocatorSetDump(ctx context.Context, in *LispLocatorS if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -348,7 +365,11 @@ func (c *serviceClient_LispLocatorSetDumpClient) Recv() (*LispLocatorSetDetails, switch m := msg.(type) { case *LispLocatorSetDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -361,7 +382,7 @@ func (c *serviceClient) LispMapRegisterEnableDisable(ctx context.Context, in *Li if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispMapRequestMode(ctx context.Context, in *LispMapRequestMode) (*LispMapRequestModeReply, error) { @@ -370,7 +391,7 @@ func (c *serviceClient) LispMapRequestMode(ctx context.Context, in *LispMapReque if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispMapResolverDump(ctx context.Context, in *LispMapResolverDump) (RPCService_LispMapResolverDumpClient, error) { @@ -382,7 +403,7 @@ func (c *serviceClient) LispMapResolverDump(ctx context.Context, in *LispMapReso if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -405,7 +426,11 @@ func (c *serviceClient_LispMapResolverDumpClient) Recv() (*LispMapResolverDetail switch m := msg.(type) { case *LispMapResolverDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -421,7 +446,7 @@ func (c *serviceClient) LispMapServerDump(ctx context.Context, in *LispMapServer if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -444,7 +469,11 @@ func (c *serviceClient_LispMapServerDumpClient) Recv() (*LispMapServerDetails, e switch m := msg.(type) { case *LispMapServerDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -457,7 +486,7 @@ func (c *serviceClient) LispPitrSetLocatorSet(ctx context.Context, in *LispPitrS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispRlocProbeEnableDisable(ctx context.Context, in *LispRlocProbeEnableDisable) (*LispRlocProbeEnableDisableReply, error) { @@ -466,7 +495,7 @@ func (c *serviceClient) LispRlocProbeEnableDisable(ctx context.Context, in *Lisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispUsePetr(ctx context.Context, in *LispUsePetr) (*LispUsePetrReply, error) { @@ -475,7 +504,7 @@ func (c *serviceClient) LispUsePetr(ctx context.Context, in *LispUsePetr) (*Lisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispMapRegisterState(ctx context.Context, in *ShowLispMapRegisterState) (*ShowLispMapRegisterStateReply, error) { @@ -484,7 +513,7 @@ func (c *serviceClient) ShowLispMapRegisterState(ctx context.Context, in *ShowLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispMapRequestMode(ctx context.Context, in *ShowLispMapRequestMode) (*ShowLispMapRequestModeReply, error) { @@ -493,7 +522,7 @@ func (c *serviceClient) ShowLispMapRequestMode(ctx context.Context, in *ShowLisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*ShowLispPitrReply, error) { @@ -502,7 +531,7 @@ func (c *serviceClient) ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*Sh if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispRlocProbeState(ctx context.Context, in *ShowLispRlocProbeState) (*ShowLispRlocProbeStateReply, error) { @@ -511,7 +540,7 @@ func (c *serviceClient) ShowLispRlocProbeState(ctx context.Context, in *ShowLisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispStatus(ctx context.Context, in *ShowLispStatus) (*ShowLispStatusReply, error) { @@ -520,7 +549,7 @@ func (c *serviceClient) ShowLispStatus(ctx context.Context, in *ShowLispStatus) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr) (*ShowLispUsePetrReply, error) { @@ -529,5 +558,5 @@ func (c *serviceClient) ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lisp_gpe/lisp_gpe.ba.go b/binapi/lisp_gpe/lisp_gpe.ba.go index 4bc7783..8ca0889 100644 --- a/binapi/lisp_gpe/lisp_gpe.ba.go +++ b/binapi/lisp_gpe/lisp_gpe.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/lisp_gpe.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/lisp_gpe.api.json // Package lisp_gpe contains generated bindings for API file lisp_gpe.api. // @@ -13,12 +13,12 @@ package lisp_gpe import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - lisp_types "git.fd.io/govpp.git/binapi/lisp_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + lisp_types "go.fd.io/govpp/binapi/lisp_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +30,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "lisp_gpe" APIVersion = "2.0.0" - VersionCrc = 0x4947ac96 + VersionCrc = 0x92611b0 ) // GpeFwdEntry defines type 'gpe_fwd_entry'. @@ -70,7 +70,7 @@ type GpeAddDelFwdEntry struct { func (m *GpeAddDelFwdEntry) Reset() { *m = GpeAddDelFwdEntry{} } func (*GpeAddDelFwdEntry) GetMessageName() string { return "gpe_add_del_fwd_entry" } -func (*GpeAddDelFwdEntry) GetCrcString() string { return "de6df50f" } +func (*GpeAddDelFwdEntry) GetCrcString() string { return "f0847644" } func (*GpeAddDelFwdEntry) GetMessageType() api.MessageType { return api.RequestMessage } @@ -79,15 +79,15 @@ func (m *GpeAddDelFwdEntry) Size() (size int) { if m == nil { return 0 } - size += 1 // m.IsAdd - size += 1 // m.RmtEid.Type - size += 1 * 6 // m.RmtEid.Address - size += 1 // m.LclEid.Type - size += 1 * 6 // m.LclEid.Address - size += 4 // m.Vni - size += 4 // m.DpTable - size += 1 // m.Action - size += 4 // m.LocNum + size += 1 // m.IsAdd + size += 1 // m.RmtEid.Type + size += 1 * 18 // m.RmtEid.Address + size += 1 // m.LclEid.Type + size += 1 * 18 // m.LclEid.Address + size += 4 // m.Vni + size += 4 // m.DpTable + size += 1 // m.Action + size += 4 // m.LocNum for j1 := 0; j1 < len(m.Locs); j1++ { var s1 GpeLocator _ = s1 @@ -107,9 +107,9 @@ func (m *GpeAddDelFwdEntry) Marshal(b []byte) ([]byte, error) { buf := codec.NewBuffer(b) buf.EncodeBool(m.IsAdd) buf.EncodeUint8(uint8(m.RmtEid.Type)) - buf.EncodeBytes(m.RmtEid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.RmtEid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.LclEid.Type)) - buf.EncodeBytes(m.LclEid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.LclEid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(m.Vni) buf.EncodeUint32(m.DpTable) buf.EncodeUint8(m.Action) @@ -129,9 +129,9 @@ func (m *GpeAddDelFwdEntry) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.RmtEid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.RmtEid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.RmtEid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.LclEid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.LclEid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.LclEid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Vni = buf.DecodeUint32() m.DpTable = buf.DecodeUint32() m.Action = buf.DecodeUint8() @@ -270,7 +270,7 @@ type GpeAddDelNativeFwdRpath struct { func (m *GpeAddDelNativeFwdRpath) Reset() { *m = GpeAddDelNativeFwdRpath{} } func (*GpeAddDelNativeFwdRpath) GetMessageName() string { return "gpe_add_del_native_fwd_rpath" } -func (*GpeAddDelNativeFwdRpath) GetCrcString() string { return "812da2f2" } +func (*GpeAddDelNativeFwdRpath) GetCrcString() string { return "43fc8b54" } func (*GpeAddDelNativeFwdRpath) GetMessageType() api.MessageType { return api.RequestMessage } @@ -451,7 +451,7 @@ type GpeFwdEntriesGetReply struct { func (m *GpeFwdEntriesGetReply) Reset() { *m = GpeFwdEntriesGetReply{} } func (*GpeFwdEntriesGetReply) GetMessageName() string { return "gpe_fwd_entries_get_reply" } -func (*GpeFwdEntriesGetReply) GetCrcString() string { return "f9f53f1b" } +func (*GpeFwdEntriesGetReply) GetCrcString() string { return "c4844876" } func (*GpeFwdEntriesGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -468,14 +468,14 @@ func (m *GpeFwdEntriesGetReply) Size() (size int) { if j1 < len(m.Entries) { s1 = m.Entries[j1] } - size += 4 // s1.FwdEntryIndex - size += 4 // s1.DpTable - size += 1 // s1.Leid.Type - size += 1 * 6 // s1.Leid.Address - size += 1 // s1.Reid.Type - size += 1 * 6 // s1.Reid.Address - size += 4 // s1.Vni - size += 1 // s1.Action + size += 4 // s1.FwdEntryIndex + size += 4 // s1.DpTable + size += 1 // s1.Leid.Type + size += 1 * 18 // s1.Leid.Address + size += 1 // s1.Reid.Type + size += 1 * 18 // s1.Reid.Address + size += 4 // s1.Vni + size += 1 // s1.Action } return size } @@ -494,9 +494,9 @@ func (m *GpeFwdEntriesGetReply) Marshal(b []byte) ([]byte, error) { buf.EncodeUint32(v0.FwdEntryIndex) buf.EncodeUint32(v0.DpTable) buf.EncodeUint8(uint8(v0.Leid.Type)) - buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(v0.Reid.Type)) - buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(v0.Vni) buf.EncodeUint8(v0.Action) } @@ -511,9 +511,9 @@ func (m *GpeFwdEntriesGetReply) Unmarshal(b []byte) error { m.Entries[j0].FwdEntryIndex = buf.DecodeUint32() m.Entries[j0].DpTable = buf.DecodeUint32() m.Entries[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Entries[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Entries[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Entries[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Entries[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Entries[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Entries[j0].Vni = buf.DecodeUint32() m.Entries[j0].Action = buf.DecodeUint8() } @@ -528,7 +528,7 @@ type GpeFwdEntryPathDetails struct { func (m *GpeFwdEntryPathDetails) Reset() { *m = GpeFwdEntryPathDetails{} } func (*GpeFwdEntryPathDetails) GetMessageName() string { return "gpe_fwd_entry_path_details" } -func (*GpeFwdEntryPathDetails) GetCrcString() string { return "ee80b19a" } +func (*GpeFwdEntryPathDetails) GetCrcString() string { return "483df51a" } func (*GpeFwdEntryPathDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -785,7 +785,7 @@ type GpeNativeFwdRpathsGetReply struct { func (m *GpeNativeFwdRpathsGetReply) Reset() { *m = GpeNativeFwdRpathsGetReply{} } func (*GpeNativeFwdRpathsGetReply) GetMessageName() string { return "gpe_native_fwd_rpaths_get_reply" } -func (*GpeNativeFwdRpathsGetReply) GetCrcString() string { return "79d54eb9" } +func (*GpeNativeFwdRpathsGetReply) GetCrcString() string { return "7a1ca5a2" } func (*GpeNativeFwdRpathsGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -910,24 +910,24 @@ func (m *GpeSetEncapModeReply) Unmarshal(b []byte) error { func init() { file_lisp_gpe_binapi_init() } func file_lisp_gpe_binapi_init() { - api.RegisterMessage((*GpeAddDelFwdEntry)(nil), "gpe_add_del_fwd_entry_de6df50f") + api.RegisterMessage((*GpeAddDelFwdEntry)(nil), "gpe_add_del_fwd_entry_f0847644") api.RegisterMessage((*GpeAddDelFwdEntryReply)(nil), "gpe_add_del_fwd_entry_reply_efe5f176") api.RegisterMessage((*GpeAddDelIface)(nil), "gpe_add_del_iface_3ccff273") api.RegisterMessage((*GpeAddDelIfaceReply)(nil), "gpe_add_del_iface_reply_e8d4e804") - api.RegisterMessage((*GpeAddDelNativeFwdRpath)(nil), "gpe_add_del_native_fwd_rpath_812da2f2") + api.RegisterMessage((*GpeAddDelNativeFwdRpath)(nil), "gpe_add_del_native_fwd_rpath_43fc8b54") api.RegisterMessage((*GpeAddDelNativeFwdRpathReply)(nil), "gpe_add_del_native_fwd_rpath_reply_e8d4e804") api.RegisterMessage((*GpeEnableDisable)(nil), "gpe_enable_disable_c264d7bf") api.RegisterMessage((*GpeEnableDisableReply)(nil), "gpe_enable_disable_reply_e8d4e804") api.RegisterMessage((*GpeFwdEntriesGet)(nil), "gpe_fwd_entries_get_8d1f2fe9") - api.RegisterMessage((*GpeFwdEntriesGetReply)(nil), "gpe_fwd_entries_get_reply_f9f53f1b") - api.RegisterMessage((*GpeFwdEntryPathDetails)(nil), "gpe_fwd_entry_path_details_ee80b19a") + api.RegisterMessage((*GpeFwdEntriesGetReply)(nil), "gpe_fwd_entries_get_reply_c4844876") + api.RegisterMessage((*GpeFwdEntryPathDetails)(nil), "gpe_fwd_entry_path_details_483df51a") api.RegisterMessage((*GpeFwdEntryPathDump)(nil), "gpe_fwd_entry_path_dump_39bce980") api.RegisterMessage((*GpeFwdEntryVnisGet)(nil), "gpe_fwd_entry_vnis_get_51077d14") api.RegisterMessage((*GpeFwdEntryVnisGetReply)(nil), "gpe_fwd_entry_vnis_get_reply_aa70da20") api.RegisterMessage((*GpeGetEncapMode)(nil), "gpe_get_encap_mode_51077d14") api.RegisterMessage((*GpeGetEncapModeReply)(nil), "gpe_get_encap_mode_reply_36e3f7ca") api.RegisterMessage((*GpeNativeFwdRpathsGet)(nil), "gpe_native_fwd_rpaths_get_f652ceb4") - api.RegisterMessage((*GpeNativeFwdRpathsGetReply)(nil), "gpe_native_fwd_rpaths_get_reply_79d54eb9") + api.RegisterMessage((*GpeNativeFwdRpathsGetReply)(nil), "gpe_native_fwd_rpaths_get_reply_7a1ca5a2") api.RegisterMessage((*GpeSetEncapMode)(nil), "gpe_set_encap_mode_bd819eac") api.RegisterMessage((*GpeSetEncapModeReply)(nil), "gpe_set_encap_mode_reply_e8d4e804") } diff --git a/binapi/lisp_gpe/lisp_gpe_rest.ba.go b/binapi/lisp_gpe/lisp_gpe_rest.ba.go deleted file mode 100644 index 498b211..0000000 --- a/binapi/lisp_gpe/lisp_gpe_rest.ba.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lisp_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gpe_add_del_fwd_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelFwdEntry) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeAddDelFwdEntry(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_add_del_iface", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelIface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeAddDelIface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_add_del_native_fwd_rpath", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelNativeFwdRpath) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeAddDelNativeFwdRpath(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_fwd_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeFwdEntriesGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeFwdEntriesGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_fwd_entry_vnis_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeFwdEntryVnisGet) - reply, err := rpc.GpeFwdEntryVnisGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_get_encap_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeGetEncapMode) - reply, err := rpc.GpeGetEncapMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_native_fwd_rpaths_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeNativeFwdRpathsGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeNativeFwdRpathsGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/gpe_set_encap_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeSetEncapMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GpeSetEncapMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lisp_gpe/lisp_gpe_rpc.ba.go b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go index 42dcb31..b17a6e6 100644 --- a/binapi/lisp_gpe/lisp_gpe_rpc.ba.go +++ b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go @@ -5,12 +5,13 @@ package lisp_gpe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service lisp_gpe. +// RPCService defines RPC service lisp_gpe. type RPCService interface { GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdEntry) (*GpeAddDelFwdEntryReply, error) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) @@ -38,7 +39,7 @@ func (c *serviceClient) GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) { @@ -47,7 +48,7 @@ func (c *serviceClient) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddDelNativeFwdRpath) (*GpeAddDelNativeFwdRpathReply, error) { @@ -56,7 +57,7 @@ func (c *serviceClient) GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeEnableDisable(ctx context.Context, in *GpeEnableDisable) (*GpeEnableDisableReply, error) { @@ -65,7 +66,7 @@ func (c *serviceClient) GpeEnableDisable(ctx context.Context, in *GpeEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesGet) (*GpeFwdEntriesGetReply, error) { @@ -74,7 +75,7 @@ func (c *serviceClient) GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeFwdEntryPathDump(ctx context.Context, in *GpeFwdEntryPathDump) (RPCService_GpeFwdEntryPathDumpClient, error) { @@ -86,7 +87,7 @@ func (c *serviceClient) GpeFwdEntryPathDump(ctx context.Context, in *GpeFwdEntry if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -109,7 +110,11 @@ func (c *serviceClient_GpeFwdEntryPathDumpClient) Recv() (*GpeFwdEntryPathDetail switch m := msg.(type) { case *GpeFwdEntryPathDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -122,7 +127,7 @@ func (c *serviceClient) GpeFwdEntryVnisGet(ctx context.Context, in *GpeFwdEntryV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode) (*GpeGetEncapModeReply, error) { @@ -131,7 +136,7 @@ func (c *serviceClient) GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNativeFwdRpathsGet) (*GpeNativeFwdRpathsGetReply, error) { @@ -140,7 +145,7 @@ func (c *serviceClient) GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNative if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode) (*GpeSetEncapModeReply, error) { @@ -149,5 +154,5 @@ func (c *serviceClient) GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lisp_types/lisp_types.ba.go b/binapi/lisp_types/lisp_types.ba.go index 49b2c3d..7e6c0fa 100644 --- a/binapi/lisp_types/lisp_types.ba.go +++ b/binapi/lisp_types/lisp_types.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/lisp_types.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/lisp_types.api.json // Package lisp_types contains generated bindings for API file lisp_types.api. // @@ -14,12 +14,13 @@ package lisp_types import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,6 +29,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "lisp_types" + APIVersion = "1.0.0" + VersionCrc = 0xf05d92a6 +) + // EidType defines enum 'eid_type'. type EidType uint8 @@ -90,8 +97,8 @@ func (x HmacKeyID) String() string { // Eid defines type 'eid'. type Eid struct { - Type EidType `binapi:"eid_type,name=type" json:"type,omitempty"` - Address EidAddress `binapi:"eid_address,name=address" json:"address,omitempty"` + Type EidType `binapi:"eid_type,name=type" json:"type,omitempty"` + Address EidAddressUnion `binapi:"eid_address,name=address" json:"address,omitempty"` } // HmacKey defines type 'hmac_key'. @@ -120,25 +127,26 @@ type RemoteLocator struct { IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` } -// EidAddress defines union 'eid_address'. -type EidAddress struct { - // Prefix *ip_types.Prefix - // Mac *ethernet_types.MacAddress - // Nsh *Nsh - XXX_UnionData [6]byte +// EidAddressUnion defines union 'eid_address'. +type EidAddressUnion struct { + // EidAddressUnion can be one of: + // - Prefix *ip_types.Prefix + // - Mac *ethernet_types.MacAddress + // - Nsh *Nsh + XXX_UnionData [18]byte } -func EidAddressPrefix(a ip_types.Prefix) (u EidAddress) { +func EidAddressUnionPrefix(a ip_types.Prefix) (u EidAddressUnion) { u.SetPrefix(a) return } -func (u *EidAddress) SetPrefix(a ip_types.Prefix) { +func (u *EidAddressUnion) SetPrefix(a ip_types.Prefix) { buf := codec.NewBuffer(u.XXX_UnionData[:]) buf.EncodeUint8(uint8(a.Address.Af)) buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16) buf.EncodeUint8(a.Len) } -func (u *EidAddress) GetPrefix() (a ip_types.Prefix) { +func (u *EidAddressUnion) GetPrefix() (a ip_types.Prefix) { buf := codec.NewBuffer(u.XXX_UnionData[:]) a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) @@ -146,30 +154,30 @@ func (u *EidAddress) GetPrefix() (a ip_types.Prefix) { return } -func EidAddressMac(a ethernet_types.MacAddress) (u EidAddress) { +func EidAddressUnionMac(a ethernet_types.MacAddress) (u EidAddressUnion) { u.SetMac(a) return } -func (u *EidAddress) SetMac(a ethernet_types.MacAddress) { +func (u *EidAddressUnion) SetMac(a ethernet_types.MacAddress) { buf := codec.NewBuffer(u.XXX_UnionData[:]) buf.EncodeBytes(a[:], 6) } -func (u *EidAddress) GetMac() (a ethernet_types.MacAddress) { +func (u *EidAddressUnion) GetMac() (a ethernet_types.MacAddress) { buf := codec.NewBuffer(u.XXX_UnionData[:]) copy(a[:], buf.DecodeBytes(6)) return } -func EidAddressNsh(a Nsh) (u EidAddress) { +func EidAddressUnionNsh(a Nsh) (u EidAddressUnion) { u.SetNsh(a) return } -func (u *EidAddress) SetNsh(a Nsh) { +func (u *EidAddressUnion) SetNsh(a Nsh) { buf := codec.NewBuffer(u.XXX_UnionData[:]) buf.EncodeUint32(a.Spi) buf.EncodeUint8(a.Si) } -func (u *EidAddress) GetNsh() (a Nsh) { +func (u *EidAddressUnion) GetNsh() (a Nsh) { buf := codec.NewBuffer(u.XXX_UnionData[:]) a.Spi = buf.DecodeUint32() a.Si = buf.DecodeUint8() diff --git a/binapi/lldp/lldp.ba.go b/binapi/lldp/lldp.ba.go index a8769b5..bf513a9 100644 --- a/binapi/lldp/lldp.ba.go +++ b/binapi/lldp/lldp.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/lldp.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/lldp.api.json // Package lldp contains generated bindings for API file lldp.api. // @@ -12,10 +12,10 @@ package lldp import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "lldp" APIVersion = "2.0.0" - VersionCrc = 0x44347d6 + VersionCrc = 0x8a7e7049 ) // LldpConfig defines message 'lldp_config'. @@ -116,7 +116,7 @@ type SwInterfaceSetLldp struct { func (m *SwInterfaceSetLldp) Reset() { *m = SwInterfaceSetLldp{} } func (*SwInterfaceSetLldp) GetMessageName() string { return "sw_interface_set_lldp" } -func (*SwInterfaceSetLldp) GetCrcString() string { return "d646ae0f" } +func (*SwInterfaceSetLldp) GetCrcString() string { return "57afbcd4" } func (*SwInterfaceSetLldp) GetMessageType() api.MessageType { return api.RequestMessage } @@ -195,7 +195,7 @@ func init() { file_lldp_binapi_init() } func file_lldp_binapi_init() { api.RegisterMessage((*LldpConfig)(nil), "lldp_config_c14445df") api.RegisterMessage((*LldpConfigReply)(nil), "lldp_config_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceSetLldp)(nil), "sw_interface_set_lldp_d646ae0f") + api.RegisterMessage((*SwInterfaceSetLldp)(nil), "sw_interface_set_lldp_57afbcd4") api.RegisterMessage((*SwInterfaceSetLldpReply)(nil), "sw_interface_set_lldp_reply_e8d4e804") } diff --git a/binapi/lldp/lldp_rest.ba.go b/binapi/lldp/lldp_rest.ba.go deleted file mode 100644 index 807ef94..0000000 --- a/binapi/lldp/lldp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lldp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lldp_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(LldpConfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.LldpConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_lldp", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetLldp) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetLldp(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lldp/lldp_rpc.ba.go b/binapi/lldp/lldp_rpc.ba.go index 9d5eb85..bf32fcf 100644 --- a/binapi/lldp/lldp_rpc.ba.go +++ b/binapi/lldp/lldp_rpc.ba.go @@ -4,10 +4,11 @@ package lldp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service lldp. +// RPCService defines RPC service lldp. type RPCService interface { LldpConfig(ctx context.Context, in *LldpConfig) (*LldpConfigReply, error) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) LldpConfig(ctx context.Context, in *LldpConfig) (*LldpCo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/mactime/mactime.ba.go b/binapi/mactime/mactime.ba.go index deb7472..22fd871 100644 --- a/binapi/mactime/mactime.ba.go +++ b/binapi/mactime/mactime.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/mactime.api.json // Package mactime contains generated bindings for API file mactime.api. @@ -13,10 +13,10 @@ package mactime import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "mactime" APIVersion = "2.0.0" - VersionCrc = 0x9283d3e + VersionCrc = 0xc72e296e ) // MactimeTimeRange defines type 'mactime_time_range'. @@ -59,7 +59,7 @@ type MactimeAddDelRange struct { func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} } func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" } -func (*MactimeAddDelRange) GetCrcString() string { return "101858ef" } +func (*MactimeAddDelRange) GetCrcString() string { return "cb56e877" } func (*MactimeAddDelRange) GetMessageType() api.MessageType { return api.RequestMessage } @@ -178,7 +178,7 @@ type MactimeDetails struct { func (m *MactimeDetails) Reset() { *m = MactimeDetails{} } func (*MactimeDetails) GetMessageName() string { return "mactime_details" } -func (*MactimeDetails) GetCrcString() string { return "44921c06" } +func (*MactimeDetails) GetCrcString() string { return "da25b13a" } func (*MactimeDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -386,9 +386,9 @@ func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error { func init() { file_mactime_binapi_init() } func file_mactime_binapi_init() { - api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_101858ef") + api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_cb56e877") api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime_add_del_range_reply_e8d4e804") - api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_44921c06") + api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_da25b13a") api.RegisterMessage((*MactimeDump)(nil), "mactime_dump_8f454e23") api.RegisterMessage((*MactimeDumpReply)(nil), "mactime_dump_reply_49bcc753") api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime_enable_disable_3865946c") diff --git a/binapi/mactime/mactime_rest.ba.go b/binapi/mactime/mactime_rest.ba.go deleted file mode 100644 index 4318dbc..0000000 --- a/binapi/mactime/mactime_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mactime - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mactime_add_del_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(MactimeAddDelRange) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MactimeAddDelRange(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/mactime_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MactimeEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MactimeEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/mactime/mactime_rpc.ba.go b/binapi/mactime/mactime_rpc.ba.go index a92a14c..3ae0803 100644 --- a/binapi/mactime/mactime_rpc.ba.go +++ b/binapi/mactime/mactime_rpc.ba.go @@ -5,12 +5,13 @@ package mactime import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service mactime. +// RPCService defines RPC service mactime. type RPCService interface { MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) @@ -31,7 +32,7 @@ func (c *serviceClient) MactimeAddDelRange(ctx context.Context, in *MactimeAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) { @@ -43,7 +44,7 @@ func (c *serviceClient) MactimeDump(ctx context.Context, in *MactimeDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -66,7 +67,11 @@ func (c *serviceClient_MactimeDumpClient) Recv() (*MactimeDetails, error) { switch m := msg.(type) { case *MactimeDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -79,5 +84,5 @@ func (c *serviceClient) MactimeEnableDisable(ctx context.Context, in *MactimeEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/map/map.ba.go b/binapi/map/map.ba.go index b906284..278d1ac 100644 --- a/binapi/map/map.ba.go +++ b/binapi/map/map.ba.go @@ -1,21 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/map.api.json // Package maps contains generated bindings for API file map.api. // // Contents: -// 30 messages +// 32 messages // package maps import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,8 +26,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "map" - APIVersion = "4.1.1" - VersionCrc = 0x82b79829 + APIVersion = "4.2.1" + VersionCrc = 0xd1f7f56c ) // MapAddDelRule defines message 'map_add_del_rule'. @@ -122,7 +122,7 @@ type MapAddDomain struct { func (m *MapAddDomain) Reset() { *m = MapAddDomain{} } func (*MapAddDomain) GetMessageName() string { return "map_add_domain" } -func (*MapAddDomain) GetCrcString() string { return "7a5a18c9" } +func (*MapAddDomain) GetCrcString() string { return "249f195c" } func (*MapAddDomain) GetMessageType() api.MessageType { return api.RequestMessage } @@ -297,7 +297,7 @@ type MapDomainDetails struct { func (m *MapDomainDetails) Reset() { *m = MapDomainDetails{} } func (*MapDomainDetails) GetMessageName() string { return "map_domain_details" } -func (*MapDomainDetails) GetCrcString() string { return "fc1859dd" } +func (*MapDomainDetails) GetCrcString() string { return "796edb50" } func (*MapDomainDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -360,6 +360,7 @@ func (m *MapDomainDetails) Unmarshal(b []byte) error { } // MapDomainDump defines message 'map_domain_dump'. +// Deprecated: the message will be removed in the future versions type MapDomainDump struct{} func (m *MapDomainDump) Reset() { *m = MapDomainDump{} } @@ -386,6 +387,76 @@ func (m *MapDomainDump) Unmarshal(b []byte) error { return nil } +// MapDomainsGet defines message 'map_domains_get'. +type MapDomainsGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *MapDomainsGet) Reset() { *m = MapDomainsGet{} } +func (*MapDomainsGet) GetMessageName() string { return "map_domains_get" } +func (*MapDomainsGet) GetCrcString() string { return "f75ba505" } +func (*MapDomainsGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapDomainsGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *MapDomainsGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *MapDomainsGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// MapDomainsGetReply defines message 'map_domains_get_reply'. +type MapDomainsGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *MapDomainsGetReply) Reset() { *m = MapDomainsGetReply{} } +func (*MapDomainsGetReply) GetMessageName() string { return "map_domains_get_reply" } +func (*MapDomainsGetReply) GetCrcString() string { return "53b48f5d" } +func (*MapDomainsGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapDomainsGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *MapDomainsGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *MapDomainsGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + // MapIfEnableDisable defines message 'map_if_enable_disable'. type MapIfEnableDisable struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -469,7 +540,7 @@ type MapParamAddDelPreResolve struct { func (m *MapParamAddDelPreResolve) Reset() { *m = MapParamAddDelPreResolve{} } func (*MapParamAddDelPreResolve) GetMessageName() string { return "map_param_add_del_pre_resolve" } -func (*MapParamAddDelPreResolve) GetCrcString() string { return "17008c66" } +func (*MapParamAddDelPreResolve) GetCrcString() string { return "dae5af03" } func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType { return api.RequestMessage } @@ -584,7 +655,7 @@ type MapParamGetReply struct { func (m *MapParamGetReply) Reset() { *m = MapParamGetReply{} } func (*MapParamGetReply) GetMessageName() string { return "map_param_get_reply" } -func (*MapParamGetReply) GetCrcString() string { return "28092156" } +func (*MapParamGetReply) GetCrcString() string { return "26272c90" } func (*MapParamGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1247,18 +1318,20 @@ func init() { file_maps_binapi_init() } func file_maps_binapi_init() { api.RegisterMessage((*MapAddDelRule)(nil), "map_add_del_rule_c65b32f7") api.RegisterMessage((*MapAddDelRuleReply)(nil), "map_add_del_rule_reply_e8d4e804") - api.RegisterMessage((*MapAddDomain)(nil), "map_add_domain_7a5a18c9") + api.RegisterMessage((*MapAddDomain)(nil), "map_add_domain_249f195c") api.RegisterMessage((*MapAddDomainReply)(nil), "map_add_domain_reply_3e6d4e2c") api.RegisterMessage((*MapDelDomain)(nil), "map_del_domain_8ac76db6") api.RegisterMessage((*MapDelDomainReply)(nil), "map_del_domain_reply_e8d4e804") - api.RegisterMessage((*MapDomainDetails)(nil), "map_domain_details_fc1859dd") + api.RegisterMessage((*MapDomainDetails)(nil), "map_domain_details_796edb50") api.RegisterMessage((*MapDomainDump)(nil), "map_domain_dump_51077d14") + api.RegisterMessage((*MapDomainsGet)(nil), "map_domains_get_f75ba505") + api.RegisterMessage((*MapDomainsGetReply)(nil), "map_domains_get_reply_53b48f5d") api.RegisterMessage((*MapIfEnableDisable)(nil), "map_if_enable_disable_59bb32f4") api.RegisterMessage((*MapIfEnableDisableReply)(nil), "map_if_enable_disable_reply_e8d4e804") - api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map_param_add_del_pre_resolve_17008c66") + api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map_param_add_del_pre_resolve_dae5af03") api.RegisterMessage((*MapParamAddDelPreResolveReply)(nil), "map_param_add_del_pre_resolve_reply_e8d4e804") api.RegisterMessage((*MapParamGet)(nil), "map_param_get_51077d14") - api.RegisterMessage((*MapParamGetReply)(nil), "map_param_get_reply_28092156") + api.RegisterMessage((*MapParamGetReply)(nil), "map_param_get_reply_26272c90") api.RegisterMessage((*MapParamSetFragmentation)(nil), "map_param_set_fragmentation_9ff54d90") api.RegisterMessage((*MapParamSetFragmentationReply)(nil), "map_param_set_fragmentation_reply_e8d4e804") api.RegisterMessage((*MapParamSetICMP)(nil), "map_param_set_icmp_58210cbf") @@ -1288,6 +1361,8 @@ func AllMessages() []api.Message { (*MapDelDomainReply)(nil), (*MapDomainDetails)(nil), (*MapDomainDump)(nil), + (*MapDomainsGet)(nil), + (*MapDomainsGetReply)(nil), (*MapIfEnableDisable)(nil), (*MapIfEnableDisableReply)(nil), (*MapParamAddDelPreResolve)(nil), diff --git a/binapi/map/map_rest.ba.go b/binapi/map/map_rest.ba.go deleted file mode 100644 index 922acb5..0000000 --- a/binapi/map/map_rest.ba.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package maps - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/map_add_del_rule", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapAddDelRule) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapAddDelRule(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_add_domain", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapAddDomain) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapAddDomain(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_del_domain", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapDelDomain) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapDelDomain(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_if_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapIfEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapIfEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_add_del_pre_resolve", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamAddDelPreResolve) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamAddDelPreResolve(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamGet) - reply, err := rpc.MapParamGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_fragmentation", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetFragmentation) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetFragmentation(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_icmp", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetICMP) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetICMP(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_icmp6", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetICMP6) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetICMP6(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_security_check", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetSecurityCheck) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetSecurityCheck(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_tcp", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetTCP) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetTCP(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_param_set_traffic_class", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetTrafficClass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MapParamSetTrafficClass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/map_summary_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapSummaryStats) - reply, err := rpc.MapSummaryStats(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/map/map_rpc.ba.go b/binapi/map/map_rpc.ba.go index 6f7c3c7..f667d67 100644 --- a/binapi/map/map_rpc.ba.go +++ b/binapi/map/map_rpc.ba.go @@ -5,17 +5,19 @@ package maps import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service map. +// RPCService defines RPC service map. type RPCService interface { MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) + MapDomainsGet(ctx context.Context, in *MapDomainsGet) (RPCService_MapDomainsGetClient, error) MapIfEnableDisable(ctx context.Context, in *MapIfEnableDisable) (*MapIfEnableDisableReply, error) MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) @@ -43,7 +45,7 @@ func (c *serviceClient) MapAddDelRule(ctx context.Context, in *MapAddDelRule) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) { @@ -52,7 +54,7 @@ func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*Ma if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) { @@ -61,7 +63,7 @@ func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*Ma if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) { @@ -73,7 +75,7 @@ func (c *serviceClient) MapDomainDump(ctx context.Context, in *MapDomainDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -96,7 +98,51 @@ func (c *serviceClient_MapDomainDumpClient) Recv() (*MapDomainDetails, error) { switch m := msg.(type) { case *MapDomainDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MapDomainsGet(ctx context.Context, in *MapDomainsGet) (RPCService_MapDomainsGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MapDomainsGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MapDomainsGetClient interface { + Recv() (*MapDomainDetails, error) + api.Stream +} + +type serviceClient_MapDomainsGetClient struct { + api.Stream +} + +func (c *serviceClient_MapDomainsGetClient) Recv() (*MapDomainDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MapDomainDetails: + return m, nil + case *MapDomainsGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -109,7 +155,7 @@ func (c *serviceClient) MapIfEnableDisable(ctx context.Context, in *MapIfEnableD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) { @@ -118,7 +164,7 @@ func (c *serviceClient) MapParamAddDelPreResolve(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) { @@ -127,7 +173,7 @@ func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) { @@ -136,7 +182,7 @@ func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error) { @@ -145,7 +191,7 @@ func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error) { @@ -154,7 +200,7 @@ func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) { @@ -163,7 +209,7 @@ func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error) { @@ -172,7 +218,7 @@ func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) { @@ -181,7 +227,7 @@ func (c *serviceClient) MapParamSetTrafficClass(ctx context.Context, in *MapPara if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error) { @@ -193,7 +239,7 @@ func (c *serviceClient) MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -216,7 +262,11 @@ func (c *serviceClient_MapRuleDumpClient) Recv() (*MapRuleDetails, error) { switch m := msg.(type) { case *MapRuleDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -229,5 +279,5 @@ func (c *serviceClient) MapSummaryStats(ctx context.Context, in *MapSummaryStats if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/mdata/mdata.ba.go b/binapi/mdata/mdata.ba.go index d4715f7..3aab6f9 100644 --- a/binapi/mdata/mdata.ba.go +++ b/binapi/mdata/mdata.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/mdata.api.json // Package mdata contains generated bindings for API file mdata.api. @@ -12,9 +12,9 @@ package mdata import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,10 +26,11 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "mdata" APIVersion = "0.1.0" - VersionCrc = 0x3a1911dd + VersionCrc = 0x5bd69477 ) // MdataEnableDisable defines message 'mdata_enable_disable'. +// InProgress: the message form may change in the future versions type MdataEnableDisable struct { EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` } @@ -63,6 +64,7 @@ func (m *MdataEnableDisable) Unmarshal(b []byte) error { } // MdataEnableDisableReply defines message 'mdata_enable_disable_reply'. +// InProgress: the message form may change in the future versions type MdataEnableDisableReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } diff --git a/binapi/mdata/mdata_rest.ba.go b/binapi/mdata/mdata_rest.ba.go deleted file mode 100644 index 12b22e7..0000000 --- a/binapi/mdata/mdata_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mdata - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mdata_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MdataEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MdataEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/mdata/mdata_rpc.ba.go b/binapi/mdata/mdata_rpc.ba.go index 08e05d5..717d5c7 100644 --- a/binapi/mdata/mdata_rpc.ba.go +++ b/binapi/mdata/mdata_rpc.ba.go @@ -4,10 +4,11 @@ package mdata import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service mdata. +// RPCService defines RPC service mdata. type RPCService interface { MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) MdataEnableDisable(ctx context.Context, in *MdataEnableD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/memclnt/memclnt.ba.go b/binapi/memclnt/memclnt.ba.go index 3bbf88d..c97c531 100644 --- a/binapi/memclnt/memclnt.ba.go +++ b/binapi/memclnt/memclnt.ba.go @@ -1,20 +1,20 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/memclnt.api.json // Package memclnt contains generated bindings for API file memclnt.api. // // Contents: // 2 structs -// 22 messages +// 24 messages // package memclnt import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "memclnt" APIVersion = "2.1.0" - VersionCrc = 0x8d3dd881 + VersionCrc = 0x230bb938 ) // MessageTableEntry defines type 'message_table_entry'. @@ -136,6 +136,74 @@ func (m *APIVersionsReply) Unmarshal(b []byte) error { return nil } +// ControlPing defines message 'control_ping'. +type ControlPing struct{} + +func (m *ControlPing) Reset() { *m = ControlPing{} } +func (*ControlPing) GetMessageName() string { return "control_ping" } +func (*ControlPing) GetCrcString() string { return "51077d14" } +func (*ControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ControlPing) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *ControlPing) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *ControlPing) Unmarshal(b []byte) error { + return nil +} + +// ControlPingReply defines message 'control_ping_reply'. +type ControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } +func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } +func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ControlPingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.ClientIndex) + buf.EncodeUint32(m.VpePID) + return buf.Bytes(), nil +} +func (m *ControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + // GetFirstMsgID defines message 'get_first_msg_id'. type GetFirstMsgID struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` @@ -920,6 +988,8 @@ func init() { file_memclnt_binapi_init() } func file_memclnt_binapi_init() { api.RegisterMessage((*APIVersions)(nil), "api_versions_51077d14") api.RegisterMessage((*APIVersionsReply)(nil), "api_versions_reply_5f0d99d6") + api.RegisterMessage((*ControlPing)(nil), "control_ping_51077d14") + api.RegisterMessage((*ControlPingReply)(nil), "control_ping_reply_f6b0b8ca") api.RegisterMessage((*GetFirstMsgID)(nil), "get_first_msg_id_ebf79a66") api.RegisterMessage((*GetFirstMsgIDReply)(nil), "get_first_msg_id_reply_7d337472") api.RegisterMessage((*MemclntCreate)(nil), "memclnt_create_9c5e1c2f") @@ -947,6 +1017,8 @@ func AllMessages() []api.Message { return []api.Message{ (*APIVersions)(nil), (*APIVersionsReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), (*GetFirstMsgID)(nil), (*GetFirstMsgIDReply)(nil), (*MemclntCreate)(nil), diff --git a/binapi/memclnt/memclnt_rest.ba.go b/binapi/memclnt/memclnt_rest.ba.go deleted file mode 100644 index bb409da..0000000 --- a/binapi/memclnt/memclnt_rest.ba.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memclnt - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/api_versions", func(w http.ResponseWriter, req *http.Request) { - var request = new(APIVersions) - reply, err := rpc.APIVersions(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_first_msg_id", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetFirstMsgID) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GetFirstMsgID(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/memclnt_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MemclntCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/memclnt_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MemclntDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/memclnt_keepalive", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntKeepalive) - reply, err := rpc.MemclntKeepalive(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/rpc_call", func(w http.ResponseWriter, req *http.Request) { - var request = new(RPCCall) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.RPCCall(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sock_init_shm", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockInitShm) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SockInitShm(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sockclnt_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockclntCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SockclntCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sockclnt_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockclntDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SockclntDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/memclnt/memclnt_rpc.ba.go b/binapi/memclnt/memclnt_rpc.ba.go index ec60156..570e594 100644 --- a/binapi/memclnt/memclnt_rpc.ba.go +++ b/binapi/memclnt/memclnt_rpc.ba.go @@ -4,12 +4,14 @@ package memclnt import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service memclnt. +// RPCService defines RPC service memclnt. type RPCService interface { APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) @@ -38,7 +40,16 @@ func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { @@ -47,7 +58,7 @@ func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { @@ -74,7 +85,7 @@ func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepali if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { @@ -86,6 +97,10 @@ func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadT if err != nil { return err } + err = stream.Close() + if err != nil { + return err + } return nil } @@ -98,6 +113,10 @@ func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntR if err != nil { return err } + err = stream.Close() + if err != nil { + return err + } return nil } @@ -107,7 +126,7 @@ func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { @@ -119,6 +138,10 @@ func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) erro if err != nil { return err } + err = stream.Close() + if err != nil { + return err + } return nil } @@ -128,7 +151,7 @@ func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*Sock if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { @@ -158,5 +181,9 @@ func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMs if err != nil { return err } + err = stream.Close() + if err != nil { + return err + } return nil } diff --git a/binapi/memif/memif.ba.go b/binapi/memif/memif.ba.go index adc41b6..5502fd4 100644 --- a/binapi/memif/memif.ba.go +++ b/binapi/memif/memif.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/memif.api.json // Package memif contains generated bindings for API file memif.api. @@ -13,11 +13,12 @@ package memif import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +30,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "memif" APIVersion = "3.0.0" - VersionCrc = 0x1a1c95b8 + VersionCrc = 0xd189f1e1 ) // MemifMode defines enum 'memif_mode'. @@ -282,7 +283,7 @@ type MemifDetails struct { func (m *MemifDetails) Reset() { *m = MemifDetails{} } func (*MemifDetails) GetMessageName() string { return "memif_details" } -func (*MemifDetails) GetCrcString() string { return "d0382c4c" } +func (*MemifDetails) GetCrcString() string { return "da34feb9" } func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -511,7 +512,7 @@ func file_memif_binapi_init() { api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f") api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e") api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804") - api.RegisterMessage((*MemifDetails)(nil), "memif_details_d0382c4c") + api.RegisterMessage((*MemifDetails)(nil), "memif_details_da34feb9") api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14") api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10") api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804") diff --git a/binapi/memif/memif_rest.ba.go b/binapi/memif/memif_rest.ba.go deleted file mode 100644 index 726824f..0000000 --- a/binapi/memif/memif_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memif - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/memif_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MemifCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/memif_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MemifDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/memif_socket_filename_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifSocketFilenameAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MemifSocketFilenameAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/memif/memif_rpc.ba.go b/binapi/memif/memif_rpc.ba.go index 4cd1fa1..f2e3e52 100644 --- a/binapi/memif/memif_rpc.ba.go +++ b/binapi/memif/memif_rpc.ba.go @@ -5,12 +5,13 @@ package memif import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service memif. +// RPCService defines RPC service memif. type RPCService interface { MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) @@ -33,7 +34,7 @@ func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*Memi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { @@ -42,7 +43,7 @@ func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*Memi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) { @@ -54,7 +55,7 @@ func (c *serviceClient) MemifDump(ctx context.Context, in *MemifDump) (RPCServic if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -77,7 +78,11 @@ func (c *serviceClient_MemifDumpClient) Recv() (*MemifDetails, error) { switch m := msg.(type) { case *MemifDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -90,7 +95,7 @@ func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *Memif if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) { @@ -102,7 +107,7 @@ func (c *serviceClient) MemifSocketFilenameDump(ctx context.Context, in *MemifSo if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -125,7 +130,11 @@ func (c *serviceClient_MemifSocketFilenameDumpClient) Recv() (*MemifSocketFilena switch m := msg.(type) { case *MemifSocketFilenameDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/mfib_types/mfib_types.ba.go b/binapi/mfib_types/mfib_types.ba.go index 645d64c..5008694 100644 --- a/binapi/mfib_types/mfib_types.ba.go +++ b/binapi/mfib_types/mfib_types.ba.go @@ -1,22 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/mfib_types.api.json // Package mfib_types contains generated bindings for API file mfib_types.api. // // Contents: -// 1 enum +// 2 enums // 1 struct // package mfib_types import ( - api "git.fd.io/govpp.git/api" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - _ "git.fd.io/govpp.git/binapi/ip_types" "strconv" + + api "go.fd.io/govpp/api" + fib_types "go.fd.io/govpp/binapi/fib_types" + _ "go.fd.io/govpp/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -25,6 +26,67 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "mfib_types" + APIVersion = "1.0.0" + VersionCrc = 0xd2b57aaf +) + +// MfibEntryFlags defines enum 'mfib_entry_flags'. +type MfibEntryFlags uint32 + +const ( + MFIB_API_ENTRY_FLAG_NONE MfibEntryFlags = 0 + MFIB_API_ENTRY_FLAG_SIGNAL MfibEntryFlags = 1 + MFIB_API_ENTRY_FLAG_DROP MfibEntryFlags = 2 + MFIB_API_ENTRY_FLAG_CONNECTED MfibEntryFlags = 4 + MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF MfibEntryFlags = 8 +) + +var ( + MfibEntryFlags_name = map[uint32]string{ + 0: "MFIB_API_ENTRY_FLAG_NONE", + 1: "MFIB_API_ENTRY_FLAG_SIGNAL", + 2: "MFIB_API_ENTRY_FLAG_DROP", + 4: "MFIB_API_ENTRY_FLAG_CONNECTED", + 8: "MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF", + } + MfibEntryFlags_value = map[string]uint32{ + "MFIB_API_ENTRY_FLAG_NONE": 0, + "MFIB_API_ENTRY_FLAG_SIGNAL": 1, + "MFIB_API_ENTRY_FLAG_DROP": 2, + "MFIB_API_ENTRY_FLAG_CONNECTED": 4, + "MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF": 8, + } +) + +func (x MfibEntryFlags) String() string { + s, ok := MfibEntryFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := MfibEntryFlags_name[uint32(n)] + if ok { + return s + } + return "MfibEntryFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + // MfibItfFlags defines enum 'mfib_itf_flags'. type MfibItfFlags uint32 diff --git a/binapi/mpls/mpls.ba.go b/binapi/mpls/mpls.ba.go index 9443728..471e187 100644 --- a/binapi/mpls/mpls.ba.go +++ b/binapi/mpls/mpls.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/mpls.api.json // Package mpls contains generated bindings for API file mpls.api. @@ -13,11 +13,11 @@ package mpls import ( - api "git.fd.io/govpp.git/api" - fib_types "git.fd.io/govpp.git/binapi/fib_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + fib_types "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "mpls" APIVersion = "1.1.1" - VersionCrc = 0xd83a030f + VersionCrc = 0x46824f02 ) // MplsRoute defines type 'mpls_route'. @@ -71,7 +71,7 @@ type MplsIPBindUnbind struct { func (m *MplsIPBindUnbind) Reset() { *m = MplsIPBindUnbind{} } func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" } -func (*MplsIPBindUnbind) GetCrcString() string { return "48249a27" } +func (*MplsIPBindUnbind) GetCrcString() string { return "c7533b32" } func (*MplsIPBindUnbind) GetMessageType() api.MessageType { return api.RequestMessage } @@ -157,7 +157,7 @@ type MplsRouteAddDel struct { func (m *MplsRouteAddDel) Reset() { *m = MplsRouteAddDel{} } func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" } -func (*MplsRouteAddDel) GetCrcString() string { return "343cff54" } +func (*MplsRouteAddDel) GetCrcString() string { return "8e1d1e07" } func (*MplsRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -321,7 +321,7 @@ type MplsRouteDetails struct { func (m *MplsRouteDetails) Reset() { *m = MplsRouteDetails{} } func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" } -func (*MplsRouteDetails) GetCrcString() string { return "d0ac384c" } +func (*MplsRouteDetails) GetCrcString() string { return "9b5043dc" } func (*MplsRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -615,7 +615,7 @@ type MplsTunnelAddDel struct { func (m *MplsTunnelAddDel) Reset() { *m = MplsTunnelAddDel{} } func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" } -func (*MplsTunnelAddDel) GetCrcString() string { return "e57ce61d" } +func (*MplsTunnelAddDel) GetCrcString() string { return "44350ac1" } func (*MplsTunnelAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -780,7 +780,7 @@ type MplsTunnelDetails struct { func (m *MplsTunnelDetails) Reset() { *m = MplsTunnelDetails{} } func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" } -func (*MplsTunnelDetails) GetCrcString() string { return "f3c0928e" } +func (*MplsTunnelDetails) GetCrcString() string { return "57118ae3" } func (*MplsTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1001,19 +1001,19 @@ func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error { func init() { file_mpls_binapi_init() } func file_mpls_binapi_init() { - api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_48249a27") + api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_c7533b32") api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804") - api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_343cff54") + api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_8e1d1e07") api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab") - api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_d0ac384c") + api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_9b5043dc") api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa") api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512") api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804") api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8") api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14") - api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_e57ce61d") + api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_44350ac1") api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472") - api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_f3c0928e") + api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_57118ae3") api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e") api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb") api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804") diff --git a/binapi/mpls/mpls_rest.ba.go b/binapi/mpls/mpls_rest.ba.go deleted file mode 100644 index 9cac11b..0000000 --- a/binapi/mpls/mpls_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mpls - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mpls_ip_bind_unbind", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsIPBindUnbind) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MplsIPBindUnbind(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/mpls_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsRouteAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MplsRouteAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/mpls_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MplsTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/mpls_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsTunnelAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.MplsTunnelAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sw_interface_set_mpls_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMplsEnable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetMplsEnable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/mpls/mpls_rpc.ba.go b/binapi/mpls/mpls_rpc.ba.go index 4a1d06e..84b852e 100644 --- a/binapi/mpls/mpls_rpc.ba.go +++ b/binapi/mpls/mpls_rpc.ba.go @@ -5,12 +5,13 @@ package mpls import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service mpls. +// RPCService defines RPC service mpls. type RPCService interface { MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbind) (*MplsIPBindUnbindReply, error) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) @@ -36,7 +37,7 @@ func (c *serviceClient) MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) { @@ -45,7 +46,7 @@ func (c *serviceClient) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsRouteDump(ctx context.Context, in *MplsRouteDump) (RPCService_MplsRouteDumpClient, error) { @@ -57,7 +58,7 @@ func (c *serviceClient) MplsRouteDump(ctx context.Context, in *MplsRouteDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -80,7 +81,11 @@ func (c *serviceClient_MplsRouteDumpClient) Recv() (*MplsRouteDetails, error) { switch m := msg.(type) { case *MplsRouteDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -93,7 +98,7 @@ func (c *serviceClient) MplsTableAddDel(ctx context.Context, in *MplsTableAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsTableDump(ctx context.Context, in *MplsTableDump) (RPCService_MplsTableDumpClient, error) { @@ -105,7 +110,7 @@ func (c *serviceClient) MplsTableDump(ctx context.Context, in *MplsTableDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -128,7 +133,11 @@ func (c *serviceClient_MplsTableDumpClient) Recv() (*MplsTableDetails, error) { switch m := msg.(type) { case *MplsTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -141,7 +150,7 @@ func (c *serviceClient) MplsTunnelAddDel(ctx context.Context, in *MplsTunnelAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsTunnelDump(ctx context.Context, in *MplsTunnelDump) (RPCService_MplsTunnelDumpClient, error) { @@ -153,7 +162,7 @@ func (c *serviceClient) MplsTunnelDump(ctx context.Context, in *MplsTunnelDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -176,7 +185,11 @@ func (c *serviceClient_MplsTunnelDumpClient) Recv() (*MplsTunnelDetails, error) switch m := msg.(type) { case *MplsTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -189,5 +202,5 @@ func (c *serviceClient) SwInterfaceSetMplsEnable(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/mss_clamp/mss_clamp.ba.go b/binapi/mss_clamp/mss_clamp.ba.go new file mode 100644 index 0000000..a4f5e09 --- /dev/null +++ b/binapi/mss_clamp/mss_clamp.ba.go @@ -0,0 +1,307 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/mss_clamp.api.json + +// Package mss_clamp contains generated bindings for API file mss_clamp.api. +// +// Contents: +// 1 enum +// 5 messages +// +package mss_clamp + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "mss_clamp" + APIVersion = "1.0.0" + VersionCrc = 0xea8186c0 +) + +// MssClampDir defines enum 'mss_clamp_dir'. +type MssClampDir uint8 + +const ( + MSS_CLAMP_DIR_NONE MssClampDir = 0 + MSS_CLAMP_DIR_RX MssClampDir = 1 + MSS_CLAMP_DIR_TX MssClampDir = 2 +) + +var ( + MssClampDir_name = map[uint8]string{ + 0: "MSS_CLAMP_DIR_NONE", + 1: "MSS_CLAMP_DIR_RX", + 2: "MSS_CLAMP_DIR_TX", + } + MssClampDir_value = map[string]uint8{ + "MSS_CLAMP_DIR_NONE": 0, + "MSS_CLAMP_DIR_RX": 1, + "MSS_CLAMP_DIR_TX": 2, + } +) + +func (x MssClampDir) String() string { + s, ok := MssClampDir_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := MssClampDir_name[uint8(n)] + if ok { + return s + } + return "MssClampDir(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// MssClampDetails defines message 'mss_clamp_details'. +type MssClampDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPv4Mss uint16 `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"` + IPv6Mss uint16 `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"` + IPv4Direction MssClampDir `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"` + IPv6Direction MssClampDir `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"` +} + +func (m *MssClampDetails) Reset() { *m = MssClampDetails{} } +func (*MssClampDetails) GetMessageName() string { return "mss_clamp_details" } +func (*MssClampDetails) GetCrcString() string { return "d3a4de61" } +func (*MssClampDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MssClampDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 2 // m.IPv4Mss + size += 2 // m.IPv6Mss + size += 1 // m.IPv4Direction + size += 1 // m.IPv6Direction + return size +} +func (m *MssClampDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(m.IPv4Mss) + buf.EncodeUint16(m.IPv6Mss) + buf.EncodeUint8(uint8(m.IPv4Direction)) + buf.EncodeUint8(uint8(m.IPv6Direction)) + return buf.Bytes(), nil +} +func (m *MssClampDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IPv4Mss = buf.DecodeUint16() + m.IPv6Mss = buf.DecodeUint16() + m.IPv4Direction = MssClampDir(buf.DecodeUint8()) + m.IPv6Direction = MssClampDir(buf.DecodeUint8()) + return nil +} + +// MssClampEnableDisable defines message 'mss_clamp_enable_disable'. +type MssClampEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPv4Mss uint16 `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"` + IPv6Mss uint16 `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"` + IPv4Direction MssClampDir `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"` + IPv6Direction MssClampDir `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"` +} + +func (m *MssClampEnableDisable) Reset() { *m = MssClampEnableDisable{} } +func (*MssClampEnableDisable) GetMessageName() string { return "mss_clamp_enable_disable" } +func (*MssClampEnableDisable) GetCrcString() string { return "d31b44e3" } +func (*MssClampEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MssClampEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 2 // m.IPv4Mss + size += 2 // m.IPv6Mss + size += 1 // m.IPv4Direction + size += 1 // m.IPv6Direction + return size +} +func (m *MssClampEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(m.IPv4Mss) + buf.EncodeUint16(m.IPv6Mss) + buf.EncodeUint8(uint8(m.IPv4Direction)) + buf.EncodeUint8(uint8(m.IPv6Direction)) + return buf.Bytes(), nil +} +func (m *MssClampEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IPv4Mss = buf.DecodeUint16() + m.IPv6Mss = buf.DecodeUint16() + m.IPv4Direction = MssClampDir(buf.DecodeUint8()) + m.IPv6Direction = MssClampDir(buf.DecodeUint8()) + return nil +} + +// MssClampEnableDisableReply defines message 'mss_clamp_enable_disable_reply'. +type MssClampEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MssClampEnableDisableReply) Reset() { *m = MssClampEnableDisableReply{} } +func (*MssClampEnableDisableReply) GetMessageName() string { return "mss_clamp_enable_disable_reply" } +func (*MssClampEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*MssClampEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MssClampEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *MssClampEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *MssClampEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// MssClampGet defines message 'mss_clamp_get'. +type MssClampGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MssClampGet) Reset() { *m = MssClampGet{} } +func (*MssClampGet) GetMessageName() string { return "mss_clamp_get" } +func (*MssClampGet) GetCrcString() string { return "47250981" } +func (*MssClampGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MssClampGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + size += 4 // m.SwIfIndex + return size +} +func (m *MssClampGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MssClampGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MssClampGetReply defines message 'mss_clamp_get_reply'. +type MssClampGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *MssClampGetReply) Reset() { *m = MssClampGetReply{} } +func (*MssClampGetReply) GetMessageName() string { return "mss_clamp_get_reply" } +func (*MssClampGetReply) GetCrcString() string { return "53b48f5d" } +func (*MssClampGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MssClampGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *MssClampGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *MssClampGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +func init() { file_mss_clamp_binapi_init() } +func file_mss_clamp_binapi_init() { + api.RegisterMessage((*MssClampDetails)(nil), "mss_clamp_details_d3a4de61") + api.RegisterMessage((*MssClampEnableDisable)(nil), "mss_clamp_enable_disable_d31b44e3") + api.RegisterMessage((*MssClampEnableDisableReply)(nil), "mss_clamp_enable_disable_reply_e8d4e804") + api.RegisterMessage((*MssClampGet)(nil), "mss_clamp_get_47250981") + api.RegisterMessage((*MssClampGetReply)(nil), "mss_clamp_get_reply_53b48f5d") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MssClampDetails)(nil), + (*MssClampEnableDisable)(nil), + (*MssClampEnableDisableReply)(nil), + (*MssClampGet)(nil), + (*MssClampGetReply)(nil), + } +} diff --git a/binapi/mss_clamp/mss_clamp_rpc.ba.go b/binapi/mss_clamp/mss_clamp_rpc.ba.go new file mode 100644 index 0000000..d533af9 --- /dev/null +++ b/binapi/mss_clamp/mss_clamp_rpc.ba.go @@ -0,0 +1,74 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mss_clamp + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service mss_clamp. +type RPCService interface { + MssClampEnableDisable(ctx context.Context, in *MssClampEnableDisable) (*MssClampEnableDisableReply, error) + MssClampGet(ctx context.Context, in *MssClampGet) (RPCService_MssClampGetClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MssClampEnableDisable(ctx context.Context, in *MssClampEnableDisable) (*MssClampEnableDisableReply, error) { + out := new(MssClampEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) MssClampGet(ctx context.Context, in *MssClampGet) (RPCService_MssClampGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MssClampGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MssClampGetClient interface { + Recv() (*MssClampDetails, error) + api.Stream +} + +type serviceClient_MssClampGetClient struct { + api.Stream +} + +func (c *serviceClient_MssClampGetClient) Recv() (*MssClampDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MssClampDetails: + return m, nil + case *MssClampGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nat/nat_rest.ba.go b/binapi/nat/nat_rest.ba.go deleted file mode 100644 index 7740ea1..0000000 --- a/binapi/nat/nat_rest.ba.go +++ /dev/null @@ -1,913 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nat - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nat44_add_del_address_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelAddressRange) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44AddDelAddressRange(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_add_del_identity_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelIdentityMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44AddDelIdentityMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelInterfaceAddr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44AddDelInterfaceAddr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_add_del_lb_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelLbStaticMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44AddDelLbStaticMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelStaticMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44AddDelStaticMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44DelSession) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44DelSession(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_del_user", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44DelUser) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44DelUser(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_forwarding_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44ForwardingEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44ForwardingEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_forwarding_is_enabled", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44ForwardingIsEnabled) - reply, err := rpc.Nat44ForwardingIsEnabled(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_interface_add_del_feature", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44InterfaceAddDelFeature) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44InterfaceAddDelFeature(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_interface_add_del_output_feature", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44InterfaceAddDelOutputFeature) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44InterfaceAddDelOutputFeature(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_lb_static_mapping_add_del_local", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44LbStaticMappingAddDelLocal) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44LbStaticMappingAddDelLocal(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_session_cleanup", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44SessionCleanup) - reply, err := rpc.Nat44SessionCleanup(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat44_set_session_limit", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44SetSessionLimit) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat44SetSessionLimit(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat64_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat64AddDelInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat64_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelInterfaceAddr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat64AddDelInterfaceAddr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat64_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelPoolAddrRange) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat64AddDelPoolAddrRange(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat64_add_del_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelPrefix) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat64AddDelPrefix(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat64_add_del_static_bib", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelStaticBib) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat64AddDelStaticBib(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat66_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat66AddDelInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat66AddDelInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat66_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat66AddDelStaticMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Nat66AddDelStaticMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatControlPing) - reply, err := rpc.NatControlPing(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_det_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetAddDelMap) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatDetAddDelMap(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_det_close_session_in", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetCloseSessionIn) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatDetCloseSessionIn(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_det_close_session_out", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetCloseSessionOut) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatDetCloseSessionOut(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_det_forward", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetForward) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatDetForward(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_det_reverse", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetReverse) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatDetReverse(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_get_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetAddrAndPortAllocAlg) - reply, err := rpc.NatGetAddrAndPortAllocAlg(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_get_mss_clamping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetMssClamping) - reply, err := rpc.NatGetMssClamping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_get_timeouts", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetTimeouts) - reply, err := rpc.NatGetTimeouts(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaFlush) - reply, err := rpc.NatHaFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_get_failover", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaGetFailover) - reply, err := rpc.NatHaGetFailover(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_get_listener", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaGetListener) - reply, err := rpc.NatHaGetListener(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_resync", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaResync) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatHaResync(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_set_failover", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaSetFailover) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatHaSetFailover(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ha_set_listener", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaSetListener) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatHaSetListener(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_ipfix_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatIpfixEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatIpfixEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_set_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetAddrAndPortAllocAlg) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatSetAddrAndPortAllocAlg(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_set_log_level", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetLogLevel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatSetLogLevel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_set_mss_clamping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetMssClamping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatSetMssClamping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_set_timeouts", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetTimeouts) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatSetTimeouts(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_set_workers", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetWorkers) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NatSetWorkers(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nat_show_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatShowConfig) - reply, err := rpc.NatShowConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/nat/nat.ba.go b/binapi/nat44_ed/nat44_ed.ba.go index 811ed63..938940e 100644 --- a/binapi/nat/nat.ba.go +++ b/binapi/nat44_ed/nat44_ed.ba.go @@ -1,24 +1,26 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/nat.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/nat44_ed.api.json -// Package nat contains generated bindings for API file nat.api. +// Package nat44_ed contains generated bindings for API file nat44_ed.api. // // Contents: -// 2 enums +// 1 enum // 1 struct -// 125 messages +// 104 messages // -package nat +package nat44_ed import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + nat_types "go.fd.io/govpp/binapi/nat_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,62 +30,50 @@ import ( const _ = api.GoVppAPIPackageIsVersion2 const ( - APIFile = "nat" - APIVersion = "5.2.0" - VersionCrc = 0xabdcbb0d + APIFile = "nat44_ed" + APIVersion = "5.4.0" + VersionCrc = 0x5697d0ef ) -// NatConfigFlags defines enum 'nat_config_flags'. -type NatConfigFlags uint8 +// Nat44ConfigFlags defines enum 'nat44_config_flags'. +type Nat44ConfigFlags uint8 const ( - NAT_IS_NONE NatConfigFlags = 0 - NAT_IS_TWICE_NAT NatConfigFlags = 1 - NAT_IS_SELF_TWICE_NAT NatConfigFlags = 2 - NAT_IS_OUT2IN_ONLY NatConfigFlags = 4 - NAT_IS_ADDR_ONLY NatConfigFlags = 8 - NAT_IS_OUTSIDE NatConfigFlags = 16 - NAT_IS_INSIDE NatConfigFlags = 32 - NAT_IS_STATIC NatConfigFlags = 64 - NAT_IS_EXT_HOST_VALID NatConfigFlags = 128 + NAT44_IS_ENDPOINT_INDEPENDENT Nat44ConfigFlags = 0 + NAT44_IS_ENDPOINT_DEPENDENT Nat44ConfigFlags = 1 + NAT44_IS_STATIC_MAPPING_ONLY Nat44ConfigFlags = 2 + NAT44_IS_CONNECTION_TRACKING Nat44ConfigFlags = 4 + NAT44_IS_OUT2IN_DPO Nat44ConfigFlags = 8 ) var ( - NatConfigFlags_name = map[uint8]string{ - 0: "NAT_IS_NONE", - 1: "NAT_IS_TWICE_NAT", - 2: "NAT_IS_SELF_TWICE_NAT", - 4: "NAT_IS_OUT2IN_ONLY", - 8: "NAT_IS_ADDR_ONLY", - 16: "NAT_IS_OUTSIDE", - 32: "NAT_IS_INSIDE", - 64: "NAT_IS_STATIC", - 128: "NAT_IS_EXT_HOST_VALID", - } - NatConfigFlags_value = map[string]uint8{ - "NAT_IS_NONE": 0, - "NAT_IS_TWICE_NAT": 1, - "NAT_IS_SELF_TWICE_NAT": 2, - "NAT_IS_OUT2IN_ONLY": 4, - "NAT_IS_ADDR_ONLY": 8, - "NAT_IS_OUTSIDE": 16, - "NAT_IS_INSIDE": 32, - "NAT_IS_STATIC": 64, - "NAT_IS_EXT_HOST_VALID": 128, + Nat44ConfigFlags_name = map[uint8]string{ + 0: "NAT44_IS_ENDPOINT_INDEPENDENT", + 1: "NAT44_IS_ENDPOINT_DEPENDENT", + 2: "NAT44_IS_STATIC_MAPPING_ONLY", + 4: "NAT44_IS_CONNECTION_TRACKING", + 8: "NAT44_IS_OUT2IN_DPO", + } + Nat44ConfigFlags_value = map[string]uint8{ + "NAT44_IS_ENDPOINT_INDEPENDENT": 0, + "NAT44_IS_ENDPOINT_DEPENDENT": 1, + "NAT44_IS_STATIC_MAPPING_ONLY": 2, + "NAT44_IS_CONNECTION_TRACKING": 4, + "NAT44_IS_OUT2IN_DPO": 8, } ) -func (x NatConfigFlags) String() string { - s, ok := NatConfigFlags_name[uint8(x)] +func (x Nat44ConfigFlags) String() string { + s, ok := Nat44ConfigFlags_name[uint8(x)] if ok { return s } str := func(n uint8) string { - s, ok := NatConfigFlags_name[uint8(n)] + s, ok := Nat44ConfigFlags_name[uint8(n)] if ok { return s } - return "NatConfigFlags(" + strconv.Itoa(int(n)) + ")" + return "Nat44ConfigFlags(" + strconv.Itoa(int(n)) + ")" } for i := uint8(0); i <= 8; i++ { val := uint8(x) @@ -100,45 +90,6 @@ func (x NatConfigFlags) String() string { return s } -// NatLogLevel defines enum 'nat_log_level'. -type NatLogLevel uint8 - -const ( - NAT_LOG_NONE NatLogLevel = 0 - NAT_LOG_ERROR NatLogLevel = 1 - NAT_LOG_WARNING NatLogLevel = 2 - NAT_LOG_NOTICE NatLogLevel = 3 - NAT_LOG_INFO NatLogLevel = 4 - NAT_LOG_DEBUG NatLogLevel = 5 -) - -var ( - NatLogLevel_name = map[uint8]string{ - 0: "NAT_LOG_NONE", - 1: "NAT_LOG_ERROR", - 2: "NAT_LOG_WARNING", - 3: "NAT_LOG_NOTICE", - 4: "NAT_LOG_INFO", - 5: "NAT_LOG_DEBUG", - } - NatLogLevel_value = map[string]uint8{ - "NAT_LOG_NONE": 0, - "NAT_LOG_ERROR": 1, - "NAT_LOG_WARNING": 2, - "NAT_LOG_NOTICE": 3, - "NAT_LOG_INFO": 4, - "NAT_LOG_DEBUG": 5, - } -) - -func (x NatLogLevel) String() string { - s, ok := NatLogLevel_name[uint8(x)] - if ok { - return s - } - return "NatLogLevel(" + strconv.Itoa(int(x)) + ")" -} - // Nat44LbAddrPort defines type 'nat44_lb_addr_port'. type Nat44LbAddrPort struct { Addr ip_types.IP4Address `binapi:"ip4_address,name=addr" json:"addr,omitempty"` @@ -149,16 +100,16 @@ type Nat44LbAddrPort struct { // Nat44AddDelAddressRange defines message 'nat44_add_del_address_range'. type Nat44AddDelAddressRange struct { - FirstIPAddress ip_types.IP4Address `binapi:"ip4_address,name=first_ip_address" json:"first_ip_address,omitempty"` - LastIPAddress ip_types.IP4Address `binapi:"ip4_address,name=last_ip_address" json:"last_ip_address,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + FirstIPAddress ip_types.IP4Address `binapi:"ip4_address,name=first_ip_address" json:"first_ip_address,omitempty"` + LastIPAddress ip_types.IP4Address `binapi:"ip4_address,name=last_ip_address" json:"last_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` } func (m *Nat44AddDelAddressRange) Reset() { *m = Nat44AddDelAddressRange{} } func (*Nat44AddDelAddressRange) GetMessageName() string { return "nat44_add_del_address_range" } -func (*Nat44AddDelAddressRange) GetCrcString() string { return "d4c7568c" } +func (*Nat44AddDelAddressRange) GetCrcString() string { return "6f2b8055" } func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType { return api.RequestMessage } @@ -192,7 +143,7 @@ func (m *Nat44AddDelAddressRange) Unmarshal(b []byte) error { copy(m.LastIPAddress[:], buf.DecodeBytes(4)) m.VrfID = buf.DecodeUint32() m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) return nil } @@ -234,7 +185,7 @@ func (m *Nat44AddDelAddressRangeReply) Unmarshal(b []byte) error { // Nat44AddDelIdentityMapping defines message 'nat44_add_del_identity_mapping'. type Nat44AddDelIdentityMapping struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` @@ -245,7 +196,7 @@ type Nat44AddDelIdentityMapping struct { func (m *Nat44AddDelIdentityMapping) Reset() { *m = Nat44AddDelIdentityMapping{} } func (*Nat44AddDelIdentityMapping) GetMessageName() string { return "nat44_add_del_identity_mapping" } -func (*Nat44AddDelIdentityMapping) GetCrcString() string { return "8e12743f" } +func (*Nat44AddDelIdentityMapping) GetCrcString() string { return "02faaa22" } func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType { return api.RequestMessage } @@ -282,7 +233,7 @@ func (m *Nat44AddDelIdentityMapping) Marshal(b []byte) ([]byte, error) { func (m *Nat44AddDelIdentityMapping) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.IPAddress[:], buf.DecodeBytes(4)) m.Protocol = buf.DecodeUint8() m.Port = buf.DecodeUint16() @@ -331,12 +282,12 @@ func (m *Nat44AddDelIdentityMappingReply) Unmarshal(b []byte) error { type Nat44AddDelInterfaceAddr struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` } func (m *Nat44AddDelInterfaceAddr) Reset() { *m = Nat44AddDelInterfaceAddr{} } func (*Nat44AddDelInterfaceAddr) GetMessageName() string { return "nat44_add_del_interface_addr" } -func (*Nat44AddDelInterfaceAddr) GetCrcString() string { return "fc835325" } +func (*Nat44AddDelInterfaceAddr) GetCrcString() string { return "4aed50c0" } func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType { return api.RequestMessage } @@ -364,7 +315,7 @@ func (m *Nat44AddDelInterfaceAddr) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) return nil } @@ -405,20 +356,20 @@ func (m *Nat44AddDelInterfaceAddrReply) Unmarshal(b []byte) error { // Nat44AddDelLbStaticMapping defines message 'nat44_add_del_lb_static_mapping'. type Nat44AddDelLbStaticMapping struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` - ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` - Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` - Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` - LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` - Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` + Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` } func (m *Nat44AddDelLbStaticMapping) Reset() { *m = Nat44AddDelLbStaticMapping{} } func (*Nat44AddDelLbStaticMapping) GetMessageName() string { return "nat44_add_del_lb_static_mapping" } -func (*Nat44AddDelLbStaticMapping) GetCrcString() string { return "53b24611" } +func (*Nat44AddDelLbStaticMapping) GetCrcString() string { return "4f68ee9d" } func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } @@ -476,7 +427,7 @@ func (m *Nat44AddDelLbStaticMapping) Marshal(b []byte) ([]byte, error) { func (m *Nat44AddDelLbStaticMapping) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.ExternalAddr[:], buf.DecodeBytes(4)) m.ExternalPort = buf.DecodeUint16() m.Protocol = buf.DecodeUint8() @@ -531,7 +482,7 @@ func (m *Nat44AddDelLbStaticMappingReply) Unmarshal(b []byte) error { // Nat44AddDelStaticMapping defines message 'nat44_add_del_static_mapping'. type Nat44AddDelStaticMapping struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` @@ -544,7 +495,7 @@ type Nat44AddDelStaticMapping struct { func (m *Nat44AddDelStaticMapping) Reset() { *m = Nat44AddDelStaticMapping{} } func (*Nat44AddDelStaticMapping) GetMessageName() string { return "nat44_add_del_static_mapping" } -func (*Nat44AddDelStaticMapping) GetCrcString() string { return "e165e83b" } +func (*Nat44AddDelStaticMapping) GetCrcString() string { return "5ae5f03e" } func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } @@ -585,7 +536,7 @@ func (m *Nat44AddDelStaticMapping) Marshal(b []byte) ([]byte, error) { func (m *Nat44AddDelStaticMapping) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) m.Protocol = buf.DecodeUint8() @@ -632,16 +583,130 @@ func (m *Nat44AddDelStaticMappingReply) Unmarshal(b []byte) error { return nil } +// Nat44AddDelStaticMappingV2 defines message 'nat44_add_del_static_mapping_v2'. +// InProgress: the message form may change in the future versions +type Nat44AddDelStaticMappingV2 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + MatchPool bool `binapi:"bool,name=match_pool" json:"match_pool,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + PoolIPAddress ip_types.IP4Address `binapi:"ip4_address,name=pool_ip_address" json:"pool_ip_address,omitempty"` + LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + ExternalSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=external_sw_if_index" json:"external_sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44AddDelStaticMappingV2) Reset() { *m = Nat44AddDelStaticMappingV2{} } +func (*Nat44AddDelStaticMappingV2) GetMessageName() string { return "nat44_add_del_static_mapping_v2" } +func (*Nat44AddDelStaticMappingV2) GetCrcString() string { return "5e205f1a" } +func (*Nat44AddDelStaticMappingV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelStaticMappingV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.MatchPool + size += 1 // m.Flags + size += 1 * 4 // m.PoolIPAddress + size += 1 * 4 // m.LocalIPAddress + size += 1 * 4 // m.ExternalIPAddress + size += 1 // m.Protocol + size += 2 // m.LocalPort + size += 2 // m.ExternalPort + size += 4 // m.ExternalSwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44AddDelStaticMappingV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.MatchPool) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.PoolIPAddress[:], 4) + buf.EncodeBytes(m.LocalIPAddress[:], 4) + buf.EncodeBytes(m.ExternalIPAddress[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.LocalPort) + buf.EncodeUint16(m.ExternalPort) + buf.EncodeUint32(uint32(m.ExternalSwIfIndex)) + buf.EncodeUint32(m.VrfID) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44AddDelStaticMappingV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.MatchPool = buf.DecodeBool() + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + copy(m.PoolIPAddress[:], buf.DecodeBytes(4)) + copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.LocalPort = buf.DecodeUint16() + m.ExternalPort = buf.DecodeUint16() + m.ExternalSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44AddDelStaticMappingV2Reply defines message 'nat44_add_del_static_mapping_v2_reply'. +// InProgress: the message form may change in the future versions +type Nat44AddDelStaticMappingV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelStaticMappingV2Reply) Reset() { *m = Nat44AddDelStaticMappingV2Reply{} } +func (*Nat44AddDelStaticMappingV2Reply) GetMessageName() string { + return "nat44_add_del_static_mapping_v2_reply" +} +func (*Nat44AddDelStaticMappingV2Reply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelStaticMappingV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelStaticMappingV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelStaticMappingV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44AddDelStaticMappingV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // Nat44AddressDetails defines message 'nat44_address_details'. type Nat44AddressDetails struct { - IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *Nat44AddressDetails) Reset() { *m = Nat44AddressDetails{} } func (*Nat44AddressDetails) GetMessageName() string { return "nat44_address_details" } -func (*Nat44AddressDetails) GetCrcString() string { return "45410ac4" } +func (*Nat44AddressDetails) GetCrcString() string { return "0d1beac1" } func (*Nat44AddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -668,7 +733,7 @@ func (m *Nat44AddressDetails) Marshal(b []byte) ([]byte, error) { func (m *Nat44AddressDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) copy(m.IPAddress[:], buf.DecodeBytes(4)) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.VrfID = buf.DecodeUint32() return nil } @@ -702,18 +767,18 @@ func (m *Nat44AddressDump) Unmarshal(b []byte) error { // Nat44DelSession defines message 'nat44_del_session'. type Nat44DelSession struct { - Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` - Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` - ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` } func (m *Nat44DelSession) Reset() { *m = Nat44DelSession{} } func (*Nat44DelSession) GetMessageName() string { return "nat44_del_session" } -func (*Nat44DelSession) GetCrcString() string { return "4c49c387" } +func (*Nat44DelSession) GetCrcString() string { return "15a5bf8c" } func (*Nat44DelSession) GetMessageType() api.MessageType { return api.RequestMessage } @@ -751,7 +816,7 @@ func (m *Nat44DelSession) Unmarshal(b []byte) error { m.Protocol = buf.DecodeUint8() m.Port = buf.DecodeUint16() m.VrfID = buf.DecodeUint32() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) m.ExtHostPort = buf.DecodeUint16() return nil @@ -860,7 +925,413 @@ func (m *Nat44DelUserReply) Unmarshal(b []byte) error { return nil } +// Nat44EdAddDelOutputInterface defines message 'nat44_ed_add_del_output_interface'. +type Nat44EdAddDelOutputInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EdAddDelOutputInterface) Reset() { *m = Nat44EdAddDelOutputInterface{} } +func (*Nat44EdAddDelOutputInterface) GetMessageName() string { + return "nat44_ed_add_del_output_interface" +} +func (*Nat44EdAddDelOutputInterface) GetCrcString() string { return "47d6e753" } +func (*Nat44EdAddDelOutputInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EdAddDelOutputInterface) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EdAddDelOutputInterface) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EdAddDelOutputInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EdAddDelOutputInterfaceReply defines message 'nat44_ed_add_del_output_interface_reply'. +type Nat44EdAddDelOutputInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EdAddDelOutputInterfaceReply) Reset() { *m = Nat44EdAddDelOutputInterfaceReply{} } +func (*Nat44EdAddDelOutputInterfaceReply) GetMessageName() string { + return "nat44_ed_add_del_output_interface_reply" +} +func (*Nat44EdAddDelOutputInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EdAddDelOutputInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdAddDelOutputInterfaceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EdAddDelOutputInterfaceReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EdAddDelOutputInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EdOutputInterfaceDetails defines message 'nat44_ed_output_interface_details'. +type Nat44EdOutputInterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EdOutputInterfaceDetails) Reset() { *m = Nat44EdOutputInterfaceDetails{} } +func (*Nat44EdOutputInterfaceDetails) GetMessageName() string { + return "nat44_ed_output_interface_details" +} +func (*Nat44EdOutputInterfaceDetails) GetCrcString() string { return "0b45011c" } +func (*Nat44EdOutputInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdOutputInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EdOutputInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EdOutputInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EdOutputInterfaceGet defines message 'nat44_ed_output_interface_get'. +type Nat44EdOutputInterfaceGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *Nat44EdOutputInterfaceGet) Reset() { *m = Nat44EdOutputInterfaceGet{} } +func (*Nat44EdOutputInterfaceGet) GetMessageName() string { return "nat44_ed_output_interface_get" } +func (*Nat44EdOutputInterfaceGet) GetCrcString() string { return "f75ba505" } +func (*Nat44EdOutputInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EdOutputInterfaceGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *Nat44EdOutputInterfaceGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *Nat44EdOutputInterfaceGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// Nat44EdOutputInterfaceGetReply defines message 'nat44_ed_output_interface_get_reply'. +type Nat44EdOutputInterfaceGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *Nat44EdOutputInterfaceGetReply) Reset() { *m = Nat44EdOutputInterfaceGetReply{} } +func (*Nat44EdOutputInterfaceGetReply) GetMessageName() string { + return "nat44_ed_output_interface_get_reply" +} +func (*Nat44EdOutputInterfaceGetReply) GetCrcString() string { return "53b48f5d" } +func (*Nat44EdOutputInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdOutputInterfaceGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *Nat44EdOutputInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *Nat44EdOutputInterfaceGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +// Nat44EdPluginEnableDisable defines message 'nat44_ed_plugin_enable_disable'. +// InProgress: the message form may change in the future versions +type Nat44EdPluginEnableDisable struct { + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Sessions uint32 `binapi:"u32,name=sessions" json:"sessions,omitempty"` + SessionMemory uint32 `binapi:"u32,name=session_memory" json:"session_memory,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + Flags Nat44ConfigFlags `binapi:"nat44_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44EdPluginEnableDisable) Reset() { *m = Nat44EdPluginEnableDisable{} } +func (*Nat44EdPluginEnableDisable) GetMessageName() string { return "nat44_ed_plugin_enable_disable" } +func (*Nat44EdPluginEnableDisable) GetCrcString() string { return "be17f8dd" } +func (*Nat44EdPluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EdPluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 4 // m.Sessions + size += 4 // m.SessionMemory + size += 1 // m.Enable + size += 1 // m.Flags + return size +} +func (m *Nat44EdPluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeUint32(m.Sessions) + buf.EncodeUint32(m.SessionMemory) + buf.EncodeBool(m.Enable) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44EdPluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Sessions = buf.DecodeUint32() + m.SessionMemory = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + m.Flags = Nat44ConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44EdPluginEnableDisableReply defines message 'nat44_ed_plugin_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Nat44EdPluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EdPluginEnableDisableReply) Reset() { *m = Nat44EdPluginEnableDisableReply{} } +func (*Nat44EdPluginEnableDisableReply) GetMessageName() string { + return "nat44_ed_plugin_enable_disable_reply" +} +func (*Nat44EdPluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EdPluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdPluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EdPluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EdPluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EdSetFqOptions defines message 'nat44_ed_set_fq_options'. +// InProgress: the message form may change in the future versions +type Nat44EdSetFqOptions struct { + FrameQueueNelts uint32 `binapi:"u32,name=frame_queue_nelts" json:"frame_queue_nelts,omitempty"` +} + +func (m *Nat44EdSetFqOptions) Reset() { *m = Nat44EdSetFqOptions{} } +func (*Nat44EdSetFqOptions) GetMessageName() string { return "nat44_ed_set_fq_options" } +func (*Nat44EdSetFqOptions) GetCrcString() string { return "2399bd71" } +func (*Nat44EdSetFqOptions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EdSetFqOptions) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.FrameQueueNelts + return size +} +func (m *Nat44EdSetFqOptions) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FrameQueueNelts) + return buf.Bytes(), nil +} +func (m *Nat44EdSetFqOptions) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FrameQueueNelts = buf.DecodeUint32() + return nil +} + +// Nat44EdSetFqOptionsReply defines message 'nat44_ed_set_fq_options_reply'. +// InProgress: the message form may change in the future versions +type Nat44EdSetFqOptionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EdSetFqOptionsReply) Reset() { *m = Nat44EdSetFqOptionsReply{} } +func (*Nat44EdSetFqOptionsReply) GetMessageName() string { return "nat44_ed_set_fq_options_reply" } +func (*Nat44EdSetFqOptionsReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EdSetFqOptionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdSetFqOptionsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EdSetFqOptionsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EdSetFqOptionsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EdShowFqOptions defines message 'nat44_ed_show_fq_options'. +// InProgress: the message form may change in the future versions +type Nat44EdShowFqOptions struct{} + +func (m *Nat44EdShowFqOptions) Reset() { *m = Nat44EdShowFqOptions{} } +func (*Nat44EdShowFqOptions) GetMessageName() string { return "nat44_ed_show_fq_options" } +func (*Nat44EdShowFqOptions) GetCrcString() string { return "51077d14" } +func (*Nat44EdShowFqOptions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EdShowFqOptions) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EdShowFqOptions) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EdShowFqOptions) Unmarshal(b []byte) error { + return nil +} + +// Nat44EdShowFqOptionsReply defines message 'nat44_ed_show_fq_options_reply'. +// InProgress: the message form may change in the future versions +type Nat44EdShowFqOptionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FrameQueueNelts uint32 `binapi:"u32,name=frame_queue_nelts" json:"frame_queue_nelts,omitempty"` +} + +func (m *Nat44EdShowFqOptionsReply) Reset() { *m = Nat44EdShowFqOptionsReply{} } +func (*Nat44EdShowFqOptionsReply) GetMessageName() string { return "nat44_ed_show_fq_options_reply" } +func (*Nat44EdShowFqOptionsReply) GetCrcString() string { return "7213b545" } +func (*Nat44EdShowFqOptionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EdShowFqOptionsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.FrameQueueNelts + return size +} +func (m *Nat44EdShowFqOptionsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.FrameQueueNelts) + return buf.Bytes(), nil +} +func (m *Nat44EdShowFqOptionsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.FrameQueueNelts = buf.DecodeUint32() + return nil +} + // Nat44ForwardingEnableDisable defines message 'nat44_forwarding_enable_disable'. +// Deprecated: the message will be removed in the future versions type Nat44ForwardingEnableDisable struct { Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` } @@ -896,6 +1367,7 @@ func (m *Nat44ForwardingEnableDisable) Unmarshal(b []byte) error { } // Nat44ForwardingEnableDisableReply defines message 'nat44_forwarding_enable_disable_reply'. +// Deprecated: the message will be removed in the future versions type Nat44ForwardingEnableDisableReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -931,6 +1403,7 @@ func (m *Nat44ForwardingEnableDisableReply) Unmarshal(b []byte) error { } // Nat44ForwardingIsEnabled defines message 'nat44_forwarding_is_enabled'. +// Deprecated: the message will be removed in the future versions type Nat44ForwardingIsEnabled struct{} func (m *Nat44ForwardingIsEnabled) Reset() { *m = Nat44ForwardingIsEnabled{} } @@ -958,6 +1431,7 @@ func (m *Nat44ForwardingIsEnabled) Unmarshal(b []byte) error { } // Nat44ForwardingIsEnabledReply defines message 'nat44_forwarding_is_enabled_reply'. +// Deprecated: the message will be removed in the future versions type Nat44ForwardingIsEnabledReply struct { Enabled bool `binapi:"bool,name=enabled" json:"enabled,omitempty"` } @@ -994,7 +1468,7 @@ func (m *Nat44ForwardingIsEnabledReply) Unmarshal(b []byte) error { // Nat44IdentityMappingDetails defines message 'nat44_identity_mapping_details'. type Nat44IdentityMappingDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` @@ -1005,7 +1479,7 @@ type Nat44IdentityMappingDetails struct { func (m *Nat44IdentityMappingDetails) Reset() { *m = Nat44IdentityMappingDetails{} } func (*Nat44IdentityMappingDetails) GetMessageName() string { return "nat44_identity_mapping_details" } -func (*Nat44IdentityMappingDetails) GetCrcString() string { return "36d21351" } +func (*Nat44IdentityMappingDetails) GetCrcString() string { return "2a52a030" } func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1039,7 +1513,7 @@ func (m *Nat44IdentityMappingDetails) Marshal(b []byte) ([]byte, error) { } func (m *Nat44IdentityMappingDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.IPAddress[:], buf.DecodeBytes(4)) m.Protocol = buf.DecodeUint8() m.Port = buf.DecodeUint16() @@ -1079,7 +1553,7 @@ func (m *Nat44IdentityMappingDump) Unmarshal(b []byte) error { // Nat44InterfaceAddDelFeature defines message 'nat44_interface_add_del_feature'. type Nat44InterfaceAddDelFeature struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -1112,7 +1586,7 @@ func (m *Nat44InterfaceAddDelFeature) Marshal(b []byte) ([]byte, error) { func (m *Nat44InterfaceAddDelFeature) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) return nil } @@ -1153,9 +1627,10 @@ func (m *Nat44InterfaceAddDelFeatureReply) Unmarshal(b []byte) error { } // Nat44InterfaceAddDelOutputFeature defines message 'nat44_interface_add_del_output_feature'. +// Deprecated: the message will be removed in the future versions type Nat44InterfaceAddDelOutputFeature struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -1190,12 +1665,13 @@ func (m *Nat44InterfaceAddDelOutputFeature) Marshal(b []byte) ([]byte, error) { func (m *Nat44InterfaceAddDelOutputFeature) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) return nil } // Nat44InterfaceAddDelOutputFeatureReply defines message 'nat44_interface_add_del_output_feature_reply'. +// Deprecated: the message will be removed in the future versions type Nat44InterfaceAddDelOutputFeatureReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1235,12 +1711,12 @@ func (m *Nat44InterfaceAddDelOutputFeatureReply) Unmarshal(b []byte) error { // Nat44InterfaceAddrDetails defines message 'nat44_interface_addr_details'. type Nat44InterfaceAddrDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` } func (m *Nat44InterfaceAddrDetails) Reset() { *m = Nat44InterfaceAddrDetails{} } func (*Nat44InterfaceAddrDetails) GetMessageName() string { return "nat44_interface_addr_details" } -func (*Nat44InterfaceAddrDetails) GetCrcString() string { return "3e687514" } +func (*Nat44InterfaceAddrDetails) GetCrcString() string { return "e4aca9ca" } func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1265,7 +1741,7 @@ func (m *Nat44InterfaceAddrDetails) Marshal(b []byte) ([]byte, error) { func (m *Nat44InterfaceAddrDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) return nil } @@ -1298,7 +1774,7 @@ func (m *Nat44InterfaceAddrDump) Unmarshal(b []byte) error { // Nat44InterfaceDetails defines message 'nat44_interface_details'. type Nat44InterfaceDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -1328,7 +1804,7 @@ func (m *Nat44InterfaceDetails) Marshal(b []byte) ([]byte, error) { } func (m *Nat44InterfaceDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) return nil } @@ -1361,8 +1837,9 @@ func (m *Nat44InterfaceDump) Unmarshal(b []byte) error { } // Nat44InterfaceOutputFeatureDetails defines message 'nat44_interface_output_feature_details'. +// Deprecated: the message will be removed in the future versions type Nat44InterfaceOutputFeatureDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -1394,12 +1871,13 @@ func (m *Nat44InterfaceOutputFeatureDetails) Marshal(b []byte) ([]byte, error) { } func (m *Nat44InterfaceOutputFeatureDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) return nil } // Nat44InterfaceOutputFeatureDump defines message 'nat44_interface_output_feature_dump'. +// Deprecated: the message will be removed in the future versions type Nat44InterfaceOutputFeatureDump struct{} func (m *Nat44InterfaceOutputFeatureDump) Reset() { *m = Nat44InterfaceOutputFeatureDump{} } @@ -1441,7 +1919,7 @@ func (m *Nat44LbStaticMappingAddDelLocal) Reset() { *m = Nat44LbStaticMappingAdd func (*Nat44LbStaticMappingAddDelLocal) GetMessageName() string { return "nat44_lb_static_mapping_add_del_local" } -func (*Nat44LbStaticMappingAddDelLocal) GetCrcString() string { return "2910a151" } +func (*Nat44LbStaticMappingAddDelLocal) GetCrcString() string { return "7ca47547" } func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1525,19 +2003,19 @@ func (m *Nat44LbStaticMappingAddDelLocalReply) Unmarshal(b []byte) error { // Nat44LbStaticMappingDetails defines message 'nat44_lb_static_mapping_details'. type Nat44LbStaticMappingDetails struct { - ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` - ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` - Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` - LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` - Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` + ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` + Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` } func (m *Nat44LbStaticMappingDetails) Reset() { *m = Nat44LbStaticMappingDetails{} } func (*Nat44LbStaticMappingDetails) GetMessageName() string { return "nat44_lb_static_mapping_details" } -func (*Nat44LbStaticMappingDetails) GetCrcString() string { return "2267b9e8" } +func (*Nat44LbStaticMappingDetails) GetCrcString() string { return "ed5ce876" } func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1595,7 +2073,7 @@ func (m *Nat44LbStaticMappingDetails) Unmarshal(b []byte) error { copy(m.ExternalAddr[:], buf.DecodeBytes(4)) m.ExternalPort = buf.DecodeUint16() m.Protocol = buf.DecodeUint8() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.Affinity = buf.DecodeUint32() m.Tag = buf.DecodeString(64) m.LocalNum = buf.DecodeUint32() @@ -1636,7 +2114,110 @@ func (m *Nat44LbStaticMappingDump) Unmarshal(b []byte) error { return nil } +// Nat44PluginEnableDisable defines message 'nat44_plugin_enable_disable'. +// Deprecated: the message will be removed in the future versions +type Nat44PluginEnableDisable struct { + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Users uint32 `binapi:"u32,name=users" json:"users,omitempty"` + UserMemory uint32 `binapi:"u32,name=user_memory" json:"user_memory,omitempty"` + Sessions uint32 `binapi:"u32,name=sessions" json:"sessions,omitempty"` + SessionMemory uint32 `binapi:"u32,name=session_memory" json:"session_memory,omitempty"` + UserSessions uint32 `binapi:"u32,name=user_sessions" json:"user_sessions,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + Flags Nat44ConfigFlags `binapi:"nat44_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44PluginEnableDisable) Reset() { *m = Nat44PluginEnableDisable{} } +func (*Nat44PluginEnableDisable) GetMessageName() string { return "nat44_plugin_enable_disable" } +func (*Nat44PluginEnableDisable) GetCrcString() string { return "dea0d501" } +func (*Nat44PluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44PluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 4 // m.Users + size += 4 // m.UserMemory + size += 4 // m.Sessions + size += 4 // m.SessionMemory + size += 4 // m.UserSessions + size += 1 // m.Enable + size += 1 // m.Flags + return size +} +func (m *Nat44PluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeUint32(m.Users) + buf.EncodeUint32(m.UserMemory) + buf.EncodeUint32(m.Sessions) + buf.EncodeUint32(m.SessionMemory) + buf.EncodeUint32(m.UserSessions) + buf.EncodeBool(m.Enable) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44PluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Users = buf.DecodeUint32() + m.UserMemory = buf.DecodeUint32() + m.Sessions = buf.DecodeUint32() + m.SessionMemory = buf.DecodeUint32() + m.UserSessions = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + m.Flags = Nat44ConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44PluginEnableDisableReply defines message 'nat44_plugin_enable_disable_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44PluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44PluginEnableDisableReply) Reset() { *m = Nat44PluginEnableDisableReply{} } +func (*Nat44PluginEnableDisableReply) GetMessageName() string { + return "nat44_plugin_enable_disable_reply" +} +func (*Nat44PluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44PluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44PluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44PluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44PluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // Nat44SessionCleanup defines message 'nat44_session_cleanup'. +// Deprecated: the message will be removed in the future versions type Nat44SessionCleanup struct{} func (m *Nat44SessionCleanup) Reset() { *m = Nat44SessionCleanup{} } @@ -1664,6 +2245,7 @@ func (m *Nat44SessionCleanup) Unmarshal(b []byte) error { } // Nat44SessionCleanupReply defines message 'nat44_session_cleanup_reply'. +// Deprecated: the message will be removed in the future versions type Nat44SessionCleanupReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -1766,9 +2348,128 @@ func (m *Nat44SetSessionLimitReply) Unmarshal(b []byte) error { return nil } +// Nat44ShowRunningConfig defines message 'nat44_show_running_config'. +// InProgress: the message form may change in the future versions +type Nat44ShowRunningConfig struct{} + +func (m *Nat44ShowRunningConfig) Reset() { *m = Nat44ShowRunningConfig{} } +func (*Nat44ShowRunningConfig) GetMessageName() string { return "nat44_show_running_config" } +func (*Nat44ShowRunningConfig) GetCrcString() string { return "51077d14" } +func (*Nat44ShowRunningConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44ShowRunningConfig) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44ShowRunningConfig) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44ShowRunningConfig) Unmarshal(b []byte) error { + return nil +} + +// Nat44ShowRunningConfigReply defines message 'nat44_show_running_config_reply'. +// InProgress: the message form may change in the future versions +type Nat44ShowRunningConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Users uint32 `binapi:"u32,name=users" json:"users,omitempty"` + Sessions uint32 `binapi:"u32,name=sessions" json:"sessions,omitempty"` + UserSessions uint32 `binapi:"u32,name=user_sessions" json:"user_sessions,omitempty"` + UserBuckets uint32 `binapi:"u32,name=user_buckets" json:"user_buckets,omitempty"` + TranslationBuckets uint32 `binapi:"u32,name=translation_buckets" json:"translation_buckets,omitempty"` + ForwardingEnabled bool `binapi:"bool,name=forwarding_enabled" json:"forwarding_enabled,omitempty"` + IpfixLoggingEnabled bool `binapi:"bool,name=ipfix_logging_enabled" json:"ipfix_logging_enabled,omitempty"` + Timeouts nat_types.NatTimeouts `binapi:"nat_timeouts,name=timeouts" json:"timeouts,omitempty"` + LogLevel nat_types.NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` + Flags Nat44ConfigFlags `binapi:"nat44_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44ShowRunningConfigReply) Reset() { *m = Nat44ShowRunningConfigReply{} } +func (*Nat44ShowRunningConfigReply) GetMessageName() string { return "nat44_show_running_config_reply" } +func (*Nat44ShowRunningConfigReply) GetCrcString() string { return "93d8e267" } +func (*Nat44ShowRunningConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44ShowRunningConfigReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 4 // m.Users + size += 4 // m.Sessions + size += 4 // m.UserSessions + size += 4 // m.UserBuckets + size += 4 // m.TranslationBuckets + size += 1 // m.ForwardingEnabled + size += 1 // m.IpfixLoggingEnabled + size += 4 // m.Timeouts.UDP + size += 4 // m.Timeouts.TCPEstablished + size += 4 // m.Timeouts.TCPTransitory + size += 4 // m.Timeouts.ICMP + size += 1 // m.LogLevel + size += 1 // m.Flags + return size +} +func (m *Nat44ShowRunningConfigReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeUint32(m.Users) + buf.EncodeUint32(m.Sessions) + buf.EncodeUint32(m.UserSessions) + buf.EncodeUint32(m.UserBuckets) + buf.EncodeUint32(m.TranslationBuckets) + buf.EncodeBool(m.ForwardingEnabled) + buf.EncodeBool(m.IpfixLoggingEnabled) + buf.EncodeUint32(m.Timeouts.UDP) + buf.EncodeUint32(m.Timeouts.TCPEstablished) + buf.EncodeUint32(m.Timeouts.TCPTransitory) + buf.EncodeUint32(m.Timeouts.ICMP) + buf.EncodeUint8(uint8(m.LogLevel)) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44ShowRunningConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Users = buf.DecodeUint32() + m.Sessions = buf.DecodeUint32() + m.UserSessions = buf.DecodeUint32() + m.UserBuckets = buf.DecodeUint32() + m.TranslationBuckets = buf.DecodeUint32() + m.ForwardingEnabled = buf.DecodeBool() + m.IpfixLoggingEnabled = buf.DecodeBool() + m.Timeouts.UDP = buf.DecodeUint32() + m.Timeouts.TCPEstablished = buf.DecodeUint32() + m.Timeouts.TCPTransitory = buf.DecodeUint32() + m.Timeouts.ICMP = buf.DecodeUint32() + m.LogLevel = nat_types.NatLogLevel(buf.DecodeUint8()) + m.Flags = Nat44ConfigFlags(buf.DecodeUint8()) + return nil +} + // Nat44StaticMappingDetails defines message 'nat44_static_mapping_details'. type Nat44StaticMappingDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` @@ -1781,7 +2482,7 @@ type Nat44StaticMappingDetails struct { func (m *Nat44StaticMappingDetails) Reset() { *m = Nat44StaticMappingDetails{} } func (*Nat44StaticMappingDetails) GetMessageName() string { return "nat44_static_mapping_details" } -func (*Nat44StaticMappingDetails) GetCrcString() string { return "1a433ef7" } +func (*Nat44StaticMappingDetails) GetCrcString() string { return "06cb40b2" } func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1819,7 +2520,7 @@ func (m *Nat44StaticMappingDetails) Marshal(b []byte) ([]byte, error) { } func (m *Nat44StaticMappingDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) m.Protocol = buf.DecodeUint8() @@ -1932,24 +2633,24 @@ func (m *Nat44UserDump) Unmarshal(b []byte) error { // Nat44UserSessionDetails defines message 'nat44_user_session_details'. type Nat44UserSessionDetails struct { - OutsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=outside_ip_address" json:"outside_ip_address,omitempty"` - OutsidePort uint16 `binapi:"u16,name=outside_port" json:"outside_port,omitempty"` - InsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=inside_ip_address" json:"inside_ip_address,omitempty"` - InsidePort uint16 `binapi:"u16,name=inside_port" json:"inside_port,omitempty"` - Protocol uint16 `binapi:"u16,name=protocol" json:"protocol,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - LastHeard uint64 `binapi:"u64,name=last_heard" json:"last_heard,omitempty"` - TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` - TotalPkts uint32 `binapi:"u32,name=total_pkts" json:"total_pkts,omitempty"` - ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` - ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` - ExtHostNatAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_nat_address" json:"ext_host_nat_address,omitempty"` - ExtHostNatPort uint16 `binapi:"u16,name=ext_host_nat_port" json:"ext_host_nat_port,omitempty"` + OutsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=outside_ip_address" json:"outside_ip_address,omitempty"` + OutsidePort uint16 `binapi:"u16,name=outside_port" json:"outside_port,omitempty"` + InsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=inside_ip_address" json:"inside_ip_address,omitempty"` + InsidePort uint16 `binapi:"u16,name=inside_port" json:"inside_port,omitempty"` + Protocol uint16 `binapi:"u16,name=protocol" json:"protocol,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + LastHeard uint64 `binapi:"u64,name=last_heard" json:"last_heard,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint32 `binapi:"u32,name=total_pkts" json:"total_pkts,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` + ExtHostNatAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_nat_address" json:"ext_host_nat_address,omitempty"` + ExtHostNatPort uint16 `binapi:"u16,name=ext_host_nat_port" json:"ext_host_nat_port,omitempty"` } func (m *Nat44UserSessionDetails) Reset() { *m = Nat44UserSessionDetails{} } func (*Nat44UserSessionDetails) GetMessageName() string { return "nat44_user_session_details" } -func (*Nat44UserSessionDetails) GetCrcString() string { return "1965fd69" } +func (*Nat44UserSessionDetails) GetCrcString() string { return "2cf6e16d" } func (*Nat44UserSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2000,7 +2701,7 @@ func (m *Nat44UserSessionDetails) Unmarshal(b []byte) error { copy(m.InsideIPAddress[:], buf.DecodeBytes(4)) m.InsidePort = buf.DecodeUint16() m.Protocol = buf.DecodeUint16() - m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) m.LastHeard = buf.DecodeUint64() m.TotalBytes = buf.DecodeUint64() m.TotalPkts = buf.DecodeUint32() @@ -2048,1081 +2749,132 @@ func (m *Nat44UserSessionDump) Unmarshal(b []byte) error { return nil } -// Nat64AddDelInterface defines message 'nat64_add_del_interface'. -type Nat64AddDelInterface struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *Nat64AddDelInterface) Reset() { *m = Nat64AddDelInterface{} } -func (*Nat64AddDelInterface) GetMessageName() string { return "nat64_add_del_interface" } -func (*Nat64AddDelInterface) GetCrcString() string { return "f3699b83" } -func (*Nat64AddDelInterface) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64AddDelInterface) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 // m.Flags - size += 4 // m.SwIfIndex - return size -} -func (m *Nat64AddDelInterface) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint8(uint8(m.Flags)) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *Nat64AddDelInterface) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// Nat64AddDelInterfaceAddr defines message 'nat64_add_del_interface_addr'. -type Nat64AddDelInterfaceAddr struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *Nat64AddDelInterfaceAddr) Reset() { *m = Nat64AddDelInterfaceAddr{} } -func (*Nat64AddDelInterfaceAddr) GetMessageName() string { return "nat64_add_del_interface_addr" } -func (*Nat64AddDelInterfaceAddr) GetCrcString() string { return "47d6e753" } -func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64AddDelInterfaceAddr) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.SwIfIndex - return size -} -func (m *Nat64AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *Nat64AddDelInterfaceAddr) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// Nat64AddDelInterfaceAddrReply defines message 'nat64_add_del_interface_addr_reply'. -type Nat64AddDelInterfaceAddrReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat64AddDelInterfaceAddrReply) Reset() { *m = Nat64AddDelInterfaceAddrReply{} } -func (*Nat64AddDelInterfaceAddrReply) GetMessageName() string { - return "nat64_add_del_interface_addr_reply" -} -func (*Nat64AddDelInterfaceAddrReply) GetCrcString() string { return "e8d4e804" } -func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { +// Nat44UserSessionV2Details defines message 'nat44_user_session_v2_details'. +// InProgress: the message form may change in the future versions +type Nat44UserSessionV2Details struct { + OutsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=outside_ip_address" json:"outside_ip_address,omitempty"` + OutsidePort uint16 `binapi:"u16,name=outside_port" json:"outside_port,omitempty"` + InsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=inside_ip_address" json:"inside_ip_address,omitempty"` + InsidePort uint16 `binapi:"u16,name=inside_port" json:"inside_port,omitempty"` + Protocol uint16 `binapi:"u16,name=protocol" json:"protocol,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + LastHeard uint64 `binapi:"u64,name=last_heard" json:"last_heard,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint32 `binapi:"u32,name=total_pkts" json:"total_pkts,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` + ExtHostNatAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_nat_address" json:"ext_host_nat_address,omitempty"` + ExtHostNatPort uint16 `binapi:"u16,name=ext_host_nat_port" json:"ext_host_nat_port,omitempty"` + IsTimedOut bool `binapi:"bool,name=is_timed_out" json:"is_timed_out,omitempty"` +} + +func (m *Nat44UserSessionV2Details) Reset() { *m = Nat44UserSessionV2Details{} } +func (*Nat44UserSessionV2Details) GetMessageName() string { return "nat44_user_session_v2_details" } +func (*Nat44UserSessionV2Details) GetCrcString() string { return "fd42b729" } +func (*Nat44UserSessionV2Details) GetMessageType() api.MessageType { return api.ReplyMessage } -func (m *Nat64AddDelInterfaceAddrReply) Size() (size int) { +func (m *Nat44UserSessionV2Details) Size() (size int) { if m == nil { return 0 } - size += 4 // m.Retval - return size -} -func (m *Nat64AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat64AddDelInterfaceAddrReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat64AddDelInterfaceReply defines message 'nat64_add_del_interface_reply'. -type Nat64AddDelInterfaceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat64AddDelInterfaceReply) Reset() { *m = Nat64AddDelInterfaceReply{} } -func (*Nat64AddDelInterfaceReply) GetMessageName() string { return "nat64_add_del_interface_reply" } -func (*Nat64AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } -func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64AddDelInterfaceReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat64AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat64AddDelInterfaceReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat64AddDelPoolAddrRange defines message 'nat64_add_del_pool_addr_range'. -type Nat64AddDelPoolAddrRange struct { - StartAddr ip_types.IP4Address `binapi:"ip4_address,name=start_addr" json:"start_addr,omitempty"` - EndAddr ip_types.IP4Address `binapi:"ip4_address,name=end_addr" json:"end_addr,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *Nat64AddDelPoolAddrRange) Reset() { *m = Nat64AddDelPoolAddrRange{} } -func (*Nat64AddDelPoolAddrRange) GetMessageName() string { return "nat64_add_del_pool_addr_range" } -func (*Nat64AddDelPoolAddrRange) GetCrcString() string { return "21234ef3" } -func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64AddDelPoolAddrRange) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.StartAddr - size += 1 * 4 // m.EndAddr - size += 4 // m.VrfID - size += 1 // m.IsAdd - return size -} -func (m *Nat64AddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.StartAddr[:], 4) - buf.EncodeBytes(m.EndAddr[:], 4) - buf.EncodeUint32(m.VrfID) - buf.EncodeBool(m.IsAdd) - return buf.Bytes(), nil -} -func (m *Nat64AddDelPoolAddrRange) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.StartAddr[:], buf.DecodeBytes(4)) - copy(m.EndAddr[:], buf.DecodeBytes(4)) - m.VrfID = buf.DecodeUint32() - m.IsAdd = buf.DecodeBool() - return nil -} - -// Nat64AddDelPoolAddrRangeReply defines message 'nat64_add_del_pool_addr_range_reply'. -type Nat64AddDelPoolAddrRangeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat64AddDelPoolAddrRangeReply) Reset() { *m = Nat64AddDelPoolAddrRangeReply{} } -func (*Nat64AddDelPoolAddrRangeReply) GetMessageName() string { - return "nat64_add_del_pool_addr_range_reply" -} -func (*Nat64AddDelPoolAddrRangeReply) GetCrcString() string { return "e8d4e804" } -func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64AddDelPoolAddrRangeReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat64AddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat64AddDelPoolAddrRangeReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat64AddDelPrefix defines message 'nat64_add_del_prefix'. -type Nat64AddDelPrefix struct { - Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *Nat64AddDelPrefix) Reset() { *m = Nat64AddDelPrefix{} } -func (*Nat64AddDelPrefix) GetMessageName() string { return "nat64_add_del_prefix" } -func (*Nat64AddDelPrefix) GetCrcString() string { return "727b2f4c" } -func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64AddDelPrefix) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.Prefix.Address - size += 1 // m.Prefix.Len - size += 4 // m.VrfID - size += 1 // m.IsAdd - return size -} -func (m *Nat64AddDelPrefix) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.Prefix.Address[:], 16) - buf.EncodeUint8(m.Prefix.Len) - buf.EncodeUint32(m.VrfID) - buf.EncodeBool(m.IsAdd) - return buf.Bytes(), nil -} -func (m *Nat64AddDelPrefix) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.Prefix.Address[:], buf.DecodeBytes(16)) - m.Prefix.Len = buf.DecodeUint8() - m.VrfID = buf.DecodeUint32() - m.IsAdd = buf.DecodeBool() - return nil -} - -// Nat64AddDelPrefixReply defines message 'nat64_add_del_prefix_reply'. -type Nat64AddDelPrefixReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat64AddDelPrefixReply) Reset() { *m = Nat64AddDelPrefixReply{} } -func (*Nat64AddDelPrefixReply) GetMessageName() string { return "nat64_add_del_prefix_reply" } -func (*Nat64AddDelPrefixReply) GetCrcString() string { return "e8d4e804" } -func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64AddDelPrefixReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat64AddDelPrefixReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat64AddDelPrefixReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat64AddDelStaticBib defines message 'nat64_add_del_static_bib'. -type Nat64AddDelStaticBib struct { - IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` - OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` - IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` - OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *Nat64AddDelStaticBib) Reset() { *m = Nat64AddDelStaticBib{} } -func (*Nat64AddDelStaticBib) GetMessageName() string { return "nat64_add_del_static_bib" } -func (*Nat64AddDelStaticBib) GetCrcString() string { return "90fae58a" } -func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64AddDelStaticBib) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.IAddr - size += 1 * 4 // m.OAddr - size += 2 // m.IPort - size += 2 // m.OPort - size += 4 // m.VrfID - size += 1 // m.Proto - size += 1 // m.IsAdd - return size -} -func (m *Nat64AddDelStaticBib) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IAddr[:], 16) - buf.EncodeBytes(m.OAddr[:], 4) - buf.EncodeUint16(m.IPort) - buf.EncodeUint16(m.OPort) - buf.EncodeUint32(m.VrfID) - buf.EncodeUint8(m.Proto) - buf.EncodeBool(m.IsAdd) - return buf.Bytes(), nil -} -func (m *Nat64AddDelStaticBib) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IAddr[:], buf.DecodeBytes(16)) - copy(m.OAddr[:], buf.DecodeBytes(4)) - m.IPort = buf.DecodeUint16() - m.OPort = buf.DecodeUint16() - m.VrfID = buf.DecodeUint32() - m.Proto = buf.DecodeUint8() - m.IsAdd = buf.DecodeBool() - return nil -} - -// Nat64AddDelStaticBibReply defines message 'nat64_add_del_static_bib_reply'. -type Nat64AddDelStaticBibReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat64AddDelStaticBibReply) Reset() { *m = Nat64AddDelStaticBibReply{} } -func (*Nat64AddDelStaticBibReply) GetMessageName() string { return "nat64_add_del_static_bib_reply" } -func (*Nat64AddDelStaticBibReply) GetCrcString() string { return "e8d4e804" } -func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64AddDelStaticBibReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat64AddDelStaticBibReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat64AddDelStaticBibReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat64BibDetails defines message 'nat64_bib_details'. -type Nat64BibDetails struct { - IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` - OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` - IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` - OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` -} - -func (m *Nat64BibDetails) Reset() { *m = Nat64BibDetails{} } -func (*Nat64BibDetails) GetMessageName() string { return "nat64_bib_details" } -func (*Nat64BibDetails) GetCrcString() string { return "62c8541d" } -func (*Nat64BibDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64BibDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.IAddr - size += 1 * 4 // m.OAddr - size += 2 // m.IPort - size += 2 // m.OPort - size += 4 // m.VrfID - size += 1 // m.Proto - size += 1 // m.Flags - size += 4 // m.SesNum + size += 1 * 4 // m.OutsideIPAddress + size += 2 // m.OutsidePort + size += 1 * 4 // m.InsideIPAddress + size += 2 // m.InsidePort + size += 2 // m.Protocol + size += 1 // m.Flags + size += 8 // m.LastHeard + size += 8 // m.TotalBytes + size += 4 // m.TotalPkts + size += 1 * 4 // m.ExtHostAddress + size += 2 // m.ExtHostPort + size += 1 * 4 // m.ExtHostNatAddress + size += 2 // m.ExtHostNatPort + size += 1 // m.IsTimedOut return size } -func (m *Nat64BibDetails) Marshal(b []byte) ([]byte, error) { +func (m *Nat44UserSessionV2Details) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IAddr[:], 16) - buf.EncodeBytes(m.OAddr[:], 4) - buf.EncodeUint16(m.IPort) - buf.EncodeUint16(m.OPort) - buf.EncodeUint32(m.VrfID) - buf.EncodeUint8(m.Proto) + buf.EncodeBytes(m.OutsideIPAddress[:], 4) + buf.EncodeUint16(m.OutsidePort) + buf.EncodeBytes(m.InsideIPAddress[:], 4) + buf.EncodeUint16(m.InsidePort) + buf.EncodeUint16(m.Protocol) buf.EncodeUint8(uint8(m.Flags)) - buf.EncodeUint32(m.SesNum) - return buf.Bytes(), nil -} -func (m *Nat64BibDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IAddr[:], buf.DecodeBytes(16)) - copy(m.OAddr[:], buf.DecodeBytes(4)) - m.IPort = buf.DecodeUint16() - m.OPort = buf.DecodeUint16() - m.VrfID = buf.DecodeUint32() - m.Proto = buf.DecodeUint8() - m.Flags = NatConfigFlags(buf.DecodeUint8()) - m.SesNum = buf.DecodeUint32() - return nil -} - -// Nat64BibDump defines message 'nat64_bib_dump'. -type Nat64BibDump struct { - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` -} - -func (m *Nat64BibDump) Reset() { *m = Nat64BibDump{} } -func (*Nat64BibDump) GetMessageName() string { return "nat64_bib_dump" } -func (*Nat64BibDump) GetCrcString() string { return "cfcb6b75" } -func (*Nat64BibDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64BibDump) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Proto - return size -} -func (m *Nat64BibDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(m.Proto) + buf.EncodeUint64(m.LastHeard) + buf.EncodeUint64(m.TotalBytes) + buf.EncodeUint32(m.TotalPkts) + buf.EncodeBytes(m.ExtHostAddress[:], 4) + buf.EncodeUint16(m.ExtHostPort) + buf.EncodeBytes(m.ExtHostNatAddress[:], 4) + buf.EncodeUint16(m.ExtHostNatPort) + buf.EncodeBool(m.IsTimedOut) return buf.Bytes(), nil } -func (m *Nat64BibDump) Unmarshal(b []byte) error { +func (m *Nat44UserSessionV2Details) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Proto = buf.DecodeUint8() + copy(m.OutsideIPAddress[:], buf.DecodeBytes(4)) + m.OutsidePort = buf.DecodeUint16() + copy(m.InsideIPAddress[:], buf.DecodeBytes(4)) + m.InsidePort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint16() + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.LastHeard = buf.DecodeUint64() + m.TotalBytes = buf.DecodeUint64() + m.TotalPkts = buf.DecodeUint32() + copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) + m.ExtHostPort = buf.DecodeUint16() + copy(m.ExtHostNatAddress[:], buf.DecodeBytes(4)) + m.ExtHostNatPort = buf.DecodeUint16() + m.IsTimedOut = buf.DecodeBool() return nil } -// Nat64InterfaceDetails defines message 'nat64_interface_details'. -type Nat64InterfaceDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *Nat64InterfaceDetails) Reset() { *m = Nat64InterfaceDetails{} } -func (*Nat64InterfaceDetails) GetMessageName() string { return "nat64_interface_details" } -func (*Nat64InterfaceDetails) GetCrcString() string { return "5d286289" } -func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64InterfaceDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Flags - size += 4 // m.SwIfIndex - return size -} -func (m *Nat64InterfaceDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(uint8(m.Flags)) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *Nat64InterfaceDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil +// Nat44UserSessionV2Dump defines message 'nat44_user_session_v2_dump'. +// InProgress: the message form may change in the future versions +type Nat44UserSessionV2Dump struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } -// Nat64InterfaceDump defines message 'nat64_interface_dump'. -type Nat64InterfaceDump struct{} - -func (m *Nat64InterfaceDump) Reset() { *m = Nat64InterfaceDump{} } -func (*Nat64InterfaceDump) GetMessageName() string { return "nat64_interface_dump" } -func (*Nat64InterfaceDump) GetCrcString() string { return "51077d14" } -func (*Nat64InterfaceDump) GetMessageType() api.MessageType { +func (m *Nat44UserSessionV2Dump) Reset() { *m = Nat44UserSessionV2Dump{} } +func (*Nat44UserSessionV2Dump) GetMessageName() string { return "nat44_user_session_v2_dump" } +func (*Nat44UserSessionV2Dump) GetCrcString() string { return "e1899c98" } +func (*Nat44UserSessionV2Dump) GetMessageType() api.MessageType { return api.RequestMessage } -func (m *Nat64InterfaceDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *Nat64InterfaceDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *Nat64InterfaceDump) Unmarshal(b []byte) error { - return nil -} - -// Nat64PoolAddrDetails defines message 'nat64_pool_addr_details'. -type Nat64PoolAddrDetails struct { - Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *Nat64PoolAddrDetails) Reset() { *m = Nat64PoolAddrDetails{} } -func (*Nat64PoolAddrDetails) GetMessageName() string { return "nat64_pool_addr_details" } -func (*Nat64PoolAddrDetails) GetCrcString() string { return "9bb99cdb" } -func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64PoolAddrDetails) Size() (size int) { +func (m *Nat44UserSessionV2Dump) Size() (size int) { if m == nil { return 0 } - size += 1 * 4 // m.Address + size += 1 * 4 // m.IPAddress size += 4 // m.VrfID return size } -func (m *Nat64PoolAddrDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.Address[:], 4) - buf.EncodeUint32(m.VrfID) - return buf.Bytes(), nil -} -func (m *Nat64PoolAddrDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.Address[:], buf.DecodeBytes(4)) - m.VrfID = buf.DecodeUint32() - return nil -} - -// Nat64PoolAddrDump defines message 'nat64_pool_addr_dump'. -type Nat64PoolAddrDump struct{} - -func (m *Nat64PoolAddrDump) Reset() { *m = Nat64PoolAddrDump{} } -func (*Nat64PoolAddrDump) GetMessageName() string { return "nat64_pool_addr_dump" } -func (*Nat64PoolAddrDump) GetCrcString() string { return "51077d14" } -func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64PoolAddrDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *Nat64PoolAddrDump) Marshal(b []byte) ([]byte, error) { +func (m *Nat44UserSessionV2Dump) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *Nat64PoolAddrDump) Unmarshal(b []byte) error { - return nil -} - -// Nat64PrefixDetails defines message 'nat64_prefix_details'. -type Nat64PrefixDetails struct { - Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *Nat64PrefixDetails) Reset() { *m = Nat64PrefixDetails{} } -func (*Nat64PrefixDetails) GetMessageName() string { return "nat64_prefix_details" } -func (*Nat64PrefixDetails) GetCrcString() string { return "20568de3" } -func (*Nat64PrefixDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64PrefixDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.Prefix.Address - size += 1 // m.Prefix.Len - size += 4 // m.VrfID - return size -} -func (m *Nat64PrefixDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.Prefix.Address[:], 16) - buf.EncodeUint8(m.Prefix.Len) - buf.EncodeUint32(m.VrfID) - return buf.Bytes(), nil -} -func (m *Nat64PrefixDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.Prefix.Address[:], buf.DecodeBytes(16)) - m.Prefix.Len = buf.DecodeUint8() - m.VrfID = buf.DecodeUint32() - return nil -} - -// Nat64PrefixDump defines message 'nat64_prefix_dump'. -type Nat64PrefixDump struct{} - -func (m *Nat64PrefixDump) Reset() { *m = Nat64PrefixDump{} } -func (*Nat64PrefixDump) GetMessageName() string { return "nat64_prefix_dump" } -func (*Nat64PrefixDump) GetCrcString() string { return "51077d14" } -func (*Nat64PrefixDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64PrefixDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *Nat64PrefixDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *Nat64PrefixDump) Unmarshal(b []byte) error { - return nil -} - -// Nat64StDetails defines message 'nat64_st_details'. -type Nat64StDetails struct { - IlAddr ip_types.IP6Address `binapi:"ip6_address,name=il_addr" json:"il_addr,omitempty"` - OlAddr ip_types.IP4Address `binapi:"ip4_address,name=ol_addr" json:"ol_addr,omitempty"` - IlPort uint16 `binapi:"u16,name=il_port" json:"il_port,omitempty"` - OlPort uint16 `binapi:"u16,name=ol_port" json:"ol_port,omitempty"` - IrAddr ip_types.IP6Address `binapi:"ip6_address,name=ir_addr" json:"ir_addr,omitempty"` - OrAddr ip_types.IP4Address `binapi:"ip4_address,name=or_addr" json:"or_addr,omitempty"` - RPort uint16 `binapi:"u16,name=r_port" json:"r_port,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` -} - -func (m *Nat64StDetails) Reset() { *m = Nat64StDetails{} } -func (*Nat64StDetails) GetMessageName() string { return "nat64_st_details" } -func (*Nat64StDetails) GetCrcString() string { return "c770d620" } -func (*Nat64StDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat64StDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.IlAddr - size += 1 * 4 // m.OlAddr - size += 2 // m.IlPort - size += 2 // m.OlPort - size += 1 * 16 // m.IrAddr - size += 1 * 4 // m.OrAddr - size += 2 // m.RPort - size += 4 // m.VrfID - size += 1 // m.Proto - return size -} -func (m *Nat64StDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IlAddr[:], 16) - buf.EncodeBytes(m.OlAddr[:], 4) - buf.EncodeUint16(m.IlPort) - buf.EncodeUint16(m.OlPort) - buf.EncodeBytes(m.IrAddr[:], 16) - buf.EncodeBytes(m.OrAddr[:], 4) - buf.EncodeUint16(m.RPort) - buf.EncodeUint32(m.VrfID) - buf.EncodeUint8(m.Proto) - return buf.Bytes(), nil -} -func (m *Nat64StDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IlAddr[:], buf.DecodeBytes(16)) - copy(m.OlAddr[:], buf.DecodeBytes(4)) - m.IlPort = buf.DecodeUint16() - m.OlPort = buf.DecodeUint16() - copy(m.IrAddr[:], buf.DecodeBytes(16)) - copy(m.OrAddr[:], buf.DecodeBytes(4)) - m.RPort = buf.DecodeUint16() - m.VrfID = buf.DecodeUint32() - m.Proto = buf.DecodeUint8() - return nil -} - -// Nat64StDump defines message 'nat64_st_dump'. -type Nat64StDump struct { - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` -} - -func (m *Nat64StDump) Reset() { *m = Nat64StDump{} } -func (*Nat64StDump) GetMessageName() string { return "nat64_st_dump" } -func (*Nat64StDump) GetCrcString() string { return "cfcb6b75" } -func (*Nat64StDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat64StDump) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Proto - return size -} -func (m *Nat64StDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(m.Proto) - return buf.Bytes(), nil -} -func (m *Nat64StDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Proto = buf.DecodeUint8() - return nil -} - -// Nat66AddDelInterface defines message 'nat66_add_del_interface'. -type Nat66AddDelInterface struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *Nat66AddDelInterface) Reset() { *m = Nat66AddDelInterface{} } -func (*Nat66AddDelInterface) GetMessageName() string { return "nat66_add_del_interface" } -func (*Nat66AddDelInterface) GetCrcString() string { return "f3699b83" } -func (*Nat66AddDelInterface) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat66AddDelInterface) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 // m.Flags - size += 4 // m.SwIfIndex - return size -} -func (m *Nat66AddDelInterface) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint8(uint8(m.Flags)) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *Nat66AddDelInterface) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Flags = NatConfigFlags(buf.DecodeUint8()) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// Nat66AddDelInterfaceReply defines message 'nat66_add_del_interface_reply'. -type Nat66AddDelInterfaceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat66AddDelInterfaceReply) Reset() { *m = Nat66AddDelInterfaceReply{} } -func (*Nat66AddDelInterfaceReply) GetMessageName() string { return "nat66_add_del_interface_reply" } -func (*Nat66AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } -func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat66AddDelInterfaceReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat66AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat66AddDelInterfaceReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat66AddDelStaticMapping defines message 'nat66_add_del_static_mapping'. -type Nat66AddDelStaticMapping struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` - ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *Nat66AddDelStaticMapping) Reset() { *m = Nat66AddDelStaticMapping{} } -func (*Nat66AddDelStaticMapping) GetMessageName() string { return "nat66_add_del_static_mapping" } -func (*Nat66AddDelStaticMapping) GetCrcString() string { return "fb64e50b" } -func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat66AddDelStaticMapping) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 * 16 // m.LocalIPAddress - size += 1 * 16 // m.ExternalIPAddress - size += 4 // m.VrfID - return size -} -func (m *Nat66AddDelStaticMapping) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeBytes(m.LocalIPAddress[:], 16) - buf.EncodeBytes(m.ExternalIPAddress[:], 16) - buf.EncodeUint32(m.VrfID) - return buf.Bytes(), nil -} -func (m *Nat66AddDelStaticMapping) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) - copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) - m.VrfID = buf.DecodeUint32() - return nil -} - -// Nat66AddDelStaticMappingReply defines message 'nat66_add_del_static_mapping_reply'. -type Nat66AddDelStaticMappingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *Nat66AddDelStaticMappingReply) Reset() { *m = Nat66AddDelStaticMappingReply{} } -func (*Nat66AddDelStaticMappingReply) GetMessageName() string { - return "nat66_add_del_static_mapping_reply" -} -func (*Nat66AddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" } -func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat66AddDelStaticMappingReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *Nat66AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *Nat66AddDelStaticMappingReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// Nat66InterfaceDetails defines message 'nat66_interface_details'. -type Nat66InterfaceDetails struct { - Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *Nat66InterfaceDetails) Reset() { *m = Nat66InterfaceDetails{} } -func (*Nat66InterfaceDetails) GetMessageName() string { return "nat66_interface_details" } -func (*Nat66InterfaceDetails) GetCrcString() string { return "5d286289" } -func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat66InterfaceDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Flags - size += 4 // m.SwIfIndex - return size -} -func (m *Nat66InterfaceDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(uint8(m.Flags)) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *Nat66InterfaceDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Flags = NatConfigFlags(buf.DecodeUint8()) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// Nat66InterfaceDump defines message 'nat66_interface_dump'. -type Nat66InterfaceDump struct{} - -func (m *Nat66InterfaceDump) Reset() { *m = Nat66InterfaceDump{} } -func (*Nat66InterfaceDump) GetMessageName() string { return "nat66_interface_dump" } -func (*Nat66InterfaceDump) GetCrcString() string { return "51077d14" } -func (*Nat66InterfaceDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat66InterfaceDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *Nat66InterfaceDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *Nat66InterfaceDump) Unmarshal(b []byte) error { - return nil -} - -// Nat66StaticMappingDetails defines message 'nat66_static_mapping_details'. -type Nat66StaticMappingDetails struct { - LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` - ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` - TotalPkts uint64 `binapi:"u64,name=total_pkts" json:"total_pkts,omitempty"` -} - -func (m *Nat66StaticMappingDetails) Reset() { *m = Nat66StaticMappingDetails{} } -func (*Nat66StaticMappingDetails) GetMessageName() string { return "nat66_static_mapping_details" } -func (*Nat66StaticMappingDetails) GetCrcString() string { return "5c568448" } -func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *Nat66StaticMappingDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.LocalIPAddress - size += 1 * 16 // m.ExternalIPAddress - size += 4 // m.VrfID - size += 8 // m.TotalBytes - size += 8 // m.TotalPkts - return size -} -func (m *Nat66StaticMappingDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.LocalIPAddress[:], 16) - buf.EncodeBytes(m.ExternalIPAddress[:], 16) + buf.EncodeBytes(m.IPAddress[:], 4) buf.EncodeUint32(m.VrfID) - buf.EncodeUint64(m.TotalBytes) - buf.EncodeUint64(m.TotalPkts) return buf.Bytes(), nil } -func (m *Nat66StaticMappingDetails) Unmarshal(b []byte) error { +func (m *Nat44UserSessionV2Dump) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) - copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) + copy(m.IPAddress[:], buf.DecodeBytes(4)) m.VrfID = buf.DecodeUint32() - m.TotalBytes = buf.DecodeUint64() - m.TotalPkts = buf.DecodeUint64() - return nil -} - -// Nat66StaticMappingDump defines message 'nat66_static_mapping_dump'. -type Nat66StaticMappingDump struct{} - -func (m *Nat66StaticMappingDump) Reset() { *m = Nat66StaticMappingDump{} } -func (*Nat66StaticMappingDump) GetMessageName() string { return "nat66_static_mapping_dump" } -func (*Nat66StaticMappingDump) GetCrcString() string { return "51077d14" } -func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Nat66StaticMappingDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *Nat66StaticMappingDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *Nat66StaticMappingDump) Unmarshal(b []byte) error { return nil } // NatControlPing defines message 'nat_control_ping'. +// Deprecated: the message will be removed in the future versions type NatControlPing struct{} func (m *NatControlPing) Reset() { *m = NatControlPing{} } @@ -3150,6 +2902,7 @@ func (m *NatControlPing) Unmarshal(b []byte) error { } // NatControlPingReply defines message 'nat_control_ping_reply'. +// Deprecated: the message will be removed in the future versions type NatControlPingReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` @@ -3190,566 +2943,6 @@ func (m *NatControlPingReply) Unmarshal(b []byte) error { return nil } -// NatDetAddDelMap defines message 'nat_det_add_del_map'. -type NatDetAddDelMap struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` - InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` - OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` - OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` -} - -func (m *NatDetAddDelMap) Reset() { *m = NatDetAddDelMap{} } -func (*NatDetAddDelMap) GetMessageName() string { return "nat_det_add_del_map" } -func (*NatDetAddDelMap) GetCrcString() string { return "112fde05" } -func (*NatDetAddDelMap) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetAddDelMap) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 * 4 // m.InAddr - size += 1 // m.InPlen - size += 1 * 4 // m.OutAddr - size += 1 // m.OutPlen - return size -} -func (m *NatDetAddDelMap) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeBytes(m.InAddr[:], 4) - buf.EncodeUint8(m.InPlen) - buf.EncodeBytes(m.OutAddr[:], 4) - buf.EncodeUint8(m.OutPlen) - return buf.Bytes(), nil -} -func (m *NatDetAddDelMap) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - copy(m.InAddr[:], buf.DecodeBytes(4)) - m.InPlen = buf.DecodeUint8() - copy(m.OutAddr[:], buf.DecodeBytes(4)) - m.OutPlen = buf.DecodeUint8() - return nil -} - -// NatDetAddDelMapReply defines message 'nat_det_add_del_map_reply'. -type NatDetAddDelMapReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *NatDetAddDelMapReply) Reset() { *m = NatDetAddDelMapReply{} } -func (*NatDetAddDelMapReply) GetMessageName() string { return "nat_det_add_del_map_reply" } -func (*NatDetAddDelMapReply) GetCrcString() string { return "e8d4e804" } -func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetAddDelMapReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *NatDetAddDelMapReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *NatDetAddDelMapReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// NatDetCloseSessionIn defines message 'nat_det_close_session_in'. -type NatDetCloseSessionIn struct { - InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` - InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` - ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` - ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` -} - -func (m *NatDetCloseSessionIn) Reset() { *m = NatDetCloseSessionIn{} } -func (*NatDetCloseSessionIn) GetMessageName() string { return "nat_det_close_session_in" } -func (*NatDetCloseSessionIn) GetCrcString() string { return "0a10ef64" } -func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetCloseSessionIn) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.InAddr - size += 2 // m.InPort - size += 1 * 4 // m.ExtAddr - size += 2 // m.ExtPort - return size -} -func (m *NatDetCloseSessionIn) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.InAddr[:], 4) - buf.EncodeUint16(m.InPort) - buf.EncodeBytes(m.ExtAddr[:], 4) - buf.EncodeUint16(m.ExtPort) - return buf.Bytes(), nil -} -func (m *NatDetCloseSessionIn) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.InAddr[:], buf.DecodeBytes(4)) - m.InPort = buf.DecodeUint16() - copy(m.ExtAddr[:], buf.DecodeBytes(4)) - m.ExtPort = buf.DecodeUint16() - return nil -} - -// NatDetCloseSessionInReply defines message 'nat_det_close_session_in_reply'. -type NatDetCloseSessionInReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *NatDetCloseSessionInReply) Reset() { *m = NatDetCloseSessionInReply{} } -func (*NatDetCloseSessionInReply) GetMessageName() string { return "nat_det_close_session_in_reply" } -func (*NatDetCloseSessionInReply) GetCrcString() string { return "e8d4e804" } -func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetCloseSessionInReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *NatDetCloseSessionInReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *NatDetCloseSessionInReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// NatDetCloseSessionOut defines message 'nat_det_close_session_out'. -type NatDetCloseSessionOut struct { - OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` - OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` - ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` - ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` -} - -func (m *NatDetCloseSessionOut) Reset() { *m = NatDetCloseSessionOut{} } -func (*NatDetCloseSessionOut) GetMessageName() string { return "nat_det_close_session_out" } -func (*NatDetCloseSessionOut) GetCrcString() string { return "c1b6cbfb" } -func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetCloseSessionOut) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.OutAddr - size += 2 // m.OutPort - size += 1 * 4 // m.ExtAddr - size += 2 // m.ExtPort - return size -} -func (m *NatDetCloseSessionOut) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.OutAddr[:], 4) - buf.EncodeUint16(m.OutPort) - buf.EncodeBytes(m.ExtAddr[:], 4) - buf.EncodeUint16(m.ExtPort) - return buf.Bytes(), nil -} -func (m *NatDetCloseSessionOut) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.OutAddr[:], buf.DecodeBytes(4)) - m.OutPort = buf.DecodeUint16() - copy(m.ExtAddr[:], buf.DecodeBytes(4)) - m.ExtPort = buf.DecodeUint16() - return nil -} - -// NatDetCloseSessionOutReply defines message 'nat_det_close_session_out_reply'. -type NatDetCloseSessionOutReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *NatDetCloseSessionOutReply) Reset() { *m = NatDetCloseSessionOutReply{} } -func (*NatDetCloseSessionOutReply) GetMessageName() string { return "nat_det_close_session_out_reply" } -func (*NatDetCloseSessionOutReply) GetCrcString() string { return "e8d4e804" } -func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetCloseSessionOutReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *NatDetCloseSessionOutReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *NatDetCloseSessionOutReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// NatDetForward defines message 'nat_det_forward'. -type NatDetForward struct { - InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` -} - -func (m *NatDetForward) Reset() { *m = NatDetForward{} } -func (*NatDetForward) GetMessageName() string { return "nat_det_forward" } -func (*NatDetForward) GetCrcString() string { return "7f8a89cd" } -func (*NatDetForward) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetForward) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.InAddr - return size -} -func (m *NatDetForward) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.InAddr[:], 4) - return buf.Bytes(), nil -} -func (m *NatDetForward) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.InAddr[:], buf.DecodeBytes(4)) - return nil -} - -// NatDetForwardReply defines message 'nat_det_forward_reply'. -type NatDetForwardReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - OutPortLo uint16 `binapi:"u16,name=out_port_lo" json:"out_port_lo,omitempty"` - OutPortHi uint16 `binapi:"u16,name=out_port_hi" json:"out_port_hi,omitempty"` - OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` -} - -func (m *NatDetForwardReply) Reset() { *m = NatDetForwardReply{} } -func (*NatDetForwardReply) GetMessageName() string { return "nat_det_forward_reply" } -func (*NatDetForwardReply) GetCrcString() string { return "a8ccbdc0" } -func (*NatDetForwardReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetForwardReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 2 // m.OutPortLo - size += 2 // m.OutPortHi - size += 1 * 4 // m.OutAddr - return size -} -func (m *NatDetForwardReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint16(m.OutPortLo) - buf.EncodeUint16(m.OutPortHi) - buf.EncodeBytes(m.OutAddr[:], 4) - return buf.Bytes(), nil -} -func (m *NatDetForwardReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.OutPortLo = buf.DecodeUint16() - m.OutPortHi = buf.DecodeUint16() - copy(m.OutAddr[:], buf.DecodeBytes(4)) - return nil -} - -// NatDetMapDetails defines message 'nat_det_map_details'. -type NatDetMapDetails struct { - InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` - InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` - OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` - OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` - SharingRatio uint32 `binapi:"u32,name=sharing_ratio" json:"sharing_ratio,omitempty"` - PortsPerHost uint16 `binapi:"u16,name=ports_per_host" json:"ports_per_host,omitempty"` - SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` -} - -func (m *NatDetMapDetails) Reset() { *m = NatDetMapDetails{} } -func (*NatDetMapDetails) GetMessageName() string { return "nat_det_map_details" } -func (*NatDetMapDetails) GetCrcString() string { return "88000ee1" } -func (*NatDetMapDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetMapDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.InAddr - size += 1 // m.InPlen - size += 1 * 4 // m.OutAddr - size += 1 // m.OutPlen - size += 4 // m.SharingRatio - size += 2 // m.PortsPerHost - size += 4 // m.SesNum - return size -} -func (m *NatDetMapDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.InAddr[:], 4) - buf.EncodeUint8(m.InPlen) - buf.EncodeBytes(m.OutAddr[:], 4) - buf.EncodeUint8(m.OutPlen) - buf.EncodeUint32(m.SharingRatio) - buf.EncodeUint16(m.PortsPerHost) - buf.EncodeUint32(m.SesNum) - return buf.Bytes(), nil -} -func (m *NatDetMapDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.InAddr[:], buf.DecodeBytes(4)) - m.InPlen = buf.DecodeUint8() - copy(m.OutAddr[:], buf.DecodeBytes(4)) - m.OutPlen = buf.DecodeUint8() - m.SharingRatio = buf.DecodeUint32() - m.PortsPerHost = buf.DecodeUint16() - m.SesNum = buf.DecodeUint32() - return nil -} - -// NatDetMapDump defines message 'nat_det_map_dump'. -type NatDetMapDump struct{} - -func (m *NatDetMapDump) Reset() { *m = NatDetMapDump{} } -func (*NatDetMapDump) GetMessageName() string { return "nat_det_map_dump" } -func (*NatDetMapDump) GetCrcString() string { return "51077d14" } -func (*NatDetMapDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetMapDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *NatDetMapDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *NatDetMapDump) Unmarshal(b []byte) error { - return nil -} - -// NatDetReverse defines message 'nat_det_reverse'. -type NatDetReverse struct { - OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` - OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` -} - -func (m *NatDetReverse) Reset() { *m = NatDetReverse{} } -func (*NatDetReverse) GetMessageName() string { return "nat_det_reverse" } -func (*NatDetReverse) GetCrcString() string { return "a7573fe1" } -func (*NatDetReverse) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetReverse) Size() (size int) { - if m == nil { - return 0 - } - size += 2 // m.OutPort - size += 1 * 4 // m.OutAddr - return size -} -func (m *NatDetReverse) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint16(m.OutPort) - buf.EncodeBytes(m.OutAddr[:], 4) - return buf.Bytes(), nil -} -func (m *NatDetReverse) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.OutPort = buf.DecodeUint16() - copy(m.OutAddr[:], buf.DecodeBytes(4)) - return nil -} - -// NatDetReverseReply defines message 'nat_det_reverse_reply'. -type NatDetReverseReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` -} - -func (m *NatDetReverseReply) Reset() { *m = NatDetReverseReply{} } -func (*NatDetReverseReply) GetMessageName() string { return "nat_det_reverse_reply" } -func (*NatDetReverseReply) GetCrcString() string { return "34066d48" } -func (*NatDetReverseReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetReverseReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 1 * 4 // m.InAddr - return size -} -func (m *NatDetReverseReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeBytes(m.InAddr[:], 4) - return buf.Bytes(), nil -} -func (m *NatDetReverseReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - copy(m.InAddr[:], buf.DecodeBytes(4)) - return nil -} - -// NatDetSessionDetails defines message 'nat_det_session_details'. -type NatDetSessionDetails struct { - InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` - ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` - ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` - OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` - State uint8 `binapi:"u8,name=state" json:"state,omitempty"` - Expire uint32 `binapi:"u32,name=expire" json:"expire,omitempty"` -} - -func (m *NatDetSessionDetails) Reset() { *m = NatDetSessionDetails{} } -func (*NatDetSessionDetails) GetMessageName() string { return "nat_det_session_details" } -func (*NatDetSessionDetails) GetCrcString() string { return "27f3c171" } -func (*NatDetSessionDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *NatDetSessionDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 2 // m.InPort - size += 1 * 4 // m.ExtAddr - size += 2 // m.ExtPort - size += 2 // m.OutPort - size += 1 // m.State - size += 4 // m.Expire - return size -} -func (m *NatDetSessionDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint16(m.InPort) - buf.EncodeBytes(m.ExtAddr[:], 4) - buf.EncodeUint16(m.ExtPort) - buf.EncodeUint16(m.OutPort) - buf.EncodeUint8(m.State) - buf.EncodeUint32(m.Expire) - return buf.Bytes(), nil -} -func (m *NatDetSessionDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.InPort = buf.DecodeUint16() - copy(m.ExtAddr[:], buf.DecodeBytes(4)) - m.ExtPort = buf.DecodeUint16() - m.OutPort = buf.DecodeUint16() - m.State = buf.DecodeUint8() - m.Expire = buf.DecodeUint32() - return nil -} - -// NatDetSessionDump defines message 'nat_det_session_dump'. -type NatDetSessionDump struct { - UserAddr ip_types.IP4Address `binapi:"ip4_address,name=user_addr" json:"user_addr,omitempty"` -} - -func (m *NatDetSessionDump) Reset() { *m = NatDetSessionDump{} } -func (*NatDetSessionDump) GetMessageName() string { return "nat_det_session_dump" } -func (*NatDetSessionDump) GetCrcString() string { return "e45a3af7" } -func (*NatDetSessionDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *NatDetSessionDump) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.UserAddr - return size -} -func (m *NatDetSessionDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.UserAddr[:], 4) - return buf.Bytes(), nil -} -func (m *NatDetSessionDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.UserAddr[:], buf.DecodeBytes(4)) - return nil -} - // NatGetAddrAndPortAllocAlg defines message 'nat_get_addr_and_port_alloc_alg'. type NatGetAddrAndPortAllocAlg struct{} @@ -3905,6 +3098,7 @@ func (m *NatGetMssClampingReply) Unmarshal(b []byte) error { } // NatGetTimeouts defines message 'nat_get_timeouts'. +// Deprecated: the message will be removed in the future versions type NatGetTimeouts struct{} func (m *NatGetTimeouts) Reset() { *m = NatGetTimeouts{} } @@ -3932,6 +3126,7 @@ func (m *NatGetTimeouts) Unmarshal(b []byte) error { } // NatGetTimeoutsReply defines message 'nat_get_timeouts_reply'. +// Deprecated: the message will be removed in the future versions type NatGetTimeoutsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` @@ -4440,6 +3635,7 @@ func (m *NatHaSetListenerReply) Unmarshal(b []byte) error { } // NatIpfixEnableDisable defines message 'nat_ipfix_enable_disable'. +// Deprecated: the message will be removed in the future versions type NatIpfixEnableDisable struct { DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` @@ -4481,6 +3677,7 @@ func (m *NatIpfixEnableDisable) Unmarshal(b []byte) error { } // NatIpfixEnableDisableReply defines message 'nat_ipfix_enable_disable_reply'. +// Deprecated: the message will be removed in the future versions type NatIpfixEnableDisableReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -4602,8 +3799,9 @@ func (m *NatSetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error { } // NatSetLogLevel defines message 'nat_set_log_level'. +// Deprecated: the message will be removed in the future versions type NatSetLogLevel struct { - LogLevel NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` + LogLevel nat_types.NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` } func (m *NatSetLogLevel) Reset() { *m = NatSetLogLevel{} } @@ -4630,11 +3828,12 @@ func (m *NatSetLogLevel) Marshal(b []byte) ([]byte, error) { } func (m *NatSetLogLevel) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.LogLevel = NatLogLevel(buf.DecodeUint8()) + m.LogLevel = nat_types.NatLogLevel(buf.DecodeUint8()) return nil } // NatSetLogLevelReply defines message 'nat_set_log_level_reply'. +// Deprecated: the message will be removed in the future versions type NatSetLogLevelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -4738,6 +3937,7 @@ func (m *NatSetMssClampingReply) Unmarshal(b []byte) error { } // NatSetTimeouts defines message 'nat_set_timeouts'. +// Deprecated: the message will be removed in the future versions type NatSetTimeouts struct { UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` @@ -4783,6 +3983,7 @@ func (m *NatSetTimeouts) Unmarshal(b []byte) error { } // NatSetTimeoutsReply defines message 'nat_set_timeouts_reply'. +// Deprecated: the message will be removed in the future versions type NatSetTimeoutsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -4882,6 +4083,7 @@ func (m *NatSetWorkersReply) Unmarshal(b []byte) error { } // NatShowConfig defines message 'nat_show_config'. +// Deprecated: the message will be removed in the future versions type NatShowConfig struct{} func (m *NatShowConfig) Reset() { *m = NatShowConfig{} } @@ -4908,7 +4110,146 @@ func (m *NatShowConfig) Unmarshal(b []byte) error { return nil } +// NatShowConfig2 defines message 'nat_show_config_2'. +// Deprecated: the message will be removed in the future versions +type NatShowConfig2 struct{} + +func (m *NatShowConfig2) Reset() { *m = NatShowConfig2{} } +func (*NatShowConfig2) GetMessageName() string { return "nat_show_config_2" } +func (*NatShowConfig2) GetCrcString() string { return "51077d14" } +func (*NatShowConfig2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatShowConfig2) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *NatShowConfig2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *NatShowConfig2) Unmarshal(b []byte) error { + return nil +} + +// NatShowConfig2Reply defines message 'nat_show_config_2_reply'. +// Deprecated: the message will be removed in the future versions +type NatShowConfig2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StaticMappingOnly bool `binapi:"bool,name=static_mapping_only" json:"static_mapping_only,omitempty"` + StaticMappingConnectionTracking bool `binapi:"bool,name=static_mapping_connection_tracking" json:"static_mapping_connection_tracking,omitempty"` + Deterministic bool `binapi:"bool,name=deterministic" json:"deterministic,omitempty"` + EndpointDependent bool `binapi:"bool,name=endpoint_dependent" json:"endpoint_dependent,omitempty"` + Out2inDpo bool `binapi:"bool,name=out2in_dpo" json:"out2in_dpo,omitempty"` + DsliteCe bool `binapi:"bool,name=dslite_ce" json:"dslite_ce,omitempty"` + TranslationBuckets uint32 `binapi:"u32,name=translation_buckets" json:"translation_buckets,omitempty"` + TranslationMemorySize uint64 `binapi:"u64,name=translation_memory_size" json:"translation_memory_size,omitempty"` + UserBuckets uint32 `binapi:"u32,name=user_buckets" json:"user_buckets,omitempty"` + UserMemorySize uint64 `binapi:"u64,name=user_memory_size" json:"user_memory_size,omitempty"` + MaxTranslationsPerUser uint32 `binapi:"u32,name=max_translations_per_user" json:"max_translations_per_user,omitempty"` + OutsideVrfID uint32 `binapi:"u32,name=outside_vrf_id" json:"outside_vrf_id,omitempty"` + InsideVrfID uint32 `binapi:"u32,name=inside_vrf_id" json:"inside_vrf_id,omitempty"` + Nat64BibBuckets uint32 `binapi:"u32,name=nat64_bib_buckets" json:"nat64_bib_buckets,omitempty"` + Nat64BibMemorySize uint64 `binapi:"u64,name=nat64_bib_memory_size" json:"nat64_bib_memory_size,omitempty"` + Nat64StBuckets uint32 `binapi:"u32,name=nat64_st_buckets" json:"nat64_st_buckets,omitempty"` + Nat64StMemorySize uint64 `binapi:"u64,name=nat64_st_memory_size" json:"nat64_st_memory_size,omitempty"` + MaxTranslationsPerThread uint32 `binapi:"u32,name=max_translations_per_thread" json:"max_translations_per_thread,omitempty"` + MaxUsersPerThread uint32 `binapi:"u32,name=max_users_per_thread" json:"max_users_per_thread,omitempty"` +} + +func (m *NatShowConfig2Reply) Reset() { *m = NatShowConfig2Reply{} } +func (*NatShowConfig2Reply) GetMessageName() string { return "nat_show_config_2_reply" } +func (*NatShowConfig2Reply) GetCrcString() string { return "0404a5b4" } +func (*NatShowConfig2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatShowConfig2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 // m.StaticMappingOnly + size += 1 // m.StaticMappingConnectionTracking + size += 1 // m.Deterministic + size += 1 // m.EndpointDependent + size += 1 // m.Out2inDpo + size += 1 // m.DsliteCe + size += 4 // m.TranslationBuckets + size += 8 // m.TranslationMemorySize + size += 4 // m.UserBuckets + size += 8 // m.UserMemorySize + size += 4 // m.MaxTranslationsPerUser + size += 4 // m.OutsideVrfID + size += 4 // m.InsideVrfID + size += 4 // m.Nat64BibBuckets + size += 8 // m.Nat64BibMemorySize + size += 4 // m.Nat64StBuckets + size += 8 // m.Nat64StMemorySize + size += 4 // m.MaxTranslationsPerThread + size += 4 // m.MaxUsersPerThread + return size +} +func (m *NatShowConfig2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBool(m.StaticMappingOnly) + buf.EncodeBool(m.StaticMappingConnectionTracking) + buf.EncodeBool(m.Deterministic) + buf.EncodeBool(m.EndpointDependent) + buf.EncodeBool(m.Out2inDpo) + buf.EncodeBool(m.DsliteCe) + buf.EncodeUint32(m.TranslationBuckets) + buf.EncodeUint64(m.TranslationMemorySize) + buf.EncodeUint32(m.UserBuckets) + buf.EncodeUint64(m.UserMemorySize) + buf.EncodeUint32(m.MaxTranslationsPerUser) + buf.EncodeUint32(m.OutsideVrfID) + buf.EncodeUint32(m.InsideVrfID) + buf.EncodeUint32(m.Nat64BibBuckets) + buf.EncodeUint64(m.Nat64BibMemorySize) + buf.EncodeUint32(m.Nat64StBuckets) + buf.EncodeUint64(m.Nat64StMemorySize) + buf.EncodeUint32(m.MaxTranslationsPerThread) + buf.EncodeUint32(m.MaxUsersPerThread) + return buf.Bytes(), nil +} +func (m *NatShowConfig2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StaticMappingOnly = buf.DecodeBool() + m.StaticMappingConnectionTracking = buf.DecodeBool() + m.Deterministic = buf.DecodeBool() + m.EndpointDependent = buf.DecodeBool() + m.Out2inDpo = buf.DecodeBool() + m.DsliteCe = buf.DecodeBool() + m.TranslationBuckets = buf.DecodeUint32() + m.TranslationMemorySize = buf.DecodeUint64() + m.UserBuckets = buf.DecodeUint32() + m.UserMemorySize = buf.DecodeUint64() + m.MaxTranslationsPerUser = buf.DecodeUint32() + m.OutsideVrfID = buf.DecodeUint32() + m.InsideVrfID = buf.DecodeUint32() + m.Nat64BibBuckets = buf.DecodeUint32() + m.Nat64BibMemorySize = buf.DecodeUint64() + m.Nat64StBuckets = buf.DecodeUint32() + m.Nat64StMemorySize = buf.DecodeUint64() + m.MaxTranslationsPerThread = buf.DecodeUint32() + m.MaxUsersPerThread = buf.DecodeUint32() + return nil +} + // NatShowConfigReply defines message 'nat_show_config_reply'. +// Deprecated: the message will be removed in the future versions type NatShowConfigReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` StaticMappingOnly bool `binapi:"bool,name=static_mapping_only" json:"static_mapping_only,omitempty"` @@ -5077,98 +4418,75 @@ func (m *NatWorkerDump) Unmarshal(b []byte) error { return nil } -func init() { file_nat_binapi_init() } -func file_nat_binapi_init() { - api.RegisterMessage((*Nat44AddDelAddressRange)(nil), "nat44_add_del_address_range_d4c7568c") +func init() { file_nat44_ed_binapi_init() } +func file_nat44_ed_binapi_init() { + api.RegisterMessage((*Nat44AddDelAddressRange)(nil), "nat44_add_del_address_range_6f2b8055") api.RegisterMessage((*Nat44AddDelAddressRangeReply)(nil), "nat44_add_del_address_range_reply_e8d4e804") - api.RegisterMessage((*Nat44AddDelIdentityMapping)(nil), "nat44_add_del_identity_mapping_8e12743f") + api.RegisterMessage((*Nat44AddDelIdentityMapping)(nil), "nat44_add_del_identity_mapping_02faaa22") api.RegisterMessage((*Nat44AddDelIdentityMappingReply)(nil), "nat44_add_del_identity_mapping_reply_e8d4e804") - api.RegisterMessage((*Nat44AddDelInterfaceAddr)(nil), "nat44_add_del_interface_addr_fc835325") + api.RegisterMessage((*Nat44AddDelInterfaceAddr)(nil), "nat44_add_del_interface_addr_4aed50c0") api.RegisterMessage((*Nat44AddDelInterfaceAddrReply)(nil), "nat44_add_del_interface_addr_reply_e8d4e804") - api.RegisterMessage((*Nat44AddDelLbStaticMapping)(nil), "nat44_add_del_lb_static_mapping_53b24611") + api.RegisterMessage((*Nat44AddDelLbStaticMapping)(nil), "nat44_add_del_lb_static_mapping_4f68ee9d") api.RegisterMessage((*Nat44AddDelLbStaticMappingReply)(nil), "nat44_add_del_lb_static_mapping_reply_e8d4e804") - api.RegisterMessage((*Nat44AddDelStaticMapping)(nil), "nat44_add_del_static_mapping_e165e83b") + api.RegisterMessage((*Nat44AddDelStaticMapping)(nil), "nat44_add_del_static_mapping_5ae5f03e") api.RegisterMessage((*Nat44AddDelStaticMappingReply)(nil), "nat44_add_del_static_mapping_reply_e8d4e804") - api.RegisterMessage((*Nat44AddressDetails)(nil), "nat44_address_details_45410ac4") + api.RegisterMessage((*Nat44AddDelStaticMappingV2)(nil), "nat44_add_del_static_mapping_v2_5e205f1a") + api.RegisterMessage((*Nat44AddDelStaticMappingV2Reply)(nil), "nat44_add_del_static_mapping_v2_reply_e8d4e804") + api.RegisterMessage((*Nat44AddressDetails)(nil), "nat44_address_details_0d1beac1") api.RegisterMessage((*Nat44AddressDump)(nil), "nat44_address_dump_51077d14") - api.RegisterMessage((*Nat44DelSession)(nil), "nat44_del_session_4c49c387") + api.RegisterMessage((*Nat44DelSession)(nil), "nat44_del_session_15a5bf8c") api.RegisterMessage((*Nat44DelSessionReply)(nil), "nat44_del_session_reply_e8d4e804") api.RegisterMessage((*Nat44DelUser)(nil), "nat44_del_user_99a9f998") api.RegisterMessage((*Nat44DelUserReply)(nil), "nat44_del_user_reply_e8d4e804") + api.RegisterMessage((*Nat44EdAddDelOutputInterface)(nil), "nat44_ed_add_del_output_interface_47d6e753") + api.RegisterMessage((*Nat44EdAddDelOutputInterfaceReply)(nil), "nat44_ed_add_del_output_interface_reply_e8d4e804") + api.RegisterMessage((*Nat44EdOutputInterfaceDetails)(nil), "nat44_ed_output_interface_details_0b45011c") + api.RegisterMessage((*Nat44EdOutputInterfaceGet)(nil), "nat44_ed_output_interface_get_f75ba505") + api.RegisterMessage((*Nat44EdOutputInterfaceGetReply)(nil), "nat44_ed_output_interface_get_reply_53b48f5d") + api.RegisterMessage((*Nat44EdPluginEnableDisable)(nil), "nat44_ed_plugin_enable_disable_be17f8dd") + api.RegisterMessage((*Nat44EdPluginEnableDisableReply)(nil), "nat44_ed_plugin_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat44EdSetFqOptions)(nil), "nat44_ed_set_fq_options_2399bd71") + api.RegisterMessage((*Nat44EdSetFqOptionsReply)(nil), "nat44_ed_set_fq_options_reply_e8d4e804") + api.RegisterMessage((*Nat44EdShowFqOptions)(nil), "nat44_ed_show_fq_options_51077d14") + api.RegisterMessage((*Nat44EdShowFqOptionsReply)(nil), "nat44_ed_show_fq_options_reply_7213b545") api.RegisterMessage((*Nat44ForwardingEnableDisable)(nil), "nat44_forwarding_enable_disable_b3e225d2") api.RegisterMessage((*Nat44ForwardingEnableDisableReply)(nil), "nat44_forwarding_enable_disable_reply_e8d4e804") api.RegisterMessage((*Nat44ForwardingIsEnabled)(nil), "nat44_forwarding_is_enabled_51077d14") api.RegisterMessage((*Nat44ForwardingIsEnabledReply)(nil), "nat44_forwarding_is_enabled_reply_46924a06") - api.RegisterMessage((*Nat44IdentityMappingDetails)(nil), "nat44_identity_mapping_details_36d21351") + api.RegisterMessage((*Nat44IdentityMappingDetails)(nil), "nat44_identity_mapping_details_2a52a030") api.RegisterMessage((*Nat44IdentityMappingDump)(nil), "nat44_identity_mapping_dump_51077d14") api.RegisterMessage((*Nat44InterfaceAddDelFeature)(nil), "nat44_interface_add_del_feature_f3699b83") api.RegisterMessage((*Nat44InterfaceAddDelFeatureReply)(nil), "nat44_interface_add_del_feature_reply_e8d4e804") api.RegisterMessage((*Nat44InterfaceAddDelOutputFeature)(nil), "nat44_interface_add_del_output_feature_f3699b83") api.RegisterMessage((*Nat44InterfaceAddDelOutputFeatureReply)(nil), "nat44_interface_add_del_output_feature_reply_e8d4e804") - api.RegisterMessage((*Nat44InterfaceAddrDetails)(nil), "nat44_interface_addr_details_3e687514") + api.RegisterMessage((*Nat44InterfaceAddrDetails)(nil), "nat44_interface_addr_details_e4aca9ca") api.RegisterMessage((*Nat44InterfaceAddrDump)(nil), "nat44_interface_addr_dump_51077d14") api.RegisterMessage((*Nat44InterfaceDetails)(nil), "nat44_interface_details_5d286289") api.RegisterMessage((*Nat44InterfaceDump)(nil), "nat44_interface_dump_51077d14") api.RegisterMessage((*Nat44InterfaceOutputFeatureDetails)(nil), "nat44_interface_output_feature_details_5d286289") api.RegisterMessage((*Nat44InterfaceOutputFeatureDump)(nil), "nat44_interface_output_feature_dump_51077d14") - api.RegisterMessage((*Nat44LbStaticMappingAddDelLocal)(nil), "nat44_lb_static_mapping_add_del_local_2910a151") + api.RegisterMessage((*Nat44LbStaticMappingAddDelLocal)(nil), "nat44_lb_static_mapping_add_del_local_7ca47547") api.RegisterMessage((*Nat44LbStaticMappingAddDelLocalReply)(nil), "nat44_lb_static_mapping_add_del_local_reply_e8d4e804") - api.RegisterMessage((*Nat44LbStaticMappingDetails)(nil), "nat44_lb_static_mapping_details_2267b9e8") + api.RegisterMessage((*Nat44LbStaticMappingDetails)(nil), "nat44_lb_static_mapping_details_ed5ce876") api.RegisterMessage((*Nat44LbStaticMappingDump)(nil), "nat44_lb_static_mapping_dump_51077d14") + api.RegisterMessage((*Nat44PluginEnableDisable)(nil), "nat44_plugin_enable_disable_dea0d501") + api.RegisterMessage((*Nat44PluginEnableDisableReply)(nil), "nat44_plugin_enable_disable_reply_e8d4e804") api.RegisterMessage((*Nat44SessionCleanup)(nil), "nat44_session_cleanup_51077d14") api.RegisterMessage((*Nat44SessionCleanupReply)(nil), "nat44_session_cleanup_reply_e8d4e804") api.RegisterMessage((*Nat44SetSessionLimit)(nil), "nat44_set_session_limit_8899bbb1") api.RegisterMessage((*Nat44SetSessionLimitReply)(nil), "nat44_set_session_limit_reply_e8d4e804") - api.RegisterMessage((*Nat44StaticMappingDetails)(nil), "nat44_static_mapping_details_1a433ef7") + api.RegisterMessage((*Nat44ShowRunningConfig)(nil), "nat44_show_running_config_51077d14") + api.RegisterMessage((*Nat44ShowRunningConfigReply)(nil), "nat44_show_running_config_reply_93d8e267") + api.RegisterMessage((*Nat44StaticMappingDetails)(nil), "nat44_static_mapping_details_06cb40b2") api.RegisterMessage((*Nat44StaticMappingDump)(nil), "nat44_static_mapping_dump_51077d14") api.RegisterMessage((*Nat44UserDetails)(nil), "nat44_user_details_355896c2") api.RegisterMessage((*Nat44UserDump)(nil), "nat44_user_dump_51077d14") - api.RegisterMessage((*Nat44UserSessionDetails)(nil), "nat44_user_session_details_1965fd69") + api.RegisterMessage((*Nat44UserSessionDetails)(nil), "nat44_user_session_details_2cf6e16d") api.RegisterMessage((*Nat44UserSessionDump)(nil), "nat44_user_session_dump_e1899c98") - api.RegisterMessage((*Nat64AddDelInterface)(nil), "nat64_add_del_interface_f3699b83") - api.RegisterMessage((*Nat64AddDelInterfaceAddr)(nil), "nat64_add_del_interface_addr_47d6e753") - api.RegisterMessage((*Nat64AddDelInterfaceAddrReply)(nil), "nat64_add_del_interface_addr_reply_e8d4e804") - api.RegisterMessage((*Nat64AddDelInterfaceReply)(nil), "nat64_add_del_interface_reply_e8d4e804") - api.RegisterMessage((*Nat64AddDelPoolAddrRange)(nil), "nat64_add_del_pool_addr_range_21234ef3") - api.RegisterMessage((*Nat64AddDelPoolAddrRangeReply)(nil), "nat64_add_del_pool_addr_range_reply_e8d4e804") - api.RegisterMessage((*Nat64AddDelPrefix)(nil), "nat64_add_del_prefix_727b2f4c") - api.RegisterMessage((*Nat64AddDelPrefixReply)(nil), "nat64_add_del_prefix_reply_e8d4e804") - api.RegisterMessage((*Nat64AddDelStaticBib)(nil), "nat64_add_del_static_bib_90fae58a") - api.RegisterMessage((*Nat64AddDelStaticBibReply)(nil), "nat64_add_del_static_bib_reply_e8d4e804") - api.RegisterMessage((*Nat64BibDetails)(nil), "nat64_bib_details_62c8541d") - api.RegisterMessage((*Nat64BibDump)(nil), "nat64_bib_dump_cfcb6b75") - api.RegisterMessage((*Nat64InterfaceDetails)(nil), "nat64_interface_details_5d286289") - api.RegisterMessage((*Nat64InterfaceDump)(nil), "nat64_interface_dump_51077d14") - api.RegisterMessage((*Nat64PoolAddrDetails)(nil), "nat64_pool_addr_details_9bb99cdb") - api.RegisterMessage((*Nat64PoolAddrDump)(nil), "nat64_pool_addr_dump_51077d14") - api.RegisterMessage((*Nat64PrefixDetails)(nil), "nat64_prefix_details_20568de3") - api.RegisterMessage((*Nat64PrefixDump)(nil), "nat64_prefix_dump_51077d14") - api.RegisterMessage((*Nat64StDetails)(nil), "nat64_st_details_c770d620") - api.RegisterMessage((*Nat64StDump)(nil), "nat64_st_dump_cfcb6b75") - api.RegisterMessage((*Nat66AddDelInterface)(nil), "nat66_add_del_interface_f3699b83") - api.RegisterMessage((*Nat66AddDelInterfaceReply)(nil), "nat66_add_del_interface_reply_e8d4e804") - api.RegisterMessage((*Nat66AddDelStaticMapping)(nil), "nat66_add_del_static_mapping_fb64e50b") - api.RegisterMessage((*Nat66AddDelStaticMappingReply)(nil), "nat66_add_del_static_mapping_reply_e8d4e804") - api.RegisterMessage((*Nat66InterfaceDetails)(nil), "nat66_interface_details_5d286289") - api.RegisterMessage((*Nat66InterfaceDump)(nil), "nat66_interface_dump_51077d14") - api.RegisterMessage((*Nat66StaticMappingDetails)(nil), "nat66_static_mapping_details_5c568448") - api.RegisterMessage((*Nat66StaticMappingDump)(nil), "nat66_static_mapping_dump_51077d14") + api.RegisterMessage((*Nat44UserSessionV2Details)(nil), "nat44_user_session_v2_details_fd42b729") + api.RegisterMessage((*Nat44UserSessionV2Dump)(nil), "nat44_user_session_v2_dump_e1899c98") api.RegisterMessage((*NatControlPing)(nil), "nat_control_ping_51077d14") api.RegisterMessage((*NatControlPingReply)(nil), "nat_control_ping_reply_f6b0b8ca") - api.RegisterMessage((*NatDetAddDelMap)(nil), "nat_det_add_del_map_112fde05") - api.RegisterMessage((*NatDetAddDelMapReply)(nil), "nat_det_add_del_map_reply_e8d4e804") - api.RegisterMessage((*NatDetCloseSessionIn)(nil), "nat_det_close_session_in_0a10ef64") - api.RegisterMessage((*NatDetCloseSessionInReply)(nil), "nat_det_close_session_in_reply_e8d4e804") - api.RegisterMessage((*NatDetCloseSessionOut)(nil), "nat_det_close_session_out_c1b6cbfb") - api.RegisterMessage((*NatDetCloseSessionOutReply)(nil), "nat_det_close_session_out_reply_e8d4e804") - api.RegisterMessage((*NatDetForward)(nil), "nat_det_forward_7f8a89cd") - api.RegisterMessage((*NatDetForwardReply)(nil), "nat_det_forward_reply_a8ccbdc0") - api.RegisterMessage((*NatDetMapDetails)(nil), "nat_det_map_details_88000ee1") - api.RegisterMessage((*NatDetMapDump)(nil), "nat_det_map_dump_51077d14") - api.RegisterMessage((*NatDetReverse)(nil), "nat_det_reverse_a7573fe1") - api.RegisterMessage((*NatDetReverseReply)(nil), "nat_det_reverse_reply_34066d48") - api.RegisterMessage((*NatDetSessionDetails)(nil), "nat_det_session_details_27f3c171") - api.RegisterMessage((*NatDetSessionDump)(nil), "nat_det_session_dump_e45a3af7") api.RegisterMessage((*NatGetAddrAndPortAllocAlg)(nil), "nat_get_addr_and_port_alloc_alg_51077d14") api.RegisterMessage((*NatGetAddrAndPortAllocAlgReply)(nil), "nat_get_addr_and_port_alloc_alg_reply_3607a7d0") api.RegisterMessage((*NatGetMssClamping)(nil), "nat_get_mss_clamping_51077d14") @@ -5201,6 +4519,8 @@ func file_nat_binapi_init() { api.RegisterMessage((*NatSetWorkers)(nil), "nat_set_workers_da926638") api.RegisterMessage((*NatSetWorkersReply)(nil), "nat_set_workers_reply_e8d4e804") api.RegisterMessage((*NatShowConfig)(nil), "nat_show_config_51077d14") + api.RegisterMessage((*NatShowConfig2)(nil), "nat_show_config_2_51077d14") + api.RegisterMessage((*NatShowConfig2Reply)(nil), "nat_show_config_2_reply_0404a5b4") api.RegisterMessage((*NatShowConfigReply)(nil), "nat_show_config_reply_7903ef06") api.RegisterMessage((*NatWorkerDetails)(nil), "nat_worker_details_84bf06fc") api.RegisterMessage((*NatWorkerDump)(nil), "nat_worker_dump_51077d14") @@ -5219,12 +4539,25 @@ func AllMessages() []api.Message { (*Nat44AddDelLbStaticMappingReply)(nil), (*Nat44AddDelStaticMapping)(nil), (*Nat44AddDelStaticMappingReply)(nil), + (*Nat44AddDelStaticMappingV2)(nil), + (*Nat44AddDelStaticMappingV2Reply)(nil), (*Nat44AddressDetails)(nil), (*Nat44AddressDump)(nil), (*Nat44DelSession)(nil), (*Nat44DelSessionReply)(nil), (*Nat44DelUser)(nil), (*Nat44DelUserReply)(nil), + (*Nat44EdAddDelOutputInterface)(nil), + (*Nat44EdAddDelOutputInterfaceReply)(nil), + (*Nat44EdOutputInterfaceDetails)(nil), + (*Nat44EdOutputInterfaceGet)(nil), + (*Nat44EdOutputInterfaceGetReply)(nil), + (*Nat44EdPluginEnableDisable)(nil), + (*Nat44EdPluginEnableDisableReply)(nil), + (*Nat44EdSetFqOptions)(nil), + (*Nat44EdSetFqOptionsReply)(nil), + (*Nat44EdShowFqOptions)(nil), + (*Nat44EdShowFqOptionsReply)(nil), (*Nat44ForwardingEnableDisable)(nil), (*Nat44ForwardingEnableDisableReply)(nil), (*Nat44ForwardingIsEnabled)(nil), @@ -5245,60 +4578,24 @@ func AllMessages() []api.Message { (*Nat44LbStaticMappingAddDelLocalReply)(nil), (*Nat44LbStaticMappingDetails)(nil), (*Nat44LbStaticMappingDump)(nil), + (*Nat44PluginEnableDisable)(nil), + (*Nat44PluginEnableDisableReply)(nil), (*Nat44SessionCleanup)(nil), (*Nat44SessionCleanupReply)(nil), (*Nat44SetSessionLimit)(nil), (*Nat44SetSessionLimitReply)(nil), + (*Nat44ShowRunningConfig)(nil), + (*Nat44ShowRunningConfigReply)(nil), (*Nat44StaticMappingDetails)(nil), (*Nat44StaticMappingDump)(nil), (*Nat44UserDetails)(nil), (*Nat44UserDump)(nil), (*Nat44UserSessionDetails)(nil), (*Nat44UserSessionDump)(nil), - (*Nat64AddDelInterface)(nil), - (*Nat64AddDelInterfaceAddr)(nil), - (*Nat64AddDelInterfaceAddrReply)(nil), - (*Nat64AddDelInterfaceReply)(nil), - (*Nat64AddDelPoolAddrRange)(nil), - (*Nat64AddDelPoolAddrRangeReply)(nil), - (*Nat64AddDelPrefix)(nil), - (*Nat64AddDelPrefixReply)(nil), - (*Nat64AddDelStaticBib)(nil), - (*Nat64AddDelStaticBibReply)(nil), - (*Nat64BibDetails)(nil), - (*Nat64BibDump)(nil), - (*Nat64InterfaceDetails)(nil), - (*Nat64InterfaceDump)(nil), - (*Nat64PoolAddrDetails)(nil), - (*Nat64PoolAddrDump)(nil), - (*Nat64PrefixDetails)(nil), - (*Nat64PrefixDump)(nil), - (*Nat64StDetails)(nil), - (*Nat64StDump)(nil), - (*Nat66AddDelInterface)(nil), - (*Nat66AddDelInterfaceReply)(nil), - (*Nat66AddDelStaticMapping)(nil), - (*Nat66AddDelStaticMappingReply)(nil), - (*Nat66InterfaceDetails)(nil), - (*Nat66InterfaceDump)(nil), - (*Nat66StaticMappingDetails)(nil), - (*Nat66StaticMappingDump)(nil), + (*Nat44UserSessionV2Details)(nil), + (*Nat44UserSessionV2Dump)(nil), (*NatControlPing)(nil), (*NatControlPingReply)(nil), - (*NatDetAddDelMap)(nil), - (*NatDetAddDelMapReply)(nil), - (*NatDetCloseSessionIn)(nil), - (*NatDetCloseSessionInReply)(nil), - (*NatDetCloseSessionOut)(nil), - (*NatDetCloseSessionOutReply)(nil), - (*NatDetForward)(nil), - (*NatDetForwardReply)(nil), - (*NatDetMapDetails)(nil), - (*NatDetMapDump)(nil), - (*NatDetReverse)(nil), - (*NatDetReverseReply)(nil), - (*NatDetSessionDetails)(nil), - (*NatDetSessionDump)(nil), (*NatGetAddrAndPortAllocAlg)(nil), (*NatGetAddrAndPortAllocAlgReply)(nil), (*NatGetMssClamping)(nil), @@ -5331,6 +4628,8 @@ func AllMessages() []api.Message { (*NatSetWorkers)(nil), (*NatSetWorkersReply)(nil), (*NatShowConfig)(nil), + (*NatShowConfig2)(nil), + (*NatShowConfig2Reply)(nil), (*NatShowConfigReply)(nil), (*NatWorkerDetails)(nil), (*NatWorkerDump)(nil), diff --git a/binapi/nat/nat_rpc.ba.go b/binapi/nat44_ed/nat44_ed_rpc.ba.go index ad76f5d..190d517 100644 --- a/binapi/nat/nat_rpc.ba.go +++ b/binapi/nat44_ed/nat44_ed_rpc.ba.go @@ -1,25 +1,32 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. -package nat +package nat44_ed import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service nat. +// RPCService defines RPC service nat44_ed. type RPCService interface { Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) + Nat44AddDelStaticMappingV2(ctx context.Context, in *Nat44AddDelStaticMappingV2) (*Nat44AddDelStaticMappingV2Reply, error) Nat44AddressDump(ctx context.Context, in *Nat44AddressDump) (RPCService_Nat44AddressDumpClient, error) Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Nat44DelUserReply, error) + Nat44EdAddDelOutputInterface(ctx context.Context, in *Nat44EdAddDelOutputInterface) (*Nat44EdAddDelOutputInterfaceReply, error) + Nat44EdOutputInterfaceGet(ctx context.Context, in *Nat44EdOutputInterfaceGet) (RPCService_Nat44EdOutputInterfaceGetClient, error) + Nat44EdPluginEnableDisable(ctx context.Context, in *Nat44EdPluginEnableDisable) (*Nat44EdPluginEnableDisableReply, error) + Nat44EdSetFqOptions(ctx context.Context, in *Nat44EdSetFqOptions) (*Nat44EdSetFqOptionsReply, error) + Nat44EdShowFqOptions(ctx context.Context, in *Nat44EdShowFqOptions) (*Nat44EdShowFqOptionsReply, error) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) Nat44IdentityMappingDump(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_Nat44IdentityMappingDumpClient, error) @@ -30,33 +37,15 @@ type RPCService interface { Nat44InterfaceOutputFeatureDump(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_Nat44InterfaceOutputFeatureDumpClient, error) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) Nat44LbStaticMappingDump(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_Nat44LbStaticMappingDumpClient, error) + Nat44PluginEnableDisable(ctx context.Context, in *Nat44PluginEnableDisable) (*Nat44PluginEnableDisableReply, error) Nat44SessionCleanup(ctx context.Context, in *Nat44SessionCleanup) (*Nat44SessionCleanupReply, error) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSessionLimit) (*Nat44SetSessionLimitReply, error) + Nat44ShowRunningConfig(ctx context.Context, in *Nat44ShowRunningConfig) (*Nat44ShowRunningConfigReply, error) Nat44StaticMappingDump(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_Nat44StaticMappingDumpClient, error) Nat44UserDump(ctx context.Context, in *Nat44UserDump) (RPCService_Nat44UserDumpClient, error) Nat44UserSessionDump(ctx context.Context, in *Nat44UserSessionDump) (RPCService_Nat44UserSessionDumpClient, error) - Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) - Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) - Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) - Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) - Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) - Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) - Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) - Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) - Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) - Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) - Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) - Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) - Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) - Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) + Nat44UserSessionV2Dump(ctx context.Context, in *Nat44UserSessionV2Dump) (RPCService_Nat44UserSessionV2DumpClient, error) NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) - NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) - NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) - NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) - NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) - NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) - NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) - NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) @@ -73,6 +62,7 @@ type RPCService interface { NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) + NatShowConfig2(ctx context.Context, in *NatShowConfig2) (*NatShowConfig2Reply, error) NatWorkerDump(ctx context.Context, in *NatWorkerDump) (RPCService_NatWorkerDumpClient, error) } @@ -90,7 +80,7 @@ func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44Ad if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { @@ -99,7 +89,7 @@ func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat4 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { @@ -108,7 +98,7 @@ func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { @@ -117,7 +107,7 @@ func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat4 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { @@ -126,7 +116,16 @@ func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44AddDelStaticMappingV2(ctx context.Context, in *Nat44AddDelStaticMappingV2) (*Nat44AddDelStaticMappingV2Reply, error) { + out := new(Nat44AddDelStaticMappingV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddressDump(ctx context.Context, in *Nat44AddressDump) (RPCService_Nat44AddressDumpClient, error) { @@ -138,7 +137,7 @@ func (c *serviceClient) Nat44AddressDump(ctx context.Context, in *Nat44AddressDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -161,7 +160,11 @@ func (c *serviceClient_Nat44AddressDumpClient) Recv() (*Nat44AddressDetails, err switch m := msg.(type) { case *Nat44AddressDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -174,7 +177,7 @@ func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Nat44DelUserReply, error) { @@ -183,7 +186,83 @@ func (c *serviceClient) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Na if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EdAddDelOutputInterface(ctx context.Context, in *Nat44EdAddDelOutputInterface) (*Nat44EdAddDelOutputInterfaceReply, error) { + out := new(Nat44EdAddDelOutputInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EdOutputInterfaceGet(ctx context.Context, in *Nat44EdOutputInterfaceGet) (RPCService_Nat44EdOutputInterfaceGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EdOutputInterfaceGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EdOutputInterfaceGetClient interface { + Recv() (*Nat44EdOutputInterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat44EdOutputInterfaceGetClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EdOutputInterfaceGetClient) Recv() (*Nat44EdOutputInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EdOutputInterfaceDetails: + return m, nil + case *Nat44EdOutputInterfaceGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EdPluginEnableDisable(ctx context.Context, in *Nat44EdPluginEnableDisable) (*Nat44EdPluginEnableDisableReply, error) { + out := new(Nat44EdPluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EdSetFqOptions(ctx context.Context, in *Nat44EdSetFqOptions) (*Nat44EdSetFqOptionsReply, error) { + out := new(Nat44EdSetFqOptionsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EdShowFqOptions(ctx context.Context, in *Nat44EdShowFqOptions) (*Nat44EdShowFqOptionsReply, error) { + out := new(Nat44EdShowFqOptionsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { @@ -192,7 +271,7 @@ func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Na if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { @@ -213,7 +292,7 @@ func (c *serviceClient) Nat44IdentityMappingDump(ctx context.Context, in *Nat44I if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -236,7 +315,11 @@ func (c *serviceClient_Nat44IdentityMappingDumpClient) Recv() (*Nat44IdentityMap switch m := msg.(type) { case *Nat44IdentityMappingDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -249,7 +332,7 @@ func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { @@ -258,7 +341,7 @@ func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44InterfaceAddrDump(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_Nat44InterfaceAddrDumpClient, error) { @@ -270,7 +353,7 @@ func (c *serviceClient) Nat44InterfaceAddrDump(ctx context.Context, in *Nat44Int if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -293,7 +376,11 @@ func (c *serviceClient_Nat44InterfaceAddrDumpClient) Recv() (*Nat44InterfaceAddr switch m := msg.(type) { case *Nat44InterfaceAddrDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -309,7 +396,7 @@ func (c *serviceClient) Nat44InterfaceDump(ctx context.Context, in *Nat44Interfa if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -332,7 +419,11 @@ func (c *serviceClient_Nat44InterfaceDumpClient) Recv() (*Nat44InterfaceDetails, switch m := msg.(type) { case *Nat44InterfaceDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -348,7 +439,7 @@ func (c *serviceClient) Nat44InterfaceOutputFeatureDump(ctx context.Context, in if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -371,7 +462,11 @@ func (c *serviceClient_Nat44InterfaceOutputFeatureDumpClient) Recv() (*Nat44Inte switch m := msg.(type) { case *Nat44InterfaceOutputFeatureDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -384,7 +479,7 @@ func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44LbStaticMappingDump(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_Nat44LbStaticMappingDumpClient, error) { @@ -396,7 +491,7 @@ func (c *serviceClient) Nat44LbStaticMappingDump(ctx context.Context, in *Nat44L if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -419,20 +514,33 @@ func (c *serviceClient_Nat44LbStaticMappingDumpClient) Recv() (*Nat44LbStaticMap switch m := msg.(type) { case *Nat44LbStaticMappingDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } +func (c *serviceClient) Nat44PluginEnableDisable(ctx context.Context, in *Nat44PluginEnableDisable) (*Nat44PluginEnableDisableReply, error) { + out := new(Nat44PluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) Nat44SessionCleanup(ctx context.Context, in *Nat44SessionCleanup) (*Nat44SessionCleanupReply, error) { out := new(Nat44SessionCleanupReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSessionLimit) (*Nat44SetSessionLimitReply, error) { @@ -441,7 +549,16 @@ func (c *serviceClient) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44ShowRunningConfig(ctx context.Context, in *Nat44ShowRunningConfig) (*Nat44ShowRunningConfigReply, error) { + out := new(Nat44ShowRunningConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44StaticMappingDump(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_Nat44StaticMappingDumpClient, error) { @@ -453,7 +570,7 @@ func (c *serviceClient) Nat44StaticMappingDump(ctx context.Context, in *Nat44Sta if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -476,7 +593,11 @@ func (c *serviceClient_Nat44StaticMappingDumpClient) Recv() (*Nat44StaticMapping switch m := msg.(type) { case *Nat44StaticMappingDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -492,7 +613,7 @@ func (c *serviceClient) Nat44UserDump(ctx context.Context, in *Nat44UserDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -515,7 +636,11 @@ func (c *serviceClient_Nat44UserDumpClient) Recv() (*Nat44UserDetails, error) { switch m := msg.(type) { case *Nat44UserDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -531,7 +656,7 @@ func (c *serviceClient) Nat44UserSessionDump(ctx context.Context, in *Nat44UserS if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -554,343 +679,54 @@ func (c *serviceClient_Nat44UserSessionDumpClient) Recv() (*Nat44UserSessionDeta switch m := msg.(type) { case *Nat44UserSessionDetails: return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { - out := new(Nat64AddDelInterfaceReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { - out := new(Nat64AddDelInterfaceAddrReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { - out := new(Nat64AddDelPoolAddrRangeReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { - out := new(Nat64AddDelPrefixReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { - out := new(Nat64AddDelStaticBibReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat64BibDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat64BibDumpClient interface { - Recv() (*Nat64BibDetails, error) - api.Stream -} - -type serviceClient_Nat64BibDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat64BibDumpClient) Recv() (*Nat64BibDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat64BibDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat64InterfaceDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat64InterfaceDumpClient interface { - Recv() (*Nat64InterfaceDetails, error) - api.Stream -} - -type serviceClient_Nat64InterfaceDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat64InterfaceDumpClient) Recv() (*Nat64InterfaceDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat64InterfaceDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat64PoolAddrDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat64PoolAddrDumpClient interface { - Recv() (*Nat64PoolAddrDetails, error) - api.Stream -} - -type serviceClient_Nat64PoolAddrDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat64PoolAddrDumpClient) Recv() (*Nat64PoolAddrDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat64PoolAddrDetails: - return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } -func (c *serviceClient) Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) { +func (c *serviceClient) Nat44UserSessionV2Dump(ctx context.Context, in *Nat44UserSessionV2Dump) (RPCService_Nat44UserSessionV2DumpClient, error) { stream, err := c.conn.NewStream(ctx) if err != nil { return nil, err } - x := &serviceClient_Nat64PrefixDumpClient{stream} + x := &serviceClient_Nat44UserSessionV2DumpClient{stream} if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil } -type RPCService_Nat64PrefixDumpClient interface { - Recv() (*Nat64PrefixDetails, error) +type RPCService_Nat44UserSessionV2DumpClient interface { + Recv() (*Nat44UserSessionV2Details, error) api.Stream } -type serviceClient_Nat64PrefixDumpClient struct { +type serviceClient_Nat44UserSessionV2DumpClient struct { api.Stream } -func (c *serviceClient_Nat64PrefixDumpClient) Recv() (*Nat64PrefixDetails, error) { +func (c *serviceClient_Nat44UserSessionV2DumpClient) Recv() (*Nat44UserSessionV2Details, error) { msg, err := c.Stream.RecvMsg() if err != nil { return nil, err } switch m := msg.(type) { - case *Nat64PrefixDetails: + case *Nat44UserSessionV2Details: return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat64StDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat64StDumpClient interface { - Recv() (*Nat64StDetails, error) - api.Stream -} - -type serviceClient_Nat64StDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat64StDumpClient) Recv() (*Nat64StDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat64StDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { - out := new(Nat66AddDelInterfaceReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { - out := new(Nat66AddDelStaticMappingReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat66InterfaceDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat66InterfaceDumpClient interface { - Recv() (*Nat66InterfaceDetails, error) - api.Stream -} - -type serviceClient_Nat66InterfaceDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat66InterfaceDumpClient) Recv() (*Nat66InterfaceDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat66InterfaceDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_Nat66StaticMappingDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_Nat66StaticMappingDumpClient interface { - Recv() (*Nat66StaticMappingDetails, error) - api.Stream -} - -type serviceClient_Nat66StaticMappingDumpClient struct { - api.Stream -} - -func (c *serviceClient_Nat66StaticMappingDumpClient) Recv() (*Nat66StaticMappingDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *Nat66StaticMappingDetails: - return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -903,130 +739,7 @@ func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) if err != nil { return nil, err } - return out, nil -} - -func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { - out := new(NatDetAddDelMapReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { - out := new(NatDetCloseSessionInReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { - out := new(NatDetCloseSessionOutReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { - out := new(NatDetForwardReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_NatDetMapDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_NatDetMapDumpClient interface { - Recv() (*NatDetMapDetails, error) - api.Stream -} - -type serviceClient_NatDetMapDumpClient struct { - api.Stream -} - -func (c *serviceClient_NatDetMapDumpClient) Recv() (*NatDetMapDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *NatDetMapDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { - out := new(NatDetReverseReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_NatDetSessionDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_NatDetSessionDumpClient interface { - Recv() (*NatDetSessionDetails, error) - api.Stream -} - -type serviceClient_NatDetSessionDumpClient struct { - api.Stream -} - -func (c *serviceClient_NatDetSessionDumpClient) Recv() (*NatDetSessionDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *NatDetSessionDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) { @@ -1035,7 +748,7 @@ func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { @@ -1044,7 +757,7 @@ func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { @@ -1053,7 +766,7 @@ func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) { @@ -1062,7 +775,7 @@ func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaF if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) { @@ -1071,7 +784,7 @@ func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailov if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) { @@ -1080,7 +793,7 @@ func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) { @@ -1089,7 +802,7 @@ func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatH if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) { @@ -1098,7 +811,7 @@ func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailov if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) { @@ -1107,7 +820,7 @@ func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { @@ -1116,7 +829,7 @@ func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { @@ -1125,7 +838,7 @@ func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) { @@ -1134,7 +847,7 @@ func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { @@ -1143,7 +856,7 @@ func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { @@ -1152,7 +865,7 @@ func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { @@ -1161,7 +874,7 @@ func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { @@ -1170,7 +883,16 @@ func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NatShowConfig2(ctx context.Context, in *NatShowConfig2) (*NatShowConfig2Reply, error) { + out := new(NatShowConfig2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatWorkerDump(ctx context.Context, in *NatWorkerDump) (RPCService_NatWorkerDumpClient, error) { @@ -1182,7 +904,7 @@ func (c *serviceClient) NatWorkerDump(ctx context.Context, in *NatWorkerDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -1205,7 +927,11 @@ func (c *serviceClient_NatWorkerDumpClient) Recv() (*NatWorkerDetails, error) { switch m := msg.(type) { case *NatWorkerDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/nat44_ei/nat44_ei.ba.go b/binapi/nat44_ei/nat44_ei.ba.go new file mode 100644 index 0000000..21c97b5 --- /dev/null +++ b/binapi/nat44_ei/nat44_ei.ba.go @@ -0,0 +1,3361 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/nat44_ei.api.json + +// Package nat44_ei contains generated bindings for API file nat44_ei.api. +// +// Contents: +// 1 enum +// 78 messages +// +package nat44_ei + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + nat_types "go.fd.io/govpp/binapi/nat_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nat44_ei" + APIVersion = "1.1.1" + VersionCrc = 0xfa6ff1f7 +) + +// Nat44EiConfigFlags defines enum 'nat44_ei_config_flags'. +type Nat44EiConfigFlags uint8 + +const ( + NAT44_EI_NONE Nat44EiConfigFlags = 0 + NAT44_EI_STATIC_MAPPING_ONLY Nat44EiConfigFlags = 1 + NAT44_EI_CONNECTION_TRACKING Nat44EiConfigFlags = 2 + NAT44_EI_OUT2IN_DPO Nat44EiConfigFlags = 4 + NAT44_EI_ADDR_ONLY_MAPPING Nat44EiConfigFlags = 8 + NAT44_EI_IF_INSIDE Nat44EiConfigFlags = 16 + NAT44_EI_IF_OUTSIDE Nat44EiConfigFlags = 32 + NAT44_EI_STATIC_MAPPING Nat44EiConfigFlags = 64 +) + +var ( + Nat44EiConfigFlags_name = map[uint8]string{ + 0: "NAT44_EI_NONE", + 1: "NAT44_EI_STATIC_MAPPING_ONLY", + 2: "NAT44_EI_CONNECTION_TRACKING", + 4: "NAT44_EI_OUT2IN_DPO", + 8: "NAT44_EI_ADDR_ONLY_MAPPING", + 16: "NAT44_EI_IF_INSIDE", + 32: "NAT44_EI_IF_OUTSIDE", + 64: "NAT44_EI_STATIC_MAPPING", + } + Nat44EiConfigFlags_value = map[string]uint8{ + "NAT44_EI_NONE": 0, + "NAT44_EI_STATIC_MAPPING_ONLY": 1, + "NAT44_EI_CONNECTION_TRACKING": 2, + "NAT44_EI_OUT2IN_DPO": 4, + "NAT44_EI_ADDR_ONLY_MAPPING": 8, + "NAT44_EI_IF_INSIDE": 16, + "NAT44_EI_IF_OUTSIDE": 32, + "NAT44_EI_STATIC_MAPPING": 64, + } +) + +func (x Nat44EiConfigFlags) String() string { + s, ok := Nat44EiConfigFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := Nat44EiConfigFlags_name[uint8(n)] + if ok { + return s + } + return "Nat44EiConfigFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// Nat44EiAddDelAddressRange defines message 'nat44_ei_add_del_address_range'. +// InProgress: the message form may change in the future versions +type Nat44EiAddDelAddressRange struct { + FirstIPAddress ip_types.IP4Address `binapi:"ip4_address,name=first_ip_address" json:"first_ip_address,omitempty"` + LastIPAddress ip_types.IP4Address `binapi:"ip4_address,name=last_ip_address" json:"last_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat44EiAddDelAddressRange) Reset() { *m = Nat44EiAddDelAddressRange{} } +func (*Nat44EiAddDelAddressRange) GetMessageName() string { return "nat44_ei_add_del_address_range" } +func (*Nat44EiAddDelAddressRange) GetCrcString() string { return "35f21abc" } +func (*Nat44EiAddDelAddressRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddDelAddressRange) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.FirstIPAddress + size += 1 * 4 // m.LastIPAddress + size += 4 // m.VrfID + size += 1 // m.IsAdd + return size +} +func (m *Nat44EiAddDelAddressRange) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.FirstIPAddress[:], 4) + buf.EncodeBytes(m.LastIPAddress[:], 4) + buf.EncodeUint32(m.VrfID) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelAddressRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.FirstIPAddress[:], buf.DecodeBytes(4)) + copy(m.LastIPAddress[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat44EiAddDelAddressRangeReply defines message 'nat44_ei_add_del_address_range_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiAddDelAddressRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiAddDelAddressRangeReply) Reset() { *m = Nat44EiAddDelAddressRangeReply{} } +func (*Nat44EiAddDelAddressRangeReply) GetMessageName() string { + return "nat44_ei_add_del_address_range_reply" +} +func (*Nat44EiAddDelAddressRangeReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiAddDelAddressRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddDelAddressRangeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiAddDelAddressRangeReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelAddressRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiAddDelIdentityMapping defines message 'nat44_ei_add_del_identity_mapping'. +// Deprecated: the message will be removed in the future versions +type Nat44EiAddDelIdentityMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44EiAddDelIdentityMapping) Reset() { *m = Nat44EiAddDelIdentityMapping{} } +func (*Nat44EiAddDelIdentityMapping) GetMessageName() string { + return "nat44_ei_add_del_identity_mapping" +} +func (*Nat44EiAddDelIdentityMapping) GetCrcString() string { return "cb8606b9" } +func (*Nat44EiAddDelIdentityMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddDelIdentityMapping) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 1 * 4 // m.IPAddress + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.SwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44EiAddDelIdentityMapping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.VrfID) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelIdentityMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44EiAddDelIdentityMappingReply defines message 'nat44_ei_add_del_identity_mapping_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiAddDelIdentityMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiAddDelIdentityMappingReply) Reset() { *m = Nat44EiAddDelIdentityMappingReply{} } +func (*Nat44EiAddDelIdentityMappingReply) GetMessageName() string { + return "nat44_ei_add_del_identity_mapping_reply" +} +func (*Nat44EiAddDelIdentityMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiAddDelIdentityMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddDelIdentityMappingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiAddDelIdentityMappingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelIdentityMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiAddDelInterfaceAddr defines message 'nat44_ei_add_del_interface_addr'. +// Deprecated: the message will be removed in the future versions +type Nat44EiAddDelInterfaceAddr struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44EiAddDelInterfaceAddr) Reset() { *m = Nat44EiAddDelInterfaceAddr{} } +func (*Nat44EiAddDelInterfaceAddr) GetMessageName() string { return "nat44_ei_add_del_interface_addr" } +func (*Nat44EiAddDelInterfaceAddr) GetCrcString() string { return "883abbcc" } +func (*Nat44EiAddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddDelInterfaceAddr) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 1 // m.Flags + return size +} +func (m *Nat44EiAddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelInterfaceAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44EiAddDelInterfaceAddrReply defines message 'nat44_ei_add_del_interface_addr_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiAddDelInterfaceAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiAddDelInterfaceAddrReply) Reset() { *m = Nat44EiAddDelInterfaceAddrReply{} } +func (*Nat44EiAddDelInterfaceAddrReply) GetMessageName() string { + return "nat44_ei_add_del_interface_addr_reply" +} +func (*Nat44EiAddDelInterfaceAddrReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiAddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddDelInterfaceAddrReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiAddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelInterfaceAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiAddDelOutputInterface defines message 'nat44_ei_add_del_output_interface'. +type Nat44EiAddDelOutputInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiAddDelOutputInterface) Reset() { *m = Nat44EiAddDelOutputInterface{} } +func (*Nat44EiAddDelOutputInterface) GetMessageName() string { + return "nat44_ei_add_del_output_interface" +} +func (*Nat44EiAddDelOutputInterface) GetCrcString() string { return "47d6e753" } +func (*Nat44EiAddDelOutputInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddDelOutputInterface) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiAddDelOutputInterface) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelOutputInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiAddDelOutputInterfaceReply defines message 'nat44_ei_add_del_output_interface_reply'. +type Nat44EiAddDelOutputInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiAddDelOutputInterfaceReply) Reset() { *m = Nat44EiAddDelOutputInterfaceReply{} } +func (*Nat44EiAddDelOutputInterfaceReply) GetMessageName() string { + return "nat44_ei_add_del_output_interface_reply" +} +func (*Nat44EiAddDelOutputInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiAddDelOutputInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddDelOutputInterfaceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiAddDelOutputInterfaceReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelOutputInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiAddDelStaticMapping defines message 'nat44_ei_add_del_static_mapping'. +// InProgress: the message form may change in the future versions +type Nat44EiAddDelStaticMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + ExternalSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=external_sw_if_index" json:"external_sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44EiAddDelStaticMapping) Reset() { *m = Nat44EiAddDelStaticMapping{} } +func (*Nat44EiAddDelStaticMapping) GetMessageName() string { return "nat44_ei_add_del_static_mapping" } +func (*Nat44EiAddDelStaticMapping) GetCrcString() string { return "b404b7fe" } +func (*Nat44EiAddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddDelStaticMapping) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 1 * 4 // m.LocalIPAddress + size += 1 * 4 // m.ExternalIPAddress + size += 1 // m.Protocol + size += 2 // m.LocalPort + size += 2 // m.ExternalPort + size += 4 // m.ExternalSwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44EiAddDelStaticMapping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.LocalIPAddress[:], 4) + buf.EncodeBytes(m.ExternalIPAddress[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.LocalPort) + buf.EncodeUint16(m.ExternalPort) + buf.EncodeUint32(uint32(m.ExternalSwIfIndex)) + buf.EncodeUint32(m.VrfID) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelStaticMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.LocalPort = buf.DecodeUint16() + m.ExternalPort = buf.DecodeUint16() + m.ExternalSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44EiAddDelStaticMappingReply defines message 'nat44_ei_add_del_static_mapping_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiAddDelStaticMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiAddDelStaticMappingReply) Reset() { *m = Nat44EiAddDelStaticMappingReply{} } +func (*Nat44EiAddDelStaticMappingReply) GetMessageName() string { + return "nat44_ei_add_del_static_mapping_reply" +} +func (*Nat44EiAddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiAddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddDelStaticMappingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiAddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiAddDelStaticMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiAddressDetails defines message 'nat44_ei_address_details'. +// InProgress: the message form may change in the future versions +type Nat44EiAddressDetails struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat44EiAddressDetails) Reset() { *m = Nat44EiAddressDetails{} } +func (*Nat44EiAddressDetails) GetMessageName() string { return "nat44_ei_address_details" } +func (*Nat44EiAddressDetails) GetCrcString() string { return "318f1202" } +func (*Nat44EiAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiAddressDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.IPAddress + size += 4 // m.VrfID + return size +} +func (m *Nat44EiAddressDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *Nat44EiAddressDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat44EiAddressDump defines message 'nat44_ei_address_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiAddressDump struct{} + +func (m *Nat44EiAddressDump) Reset() { *m = Nat44EiAddressDump{} } +func (*Nat44EiAddressDump) GetMessageName() string { return "nat44_ei_address_dump" } +func (*Nat44EiAddressDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiAddressDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiAddressDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiAddressDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiDelSession defines message 'nat44_ei_del_session'. +// InProgress: the message form may change in the future versions +type Nat44EiDelSession struct { + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` +} + +func (m *Nat44EiDelSession) Reset() { *m = Nat44EiDelSession{} } +func (*Nat44EiDelSession) GetMessageName() string { return "nat44_ei_del_session" } +func (*Nat44EiDelSession) GetCrcString() string { return "74969ffe" } +func (*Nat44EiDelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiDelSession) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.Address + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.VrfID + size += 1 // m.Flags + size += 1 * 4 // m.ExtHostAddress + size += 2 // m.ExtHostPort + return size +} +func (m *Nat44EiDelSession) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Address[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.ExtHostAddress[:], 4) + buf.EncodeUint16(m.ExtHostPort) + return buf.Bytes(), nil +} +func (m *Nat44EiDelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Address[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) + m.ExtHostPort = buf.DecodeUint16() + return nil +} + +// Nat44EiDelSessionReply defines message 'nat44_ei_del_session_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiDelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiDelSessionReply) Reset() { *m = Nat44EiDelSessionReply{} } +func (*Nat44EiDelSessionReply) GetMessageName() string { return "nat44_ei_del_session_reply" } +func (*Nat44EiDelSessionReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiDelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiDelSessionReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiDelSessionReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiDelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiDelUser defines message 'nat44_ei_del_user'. +// InProgress: the message form may change in the future versions +type Nat44EiDelUser struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + FibIndex uint32 `binapi:"u32,name=fib_index" json:"fib_index,omitempty"` +} + +func (m *Nat44EiDelUser) Reset() { *m = Nat44EiDelUser{} } +func (*Nat44EiDelUser) GetMessageName() string { return "nat44_ei_del_user" } +func (*Nat44EiDelUser) GetCrcString() string { return "99a9f998" } +func (*Nat44EiDelUser) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiDelUser) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.IPAddress + size += 4 // m.FibIndex + return size +} +func (m *Nat44EiDelUser) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(m.FibIndex) + return buf.Bytes(), nil +} +func (m *Nat44EiDelUser) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.FibIndex = buf.DecodeUint32() + return nil +} + +// Nat44EiDelUserReply defines message 'nat44_ei_del_user_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiDelUserReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiDelUserReply) Reset() { *m = Nat44EiDelUserReply{} } +func (*Nat44EiDelUserReply) GetMessageName() string { return "nat44_ei_del_user_reply" } +func (*Nat44EiDelUserReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiDelUserReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiDelUserReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiDelUserReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiDelUserReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiForwardingEnableDisable defines message 'nat44_ei_forwarding_enable_disable'. +// InProgress: the message form may change in the future versions +type Nat44EiForwardingEnableDisable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat44EiForwardingEnableDisable) Reset() { *m = Nat44EiForwardingEnableDisable{} } +func (*Nat44EiForwardingEnableDisable) GetMessageName() string { + return "nat44_ei_forwarding_enable_disable" +} +func (*Nat44EiForwardingEnableDisable) GetCrcString() string { return "b3e225d2" } +func (*Nat44EiForwardingEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiForwardingEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Enable + return size +} +func (m *Nat44EiForwardingEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat44EiForwardingEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// Nat44EiForwardingEnableDisableReply defines message 'nat44_ei_forwarding_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiForwardingEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiForwardingEnableDisableReply) Reset() { *m = Nat44EiForwardingEnableDisableReply{} } +func (*Nat44EiForwardingEnableDisableReply) GetMessageName() string { + return "nat44_ei_forwarding_enable_disable_reply" +} +func (*Nat44EiForwardingEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiForwardingEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiForwardingEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiForwardingEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiForwardingEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiGetAddrAndPortAllocAlg defines message 'nat44_ei_get_addr_and_port_alloc_alg'. +// Deprecated: the message will be removed in the future versions +type Nat44EiGetAddrAndPortAllocAlg struct{} + +func (m *Nat44EiGetAddrAndPortAllocAlg) Reset() { *m = Nat44EiGetAddrAndPortAllocAlg{} } +func (*Nat44EiGetAddrAndPortAllocAlg) GetMessageName() string { + return "nat44_ei_get_addr_and_port_alloc_alg" +} +func (*Nat44EiGetAddrAndPortAllocAlg) GetCrcString() string { return "51077d14" } +func (*Nat44EiGetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiGetAddrAndPortAllocAlg) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiGetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiGetAddrAndPortAllocAlg) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiGetAddrAndPortAllocAlgReply defines message 'nat44_ei_get_addr_and_port_alloc_alg_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiGetAddrAndPortAllocAlgReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Alg uint8 `binapi:"u8,name=alg" json:"alg,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` +} + +func (m *Nat44EiGetAddrAndPortAllocAlgReply) Reset() { *m = Nat44EiGetAddrAndPortAllocAlgReply{} } +func (*Nat44EiGetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat44_ei_get_addr_and_port_alloc_alg_reply" +} +func (*Nat44EiGetAddrAndPortAllocAlgReply) GetCrcString() string { return "3607a7d0" } +func (*Nat44EiGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiGetAddrAndPortAllocAlgReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 // m.Alg + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 2 // m.Psid + size += 2 // m.StartPort + size += 2 // m.EndPort + return size +} +func (m *Nat44EiGetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint8(m.Alg) + buf.EncodeUint8(m.PsidOffset) + buf.EncodeUint8(m.PsidLength) + buf.EncodeUint16(m.Psid) + buf.EncodeUint16(m.StartPort) + buf.EncodeUint16(m.EndPort) + return buf.Bytes(), nil +} +func (m *Nat44EiGetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Alg = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Psid = buf.DecodeUint16() + m.StartPort = buf.DecodeUint16() + m.EndPort = buf.DecodeUint16() + return nil +} + +// Nat44EiGetMssClamping defines message 'nat44_ei_get_mss_clamping'. +// Deprecated: the message will be removed in the future versions +type Nat44EiGetMssClamping struct{} + +func (m *Nat44EiGetMssClamping) Reset() { *m = Nat44EiGetMssClamping{} } +func (*Nat44EiGetMssClamping) GetMessageName() string { return "nat44_ei_get_mss_clamping" } +func (*Nat44EiGetMssClamping) GetCrcString() string { return "51077d14" } +func (*Nat44EiGetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiGetMssClamping) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiGetMssClamping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiGetMssClamping) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiGetMssClampingReply defines message 'nat44_ei_get_mss_clamping_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiGetMssClampingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MssValue uint16 `binapi:"u16,name=mss_value" json:"mss_value,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat44EiGetMssClampingReply) Reset() { *m = Nat44EiGetMssClampingReply{} } +func (*Nat44EiGetMssClampingReply) GetMessageName() string { return "nat44_ei_get_mss_clamping_reply" } +func (*Nat44EiGetMssClampingReply) GetCrcString() string { return "1c0b2a78" } +func (*Nat44EiGetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiGetMssClampingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 2 // m.MssValue + size += 1 // m.Enable + return size +} +func (m *Nat44EiGetMssClampingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint16(m.MssValue) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat44EiGetMssClampingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.MssValue = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// Nat44EiHaFlush defines message 'nat44_ei_ha_flush'. +// InProgress: the message form may change in the future versions +type Nat44EiHaFlush struct{} + +func (m *Nat44EiHaFlush) Reset() { *m = Nat44EiHaFlush{} } +func (*Nat44EiHaFlush) GetMessageName() string { return "nat44_ei_ha_flush" } +func (*Nat44EiHaFlush) GetCrcString() string { return "51077d14" } +func (*Nat44EiHaFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaFlush) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiHaFlush) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiHaFlush) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiHaFlushReply defines message 'nat44_ei_ha_flush_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiHaFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiHaFlushReply) Reset() { *m = Nat44EiHaFlushReply{} } +func (*Nat44EiHaFlushReply) GetMessageName() string { return "nat44_ei_ha_flush_reply" } +func (*Nat44EiHaFlushReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiHaFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaFlushReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiHaFlushReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiHaGetFailover defines message 'nat44_ei_ha_get_failover'. +// Deprecated: the message will be removed in the future versions +type Nat44EiHaGetFailover struct{} + +func (m *Nat44EiHaGetFailover) Reset() { *m = Nat44EiHaGetFailover{} } +func (*Nat44EiHaGetFailover) GetMessageName() string { return "nat44_ei_ha_get_failover" } +func (*Nat44EiHaGetFailover) GetCrcString() string { return "51077d14" } +func (*Nat44EiHaGetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaGetFailover) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiHaGetFailover) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiHaGetFailover) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiHaGetFailoverReply defines message 'nat44_ei_ha_get_failover_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiHaGetFailoverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SessionRefreshInterval uint32 `binapi:"u32,name=session_refresh_interval" json:"session_refresh_interval,omitempty"` +} + +func (m *Nat44EiHaGetFailoverReply) Reset() { *m = Nat44EiHaGetFailoverReply{} } +func (*Nat44EiHaGetFailoverReply) GetMessageName() string { return "nat44_ei_ha_get_failover_reply" } +func (*Nat44EiHaGetFailoverReply) GetCrcString() string { return "a67d8752" } +func (*Nat44EiHaGetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaGetFailoverReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.SessionRefreshInterval + return size +} +func (m *Nat44EiHaGetFailoverReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(m.SessionRefreshInterval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaGetFailoverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.SessionRefreshInterval = buf.DecodeUint32() + return nil +} + +// Nat44EiHaGetListener defines message 'nat44_ei_ha_get_listener'. +// Deprecated: the message will be removed in the future versions +type Nat44EiHaGetListener struct{} + +func (m *Nat44EiHaGetListener) Reset() { *m = Nat44EiHaGetListener{} } +func (*Nat44EiHaGetListener) GetMessageName() string { return "nat44_ei_ha_get_listener" } +func (*Nat44EiHaGetListener) GetCrcString() string { return "51077d14" } +func (*Nat44EiHaGetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaGetListener) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiHaGetListener) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiHaGetListener) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiHaGetListenerReply defines message 'nat44_ei_ha_get_listener_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiHaGetListenerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` +} + +func (m *Nat44EiHaGetListenerReply) Reset() { *m = Nat44EiHaGetListenerReply{} } +func (*Nat44EiHaGetListenerReply) GetMessageName() string { return "nat44_ei_ha_get_listener_reply" } +func (*Nat44EiHaGetListenerReply) GetCrcString() string { return "123ea41f" } +func (*Nat44EiHaGetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaGetListenerReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.PathMtu + return size +} +func (m *Nat44EiHaGetListenerReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(m.PathMtu) + return buf.Bytes(), nil +} +func (m *Nat44EiHaGetListenerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.PathMtu = buf.DecodeUint32() + return nil +} + +// Nat44EiHaResync defines message 'nat44_ei_ha_resync'. +// InProgress: the message form may change in the future versions +type Nat44EiHaResync struct { + WantResyncEvent uint8 `binapi:"u8,name=want_resync_event" json:"want_resync_event,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *Nat44EiHaResync) Reset() { *m = Nat44EiHaResync{} } +func (*Nat44EiHaResync) GetMessageName() string { return "nat44_ei_ha_resync" } +func (*Nat44EiHaResync) GetCrcString() string { return "c8ab9e03" } +func (*Nat44EiHaResync) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaResync) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.WantResyncEvent + size += 4 // m.PID + return size +} +func (m *Nat44EiHaResync) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.WantResyncEvent) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *Nat44EiHaResync) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WantResyncEvent = buf.DecodeUint8() + m.PID = buf.DecodeUint32() + return nil +} + +// Nat44EiHaResyncCompletedEvent defines message 'nat44_ei_ha_resync_completed_event'. +// InProgress: the message form may change in the future versions +type Nat44EiHaResyncCompletedEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + MissedCount uint32 `binapi:"u32,name=missed_count" json:"missed_count,omitempty"` +} + +func (m *Nat44EiHaResyncCompletedEvent) Reset() { *m = Nat44EiHaResyncCompletedEvent{} } +func (*Nat44EiHaResyncCompletedEvent) GetMessageName() string { + return "nat44_ei_ha_resync_completed_event" +} +func (*Nat44EiHaResyncCompletedEvent) GetCrcString() string { return "fdc598fb" } +func (*Nat44EiHaResyncCompletedEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *Nat44EiHaResyncCompletedEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.MissedCount + return size +} +func (m *Nat44EiHaResyncCompletedEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(m.MissedCount) + return buf.Bytes(), nil +} +func (m *Nat44EiHaResyncCompletedEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.MissedCount = buf.DecodeUint32() + return nil +} + +// Nat44EiHaResyncReply defines message 'nat44_ei_ha_resync_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiHaResyncReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiHaResyncReply) Reset() { *m = Nat44EiHaResyncReply{} } +func (*Nat44EiHaResyncReply) GetMessageName() string { return "nat44_ei_ha_resync_reply" } +func (*Nat44EiHaResyncReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiHaResyncReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaResyncReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiHaResyncReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaResyncReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiHaSetFailover defines message 'nat44_ei_ha_set_failover'. +// InProgress: the message form may change in the future versions +type Nat44EiHaSetFailover struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SessionRefreshInterval uint32 `binapi:"u32,name=session_refresh_interval" json:"session_refresh_interval,omitempty"` +} + +func (m *Nat44EiHaSetFailover) Reset() { *m = Nat44EiHaSetFailover{} } +func (*Nat44EiHaSetFailover) GetMessageName() string { return "nat44_ei_ha_set_failover" } +func (*Nat44EiHaSetFailover) GetCrcString() string { return "718246af" } +func (*Nat44EiHaSetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaSetFailover) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.SessionRefreshInterval + return size +} +func (m *Nat44EiHaSetFailover) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(m.SessionRefreshInterval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaSetFailover) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.SessionRefreshInterval = buf.DecodeUint32() + return nil +} + +// Nat44EiHaSetFailoverReply defines message 'nat44_ei_ha_set_failover_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiHaSetFailoverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiHaSetFailoverReply) Reset() { *m = Nat44EiHaSetFailoverReply{} } +func (*Nat44EiHaSetFailoverReply) GetMessageName() string { return "nat44_ei_ha_set_failover_reply" } +func (*Nat44EiHaSetFailoverReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiHaSetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaSetFailoverReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiHaSetFailoverReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaSetFailoverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiHaSetListener defines message 'nat44_ei_ha_set_listener'. +// InProgress: the message form may change in the future versions +type Nat44EiHaSetListener struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` +} + +func (m *Nat44EiHaSetListener) Reset() { *m = Nat44EiHaSetListener{} } +func (*Nat44EiHaSetListener) GetMessageName() string { return "nat44_ei_ha_set_listener" } +func (*Nat44EiHaSetListener) GetCrcString() string { return "e4a8cb4e" } +func (*Nat44EiHaSetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiHaSetListener) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.PathMtu + return size +} +func (m *Nat44EiHaSetListener) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(m.PathMtu) + return buf.Bytes(), nil +} +func (m *Nat44EiHaSetListener) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.PathMtu = buf.DecodeUint32() + return nil +} + +// Nat44EiHaSetListenerReply defines message 'nat44_ei_ha_set_listener_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiHaSetListenerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiHaSetListenerReply) Reset() { *m = Nat44EiHaSetListenerReply{} } +func (*Nat44EiHaSetListenerReply) GetMessageName() string { return "nat44_ei_ha_set_listener_reply" } +func (*Nat44EiHaSetListenerReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiHaSetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiHaSetListenerReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiHaSetListenerReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiHaSetListenerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiIdentityMappingDetails defines message 'nat44_ei_identity_mapping_details'. +// Deprecated: the message will be removed in the future versions +type Nat44EiIdentityMappingDetails struct { + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44EiIdentityMappingDetails) Reset() { *m = Nat44EiIdentityMappingDetails{} } +func (*Nat44EiIdentityMappingDetails) GetMessageName() string { + return "nat44_ei_identity_mapping_details" +} +func (*Nat44EiIdentityMappingDetails) GetCrcString() string { return "30d53e26" } +func (*Nat44EiIdentityMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiIdentityMappingDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 1 * 4 // m.IPAddress + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.SwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44EiIdentityMappingDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.Port) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.VrfID) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44EiIdentityMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44EiIdentityMappingDump defines message 'nat44_ei_identity_mapping_dump'. +// Deprecated: the message will be removed in the future versions +type Nat44EiIdentityMappingDump struct{} + +func (m *Nat44EiIdentityMappingDump) Reset() { *m = Nat44EiIdentityMappingDump{} } +func (*Nat44EiIdentityMappingDump) GetMessageName() string { return "nat44_ei_identity_mapping_dump" } +func (*Nat44EiIdentityMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiIdentityMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiIdentityMappingDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiIdentityMappingDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiIdentityMappingDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiInterfaceAddDelFeature defines message 'nat44_ei_interface_add_del_feature'. +// InProgress: the message form may change in the future versions +type Nat44EiInterfaceAddDelFeature struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiInterfaceAddDelFeature) Reset() { *m = Nat44EiInterfaceAddDelFeature{} } +func (*Nat44EiInterfaceAddDelFeature) GetMessageName() string { + return "nat44_ei_interface_add_del_feature" +} +func (*Nat44EiInterfaceAddDelFeature) GetCrcString() string { return "63a2db8b" } +func (*Nat44EiInterfaceAddDelFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiInterfaceAddDelFeature) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiInterfaceAddDelFeature) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddDelFeature) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiInterfaceAddDelFeatureReply defines message 'nat44_ei_interface_add_del_feature_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiInterfaceAddDelFeatureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiInterfaceAddDelFeatureReply) Reset() { *m = Nat44EiInterfaceAddDelFeatureReply{} } +func (*Nat44EiInterfaceAddDelFeatureReply) GetMessageName() string { + return "nat44_ei_interface_add_del_feature_reply" +} +func (*Nat44EiInterfaceAddDelFeatureReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiInterfaceAddDelFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiInterfaceAddDelFeatureReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiInterfaceAddDelFeatureReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddDelFeatureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiInterfaceAddDelOutputFeature defines message 'nat44_ei_interface_add_del_output_feature'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceAddDelOutputFeature struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiInterfaceAddDelOutputFeature) Reset() { *m = Nat44EiInterfaceAddDelOutputFeature{} } +func (*Nat44EiInterfaceAddDelOutputFeature) GetMessageName() string { + return "nat44_ei_interface_add_del_output_feature" +} +func (*Nat44EiInterfaceAddDelOutputFeature) GetCrcString() string { return "63a2db8b" } +func (*Nat44EiInterfaceAddDelOutputFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiInterfaceAddDelOutputFeature) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiInterfaceAddDelOutputFeature) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddDelOutputFeature) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiInterfaceAddDelOutputFeatureReply defines message 'nat44_ei_interface_add_del_output_feature_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceAddDelOutputFeatureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiInterfaceAddDelOutputFeatureReply) Reset() { + *m = Nat44EiInterfaceAddDelOutputFeatureReply{} +} +func (*Nat44EiInterfaceAddDelOutputFeatureReply) GetMessageName() string { + return "nat44_ei_interface_add_del_output_feature_reply" +} +func (*Nat44EiInterfaceAddDelOutputFeatureReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiInterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiInterfaceAddDelOutputFeatureReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiInterfaceAddDelOutputFeatureReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddDelOutputFeatureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiInterfaceAddrDetails defines message 'nat44_ei_interface_addr_details'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceAddrDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiInterfaceAddrDetails) Reset() { *m = Nat44EiInterfaceAddrDetails{} } +func (*Nat44EiInterfaceAddrDetails) GetMessageName() string { return "nat44_ei_interface_addr_details" } +func (*Nat44EiInterfaceAddrDetails) GetCrcString() string { return "0b45011c" } +func (*Nat44EiInterfaceAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiInterfaceAddrDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiInterfaceAddrDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddrDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiInterfaceAddrDump defines message 'nat44_ei_interface_addr_dump'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceAddrDump struct{} + +func (m *Nat44EiInterfaceAddrDump) Reset() { *m = Nat44EiInterfaceAddrDump{} } +func (*Nat44EiInterfaceAddrDump) GetMessageName() string { return "nat44_ei_interface_addr_dump" } +func (*Nat44EiInterfaceAddrDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiInterfaceAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiInterfaceAddrDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiInterfaceAddrDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceAddrDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiInterfaceDetails defines message 'nat44_ei_interface_details'. +// InProgress: the message form may change in the future versions +type Nat44EiInterfaceDetails struct { + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiInterfaceDetails) Reset() { *m = Nat44EiInterfaceDetails{} } +func (*Nat44EiInterfaceDetails) GetMessageName() string { return "nat44_ei_interface_details" } +func (*Nat44EiInterfaceDetails) GetCrcString() string { return "f446e508" } +func (*Nat44EiInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiInterfaceDump defines message 'nat44_ei_interface_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiInterfaceDump struct{} + +func (m *Nat44EiInterfaceDump) Reset() { *m = Nat44EiInterfaceDump{} } +func (*Nat44EiInterfaceDump) GetMessageName() string { return "nat44_ei_interface_dump" } +func (*Nat44EiInterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiInterfaceOutputFeatureDetails defines message 'nat44_ei_interface_output_feature_details'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceOutputFeatureDetails struct { + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiInterfaceOutputFeatureDetails) Reset() { *m = Nat44EiInterfaceOutputFeatureDetails{} } +func (*Nat44EiInterfaceOutputFeatureDetails) GetMessageName() string { + return "nat44_ei_interface_output_feature_details" +} +func (*Nat44EiInterfaceOutputFeatureDetails) GetCrcString() string { return "f446e508" } +func (*Nat44EiInterfaceOutputFeatureDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiInterfaceOutputFeatureDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiInterfaceOutputFeatureDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceOutputFeatureDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiInterfaceOutputFeatureDump defines message 'nat44_ei_interface_output_feature_dump'. +// Deprecated: the message will be removed in the future versions +type Nat44EiInterfaceOutputFeatureDump struct{} + +func (m *Nat44EiInterfaceOutputFeatureDump) Reset() { *m = Nat44EiInterfaceOutputFeatureDump{} } +func (*Nat44EiInterfaceOutputFeatureDump) GetMessageName() string { + return "nat44_ei_interface_output_feature_dump" +} +func (*Nat44EiInterfaceOutputFeatureDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiInterfaceOutputFeatureDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiInterfaceOutputFeatureDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiInterfaceOutputFeatureDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiInterfaceOutputFeatureDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiIpfixEnableDisable defines message 'nat44_ei_ipfix_enable_disable'. +// InProgress: the message form may change in the future versions +type Nat44EiIpfixEnableDisable struct { + DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat44EiIpfixEnableDisable) Reset() { *m = Nat44EiIpfixEnableDisable{} } +func (*Nat44EiIpfixEnableDisable) GetMessageName() string { return "nat44_ei_ipfix_enable_disable" } +func (*Nat44EiIpfixEnableDisable) GetCrcString() string { return "9af4a2d2" } +func (*Nat44EiIpfixEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiIpfixEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.DomainID + size += 2 // m.SrcPort + size += 1 // m.Enable + return size +} +func (m *Nat44EiIpfixEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.DomainID) + buf.EncodeUint16(m.SrcPort) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat44EiIpfixEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainID = buf.DecodeUint32() + m.SrcPort = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// Nat44EiIpfixEnableDisableReply defines message 'nat44_ei_ipfix_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiIpfixEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiIpfixEnableDisableReply) Reset() { *m = Nat44EiIpfixEnableDisableReply{} } +func (*Nat44EiIpfixEnableDisableReply) GetMessageName() string { + return "nat44_ei_ipfix_enable_disable_reply" +} +func (*Nat44EiIpfixEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiIpfixEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiIpfixEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiIpfixEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiIpfixEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiOutputInterfaceDetails defines message 'nat44_ei_output_interface_details'. +type Nat44EiOutputInterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44EiOutputInterfaceDetails) Reset() { *m = Nat44EiOutputInterfaceDetails{} } +func (*Nat44EiOutputInterfaceDetails) GetMessageName() string { + return "nat44_ei_output_interface_details" +} +func (*Nat44EiOutputInterfaceDetails) GetCrcString() string { return "0b45011c" } +func (*Nat44EiOutputInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiOutputInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44EiOutputInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44EiOutputInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44EiOutputInterfaceGet defines message 'nat44_ei_output_interface_get'. +type Nat44EiOutputInterfaceGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *Nat44EiOutputInterfaceGet) Reset() { *m = Nat44EiOutputInterfaceGet{} } +func (*Nat44EiOutputInterfaceGet) GetMessageName() string { return "nat44_ei_output_interface_get" } +func (*Nat44EiOutputInterfaceGet) GetCrcString() string { return "f75ba505" } +func (*Nat44EiOutputInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiOutputInterfaceGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *Nat44EiOutputInterfaceGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *Nat44EiOutputInterfaceGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// Nat44EiOutputInterfaceGetReply defines message 'nat44_ei_output_interface_get_reply'. +type Nat44EiOutputInterfaceGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *Nat44EiOutputInterfaceGetReply) Reset() { *m = Nat44EiOutputInterfaceGetReply{} } +func (*Nat44EiOutputInterfaceGetReply) GetMessageName() string { + return "nat44_ei_output_interface_get_reply" +} +func (*Nat44EiOutputInterfaceGetReply) GetCrcString() string { return "53b48f5d" } +func (*Nat44EiOutputInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiOutputInterfaceGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *Nat44EiOutputInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *Nat44EiOutputInterfaceGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +// Nat44EiPluginEnableDisable defines message 'nat44_ei_plugin_enable_disable'. +// InProgress: the message form may change in the future versions +type Nat44EiPluginEnableDisable struct { + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Users uint32 `binapi:"u32,name=users" json:"users,omitempty"` + UserMemory uint32 `binapi:"u32,name=user_memory" json:"user_memory,omitempty"` + Sessions uint32 `binapi:"u32,name=sessions" json:"sessions,omitempty"` + SessionMemory uint32 `binapi:"u32,name=session_memory" json:"session_memory,omitempty"` + UserSessions uint32 `binapi:"u32,name=user_sessions" json:"user_sessions,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44EiPluginEnableDisable) Reset() { *m = Nat44EiPluginEnableDisable{} } +func (*Nat44EiPluginEnableDisable) GetMessageName() string { return "nat44_ei_plugin_enable_disable" } +func (*Nat44EiPluginEnableDisable) GetCrcString() string { return "bf692144" } +func (*Nat44EiPluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiPluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 4 // m.Users + size += 4 // m.UserMemory + size += 4 // m.Sessions + size += 4 // m.SessionMemory + size += 4 // m.UserSessions + size += 1 // m.Enable + size += 1 // m.Flags + return size +} +func (m *Nat44EiPluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeUint32(m.Users) + buf.EncodeUint32(m.UserMemory) + buf.EncodeUint32(m.Sessions) + buf.EncodeUint32(m.SessionMemory) + buf.EncodeUint32(m.UserSessions) + buf.EncodeBool(m.Enable) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44EiPluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Users = buf.DecodeUint32() + m.UserMemory = buf.DecodeUint32() + m.Sessions = buf.DecodeUint32() + m.SessionMemory = buf.DecodeUint32() + m.UserSessions = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44EiPluginEnableDisableReply defines message 'nat44_ei_plugin_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiPluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiPluginEnableDisableReply) Reset() { *m = Nat44EiPluginEnableDisableReply{} } +func (*Nat44EiPluginEnableDisableReply) GetMessageName() string { + return "nat44_ei_plugin_enable_disable_reply" +} +func (*Nat44EiPluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiPluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiPluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiPluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiPluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetAddrAndPortAllocAlg defines message 'nat44_ei_set_addr_and_port_alloc_alg'. +// InProgress: the message form may change in the future versions +type Nat44EiSetAddrAndPortAllocAlg struct { + Alg uint8 `binapi:"u8,name=alg" json:"alg,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` +} + +func (m *Nat44EiSetAddrAndPortAllocAlg) Reset() { *m = Nat44EiSetAddrAndPortAllocAlg{} } +func (*Nat44EiSetAddrAndPortAllocAlg) GetMessageName() string { + return "nat44_ei_set_addr_and_port_alloc_alg" +} +func (*Nat44EiSetAddrAndPortAllocAlg) GetCrcString() string { return "deeb746f" } +func (*Nat44EiSetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetAddrAndPortAllocAlg) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Alg + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 2 // m.Psid + size += 2 // m.StartPort + size += 2 // m.EndPort + return size +} +func (m *Nat44EiSetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Alg) + buf.EncodeUint8(m.PsidOffset) + buf.EncodeUint8(m.PsidLength) + buf.EncodeUint16(m.Psid) + buf.EncodeUint16(m.StartPort) + buf.EncodeUint16(m.EndPort) + return buf.Bytes(), nil +} +func (m *Nat44EiSetAddrAndPortAllocAlg) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Alg = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Psid = buf.DecodeUint16() + m.StartPort = buf.DecodeUint16() + m.EndPort = buf.DecodeUint16() + return nil +} + +// Nat44EiSetAddrAndPortAllocAlgReply defines message 'nat44_ei_set_addr_and_port_alloc_alg_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiSetAddrAndPortAllocAlgReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetAddrAndPortAllocAlgReply) Reset() { *m = Nat44EiSetAddrAndPortAllocAlgReply{} } +func (*Nat44EiSetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat44_ei_set_addr_and_port_alloc_alg_reply" +} +func (*Nat44EiSetAddrAndPortAllocAlgReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetAddrAndPortAllocAlgReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetFqOptions defines message 'nat44_ei_set_fq_options'. +// InProgress: the message form may change in the future versions +type Nat44EiSetFqOptions struct { + FrameQueueNelts uint32 `binapi:"u32,name=frame_queue_nelts" json:"frame_queue_nelts,omitempty"` +} + +func (m *Nat44EiSetFqOptions) Reset() { *m = Nat44EiSetFqOptions{} } +func (*Nat44EiSetFqOptions) GetMessageName() string { return "nat44_ei_set_fq_options" } +func (*Nat44EiSetFqOptions) GetCrcString() string { return "2399bd71" } +func (*Nat44EiSetFqOptions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetFqOptions) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.FrameQueueNelts + return size +} +func (m *Nat44EiSetFqOptions) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FrameQueueNelts) + return buf.Bytes(), nil +} +func (m *Nat44EiSetFqOptions) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FrameQueueNelts = buf.DecodeUint32() + return nil +} + +// Nat44EiSetFqOptionsReply defines message 'nat44_ei_set_fq_options_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiSetFqOptionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetFqOptionsReply) Reset() { *m = Nat44EiSetFqOptionsReply{} } +func (*Nat44EiSetFqOptionsReply) GetMessageName() string { return "nat44_ei_set_fq_options_reply" } +func (*Nat44EiSetFqOptionsReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetFqOptionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetFqOptionsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetFqOptionsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetFqOptionsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetLogLevel defines message 'nat44_ei_set_log_level'. +// Deprecated: the message will be removed in the future versions +type Nat44EiSetLogLevel struct { + LogLevel nat_types.NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` +} + +func (m *Nat44EiSetLogLevel) Reset() { *m = Nat44EiSetLogLevel{} } +func (*Nat44EiSetLogLevel) GetMessageName() string { return "nat44_ei_set_log_level" } +func (*Nat44EiSetLogLevel) GetCrcString() string { return "70076bfe" } +func (*Nat44EiSetLogLevel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetLogLevel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.LogLevel + return size +} +func (m *Nat44EiSetLogLevel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.LogLevel)) + return buf.Bytes(), nil +} +func (m *Nat44EiSetLogLevel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LogLevel = nat_types.NatLogLevel(buf.DecodeUint8()) + return nil +} + +// Nat44EiSetLogLevelReply defines message 'nat44_ei_set_log_level_reply'. +// Deprecated: the message will be removed in the future versions +type Nat44EiSetLogLevelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetLogLevelReply) Reset() { *m = Nat44EiSetLogLevelReply{} } +func (*Nat44EiSetLogLevelReply) GetMessageName() string { return "nat44_ei_set_log_level_reply" } +func (*Nat44EiSetLogLevelReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetLogLevelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetLogLevelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetLogLevelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetLogLevelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetMssClamping defines message 'nat44_ei_set_mss_clamping'. +// InProgress: the message form may change in the future versions +type Nat44EiSetMssClamping struct { + MssValue uint16 `binapi:"u16,name=mss_value" json:"mss_value,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat44EiSetMssClamping) Reset() { *m = Nat44EiSetMssClamping{} } +func (*Nat44EiSetMssClamping) GetMessageName() string { return "nat44_ei_set_mss_clamping" } +func (*Nat44EiSetMssClamping) GetCrcString() string { return "25e90abb" } +func (*Nat44EiSetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetMssClamping) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.MssValue + size += 1 // m.Enable + return size +} +func (m *Nat44EiSetMssClamping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.MssValue) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat44EiSetMssClamping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MssValue = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// Nat44EiSetMssClampingReply defines message 'nat44_ei_set_mss_clamping_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiSetMssClampingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetMssClampingReply) Reset() { *m = Nat44EiSetMssClampingReply{} } +func (*Nat44EiSetMssClampingReply) GetMessageName() string { return "nat44_ei_set_mss_clamping_reply" } +func (*Nat44EiSetMssClampingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetMssClampingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetMssClampingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetMssClampingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetTimeouts defines message 'nat44_ei_set_timeouts'. +// InProgress: the message form may change in the future versions +type Nat44EiSetTimeouts struct { + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *Nat44EiSetTimeouts) Reset() { *m = Nat44EiSetTimeouts{} } +func (*Nat44EiSetTimeouts) GetMessageName() string { return "nat44_ei_set_timeouts" } +func (*Nat44EiSetTimeouts) GetCrcString() string { return "d4746b16" } +func (*Nat44EiSetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetTimeouts) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *Nat44EiSetTimeouts) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.UDP) + buf.EncodeUint32(m.TCPEstablished) + buf.EncodeUint32(m.TCPTransitory) + buf.EncodeUint32(m.ICMP) + return buf.Bytes(), nil +} +func (m *Nat44EiSetTimeouts) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// Nat44EiSetTimeoutsReply defines message 'nat44_ei_set_timeouts_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiSetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetTimeoutsReply) Reset() { *m = Nat44EiSetTimeoutsReply{} } +func (*Nat44EiSetTimeoutsReply) GetMessageName() string { return "nat44_ei_set_timeouts_reply" } +func (*Nat44EiSetTimeoutsReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetTimeoutsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiSetWorkers defines message 'nat44_ei_set_workers'. +// InProgress: the message form may change in the future versions +type Nat44EiSetWorkers struct { + WorkerMask uint64 `binapi:"u64,name=worker_mask" json:"worker_mask,omitempty"` +} + +func (m *Nat44EiSetWorkers) Reset() { *m = Nat44EiSetWorkers{} } +func (*Nat44EiSetWorkers) GetMessageName() string { return "nat44_ei_set_workers" } +func (*Nat44EiSetWorkers) GetCrcString() string { return "da926638" } +func (*Nat44EiSetWorkers) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiSetWorkers) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.WorkerMask + return size +} +func (m *Nat44EiSetWorkers) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint64(m.WorkerMask) + return buf.Bytes(), nil +} +func (m *Nat44EiSetWorkers) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WorkerMask = buf.DecodeUint64() + return nil +} + +// Nat44EiSetWorkersReply defines message 'nat44_ei_set_workers_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiSetWorkersReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44EiSetWorkersReply) Reset() { *m = Nat44EiSetWorkersReply{} } +func (*Nat44EiSetWorkersReply) GetMessageName() string { return "nat44_ei_set_workers_reply" } +func (*Nat44EiSetWorkersReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44EiSetWorkersReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiSetWorkersReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat44EiSetWorkersReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat44EiSetWorkersReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat44EiShowFqOptions defines message 'nat44_ei_show_fq_options'. +// InProgress: the message form may change in the future versions +type Nat44EiShowFqOptions struct{} + +func (m *Nat44EiShowFqOptions) Reset() { *m = Nat44EiShowFqOptions{} } +func (*Nat44EiShowFqOptions) GetMessageName() string { return "nat44_ei_show_fq_options" } +func (*Nat44EiShowFqOptions) GetCrcString() string { return "51077d14" } +func (*Nat44EiShowFqOptions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiShowFqOptions) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiShowFqOptions) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiShowFqOptions) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiShowFqOptionsReply defines message 'nat44_ei_show_fq_options_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiShowFqOptionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FrameQueueNelts uint32 `binapi:"u32,name=frame_queue_nelts" json:"frame_queue_nelts,omitempty"` +} + +func (m *Nat44EiShowFqOptionsReply) Reset() { *m = Nat44EiShowFqOptionsReply{} } +func (*Nat44EiShowFqOptionsReply) GetMessageName() string { return "nat44_ei_show_fq_options_reply" } +func (*Nat44EiShowFqOptionsReply) GetCrcString() string { return "7213b545" } +func (*Nat44EiShowFqOptionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiShowFqOptionsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.FrameQueueNelts + return size +} +func (m *Nat44EiShowFqOptionsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.FrameQueueNelts) + return buf.Bytes(), nil +} +func (m *Nat44EiShowFqOptionsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.FrameQueueNelts = buf.DecodeUint32() + return nil +} + +// Nat44EiShowRunningConfig defines message 'nat44_ei_show_running_config'. +// InProgress: the message form may change in the future versions +type Nat44EiShowRunningConfig struct{} + +func (m *Nat44EiShowRunningConfig) Reset() { *m = Nat44EiShowRunningConfig{} } +func (*Nat44EiShowRunningConfig) GetMessageName() string { return "nat44_ei_show_running_config" } +func (*Nat44EiShowRunningConfig) GetCrcString() string { return "51077d14" } +func (*Nat44EiShowRunningConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiShowRunningConfig) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiShowRunningConfig) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiShowRunningConfig) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiShowRunningConfigReply defines message 'nat44_ei_show_running_config_reply'. +// InProgress: the message form may change in the future versions +type Nat44EiShowRunningConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + InsideVrf uint32 `binapi:"u32,name=inside_vrf" json:"inside_vrf,omitempty"` + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Users uint32 `binapi:"u32,name=users" json:"users,omitempty"` + Sessions uint32 `binapi:"u32,name=sessions" json:"sessions,omitempty"` + UserSessions uint32 `binapi:"u32,name=user_sessions" json:"user_sessions,omitempty"` + UserBuckets uint32 `binapi:"u32,name=user_buckets" json:"user_buckets,omitempty"` + TranslationBuckets uint32 `binapi:"u32,name=translation_buckets" json:"translation_buckets,omitempty"` + ForwardingEnabled bool `binapi:"bool,name=forwarding_enabled" json:"forwarding_enabled,omitempty"` + IpfixLoggingEnabled bool `binapi:"bool,name=ipfix_logging_enabled" json:"ipfix_logging_enabled,omitempty"` + Timeouts nat_types.NatTimeouts `binapi:"nat_timeouts,name=timeouts" json:"timeouts,omitempty"` + LogLevel nat_types.NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44EiShowRunningConfigReply) Reset() { *m = Nat44EiShowRunningConfigReply{} } +func (*Nat44EiShowRunningConfigReply) GetMessageName() string { + return "nat44_ei_show_running_config_reply" +} +func (*Nat44EiShowRunningConfigReply) GetCrcString() string { return "41b66a81" } +func (*Nat44EiShowRunningConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiShowRunningConfigReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.InsideVrf + size += 4 // m.OutsideVrf + size += 4 // m.Users + size += 4 // m.Sessions + size += 4 // m.UserSessions + size += 4 // m.UserBuckets + size += 4 // m.TranslationBuckets + size += 1 // m.ForwardingEnabled + size += 1 // m.IpfixLoggingEnabled + size += 4 // m.Timeouts.UDP + size += 4 // m.Timeouts.TCPEstablished + size += 4 // m.Timeouts.TCPTransitory + size += 4 // m.Timeouts.ICMP + size += 1 // m.LogLevel + size += 1 // m.Flags + return size +} +func (m *Nat44EiShowRunningConfigReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.InsideVrf) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeUint32(m.Users) + buf.EncodeUint32(m.Sessions) + buf.EncodeUint32(m.UserSessions) + buf.EncodeUint32(m.UserBuckets) + buf.EncodeUint32(m.TranslationBuckets) + buf.EncodeBool(m.ForwardingEnabled) + buf.EncodeBool(m.IpfixLoggingEnabled) + buf.EncodeUint32(m.Timeouts.UDP) + buf.EncodeUint32(m.Timeouts.TCPEstablished) + buf.EncodeUint32(m.Timeouts.TCPTransitory) + buf.EncodeUint32(m.Timeouts.ICMP) + buf.EncodeUint8(uint8(m.LogLevel)) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44EiShowRunningConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.InsideVrf = buf.DecodeUint32() + m.OutsideVrf = buf.DecodeUint32() + m.Users = buf.DecodeUint32() + m.Sessions = buf.DecodeUint32() + m.UserSessions = buf.DecodeUint32() + m.UserBuckets = buf.DecodeUint32() + m.TranslationBuckets = buf.DecodeUint32() + m.ForwardingEnabled = buf.DecodeBool() + m.IpfixLoggingEnabled = buf.DecodeBool() + m.Timeouts.UDP = buf.DecodeUint32() + m.Timeouts.TCPEstablished = buf.DecodeUint32() + m.Timeouts.TCPTransitory = buf.DecodeUint32() + m.Timeouts.ICMP = buf.DecodeUint32() + m.LogLevel = nat_types.NatLogLevel(buf.DecodeUint8()) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44EiStaticMappingDetails defines message 'nat44_ei_static_mapping_details'. +// InProgress: the message form may change in the future versions +type Nat44EiStaticMappingDetails struct { + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + ExternalSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=external_sw_if_index" json:"external_sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44EiStaticMappingDetails) Reset() { *m = Nat44EiStaticMappingDetails{} } +func (*Nat44EiStaticMappingDetails) GetMessageName() string { return "nat44_ei_static_mapping_details" } +func (*Nat44EiStaticMappingDetails) GetCrcString() string { return "6b51ca6e" } +func (*Nat44EiStaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiStaticMappingDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 1 * 4 // m.LocalIPAddress + size += 1 * 4 // m.ExternalIPAddress + size += 1 // m.Protocol + size += 2 // m.LocalPort + size += 2 // m.ExternalPort + size += 4 // m.ExternalSwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44EiStaticMappingDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.LocalIPAddress[:], 4) + buf.EncodeBytes(m.ExternalIPAddress[:], 4) + buf.EncodeUint8(m.Protocol) + buf.EncodeUint16(m.LocalPort) + buf.EncodeUint16(m.ExternalPort) + buf.EncodeUint32(uint32(m.ExternalSwIfIndex)) + buf.EncodeUint32(m.VrfID) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44EiStaticMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.LocalPort = buf.DecodeUint16() + m.ExternalPort = buf.DecodeUint16() + m.ExternalSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44EiStaticMappingDump defines message 'nat44_ei_static_mapping_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiStaticMappingDump struct{} + +func (m *Nat44EiStaticMappingDump) Reset() { *m = Nat44EiStaticMappingDump{} } +func (*Nat44EiStaticMappingDump) GetMessageName() string { return "nat44_ei_static_mapping_dump" } +func (*Nat44EiStaticMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiStaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiStaticMappingDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiStaticMappingDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiStaticMappingDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiUserDetails defines message 'nat44_ei_user_details'. +// InProgress: the message form may change in the future versions +type Nat44EiUserDetails struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Nsessions uint32 `binapi:"u32,name=nsessions" json:"nsessions,omitempty"` + Nstaticsessions uint32 `binapi:"u32,name=nstaticsessions" json:"nstaticsessions,omitempty"` +} + +func (m *Nat44EiUserDetails) Reset() { *m = Nat44EiUserDetails{} } +func (*Nat44EiUserDetails) GetMessageName() string { return "nat44_ei_user_details" } +func (*Nat44EiUserDetails) GetCrcString() string { return "355896c2" } +func (*Nat44EiUserDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiUserDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.VrfID + size += 1 * 4 // m.IPAddress + size += 4 // m.Nsessions + size += 4 // m.Nstaticsessions + return size +} +func (m *Nat44EiUserDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.VrfID) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(m.Nsessions) + buf.EncodeUint32(m.Nstaticsessions) + return buf.Bytes(), nil +} +func (m *Nat44EiUserDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.VrfID = buf.DecodeUint32() + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Nsessions = buf.DecodeUint32() + m.Nstaticsessions = buf.DecodeUint32() + return nil +} + +// Nat44EiUserDump defines message 'nat44_ei_user_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiUserDump struct{} + +func (m *Nat44EiUserDump) Reset() { *m = Nat44EiUserDump{} } +func (*Nat44EiUserDump) GetMessageName() string { return "nat44_ei_user_dump" } +func (*Nat44EiUserDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiUserDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiUserDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiUserDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiUserDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44EiUserSessionDetails defines message 'nat44_ei_user_session_details'. +// InProgress: the message form may change in the future versions +type Nat44EiUserSessionDetails struct { + OutsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=outside_ip_address" json:"outside_ip_address,omitempty"` + OutsidePort uint16 `binapi:"u16,name=outside_port" json:"outside_port,omitempty"` + InsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=inside_ip_address" json:"inside_ip_address,omitempty"` + InsidePort uint16 `binapi:"u16,name=inside_port" json:"inside_port,omitempty"` + Protocol uint16 `binapi:"u16,name=protocol" json:"protocol,omitempty"` + Flags Nat44EiConfigFlags `binapi:"nat44_ei_config_flags,name=flags" json:"flags,omitempty"` + LastHeard uint64 `binapi:"u64,name=last_heard" json:"last_heard,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint32 `binapi:"u32,name=total_pkts" json:"total_pkts,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` +} + +func (m *Nat44EiUserSessionDetails) Reset() { *m = Nat44EiUserSessionDetails{} } +func (*Nat44EiUserSessionDetails) GetMessageName() string { return "nat44_ei_user_session_details" } +func (*Nat44EiUserSessionDetails) GetCrcString() string { return "19b7c0ac" } +func (*Nat44EiUserSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiUserSessionDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.OutsideIPAddress + size += 2 // m.OutsidePort + size += 1 * 4 // m.InsideIPAddress + size += 2 // m.InsidePort + size += 2 // m.Protocol + size += 1 // m.Flags + size += 8 // m.LastHeard + size += 8 // m.TotalBytes + size += 4 // m.TotalPkts + size += 1 * 4 // m.ExtHostAddress + size += 2 // m.ExtHostPort + return size +} +func (m *Nat44EiUserSessionDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.OutsideIPAddress[:], 4) + buf.EncodeUint16(m.OutsidePort) + buf.EncodeBytes(m.InsideIPAddress[:], 4) + buf.EncodeUint16(m.InsidePort) + buf.EncodeUint16(m.Protocol) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint64(m.LastHeard) + buf.EncodeUint64(m.TotalBytes) + buf.EncodeUint32(m.TotalPkts) + buf.EncodeBytes(m.ExtHostAddress[:], 4) + buf.EncodeUint16(m.ExtHostPort) + return buf.Bytes(), nil +} +func (m *Nat44EiUserSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.OutsideIPAddress[:], buf.DecodeBytes(4)) + m.OutsidePort = buf.DecodeUint16() + copy(m.InsideIPAddress[:], buf.DecodeBytes(4)) + m.InsidePort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint16() + m.Flags = Nat44EiConfigFlags(buf.DecodeUint8()) + m.LastHeard = buf.DecodeUint64() + m.TotalBytes = buf.DecodeUint64() + m.TotalPkts = buf.DecodeUint32() + copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) + m.ExtHostPort = buf.DecodeUint16() + return nil +} + +// Nat44EiUserSessionDump defines message 'nat44_ei_user_session_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiUserSessionDump struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat44EiUserSessionDump) Reset() { *m = Nat44EiUserSessionDump{} } +func (*Nat44EiUserSessionDump) GetMessageName() string { return "nat44_ei_user_session_dump" } +func (*Nat44EiUserSessionDump) GetCrcString() string { return "e1899c98" } +func (*Nat44EiUserSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiUserSessionDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.IPAddress + size += 4 // m.VrfID + return size +} +func (m *Nat44EiUserSessionDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *Nat44EiUserSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat44EiWorkerDetails defines message 'nat44_ei_worker_details'. +// InProgress: the message form may change in the future versions +type Nat44EiWorkerDetails struct { + WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"` + LcoreID uint32 `binapi:"u32,name=lcore_id" json:"lcore_id,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *Nat44EiWorkerDetails) Reset() { *m = Nat44EiWorkerDetails{} } +func (*Nat44EiWorkerDetails) GetMessageName() string { return "nat44_ei_worker_details" } +func (*Nat44EiWorkerDetails) GetCrcString() string { return "84bf06fc" } +func (*Nat44EiWorkerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44EiWorkerDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.WorkerIndex + size += 4 // m.LcoreID + size += 64 // m.Name + return size +} +func (m *Nat44EiWorkerDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.WorkerIndex) + buf.EncodeUint32(m.LcoreID) + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *Nat44EiWorkerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WorkerIndex = buf.DecodeUint32() + m.LcoreID = buf.DecodeUint32() + m.Name = buf.DecodeString(64) + return nil +} + +// Nat44EiWorkerDump defines message 'nat44_ei_worker_dump'. +// InProgress: the message form may change in the future versions +type Nat44EiWorkerDump struct{} + +func (m *Nat44EiWorkerDump) Reset() { *m = Nat44EiWorkerDump{} } +func (*Nat44EiWorkerDump) GetMessageName() string { return "nat44_ei_worker_dump" } +func (*Nat44EiWorkerDump) GetCrcString() string { return "51077d14" } +func (*Nat44EiWorkerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44EiWorkerDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat44EiWorkerDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat44EiWorkerDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_nat44_ei_binapi_init() } +func file_nat44_ei_binapi_init() { + api.RegisterMessage((*Nat44EiAddDelAddressRange)(nil), "nat44_ei_add_del_address_range_35f21abc") + api.RegisterMessage((*Nat44EiAddDelAddressRangeReply)(nil), "nat44_ei_add_del_address_range_reply_e8d4e804") + api.RegisterMessage((*Nat44EiAddDelIdentityMapping)(nil), "nat44_ei_add_del_identity_mapping_cb8606b9") + api.RegisterMessage((*Nat44EiAddDelIdentityMappingReply)(nil), "nat44_ei_add_del_identity_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat44EiAddDelInterfaceAddr)(nil), "nat44_ei_add_del_interface_addr_883abbcc") + api.RegisterMessage((*Nat44EiAddDelInterfaceAddrReply)(nil), "nat44_ei_add_del_interface_addr_reply_e8d4e804") + api.RegisterMessage((*Nat44EiAddDelOutputInterface)(nil), "nat44_ei_add_del_output_interface_47d6e753") + api.RegisterMessage((*Nat44EiAddDelOutputInterfaceReply)(nil), "nat44_ei_add_del_output_interface_reply_e8d4e804") + api.RegisterMessage((*Nat44EiAddDelStaticMapping)(nil), "nat44_ei_add_del_static_mapping_b404b7fe") + api.RegisterMessage((*Nat44EiAddDelStaticMappingReply)(nil), "nat44_ei_add_del_static_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat44EiAddressDetails)(nil), "nat44_ei_address_details_318f1202") + api.RegisterMessage((*Nat44EiAddressDump)(nil), "nat44_ei_address_dump_51077d14") + api.RegisterMessage((*Nat44EiDelSession)(nil), "nat44_ei_del_session_74969ffe") + api.RegisterMessage((*Nat44EiDelSessionReply)(nil), "nat44_ei_del_session_reply_e8d4e804") + api.RegisterMessage((*Nat44EiDelUser)(nil), "nat44_ei_del_user_99a9f998") + api.RegisterMessage((*Nat44EiDelUserReply)(nil), "nat44_ei_del_user_reply_e8d4e804") + api.RegisterMessage((*Nat44EiForwardingEnableDisable)(nil), "nat44_ei_forwarding_enable_disable_b3e225d2") + api.RegisterMessage((*Nat44EiForwardingEnableDisableReply)(nil), "nat44_ei_forwarding_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat44EiGetAddrAndPortAllocAlg)(nil), "nat44_ei_get_addr_and_port_alloc_alg_51077d14") + api.RegisterMessage((*Nat44EiGetAddrAndPortAllocAlgReply)(nil), "nat44_ei_get_addr_and_port_alloc_alg_reply_3607a7d0") + api.RegisterMessage((*Nat44EiGetMssClamping)(nil), "nat44_ei_get_mss_clamping_51077d14") + api.RegisterMessage((*Nat44EiGetMssClampingReply)(nil), "nat44_ei_get_mss_clamping_reply_1c0b2a78") + api.RegisterMessage((*Nat44EiHaFlush)(nil), "nat44_ei_ha_flush_51077d14") + api.RegisterMessage((*Nat44EiHaFlushReply)(nil), "nat44_ei_ha_flush_reply_e8d4e804") + api.RegisterMessage((*Nat44EiHaGetFailover)(nil), "nat44_ei_ha_get_failover_51077d14") + api.RegisterMessage((*Nat44EiHaGetFailoverReply)(nil), "nat44_ei_ha_get_failover_reply_a67d8752") + api.RegisterMessage((*Nat44EiHaGetListener)(nil), "nat44_ei_ha_get_listener_51077d14") + api.RegisterMessage((*Nat44EiHaGetListenerReply)(nil), "nat44_ei_ha_get_listener_reply_123ea41f") + api.RegisterMessage((*Nat44EiHaResync)(nil), "nat44_ei_ha_resync_c8ab9e03") + api.RegisterMessage((*Nat44EiHaResyncCompletedEvent)(nil), "nat44_ei_ha_resync_completed_event_fdc598fb") + api.RegisterMessage((*Nat44EiHaResyncReply)(nil), "nat44_ei_ha_resync_reply_e8d4e804") + api.RegisterMessage((*Nat44EiHaSetFailover)(nil), "nat44_ei_ha_set_failover_718246af") + api.RegisterMessage((*Nat44EiHaSetFailoverReply)(nil), "nat44_ei_ha_set_failover_reply_e8d4e804") + api.RegisterMessage((*Nat44EiHaSetListener)(nil), "nat44_ei_ha_set_listener_e4a8cb4e") + api.RegisterMessage((*Nat44EiHaSetListenerReply)(nil), "nat44_ei_ha_set_listener_reply_e8d4e804") + api.RegisterMessage((*Nat44EiIdentityMappingDetails)(nil), "nat44_ei_identity_mapping_details_30d53e26") + api.RegisterMessage((*Nat44EiIdentityMappingDump)(nil), "nat44_ei_identity_mapping_dump_51077d14") + api.RegisterMessage((*Nat44EiInterfaceAddDelFeature)(nil), "nat44_ei_interface_add_del_feature_63a2db8b") + api.RegisterMessage((*Nat44EiInterfaceAddDelFeatureReply)(nil), "nat44_ei_interface_add_del_feature_reply_e8d4e804") + api.RegisterMessage((*Nat44EiInterfaceAddDelOutputFeature)(nil), "nat44_ei_interface_add_del_output_feature_63a2db8b") + api.RegisterMessage((*Nat44EiInterfaceAddDelOutputFeatureReply)(nil), "nat44_ei_interface_add_del_output_feature_reply_e8d4e804") + api.RegisterMessage((*Nat44EiInterfaceAddrDetails)(nil), "nat44_ei_interface_addr_details_0b45011c") + api.RegisterMessage((*Nat44EiInterfaceAddrDump)(nil), "nat44_ei_interface_addr_dump_51077d14") + api.RegisterMessage((*Nat44EiInterfaceDetails)(nil), "nat44_ei_interface_details_f446e508") + api.RegisterMessage((*Nat44EiInterfaceDump)(nil), "nat44_ei_interface_dump_51077d14") + api.RegisterMessage((*Nat44EiInterfaceOutputFeatureDetails)(nil), "nat44_ei_interface_output_feature_details_f446e508") + api.RegisterMessage((*Nat44EiInterfaceOutputFeatureDump)(nil), "nat44_ei_interface_output_feature_dump_51077d14") + api.RegisterMessage((*Nat44EiIpfixEnableDisable)(nil), "nat44_ei_ipfix_enable_disable_9af4a2d2") + api.RegisterMessage((*Nat44EiIpfixEnableDisableReply)(nil), "nat44_ei_ipfix_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat44EiOutputInterfaceDetails)(nil), "nat44_ei_output_interface_details_0b45011c") + api.RegisterMessage((*Nat44EiOutputInterfaceGet)(nil), "nat44_ei_output_interface_get_f75ba505") + api.RegisterMessage((*Nat44EiOutputInterfaceGetReply)(nil), "nat44_ei_output_interface_get_reply_53b48f5d") + api.RegisterMessage((*Nat44EiPluginEnableDisable)(nil), "nat44_ei_plugin_enable_disable_bf692144") + api.RegisterMessage((*Nat44EiPluginEnableDisableReply)(nil), "nat44_ei_plugin_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetAddrAndPortAllocAlg)(nil), "nat44_ei_set_addr_and_port_alloc_alg_deeb746f") + api.RegisterMessage((*Nat44EiSetAddrAndPortAllocAlgReply)(nil), "nat44_ei_set_addr_and_port_alloc_alg_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetFqOptions)(nil), "nat44_ei_set_fq_options_2399bd71") + api.RegisterMessage((*Nat44EiSetFqOptionsReply)(nil), "nat44_ei_set_fq_options_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetLogLevel)(nil), "nat44_ei_set_log_level_70076bfe") + api.RegisterMessage((*Nat44EiSetLogLevelReply)(nil), "nat44_ei_set_log_level_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetMssClamping)(nil), "nat44_ei_set_mss_clamping_25e90abb") + api.RegisterMessage((*Nat44EiSetMssClampingReply)(nil), "nat44_ei_set_mss_clamping_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetTimeouts)(nil), "nat44_ei_set_timeouts_d4746b16") + api.RegisterMessage((*Nat44EiSetTimeoutsReply)(nil), "nat44_ei_set_timeouts_reply_e8d4e804") + api.RegisterMessage((*Nat44EiSetWorkers)(nil), "nat44_ei_set_workers_da926638") + api.RegisterMessage((*Nat44EiSetWorkersReply)(nil), "nat44_ei_set_workers_reply_e8d4e804") + api.RegisterMessage((*Nat44EiShowFqOptions)(nil), "nat44_ei_show_fq_options_51077d14") + api.RegisterMessage((*Nat44EiShowFqOptionsReply)(nil), "nat44_ei_show_fq_options_reply_7213b545") + api.RegisterMessage((*Nat44EiShowRunningConfig)(nil), "nat44_ei_show_running_config_51077d14") + api.RegisterMessage((*Nat44EiShowRunningConfigReply)(nil), "nat44_ei_show_running_config_reply_41b66a81") + api.RegisterMessage((*Nat44EiStaticMappingDetails)(nil), "nat44_ei_static_mapping_details_6b51ca6e") + api.RegisterMessage((*Nat44EiStaticMappingDump)(nil), "nat44_ei_static_mapping_dump_51077d14") + api.RegisterMessage((*Nat44EiUserDetails)(nil), "nat44_ei_user_details_355896c2") + api.RegisterMessage((*Nat44EiUserDump)(nil), "nat44_ei_user_dump_51077d14") + api.RegisterMessage((*Nat44EiUserSessionDetails)(nil), "nat44_ei_user_session_details_19b7c0ac") + api.RegisterMessage((*Nat44EiUserSessionDump)(nil), "nat44_ei_user_session_dump_e1899c98") + api.RegisterMessage((*Nat44EiWorkerDetails)(nil), "nat44_ei_worker_details_84bf06fc") + api.RegisterMessage((*Nat44EiWorkerDump)(nil), "nat44_ei_worker_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Nat44EiAddDelAddressRange)(nil), + (*Nat44EiAddDelAddressRangeReply)(nil), + (*Nat44EiAddDelIdentityMapping)(nil), + (*Nat44EiAddDelIdentityMappingReply)(nil), + (*Nat44EiAddDelInterfaceAddr)(nil), + (*Nat44EiAddDelInterfaceAddrReply)(nil), + (*Nat44EiAddDelOutputInterface)(nil), + (*Nat44EiAddDelOutputInterfaceReply)(nil), + (*Nat44EiAddDelStaticMapping)(nil), + (*Nat44EiAddDelStaticMappingReply)(nil), + (*Nat44EiAddressDetails)(nil), + (*Nat44EiAddressDump)(nil), + (*Nat44EiDelSession)(nil), + (*Nat44EiDelSessionReply)(nil), + (*Nat44EiDelUser)(nil), + (*Nat44EiDelUserReply)(nil), + (*Nat44EiForwardingEnableDisable)(nil), + (*Nat44EiForwardingEnableDisableReply)(nil), + (*Nat44EiGetAddrAndPortAllocAlg)(nil), + (*Nat44EiGetAddrAndPortAllocAlgReply)(nil), + (*Nat44EiGetMssClamping)(nil), + (*Nat44EiGetMssClampingReply)(nil), + (*Nat44EiHaFlush)(nil), + (*Nat44EiHaFlushReply)(nil), + (*Nat44EiHaGetFailover)(nil), + (*Nat44EiHaGetFailoverReply)(nil), + (*Nat44EiHaGetListener)(nil), + (*Nat44EiHaGetListenerReply)(nil), + (*Nat44EiHaResync)(nil), + (*Nat44EiHaResyncCompletedEvent)(nil), + (*Nat44EiHaResyncReply)(nil), + (*Nat44EiHaSetFailover)(nil), + (*Nat44EiHaSetFailoverReply)(nil), + (*Nat44EiHaSetListener)(nil), + (*Nat44EiHaSetListenerReply)(nil), + (*Nat44EiIdentityMappingDetails)(nil), + (*Nat44EiIdentityMappingDump)(nil), + (*Nat44EiInterfaceAddDelFeature)(nil), + (*Nat44EiInterfaceAddDelFeatureReply)(nil), + (*Nat44EiInterfaceAddDelOutputFeature)(nil), + (*Nat44EiInterfaceAddDelOutputFeatureReply)(nil), + (*Nat44EiInterfaceAddrDetails)(nil), + (*Nat44EiInterfaceAddrDump)(nil), + (*Nat44EiInterfaceDetails)(nil), + (*Nat44EiInterfaceDump)(nil), + (*Nat44EiInterfaceOutputFeatureDetails)(nil), + (*Nat44EiInterfaceOutputFeatureDump)(nil), + (*Nat44EiIpfixEnableDisable)(nil), + (*Nat44EiIpfixEnableDisableReply)(nil), + (*Nat44EiOutputInterfaceDetails)(nil), + (*Nat44EiOutputInterfaceGet)(nil), + (*Nat44EiOutputInterfaceGetReply)(nil), + (*Nat44EiPluginEnableDisable)(nil), + (*Nat44EiPluginEnableDisableReply)(nil), + (*Nat44EiSetAddrAndPortAllocAlg)(nil), + (*Nat44EiSetAddrAndPortAllocAlgReply)(nil), + (*Nat44EiSetFqOptions)(nil), + (*Nat44EiSetFqOptionsReply)(nil), + (*Nat44EiSetLogLevel)(nil), + (*Nat44EiSetLogLevelReply)(nil), + (*Nat44EiSetMssClamping)(nil), + (*Nat44EiSetMssClampingReply)(nil), + (*Nat44EiSetTimeouts)(nil), + (*Nat44EiSetTimeoutsReply)(nil), + (*Nat44EiSetWorkers)(nil), + (*Nat44EiSetWorkersReply)(nil), + (*Nat44EiShowFqOptions)(nil), + (*Nat44EiShowFqOptionsReply)(nil), + (*Nat44EiShowRunningConfig)(nil), + (*Nat44EiShowRunningConfigReply)(nil), + (*Nat44EiStaticMappingDetails)(nil), + (*Nat44EiStaticMappingDump)(nil), + (*Nat44EiUserDetails)(nil), + (*Nat44EiUserDump)(nil), + (*Nat44EiUserSessionDetails)(nil), + (*Nat44EiUserSessionDump)(nil), + (*Nat44EiWorkerDetails)(nil), + (*Nat44EiWorkerDump)(nil), + } +} diff --git a/binapi/nat44_ei/nat44_ei_rpc.ba.go b/binapi/nat44_ei/nat44_ei_rpc.ba.go new file mode 100644 index 0000000..7656525 --- /dev/null +++ b/binapi/nat44_ei/nat44_ei_rpc.ba.go @@ -0,0 +1,741 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nat44_ei + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service nat44_ei. +type RPCService interface { + Nat44EiAddDelAddressRange(ctx context.Context, in *Nat44EiAddDelAddressRange) (*Nat44EiAddDelAddressRangeReply, error) + Nat44EiAddDelIdentityMapping(ctx context.Context, in *Nat44EiAddDelIdentityMapping) (*Nat44EiAddDelIdentityMappingReply, error) + Nat44EiAddDelInterfaceAddr(ctx context.Context, in *Nat44EiAddDelInterfaceAddr) (*Nat44EiAddDelInterfaceAddrReply, error) + Nat44EiAddDelOutputInterface(ctx context.Context, in *Nat44EiAddDelOutputInterface) (*Nat44EiAddDelOutputInterfaceReply, error) + Nat44EiAddDelStaticMapping(ctx context.Context, in *Nat44EiAddDelStaticMapping) (*Nat44EiAddDelStaticMappingReply, error) + Nat44EiAddressDump(ctx context.Context, in *Nat44EiAddressDump) (RPCService_Nat44EiAddressDumpClient, error) + Nat44EiDelSession(ctx context.Context, in *Nat44EiDelSession) (*Nat44EiDelSessionReply, error) + Nat44EiDelUser(ctx context.Context, in *Nat44EiDelUser) (*Nat44EiDelUserReply, error) + Nat44EiForwardingEnableDisable(ctx context.Context, in *Nat44EiForwardingEnableDisable) (*Nat44EiForwardingEnableDisableReply, error) + Nat44EiGetAddrAndPortAllocAlg(ctx context.Context, in *Nat44EiGetAddrAndPortAllocAlg) (*Nat44EiGetAddrAndPortAllocAlgReply, error) + Nat44EiGetMssClamping(ctx context.Context, in *Nat44EiGetMssClamping) (*Nat44EiGetMssClampingReply, error) + Nat44EiHaFlush(ctx context.Context, in *Nat44EiHaFlush) (*Nat44EiHaFlushReply, error) + Nat44EiHaGetFailover(ctx context.Context, in *Nat44EiHaGetFailover) (*Nat44EiHaGetFailoverReply, error) + Nat44EiHaGetListener(ctx context.Context, in *Nat44EiHaGetListener) (*Nat44EiHaGetListenerReply, error) + Nat44EiHaResync(ctx context.Context, in *Nat44EiHaResync) (*Nat44EiHaResyncReply, error) + Nat44EiHaSetFailover(ctx context.Context, in *Nat44EiHaSetFailover) (*Nat44EiHaSetFailoverReply, error) + Nat44EiHaSetListener(ctx context.Context, in *Nat44EiHaSetListener) (*Nat44EiHaSetListenerReply, error) + Nat44EiIdentityMappingDump(ctx context.Context, in *Nat44EiIdentityMappingDump) (RPCService_Nat44EiIdentityMappingDumpClient, error) + Nat44EiInterfaceAddDelFeature(ctx context.Context, in *Nat44EiInterfaceAddDelFeature) (*Nat44EiInterfaceAddDelFeatureReply, error) + Nat44EiInterfaceAddDelOutputFeature(ctx context.Context, in *Nat44EiInterfaceAddDelOutputFeature) (*Nat44EiInterfaceAddDelOutputFeatureReply, error) + Nat44EiInterfaceAddrDump(ctx context.Context, in *Nat44EiInterfaceAddrDump) (RPCService_Nat44EiInterfaceAddrDumpClient, error) + Nat44EiInterfaceDump(ctx context.Context, in *Nat44EiInterfaceDump) (RPCService_Nat44EiInterfaceDumpClient, error) + Nat44EiInterfaceOutputFeatureDump(ctx context.Context, in *Nat44EiInterfaceOutputFeatureDump) (RPCService_Nat44EiInterfaceOutputFeatureDumpClient, error) + Nat44EiIpfixEnableDisable(ctx context.Context, in *Nat44EiIpfixEnableDisable) (*Nat44EiIpfixEnableDisableReply, error) + Nat44EiOutputInterfaceGet(ctx context.Context, in *Nat44EiOutputInterfaceGet) (RPCService_Nat44EiOutputInterfaceGetClient, error) + Nat44EiPluginEnableDisable(ctx context.Context, in *Nat44EiPluginEnableDisable) (*Nat44EiPluginEnableDisableReply, error) + Nat44EiSetAddrAndPortAllocAlg(ctx context.Context, in *Nat44EiSetAddrAndPortAllocAlg) (*Nat44EiSetAddrAndPortAllocAlgReply, error) + Nat44EiSetFqOptions(ctx context.Context, in *Nat44EiSetFqOptions) (*Nat44EiSetFqOptionsReply, error) + Nat44EiSetLogLevel(ctx context.Context, in *Nat44EiSetLogLevel) (*Nat44EiSetLogLevelReply, error) + Nat44EiSetMssClamping(ctx context.Context, in *Nat44EiSetMssClamping) (*Nat44EiSetMssClampingReply, error) + Nat44EiSetTimeouts(ctx context.Context, in *Nat44EiSetTimeouts) (*Nat44EiSetTimeoutsReply, error) + Nat44EiSetWorkers(ctx context.Context, in *Nat44EiSetWorkers) (*Nat44EiSetWorkersReply, error) + Nat44EiShowFqOptions(ctx context.Context, in *Nat44EiShowFqOptions) (*Nat44EiShowFqOptionsReply, error) + Nat44EiShowRunningConfig(ctx context.Context, in *Nat44EiShowRunningConfig) (*Nat44EiShowRunningConfigReply, error) + Nat44EiStaticMappingDump(ctx context.Context, in *Nat44EiStaticMappingDump) (RPCService_Nat44EiStaticMappingDumpClient, error) + Nat44EiUserDump(ctx context.Context, in *Nat44EiUserDump) (RPCService_Nat44EiUserDumpClient, error) + Nat44EiUserSessionDump(ctx context.Context, in *Nat44EiUserSessionDump) (RPCService_Nat44EiUserSessionDumpClient, error) + Nat44EiWorkerDump(ctx context.Context, in *Nat44EiWorkerDump) (RPCService_Nat44EiWorkerDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Nat44EiAddDelAddressRange(ctx context.Context, in *Nat44EiAddDelAddressRange) (*Nat44EiAddDelAddressRangeReply, error) { + out := new(Nat44EiAddDelAddressRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiAddDelIdentityMapping(ctx context.Context, in *Nat44EiAddDelIdentityMapping) (*Nat44EiAddDelIdentityMappingReply, error) { + out := new(Nat44EiAddDelIdentityMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiAddDelInterfaceAddr(ctx context.Context, in *Nat44EiAddDelInterfaceAddr) (*Nat44EiAddDelInterfaceAddrReply, error) { + out := new(Nat44EiAddDelInterfaceAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiAddDelOutputInterface(ctx context.Context, in *Nat44EiAddDelOutputInterface) (*Nat44EiAddDelOutputInterfaceReply, error) { + out := new(Nat44EiAddDelOutputInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiAddDelStaticMapping(ctx context.Context, in *Nat44EiAddDelStaticMapping) (*Nat44EiAddDelStaticMappingReply, error) { + out := new(Nat44EiAddDelStaticMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiAddressDump(ctx context.Context, in *Nat44EiAddressDump) (RPCService_Nat44EiAddressDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiAddressDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiAddressDumpClient interface { + Recv() (*Nat44EiAddressDetails, error) + api.Stream +} + +type serviceClient_Nat44EiAddressDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiAddressDumpClient) Recv() (*Nat44EiAddressDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiAddressDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiDelSession(ctx context.Context, in *Nat44EiDelSession) (*Nat44EiDelSessionReply, error) { + out := new(Nat44EiDelSessionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiDelUser(ctx context.Context, in *Nat44EiDelUser) (*Nat44EiDelUserReply, error) { + out := new(Nat44EiDelUserReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiForwardingEnableDisable(ctx context.Context, in *Nat44EiForwardingEnableDisable) (*Nat44EiForwardingEnableDisableReply, error) { + out := new(Nat44EiForwardingEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiGetAddrAndPortAllocAlg(ctx context.Context, in *Nat44EiGetAddrAndPortAllocAlg) (*Nat44EiGetAddrAndPortAllocAlgReply, error) { + out := new(Nat44EiGetAddrAndPortAllocAlgReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiGetMssClamping(ctx context.Context, in *Nat44EiGetMssClamping) (*Nat44EiGetMssClampingReply, error) { + out := new(Nat44EiGetMssClampingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaFlush(ctx context.Context, in *Nat44EiHaFlush) (*Nat44EiHaFlushReply, error) { + out := new(Nat44EiHaFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaGetFailover(ctx context.Context, in *Nat44EiHaGetFailover) (*Nat44EiHaGetFailoverReply, error) { + out := new(Nat44EiHaGetFailoverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaGetListener(ctx context.Context, in *Nat44EiHaGetListener) (*Nat44EiHaGetListenerReply, error) { + out := new(Nat44EiHaGetListenerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaResync(ctx context.Context, in *Nat44EiHaResync) (*Nat44EiHaResyncReply, error) { + out := new(Nat44EiHaResyncReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaSetFailover(ctx context.Context, in *Nat44EiHaSetFailover) (*Nat44EiHaSetFailoverReply, error) { + out := new(Nat44EiHaSetFailoverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiHaSetListener(ctx context.Context, in *Nat44EiHaSetListener) (*Nat44EiHaSetListenerReply, error) { + out := new(Nat44EiHaSetListenerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiIdentityMappingDump(ctx context.Context, in *Nat44EiIdentityMappingDump) (RPCService_Nat44EiIdentityMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiIdentityMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiIdentityMappingDumpClient interface { + Recv() (*Nat44EiIdentityMappingDetails, error) + api.Stream +} + +type serviceClient_Nat44EiIdentityMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiIdentityMappingDumpClient) Recv() (*Nat44EiIdentityMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiIdentityMappingDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiInterfaceAddDelFeature(ctx context.Context, in *Nat44EiInterfaceAddDelFeature) (*Nat44EiInterfaceAddDelFeatureReply, error) { + out := new(Nat44EiInterfaceAddDelFeatureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiInterfaceAddDelOutputFeature(ctx context.Context, in *Nat44EiInterfaceAddDelOutputFeature) (*Nat44EiInterfaceAddDelOutputFeatureReply, error) { + out := new(Nat44EiInterfaceAddDelOutputFeatureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiInterfaceAddrDump(ctx context.Context, in *Nat44EiInterfaceAddrDump) (RPCService_Nat44EiInterfaceAddrDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiInterfaceAddrDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiInterfaceAddrDumpClient interface { + Recv() (*Nat44EiInterfaceAddrDetails, error) + api.Stream +} + +type serviceClient_Nat44EiInterfaceAddrDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiInterfaceAddrDumpClient) Recv() (*Nat44EiInterfaceAddrDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiInterfaceAddrDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiInterfaceDump(ctx context.Context, in *Nat44EiInterfaceDump) (RPCService_Nat44EiInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiInterfaceDumpClient interface { + Recv() (*Nat44EiInterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat44EiInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiInterfaceDumpClient) Recv() (*Nat44EiInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiInterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiInterfaceOutputFeatureDump(ctx context.Context, in *Nat44EiInterfaceOutputFeatureDump) (RPCService_Nat44EiInterfaceOutputFeatureDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiInterfaceOutputFeatureDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiInterfaceOutputFeatureDumpClient interface { + Recv() (*Nat44EiInterfaceOutputFeatureDetails, error) + api.Stream +} + +type serviceClient_Nat44EiInterfaceOutputFeatureDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiInterfaceOutputFeatureDumpClient) Recv() (*Nat44EiInterfaceOutputFeatureDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiInterfaceOutputFeatureDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiIpfixEnableDisable(ctx context.Context, in *Nat44EiIpfixEnableDisable) (*Nat44EiIpfixEnableDisableReply, error) { + out := new(Nat44EiIpfixEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiOutputInterfaceGet(ctx context.Context, in *Nat44EiOutputInterfaceGet) (RPCService_Nat44EiOutputInterfaceGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiOutputInterfaceGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiOutputInterfaceGetClient interface { + Recv() (*Nat44EiOutputInterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat44EiOutputInterfaceGetClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiOutputInterfaceGetClient) Recv() (*Nat44EiOutputInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiOutputInterfaceDetails: + return m, nil + case *Nat44EiOutputInterfaceGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiPluginEnableDisable(ctx context.Context, in *Nat44EiPluginEnableDisable) (*Nat44EiPluginEnableDisableReply, error) { + out := new(Nat44EiPluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetAddrAndPortAllocAlg(ctx context.Context, in *Nat44EiSetAddrAndPortAllocAlg) (*Nat44EiSetAddrAndPortAllocAlgReply, error) { + out := new(Nat44EiSetAddrAndPortAllocAlgReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetFqOptions(ctx context.Context, in *Nat44EiSetFqOptions) (*Nat44EiSetFqOptionsReply, error) { + out := new(Nat44EiSetFqOptionsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetLogLevel(ctx context.Context, in *Nat44EiSetLogLevel) (*Nat44EiSetLogLevelReply, error) { + out := new(Nat44EiSetLogLevelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetMssClamping(ctx context.Context, in *Nat44EiSetMssClamping) (*Nat44EiSetMssClampingReply, error) { + out := new(Nat44EiSetMssClampingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetTimeouts(ctx context.Context, in *Nat44EiSetTimeouts) (*Nat44EiSetTimeoutsReply, error) { + out := new(Nat44EiSetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiSetWorkers(ctx context.Context, in *Nat44EiSetWorkers) (*Nat44EiSetWorkersReply, error) { + out := new(Nat44EiSetWorkersReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiShowFqOptions(ctx context.Context, in *Nat44EiShowFqOptions) (*Nat44EiShowFqOptionsReply, error) { + out := new(Nat44EiShowFqOptionsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiShowRunningConfig(ctx context.Context, in *Nat44EiShowRunningConfig) (*Nat44EiShowRunningConfigReply, error) { + out := new(Nat44EiShowRunningConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat44EiStaticMappingDump(ctx context.Context, in *Nat44EiStaticMappingDump) (RPCService_Nat44EiStaticMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiStaticMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiStaticMappingDumpClient interface { + Recv() (*Nat44EiStaticMappingDetails, error) + api.Stream +} + +type serviceClient_Nat44EiStaticMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiStaticMappingDumpClient) Recv() (*Nat44EiStaticMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiStaticMappingDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiUserDump(ctx context.Context, in *Nat44EiUserDump) (RPCService_Nat44EiUserDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiUserDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiUserDumpClient interface { + Recv() (*Nat44EiUserDetails, error) + api.Stream +} + +type serviceClient_Nat44EiUserDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiUserDumpClient) Recv() (*Nat44EiUserDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiUserDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiUserSessionDump(ctx context.Context, in *Nat44EiUserSessionDump) (RPCService_Nat44EiUserSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiUserSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiUserSessionDumpClient interface { + Recv() (*Nat44EiUserSessionDetails, error) + api.Stream +} + +type serviceClient_Nat44EiUserSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiUserSessionDumpClient) Recv() (*Nat44EiUserSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiUserSessionDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44EiWorkerDump(ctx context.Context, in *Nat44EiWorkerDump) (RPCService_Nat44EiWorkerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44EiWorkerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44EiWorkerDumpClient interface { + Recv() (*Nat44EiWorkerDetails, error) + api.Stream +} + +type serviceClient_Nat44EiWorkerDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44EiWorkerDumpClient) Recv() (*Nat44EiWorkerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44EiWorkerDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nat64/nat64.ba.go b/binapi/nat64/nat64.ba.go new file mode 100644 index 0000000..9543f56 --- /dev/null +++ b/binapi/nat64/nat64.ba.go @@ -0,0 +1,1114 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/nat64.api.json + +// Package nat64 contains generated bindings for API file nat64.api. +// +// Contents: +// 26 messages +// +package nat64 + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + nat_types "go.fd.io/govpp/binapi/nat_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nat64" + APIVersion = "1.0.0" + VersionCrc = 0xfbd06e33 +) + +// Nat64AddDelInterface defines message 'nat64_add_del_interface'. +type Nat64AddDelInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64AddDelInterface) Reset() { *m = Nat64AddDelInterface{} } +func (*Nat64AddDelInterface) GetMessageName() string { return "nat64_add_del_interface" } +func (*Nat64AddDelInterface) GetCrcString() string { return "f3699b83" } +func (*Nat64AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelInterface) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64AddDelInterface) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelInterfaceAddr defines message 'nat64_add_del_interface_addr'. +type Nat64AddDelInterfaceAddr struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64AddDelInterfaceAddr) Reset() { *m = Nat64AddDelInterfaceAddr{} } +func (*Nat64AddDelInterfaceAddr) GetMessageName() string { return "nat64_add_del_interface_addr" } +func (*Nat64AddDelInterfaceAddr) GetCrcString() string { return "47d6e753" } +func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelInterfaceAddr) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelInterfaceAddrReply defines message 'nat64_add_del_interface_addr_reply'. +type Nat64AddDelInterfaceAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelInterfaceAddrReply) Reset() { *m = Nat64AddDelInterfaceAddrReply{} } +func (*Nat64AddDelInterfaceAddrReply) GetMessageName() string { + return "nat64_add_del_interface_addr_reply" +} +func (*Nat64AddDelInterfaceAddrReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelInterfaceAddrReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64AddDelInterfaceReply defines message 'nat64_add_del_interface_reply'. +type Nat64AddDelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelInterfaceReply) Reset() { *m = Nat64AddDelInterfaceReply{} } +func (*Nat64AddDelInterfaceReply) GetMessageName() string { return "nat64_add_del_interface_reply" } +func (*Nat64AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelInterfaceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64AddDelPoolAddrRange defines message 'nat64_add_del_pool_addr_range'. +type Nat64AddDelPoolAddrRange struct { + StartAddr ip_types.IP4Address `binapi:"ip4_address,name=start_addr" json:"start_addr,omitempty"` + EndAddr ip_types.IP4Address `binapi:"ip4_address,name=end_addr" json:"end_addr,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelPoolAddrRange) Reset() { *m = Nat64AddDelPoolAddrRange{} } +func (*Nat64AddDelPoolAddrRange) GetMessageName() string { return "nat64_add_del_pool_addr_range" } +func (*Nat64AddDelPoolAddrRange) GetCrcString() string { return "a3b944e3" } +func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelPoolAddrRange) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.StartAddr + size += 1 * 4 // m.EndAddr + size += 4 // m.VrfID + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.StartAddr[:], 4) + buf.EncodeBytes(m.EndAddr[:], 4) + buf.EncodeUint32(m.VrfID) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPoolAddrRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.StartAddr[:], buf.DecodeBytes(4)) + copy(m.EndAddr[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelPoolAddrRangeReply defines message 'nat64_add_del_pool_addr_range_reply'. +type Nat64AddDelPoolAddrRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelPoolAddrRangeReply) Reset() { *m = Nat64AddDelPoolAddrRangeReply{} } +func (*Nat64AddDelPoolAddrRangeReply) GetMessageName() string { + return "nat64_add_del_pool_addr_range_reply" +} +func (*Nat64AddDelPoolAddrRangeReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelPoolAddrRangeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPoolAddrRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64AddDelPrefix defines message 'nat64_add_del_prefix'. +type Nat64AddDelPrefix struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelPrefix) Reset() { *m = Nat64AddDelPrefix{} } +func (*Nat64AddDelPrefix) GetMessageName() string { return "nat64_add_del_prefix" } +func (*Nat64AddDelPrefix) GetCrcString() string { return "727b2f4c" } +func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelPrefix) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.Prefix.Address + size += 1 // m.Prefix.Len + size += 4 // m.VrfID + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelPrefix) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Prefix.Address[:], 16) + buf.EncodeUint8(m.Prefix.Len) + buf.EncodeUint32(m.VrfID) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPrefix) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelPrefixReply defines message 'nat64_add_del_prefix_reply'. +type Nat64AddDelPrefixReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelPrefixReply) Reset() { *m = Nat64AddDelPrefixReply{} } +func (*Nat64AddDelPrefixReply) GetMessageName() string { return "nat64_add_del_prefix_reply" } +func (*Nat64AddDelPrefixReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelPrefixReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelPrefixReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPrefixReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64AddDelStaticBib defines message 'nat64_add_del_static_bib'. +type Nat64AddDelStaticBib struct { + IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` + OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` + IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` + OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelStaticBib) Reset() { *m = Nat64AddDelStaticBib{} } +func (*Nat64AddDelStaticBib) GetMessageName() string { return "nat64_add_del_static_bib" } +func (*Nat64AddDelStaticBib) GetCrcString() string { return "1c404de5" } +func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelStaticBib) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.IAddr + size += 1 * 4 // m.OAddr + size += 2 // m.IPort + size += 2 // m.OPort + size += 4 // m.VrfID + size += 1 // m.Proto + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelStaticBib) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IAddr[:], 16) + buf.EncodeBytes(m.OAddr[:], 4) + buf.EncodeUint16(m.IPort) + buf.EncodeUint16(m.OPort) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint8(m.Proto) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelStaticBib) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IAddr[:], buf.DecodeBytes(16)) + copy(m.OAddr[:], buf.DecodeBytes(4)) + m.IPort = buf.DecodeUint16() + m.OPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelStaticBibReply defines message 'nat64_add_del_static_bib_reply'. +type Nat64AddDelStaticBibReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelStaticBibReply) Reset() { *m = Nat64AddDelStaticBibReply{} } +func (*Nat64AddDelStaticBibReply) GetMessageName() string { return "nat64_add_del_static_bib_reply" } +func (*Nat64AddDelStaticBibReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelStaticBibReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelStaticBibReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64AddDelStaticBibReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64BibDetails defines message 'nat64_bib_details'. +type Nat64BibDetails struct { + IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` + OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` + IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` + OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` +} + +func (m *Nat64BibDetails) Reset() { *m = Nat64BibDetails{} } +func (*Nat64BibDetails) GetMessageName() string { return "nat64_bib_details" } +func (*Nat64BibDetails) GetCrcString() string { return "43bc3ddf" } +func (*Nat64BibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64BibDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.IAddr + size += 1 * 4 // m.OAddr + size += 2 // m.IPort + size += 2 // m.OPort + size += 4 // m.VrfID + size += 1 // m.Proto + size += 1 // m.Flags + size += 4 // m.SesNum + return size +} +func (m *Nat64BibDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IAddr[:], 16) + buf.EncodeBytes(m.OAddr[:], 4) + buf.EncodeUint16(m.IPort) + buf.EncodeUint16(m.OPort) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint8(m.Proto) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(m.SesNum) + return buf.Bytes(), nil +} +func (m *Nat64BibDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IAddr[:], buf.DecodeBytes(16)) + copy(m.OAddr[:], buf.DecodeBytes(4)) + m.IPort = buf.DecodeUint16() + m.OPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.SesNum = buf.DecodeUint32() + return nil +} + +// Nat64BibDump defines message 'nat64_bib_dump'. +type Nat64BibDump struct { + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64BibDump) Reset() { *m = Nat64BibDump{} } +func (*Nat64BibDump) GetMessageName() string { return "nat64_bib_dump" } +func (*Nat64BibDump) GetCrcString() string { return "cfcb6b75" } +func (*Nat64BibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64BibDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Proto + return size +} +func (m *Nat64BibDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Proto) + return buf.Bytes(), nil +} +func (m *Nat64BibDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proto = buf.DecodeUint8() + return nil +} + +// Nat64GetTimeouts defines message 'nat64_get_timeouts'. +type Nat64GetTimeouts struct{} + +func (m *Nat64GetTimeouts) Reset() { *m = Nat64GetTimeouts{} } +func (*Nat64GetTimeouts) GetMessageName() string { return "nat64_get_timeouts" } +func (*Nat64GetTimeouts) GetCrcString() string { return "51077d14" } +func (*Nat64GetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64GetTimeouts) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat64GetTimeouts) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat64GetTimeouts) Unmarshal(b []byte) error { + return nil +} + +// Nat64GetTimeoutsReply defines message 'nat64_get_timeouts_reply'. +type Nat64GetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *Nat64GetTimeoutsReply) Reset() { *m = Nat64GetTimeoutsReply{} } +func (*Nat64GetTimeoutsReply) GetMessageName() string { return "nat64_get_timeouts_reply" } +func (*Nat64GetTimeoutsReply) GetCrcString() string { return "3c4df4e1" } +func (*Nat64GetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64GetTimeoutsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *Nat64GetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.UDP) + buf.EncodeUint32(m.TCPEstablished) + buf.EncodeUint32(m.TCPTransitory) + buf.EncodeUint32(m.ICMP) + return buf.Bytes(), nil +} +func (m *Nat64GetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// Nat64InterfaceDetails defines message 'nat64_interface_details'. +type Nat64InterfaceDetails struct { + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64InterfaceDetails) Reset() { *m = Nat64InterfaceDetails{} } +func (*Nat64InterfaceDetails) GetMessageName() string { return "nat64_interface_details" } +func (*Nat64InterfaceDetails) GetCrcString() string { return "5d286289" } +func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64InterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64InterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64InterfaceDump defines message 'nat64_interface_dump'. +type Nat64InterfaceDump struct{} + +func (m *Nat64InterfaceDump) Reset() { *m = Nat64InterfaceDump{} } +func (*Nat64InterfaceDump) GetMessageName() string { return "nat64_interface_dump" } +func (*Nat64InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat64InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64InterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat64InterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat64InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64PluginEnableDisable defines message 'nat64_plugin_enable_disable'. +// InProgress: the message form may change in the future versions +type Nat64PluginEnableDisable struct { + BibBuckets uint32 `binapi:"u32,name=bib_buckets" json:"bib_buckets,omitempty"` + BibMemorySize uint32 `binapi:"u32,name=bib_memory_size" json:"bib_memory_size,omitempty"` + StBuckets uint32 `binapi:"u32,name=st_buckets" json:"st_buckets,omitempty"` + StMemorySize uint32 `binapi:"u32,name=st_memory_size" json:"st_memory_size,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat64PluginEnableDisable) Reset() { *m = Nat64PluginEnableDisable{} } +func (*Nat64PluginEnableDisable) GetMessageName() string { return "nat64_plugin_enable_disable" } +func (*Nat64PluginEnableDisable) GetCrcString() string { return "45948b90" } +func (*Nat64PluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64PluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.BibBuckets + size += 4 // m.BibMemorySize + size += 4 // m.StBuckets + size += 4 // m.StMemorySize + size += 1 // m.Enable + return size +} +func (m *Nat64PluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.BibBuckets) + buf.EncodeUint32(m.BibMemorySize) + buf.EncodeUint32(m.StBuckets) + buf.EncodeUint32(m.StMemorySize) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat64PluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BibBuckets = buf.DecodeUint32() + m.BibMemorySize = buf.DecodeUint32() + m.StBuckets = buf.DecodeUint32() + m.StMemorySize = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + return nil +} + +// Nat64PluginEnableDisableReply defines message 'nat64_plugin_enable_disable_reply'. +// InProgress: the message form may change in the future versions +type Nat64PluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64PluginEnableDisableReply) Reset() { *m = Nat64PluginEnableDisableReply{} } +func (*Nat64PluginEnableDisableReply) GetMessageName() string { + return "nat64_plugin_enable_disable_reply" +} +func (*Nat64PluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64PluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64PluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64PluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64PluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64PoolAddrDetails defines message 'nat64_pool_addr_details'. +type Nat64PoolAddrDetails struct { + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat64PoolAddrDetails) Reset() { *m = Nat64PoolAddrDetails{} } +func (*Nat64PoolAddrDetails) GetMessageName() string { return "nat64_pool_addr_details" } +func (*Nat64PoolAddrDetails) GetCrcString() string { return "9bb99cdb" } +func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64PoolAddrDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.Address + size += 4 // m.VrfID + return size +} +func (m *Nat64PoolAddrDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Address[:], 4) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *Nat64PoolAddrDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Address[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat64PoolAddrDump defines message 'nat64_pool_addr_dump'. +type Nat64PoolAddrDump struct{} + +func (m *Nat64PoolAddrDump) Reset() { *m = Nat64PoolAddrDump{} } +func (*Nat64PoolAddrDump) GetMessageName() string { return "nat64_pool_addr_dump" } +func (*Nat64PoolAddrDump) GetCrcString() string { return "51077d14" } +func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64PoolAddrDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat64PoolAddrDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat64PoolAddrDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64PrefixDetails defines message 'nat64_prefix_details'. +type Nat64PrefixDetails struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat64PrefixDetails) Reset() { *m = Nat64PrefixDetails{} } +func (*Nat64PrefixDetails) GetMessageName() string { return "nat64_prefix_details" } +func (*Nat64PrefixDetails) GetCrcString() string { return "20568de3" } +func (*Nat64PrefixDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64PrefixDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.Prefix.Address + size += 1 // m.Prefix.Len + size += 4 // m.VrfID + return size +} +func (m *Nat64PrefixDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Prefix.Address[:], 16) + buf.EncodeUint8(m.Prefix.Len) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *Nat64PrefixDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat64PrefixDump defines message 'nat64_prefix_dump'. +type Nat64PrefixDump struct{} + +func (m *Nat64PrefixDump) Reset() { *m = Nat64PrefixDump{} } +func (*Nat64PrefixDump) GetMessageName() string { return "nat64_prefix_dump" } +func (*Nat64PrefixDump) GetCrcString() string { return "51077d14" } +func (*Nat64PrefixDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64PrefixDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat64PrefixDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat64PrefixDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64SetTimeouts defines message 'nat64_set_timeouts'. +type Nat64SetTimeouts struct { + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *Nat64SetTimeouts) Reset() { *m = Nat64SetTimeouts{} } +func (*Nat64SetTimeouts) GetMessageName() string { return "nat64_set_timeouts" } +func (*Nat64SetTimeouts) GetCrcString() string { return "d4746b16" } +func (*Nat64SetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64SetTimeouts) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *Nat64SetTimeouts) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.UDP) + buf.EncodeUint32(m.TCPEstablished) + buf.EncodeUint32(m.TCPTransitory) + buf.EncodeUint32(m.ICMP) + return buf.Bytes(), nil +} +func (m *Nat64SetTimeouts) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// Nat64SetTimeoutsReply defines message 'nat64_set_timeouts_reply'. +type Nat64SetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64SetTimeoutsReply) Reset() { *m = Nat64SetTimeoutsReply{} } +func (*Nat64SetTimeoutsReply) GetMessageName() string { return "nat64_set_timeouts_reply" } +func (*Nat64SetTimeoutsReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64SetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64SetTimeoutsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat64SetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat64SetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat64StDetails defines message 'nat64_st_details'. +type Nat64StDetails struct { + IlAddr ip_types.IP6Address `binapi:"ip6_address,name=il_addr" json:"il_addr,omitempty"` + OlAddr ip_types.IP4Address `binapi:"ip4_address,name=ol_addr" json:"ol_addr,omitempty"` + IlPort uint16 `binapi:"u16,name=il_port" json:"il_port,omitempty"` + OlPort uint16 `binapi:"u16,name=ol_port" json:"ol_port,omitempty"` + IrAddr ip_types.IP6Address `binapi:"ip6_address,name=ir_addr" json:"ir_addr,omitempty"` + OrAddr ip_types.IP4Address `binapi:"ip4_address,name=or_addr" json:"or_addr,omitempty"` + RPort uint16 `binapi:"u16,name=r_port" json:"r_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64StDetails) Reset() { *m = Nat64StDetails{} } +func (*Nat64StDetails) GetMessageName() string { return "nat64_st_details" } +func (*Nat64StDetails) GetCrcString() string { return "dd3361ed" } +func (*Nat64StDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64StDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.IlAddr + size += 1 * 4 // m.OlAddr + size += 2 // m.IlPort + size += 2 // m.OlPort + size += 1 * 16 // m.IrAddr + size += 1 * 4 // m.OrAddr + size += 2 // m.RPort + size += 4 // m.VrfID + size += 1 // m.Proto + return size +} +func (m *Nat64StDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.IlAddr[:], 16) + buf.EncodeBytes(m.OlAddr[:], 4) + buf.EncodeUint16(m.IlPort) + buf.EncodeUint16(m.OlPort) + buf.EncodeBytes(m.IrAddr[:], 16) + buf.EncodeBytes(m.OrAddr[:], 4) + buf.EncodeUint16(m.RPort) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint8(m.Proto) + return buf.Bytes(), nil +} +func (m *Nat64StDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IlAddr[:], buf.DecodeBytes(16)) + copy(m.OlAddr[:], buf.DecodeBytes(4)) + m.IlPort = buf.DecodeUint16() + m.OlPort = buf.DecodeUint16() + copy(m.IrAddr[:], buf.DecodeBytes(16)) + copy(m.OrAddr[:], buf.DecodeBytes(4)) + m.RPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + return nil +} + +// Nat64StDump defines message 'nat64_st_dump'. +type Nat64StDump struct { + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64StDump) Reset() { *m = Nat64StDump{} } +func (*Nat64StDump) GetMessageName() string { return "nat64_st_dump" } +func (*Nat64StDump) GetCrcString() string { return "cfcb6b75" } +func (*Nat64StDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64StDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Proto + return size +} +func (m *Nat64StDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.Proto) + return buf.Bytes(), nil +} +func (m *Nat64StDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proto = buf.DecodeUint8() + return nil +} + +func init() { file_nat64_binapi_init() } +func file_nat64_binapi_init() { + api.RegisterMessage((*Nat64AddDelInterface)(nil), "nat64_add_del_interface_f3699b83") + api.RegisterMessage((*Nat64AddDelInterfaceAddr)(nil), "nat64_add_del_interface_addr_47d6e753") + api.RegisterMessage((*Nat64AddDelInterfaceAddrReply)(nil), "nat64_add_del_interface_addr_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelInterfaceReply)(nil), "nat64_add_del_interface_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelPoolAddrRange)(nil), "nat64_add_del_pool_addr_range_a3b944e3") + api.RegisterMessage((*Nat64AddDelPoolAddrRangeReply)(nil), "nat64_add_del_pool_addr_range_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelPrefix)(nil), "nat64_add_del_prefix_727b2f4c") + api.RegisterMessage((*Nat64AddDelPrefixReply)(nil), "nat64_add_del_prefix_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelStaticBib)(nil), "nat64_add_del_static_bib_1c404de5") + api.RegisterMessage((*Nat64AddDelStaticBibReply)(nil), "nat64_add_del_static_bib_reply_e8d4e804") + api.RegisterMessage((*Nat64BibDetails)(nil), "nat64_bib_details_43bc3ddf") + api.RegisterMessage((*Nat64BibDump)(nil), "nat64_bib_dump_cfcb6b75") + api.RegisterMessage((*Nat64GetTimeouts)(nil), "nat64_get_timeouts_51077d14") + api.RegisterMessage((*Nat64GetTimeoutsReply)(nil), "nat64_get_timeouts_reply_3c4df4e1") + api.RegisterMessage((*Nat64InterfaceDetails)(nil), "nat64_interface_details_5d286289") + api.RegisterMessage((*Nat64InterfaceDump)(nil), "nat64_interface_dump_51077d14") + api.RegisterMessage((*Nat64PluginEnableDisable)(nil), "nat64_plugin_enable_disable_45948b90") + api.RegisterMessage((*Nat64PluginEnableDisableReply)(nil), "nat64_plugin_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat64PoolAddrDetails)(nil), "nat64_pool_addr_details_9bb99cdb") + api.RegisterMessage((*Nat64PoolAddrDump)(nil), "nat64_pool_addr_dump_51077d14") + api.RegisterMessage((*Nat64PrefixDetails)(nil), "nat64_prefix_details_20568de3") + api.RegisterMessage((*Nat64PrefixDump)(nil), "nat64_prefix_dump_51077d14") + api.RegisterMessage((*Nat64SetTimeouts)(nil), "nat64_set_timeouts_d4746b16") + api.RegisterMessage((*Nat64SetTimeoutsReply)(nil), "nat64_set_timeouts_reply_e8d4e804") + api.RegisterMessage((*Nat64StDetails)(nil), "nat64_st_details_dd3361ed") + api.RegisterMessage((*Nat64StDump)(nil), "nat64_st_dump_cfcb6b75") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Nat64AddDelInterface)(nil), + (*Nat64AddDelInterfaceAddr)(nil), + (*Nat64AddDelInterfaceAddrReply)(nil), + (*Nat64AddDelInterfaceReply)(nil), + (*Nat64AddDelPoolAddrRange)(nil), + (*Nat64AddDelPoolAddrRangeReply)(nil), + (*Nat64AddDelPrefix)(nil), + (*Nat64AddDelPrefixReply)(nil), + (*Nat64AddDelStaticBib)(nil), + (*Nat64AddDelStaticBibReply)(nil), + (*Nat64BibDetails)(nil), + (*Nat64BibDump)(nil), + (*Nat64GetTimeouts)(nil), + (*Nat64GetTimeoutsReply)(nil), + (*Nat64InterfaceDetails)(nil), + (*Nat64InterfaceDump)(nil), + (*Nat64PluginEnableDisable)(nil), + (*Nat64PluginEnableDisableReply)(nil), + (*Nat64PoolAddrDetails)(nil), + (*Nat64PoolAddrDump)(nil), + (*Nat64PrefixDetails)(nil), + (*Nat64PrefixDump)(nil), + (*Nat64SetTimeouts)(nil), + (*Nat64SetTimeoutsReply)(nil), + (*Nat64StDetails)(nil), + (*Nat64StDump)(nil), + } +} diff --git a/binapi/nat64/nat64_rpc.ba.go b/binapi/nat64/nat64_rpc.ba.go new file mode 100644 index 0000000..284fc60 --- /dev/null +++ b/binapi/nat64/nat64_rpc.ba.go @@ -0,0 +1,324 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nat64 + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service nat64. +type RPCService interface { + Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) + Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) + Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) + Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) + Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) + Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) + Nat64GetTimeouts(ctx context.Context, in *Nat64GetTimeouts) (*Nat64GetTimeoutsReply, error) + Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) + Nat64PluginEnableDisable(ctx context.Context, in *Nat64PluginEnableDisable) (*Nat64PluginEnableDisableReply, error) + Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) + Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) + Nat64SetTimeouts(ctx context.Context, in *Nat64SetTimeouts) (*Nat64SetTimeoutsReply, error) + Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { + out := new(Nat64AddDelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { + out := new(Nat64AddDelInterfaceAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { + out := new(Nat64AddDelPoolAddrRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { + out := new(Nat64AddDelPrefixReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { + out := new(Nat64AddDelStaticBibReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64BibDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64BibDumpClient interface { + Recv() (*Nat64BibDetails, error) + api.Stream +} + +type serviceClient_Nat64BibDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64BibDumpClient) Recv() (*Nat64BibDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64BibDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64GetTimeouts(ctx context.Context, in *Nat64GetTimeouts) (*Nat64GetTimeoutsReply, error) { + out := new(Nat64GetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64InterfaceDumpClient interface { + Recv() (*Nat64InterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat64InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64InterfaceDumpClient) Recv() (*Nat64InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64InterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64PluginEnableDisable(ctx context.Context, in *Nat64PluginEnableDisable) (*Nat64PluginEnableDisableReply, error) { + out := new(Nat64PluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64PoolAddrDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64PoolAddrDumpClient interface { + Recv() (*Nat64PoolAddrDetails, error) + api.Stream +} + +type serviceClient_Nat64PoolAddrDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64PoolAddrDumpClient) Recv() (*Nat64PoolAddrDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64PoolAddrDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64PrefixDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64PrefixDumpClient interface { + Recv() (*Nat64PrefixDetails, error) + api.Stream +} + +type serviceClient_Nat64PrefixDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64PrefixDumpClient) Recv() (*Nat64PrefixDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64PrefixDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64SetTimeouts(ctx context.Context, in *Nat64SetTimeouts) (*Nat64SetTimeoutsReply, error) { + out := new(Nat64SetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64StDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64StDumpClient interface { + Recv() (*Nat64StDetails, error) + api.Stream +} + +type serviceClient_Nat64StDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64StDumpClient) Recv() (*Nat64StDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64StDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nat66/nat66.ba.go b/binapi/nat66/nat66.ba.go new file mode 100644 index 0000000..3884b07 --- /dev/null +++ b/binapi/nat66/nat66.ba.go @@ -0,0 +1,428 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/nat66.api.json + +// Package nat66 contains generated bindings for API file nat66.api. +// +// Contents: +// 10 messages +// +package nat66 + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + nat_types "go.fd.io/govpp/binapi/nat_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nat66" + APIVersion = "1.0.0" + VersionCrc = 0xa6343f71 +) + +// Nat66AddDelInterface defines message 'nat66_add_del_interface'. +type Nat66AddDelInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat66AddDelInterface) Reset() { *m = Nat66AddDelInterface{} } +func (*Nat66AddDelInterface) GetMessageName() string { return "nat66_add_del_interface" } +func (*Nat66AddDelInterface) GetCrcString() string { return "f3699b83" } +func (*Nat66AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66AddDelInterface) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat66AddDelInterface) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat66AddDelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat66AddDelInterfaceReply defines message 'nat66_add_del_interface_reply'. +type Nat66AddDelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat66AddDelInterfaceReply) Reset() { *m = Nat66AddDelInterfaceReply{} } +func (*Nat66AddDelInterfaceReply) GetMessageName() string { return "nat66_add_del_interface_reply" } +func (*Nat66AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66AddDelInterfaceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat66AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat66AddDelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat66AddDelStaticMapping defines message 'nat66_add_del_static_mapping'. +type Nat66AddDelStaticMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat66AddDelStaticMapping) Reset() { *m = Nat66AddDelStaticMapping{} } +func (*Nat66AddDelStaticMapping) GetMessageName() string { return "nat66_add_del_static_mapping" } +func (*Nat66AddDelStaticMapping) GetCrcString() string { return "3ed88f71" } +func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66AddDelStaticMapping) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 * 16 // m.LocalIPAddress + size += 1 * 16 // m.ExternalIPAddress + size += 4 // m.VrfID + return size +} +func (m *Nat66AddDelStaticMapping) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.LocalIPAddress[:], 16) + buf.EncodeBytes(m.ExternalIPAddress[:], 16) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *Nat66AddDelStaticMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat66AddDelStaticMappingReply defines message 'nat66_add_del_static_mapping_reply'. +type Nat66AddDelStaticMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat66AddDelStaticMappingReply) Reset() { *m = Nat66AddDelStaticMappingReply{} } +func (*Nat66AddDelStaticMappingReply) GetMessageName() string { + return "nat66_add_del_static_mapping_reply" +} +func (*Nat66AddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66AddDelStaticMappingReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat66AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat66AddDelStaticMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat66InterfaceDetails defines message 'nat66_interface_details'. +type Nat66InterfaceDetails struct { + Flags nat_types.NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat66InterfaceDetails) Reset() { *m = Nat66InterfaceDetails{} } +func (*Nat66InterfaceDetails) GetMessageName() string { return "nat66_interface_details" } +func (*Nat66InterfaceDetails) GetCrcString() string { return "5d286289" } +func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66InterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat66InterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat66InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat66InterfaceDump defines message 'nat66_interface_dump'. +type Nat66InterfaceDump struct{} + +func (m *Nat66InterfaceDump) Reset() { *m = Nat66InterfaceDump{} } +func (*Nat66InterfaceDump) GetMessageName() string { return "nat66_interface_dump" } +func (*Nat66InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat66InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66InterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat66InterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat66InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat66PluginEnableDisable defines message 'nat66_plugin_enable_disable'. +type Nat66PluginEnableDisable struct { + OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat66PluginEnableDisable) Reset() { *m = Nat66PluginEnableDisable{} } +func (*Nat66PluginEnableDisable) GetMessageName() string { return "nat66_plugin_enable_disable" } +func (*Nat66PluginEnableDisable) GetCrcString() string { return "56f2f83b" } +func (*Nat66PluginEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66PluginEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.OutsideVrf + size += 1 // m.Enable + return size +} +func (m *Nat66PluginEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.OutsideVrf) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat66PluginEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OutsideVrf = buf.DecodeUint32() + m.Enable = buf.DecodeBool() + return nil +} + +// Nat66PluginEnableDisableReply defines message 'nat66_plugin_enable_disable_reply'. +type Nat66PluginEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat66PluginEnableDisableReply) Reset() { *m = Nat66PluginEnableDisableReply{} } +func (*Nat66PluginEnableDisableReply) GetMessageName() string { + return "nat66_plugin_enable_disable_reply" +} +func (*Nat66PluginEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat66PluginEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66PluginEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *Nat66PluginEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *Nat66PluginEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// Nat66StaticMappingDetails defines message 'nat66_static_mapping_details'. +type Nat66StaticMappingDetails struct { + LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint64 `binapi:"u64,name=total_pkts" json:"total_pkts,omitempty"` +} + +func (m *Nat66StaticMappingDetails) Reset() { *m = Nat66StaticMappingDetails{} } +func (*Nat66StaticMappingDetails) GetMessageName() string { return "nat66_static_mapping_details" } +func (*Nat66StaticMappingDetails) GetCrcString() string { return "df39654b" } +func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66StaticMappingDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.LocalIPAddress + size += 1 * 16 // m.ExternalIPAddress + size += 4 // m.VrfID + size += 8 // m.TotalBytes + size += 8 // m.TotalPkts + return size +} +func (m *Nat66StaticMappingDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.LocalIPAddress[:], 16) + buf.EncodeBytes(m.ExternalIPAddress[:], 16) + buf.EncodeUint32(m.VrfID) + buf.EncodeUint64(m.TotalBytes) + buf.EncodeUint64(m.TotalPkts) + return buf.Bytes(), nil +} +func (m *Nat66StaticMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.TotalBytes = buf.DecodeUint64() + m.TotalPkts = buf.DecodeUint64() + return nil +} + +// Nat66StaticMappingDump defines message 'nat66_static_mapping_dump'. +type Nat66StaticMappingDump struct{} + +func (m *Nat66StaticMappingDump) Reset() { *m = Nat66StaticMappingDump{} } +func (*Nat66StaticMappingDump) GetMessageName() string { return "nat66_static_mapping_dump" } +func (*Nat66StaticMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66StaticMappingDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *Nat66StaticMappingDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *Nat66StaticMappingDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_nat66_binapi_init() } +func file_nat66_binapi_init() { + api.RegisterMessage((*Nat66AddDelInterface)(nil), "nat66_add_del_interface_f3699b83") + api.RegisterMessage((*Nat66AddDelInterfaceReply)(nil), "nat66_add_del_interface_reply_e8d4e804") + api.RegisterMessage((*Nat66AddDelStaticMapping)(nil), "nat66_add_del_static_mapping_3ed88f71") + api.RegisterMessage((*Nat66AddDelStaticMappingReply)(nil), "nat66_add_del_static_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat66InterfaceDetails)(nil), "nat66_interface_details_5d286289") + api.RegisterMessage((*Nat66InterfaceDump)(nil), "nat66_interface_dump_51077d14") + api.RegisterMessage((*Nat66PluginEnableDisable)(nil), "nat66_plugin_enable_disable_56f2f83b") + api.RegisterMessage((*Nat66PluginEnableDisableReply)(nil), "nat66_plugin_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat66StaticMappingDetails)(nil), "nat66_static_mapping_details_df39654b") + api.RegisterMessage((*Nat66StaticMappingDump)(nil), "nat66_static_mapping_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Nat66AddDelInterface)(nil), + (*Nat66AddDelInterfaceReply)(nil), + (*Nat66AddDelStaticMapping)(nil), + (*Nat66AddDelStaticMappingReply)(nil), + (*Nat66InterfaceDetails)(nil), + (*Nat66InterfaceDump)(nil), + (*Nat66PluginEnableDisable)(nil), + (*Nat66PluginEnableDisableReply)(nil), + (*Nat66StaticMappingDetails)(nil), + (*Nat66StaticMappingDump)(nil), + } +} diff --git a/binapi/nat66/nat66_rpc.ba.go b/binapi/nat66/nat66_rpc.ba.go new file mode 100644 index 0000000..d8a817d --- /dev/null +++ b/binapi/nat66/nat66_rpc.ba.go @@ -0,0 +1,142 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nat66 + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service nat66. +type RPCService interface { + Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) + Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) + Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) + Nat66PluginEnableDisable(ctx context.Context, in *Nat66PluginEnableDisable) (*Nat66PluginEnableDisableReply, error) + Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { + out := new(Nat66AddDelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { + out := new(Nat66AddDelStaticMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat66InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat66InterfaceDumpClient interface { + Recv() (*Nat66InterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat66InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat66InterfaceDumpClient) Recv() (*Nat66InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat66InterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat66PluginEnableDisable(ctx context.Context, in *Nat66PluginEnableDisable) (*Nat66PluginEnableDisableReply, error) { + out := new(Nat66PluginEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat66StaticMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat66StaticMappingDumpClient interface { + Recv() (*Nat66StaticMappingDetails, error) + api.Stream +} + +type serviceClient_Nat66StaticMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat66StaticMappingDumpClient) Recv() (*Nat66StaticMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat66StaticMappingDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nat_types/nat_types.ba.go b/binapi/nat_types/nat_types.ba.go new file mode 100644 index 0000000..c734c4f --- /dev/null +++ b/binapi/nat_types/nat_types.ba.go @@ -0,0 +1,145 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/nat_types.api.json + +// Package nat_types contains generated bindings for API file nat_types.api. +// +// Contents: +// 2 enums +// 1 struct +// +package nat_types + +import ( + "strconv" + + api "go.fd.io/govpp/api" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nat_types" + APIVersion = "0.0.1" + VersionCrc = 0x2ca9110f +) + +// NatConfigFlags defines enum 'nat_config_flags'. +type NatConfigFlags uint8 + +const ( + NAT_IS_NONE NatConfigFlags = 0 + NAT_IS_TWICE_NAT NatConfigFlags = 1 + NAT_IS_SELF_TWICE_NAT NatConfigFlags = 2 + NAT_IS_OUT2IN_ONLY NatConfigFlags = 4 + NAT_IS_ADDR_ONLY NatConfigFlags = 8 + NAT_IS_OUTSIDE NatConfigFlags = 16 + NAT_IS_INSIDE NatConfigFlags = 32 + NAT_IS_STATIC NatConfigFlags = 64 + NAT_IS_EXT_HOST_VALID NatConfigFlags = 128 +) + +var ( + NatConfigFlags_name = map[uint8]string{ + 0: "NAT_IS_NONE", + 1: "NAT_IS_TWICE_NAT", + 2: "NAT_IS_SELF_TWICE_NAT", + 4: "NAT_IS_OUT2IN_ONLY", + 8: "NAT_IS_ADDR_ONLY", + 16: "NAT_IS_OUTSIDE", + 32: "NAT_IS_INSIDE", + 64: "NAT_IS_STATIC", + 128: "NAT_IS_EXT_HOST_VALID", + } + NatConfigFlags_value = map[string]uint8{ + "NAT_IS_NONE": 0, + "NAT_IS_TWICE_NAT": 1, + "NAT_IS_SELF_TWICE_NAT": 2, + "NAT_IS_OUT2IN_ONLY": 4, + "NAT_IS_ADDR_ONLY": 8, + "NAT_IS_OUTSIDE": 16, + "NAT_IS_INSIDE": 32, + "NAT_IS_STATIC": 64, + "NAT_IS_EXT_HOST_VALID": 128, + } +) + +func (x NatConfigFlags) String() string { + s, ok := NatConfigFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := NatConfigFlags_name[uint8(n)] + if ok { + return s + } + return "NatConfigFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// NatLogLevel defines enum 'nat_log_level'. +type NatLogLevel uint8 + +const ( + NAT_LOG_NONE NatLogLevel = 0 + NAT_LOG_ERROR NatLogLevel = 1 + NAT_LOG_WARNING NatLogLevel = 2 + NAT_LOG_NOTICE NatLogLevel = 3 + NAT_LOG_INFO NatLogLevel = 4 + NAT_LOG_DEBUG NatLogLevel = 5 +) + +var ( + NatLogLevel_name = map[uint8]string{ + 0: "NAT_LOG_NONE", + 1: "NAT_LOG_ERROR", + 2: "NAT_LOG_WARNING", + 3: "NAT_LOG_NOTICE", + 4: "NAT_LOG_INFO", + 5: "NAT_LOG_DEBUG", + } + NatLogLevel_value = map[string]uint8{ + "NAT_LOG_NONE": 0, + "NAT_LOG_ERROR": 1, + "NAT_LOG_WARNING": 2, + "NAT_LOG_NOTICE": 3, + "NAT_LOG_INFO": 4, + "NAT_LOG_DEBUG": 5, + } +) + +func (x NatLogLevel) String() string { + s, ok := NatLogLevel_name[uint8(x)] + if ok { + return s + } + return "NatLogLevel(" + strconv.Itoa(int(x)) + ")" +} + +// NatTimeouts defines type 'nat_timeouts'. +type NatTimeouts struct { + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} diff --git a/binapi/nsh/nsh.ba.go b/binapi/nsh/nsh.ba.go index 5897a90..00a28a0 100644 --- a/binapi/nsh/nsh.ba.go +++ b/binapi/nsh/nsh.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/nsh.api.json // Package nsh contains generated bindings for API file nsh.api. @@ -12,9 +12,9 @@ package nsh import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "nsh" APIVersion = "1.0.0" - VersionCrc = 0x43be6707 + VersionCrc = 0xc2f3127d ) // NshAddDelEntry defines message 'nsh_add_del_entry'. @@ -161,7 +161,7 @@ type NshAddDelMap struct { func (m *NshAddDelMap) Reset() { *m = NshAddDelMap{} } func (*NshAddDelMap) GetMessageName() string { return "nsh_add_del_map" } -func (*NshAddDelMap) GetCrcString() string { return "898d857d" } +func (*NshAddDelMap) GetCrcString() string { return "0a0f42b0" } func (*NshAddDelMap) GetMessageType() api.MessageType { return api.RequestMessage } @@ -370,7 +370,7 @@ type NshMapDetails struct { func (m *NshMapDetails) Reset() { *m = NshMapDetails{} } func (*NshMapDetails) GetMessageName() string { return "nsh_map_details" } -func (*NshMapDetails) GetCrcString() string { return "b34ac8a1" } +func (*NshMapDetails) GetCrcString() string { return "2fefcf49" } func (*NshMapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -451,11 +451,11 @@ func init() { file_nsh_binapi_init() } func file_nsh_binapi_init() { api.RegisterMessage((*NshAddDelEntry)(nil), "nsh_add_del_entry_7dea480b") api.RegisterMessage((*NshAddDelEntryReply)(nil), "nsh_add_del_entry_reply_6296a9eb") - api.RegisterMessage((*NshAddDelMap)(nil), "nsh_add_del_map_898d857d") + api.RegisterMessage((*NshAddDelMap)(nil), "nsh_add_del_map_0a0f42b0") api.RegisterMessage((*NshAddDelMapReply)(nil), "nsh_add_del_map_reply_b2b127ef") api.RegisterMessage((*NshEntryDetails)(nil), "nsh_entry_details_046fb556") api.RegisterMessage((*NshEntryDump)(nil), "nsh_entry_dump_cdaf8ccb") - api.RegisterMessage((*NshMapDetails)(nil), "nsh_map_details_b34ac8a1") + api.RegisterMessage((*NshMapDetails)(nil), "nsh_map_details_2fefcf49") api.RegisterMessage((*NshMapDump)(nil), "nsh_map_dump_8fc06b82") } diff --git a/binapi/nsh/nsh_rest.ba.go b/binapi/nsh/nsh_rest.ba.go deleted file mode 100644 index 87b29e4..0000000 --- a/binapi/nsh/nsh_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nsh - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nsh_add_del_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(NshAddDelEntry) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NshAddDelEntry(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nsh_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(NshAddDelMap) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NshAddDelMap(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/nsh/nsh_rpc.ba.go b/binapi/nsh/nsh_rpc.ba.go index c91c85f..2761653 100644 --- a/binapi/nsh/nsh_rpc.ba.go +++ b/binapi/nsh/nsh_rpc.ba.go @@ -5,12 +5,13 @@ package nsh import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service nsh. +// RPCService defines RPC service nsh. type RPCService interface { NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) (*NshAddDelEntryReply, error) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) @@ -32,7 +33,7 @@ func (c *serviceClient) NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) { @@ -41,7 +42,7 @@ func (c *serviceClient) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*Ns if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NshEntryDump(ctx context.Context, in *NshEntryDump) (RPCService_NshEntryDumpClient, error) { @@ -53,7 +54,7 @@ func (c *serviceClient) NshEntryDump(ctx context.Context, in *NshEntryDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -76,7 +77,11 @@ func (c *serviceClient_NshEntryDumpClient) Recv() (*NshEntryDetails, error) { switch m := msg.(type) { case *NshEntryDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -92,7 +97,7 @@ func (c *serviceClient) NshMapDump(ctx context.Context, in *NshMapDump) (RPCServ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -115,7 +120,11 @@ func (c *serviceClient_NshMapDumpClient) Recv() (*NshMapDetails, error) { switch m := msg.(type) { case *NshMapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/nsim/nsim.ba.go b/binapi/nsim/nsim.ba.go index fb540ac..e7db135 100644 --- a/binapi/nsim/nsim.ba.go +++ b/binapi/nsim/nsim.ba.go @@ -1,20 +1,20 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/nsim.api.json // Package nsim contains generated bindings for API file nsim.api. // // Contents: -// 6 messages +// 8 messages // package nsim import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -25,11 +25,12 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "nsim" - APIVersion = "2.1.1" - VersionCrc = 0xcd5b42e8 + APIVersion = "2.2.1" + VersionCrc = 0x3b179b8f ) // NsimConfigure defines message 'nsim_configure'. +// Deprecated: the message will be removed in the future versions type NsimConfigure struct { DelayInUsec uint32 `binapi:"u32,name=delay_in_usec" json:"delay_in_usec,omitempty"` AveragePacketSize uint32 `binapi:"u32,name=average_packet_size" json:"average_packet_size,omitempty"` @@ -74,7 +75,90 @@ func (m *NsimConfigure) Unmarshal(b []byte) error { return nil } +// NsimConfigure2 defines message 'nsim_configure2'. +type NsimConfigure2 struct { + DelayInUsec uint32 `binapi:"u32,name=delay_in_usec" json:"delay_in_usec,omitempty"` + AveragePacketSize uint32 `binapi:"u32,name=average_packet_size" json:"average_packet_size,omitempty"` + BandwidthInBitsPerSecond uint64 `binapi:"u64,name=bandwidth_in_bits_per_second" json:"bandwidth_in_bits_per_second,omitempty"` + PacketsPerDrop uint32 `binapi:"u32,name=packets_per_drop" json:"packets_per_drop,omitempty"` + PacketsPerReorder uint32 `binapi:"u32,name=packets_per_reorder" json:"packets_per_reorder,omitempty"` +} + +func (m *NsimConfigure2) Reset() { *m = NsimConfigure2{} } +func (*NsimConfigure2) GetMessageName() string { return "nsim_configure2" } +func (*NsimConfigure2) GetCrcString() string { return "64de8ed3" } +func (*NsimConfigure2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NsimConfigure2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.DelayInUsec + size += 4 // m.AveragePacketSize + size += 8 // m.BandwidthInBitsPerSecond + size += 4 // m.PacketsPerDrop + size += 4 // m.PacketsPerReorder + return size +} +func (m *NsimConfigure2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.DelayInUsec) + buf.EncodeUint32(m.AveragePacketSize) + buf.EncodeUint64(m.BandwidthInBitsPerSecond) + buf.EncodeUint32(m.PacketsPerDrop) + buf.EncodeUint32(m.PacketsPerReorder) + return buf.Bytes(), nil +} +func (m *NsimConfigure2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DelayInUsec = buf.DecodeUint32() + m.AveragePacketSize = buf.DecodeUint32() + m.BandwidthInBitsPerSecond = buf.DecodeUint64() + m.PacketsPerDrop = buf.DecodeUint32() + m.PacketsPerReorder = buf.DecodeUint32() + return nil +} + +// NsimConfigure2Reply defines message 'nsim_configure2_reply'. +type NsimConfigure2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NsimConfigure2Reply) Reset() { *m = NsimConfigure2Reply{} } +func (*NsimConfigure2Reply) GetMessageName() string { return "nsim_configure2_reply" } +func (*NsimConfigure2Reply) GetCrcString() string { return "e8d4e804" } +func (*NsimConfigure2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NsimConfigure2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *NsimConfigure2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *NsimConfigure2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // NsimConfigureReply defines message 'nsim_configure_reply'. +// Deprecated: the message will be removed in the future versions type NsimConfigureReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -118,7 +202,7 @@ func (m *NsimCrossConnectEnableDisable) Reset() { *m = NsimCrossConnectEnableDis func (*NsimCrossConnectEnableDisable) GetMessageName() string { return "nsim_cross_connect_enable_disable" } -func (*NsimCrossConnectEnableDisable) GetCrcString() string { return "16f70bdf" } +func (*NsimCrossConnectEnableDisable) GetCrcString() string { return "9c3ead86" } func (*NsimCrossConnectEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -262,8 +346,10 @@ func (m *NsimOutputFeatureEnableDisableReply) Unmarshal(b []byte) error { func init() { file_nsim_binapi_init() } func file_nsim_binapi_init() { api.RegisterMessage((*NsimConfigure)(nil), "nsim_configure_16ed400f") + api.RegisterMessage((*NsimConfigure2)(nil), "nsim_configure2_64de8ed3") + api.RegisterMessage((*NsimConfigure2Reply)(nil), "nsim_configure2_reply_e8d4e804") api.RegisterMessage((*NsimConfigureReply)(nil), "nsim_configure_reply_e8d4e804") - api.RegisterMessage((*NsimCrossConnectEnableDisable)(nil), "nsim_cross_connect_enable_disable_16f70bdf") + api.RegisterMessage((*NsimCrossConnectEnableDisable)(nil), "nsim_cross_connect_enable_disable_9c3ead86") api.RegisterMessage((*NsimCrossConnectEnableDisableReply)(nil), "nsim_cross_connect_enable_disable_reply_e8d4e804") api.RegisterMessage((*NsimOutputFeatureEnableDisable)(nil), "nsim_output_feature_enable_disable_3865946c") api.RegisterMessage((*NsimOutputFeatureEnableDisableReply)(nil), "nsim_output_feature_enable_disable_reply_e8d4e804") @@ -273,6 +359,8 @@ func file_nsim_binapi_init() { func AllMessages() []api.Message { return []api.Message{ (*NsimConfigure)(nil), + (*NsimConfigure2)(nil), + (*NsimConfigure2Reply)(nil), (*NsimConfigureReply)(nil), (*NsimCrossConnectEnableDisable)(nil), (*NsimCrossConnectEnableDisableReply)(nil), diff --git a/binapi/nsim/nsim_rest.ba.go b/binapi/nsim/nsim_rest.ba.go deleted file mode 100644 index ba53f21..0000000 --- a/binapi/nsim/nsim_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nsim - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nsim_configure", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimConfigure) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NsimConfigure(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nsim_cross_connect_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimCrossConnectEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NsimCrossConnectEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/nsim_output_feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimOutputFeatureEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.NsimOutputFeatureEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/nsim/nsim_rpc.ba.go b/binapi/nsim/nsim_rpc.ba.go index f35e6b3..a7c3d88 100644 --- a/binapi/nsim/nsim_rpc.ba.go +++ b/binapi/nsim/nsim_rpc.ba.go @@ -4,12 +4,14 @@ package nsim import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service nsim. +// RPCService defines RPC service nsim. type RPCService interface { NsimConfigure(ctx context.Context, in *NsimConfigure) (*NsimConfigureReply, error) + NsimConfigure2(ctx context.Context, in *NsimConfigure2) (*NsimConfigure2Reply, error) NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) NsimOutputFeatureEnableDisable(ctx context.Context, in *NsimOutputFeatureEnableDisable) (*NsimOutputFeatureEnableDisableReply, error) } @@ -28,7 +30,16 @@ func (c *serviceClient) NsimConfigure(ctx context.Context, in *NsimConfigure) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) NsimConfigure2(ctx context.Context, in *NsimConfigure2) (*NsimConfigure2Reply, error) { + out := new(NsimConfigure2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) { @@ -37,7 +48,7 @@ func (c *serviceClient) NsimCrossConnectEnableDisable(ctx context.Context, in *N if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NsimOutputFeatureEnableDisable(ctx context.Context, in *NsimOutputFeatureEnableDisable) (*NsimOutputFeatureEnableDisableReply, error) { @@ -46,5 +57,5 @@ func (c *serviceClient) NsimOutputFeatureEnableDisable(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/oddbuf/oddbuf.ba.go b/binapi/oddbuf/oddbuf.ba.go index c6f3e21..73656b9 100644 --- a/binapi/oddbuf/oddbuf.ba.go +++ b/binapi/oddbuf/oddbuf.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/oddbuf.api.json // Package oddbuf contains generated bindings for API file oddbuf.api. @@ -12,9 +12,9 @@ package oddbuf import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,10 +26,11 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "oddbuf" APIVersion = "0.1.0" - VersionCrc = 0x95757869 + VersionCrc = 0x3a1a2c50 ) // OddbufEnableDisable defines message 'oddbuf_enable_disable'. +// InProgress: the message form may change in the future versions type OddbufEnableDisable struct { EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -67,6 +68,7 @@ func (m *OddbufEnableDisable) Unmarshal(b []byte) error { } // OddbufEnableDisableReply defines message 'oddbuf_enable_disable_reply'. +// InProgress: the message form may change in the future versions type OddbufEnableDisableReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } diff --git a/binapi/oddbuf/oddbuf_rest.ba.go b/binapi/oddbuf/oddbuf_rest.ba.go deleted file mode 100644 index b50418c..0000000 --- a/binapi/oddbuf/oddbuf_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package oddbuf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/oddbuf_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OddbufEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OddbufEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/oddbuf/oddbuf_rpc.ba.go b/binapi/oddbuf/oddbuf_rpc.ba.go index a8c245e..426eaed 100644 --- a/binapi/oddbuf/oddbuf_rpc.ba.go +++ b/binapi/oddbuf/oddbuf_rpc.ba.go @@ -4,10 +4,11 @@ package oddbuf import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service oddbuf. +// RPCService defines RPC service oddbuf. type RPCService interface { OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) OddbufEnableDisable(ctx context.Context, in *OddbufEnabl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/one/one.ba.go b/binapi/one/one.ba.go index fa3b5af..89fca1d 100644 --- a/binapi/one/one.ba.go +++ b/binapi/one/one.ba.go @@ -1,8 +1,8 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/one.api.json +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/one.api.json // Package one contains generated bindings for API file one.api. // @@ -14,13 +14,14 @@ package one import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - lisp_types "git.fd.io/govpp.git/binapi/lisp_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + lisp_types "go.fd.io/govpp/binapi/lisp_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -32,7 +33,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "one" APIVersion = "2.0.0" - VersionCrc = 0x288aaf5d + VersionCrc = 0x9f64600e ) // OneFilter defines enum 'one_filter'. @@ -120,7 +121,7 @@ type OneAddDelAdjacency struct { func (m *OneAddDelAdjacency) Reset() { *m = OneAddDelAdjacency{} } func (*OneAddDelAdjacency) GetMessageName() string { return "one_add_del_adjacency" } -func (*OneAddDelAdjacency) GetCrcString() string { return "e48e7afe" } +func (*OneAddDelAdjacency) GetCrcString() string { return "9e830312" } func (*OneAddDelAdjacency) GetMessageType() api.MessageType { return api.RequestMessage } @@ -129,12 +130,12 @@ func (m *OneAddDelAdjacency) Size() (size int) { if m == nil { return 0 } - size += 1 // m.IsAdd - size += 4 // m.Vni - size += 1 // m.Reid.Type - size += 1 * 6 // m.Reid.Address - size += 1 // m.Leid.Type - size += 1 * 6 // m.Leid.Address + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 1 // m.Reid.Type + size += 1 * 18 // m.Reid.Address + size += 1 // m.Leid.Type + size += 1 * 18 // m.Leid.Address return size } func (m *OneAddDelAdjacency) Marshal(b []byte) ([]byte, error) { @@ -145,9 +146,9 @@ func (m *OneAddDelAdjacency) Marshal(b []byte) ([]byte, error) { buf.EncodeUint8(m.IsAdd) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Reid.Type)) - buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Leid.Type)) - buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 18) return buf.Bytes(), nil } func (m *OneAddDelAdjacency) Unmarshal(b []byte) error { @@ -155,9 +156,9 @@ func (m *OneAddDelAdjacency) Unmarshal(b []byte) error { m.IsAdd = buf.DecodeUint8() m.Vni = buf.DecodeUint32() m.Reid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Leid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) return nil } @@ -203,7 +204,7 @@ type OneAddDelL2ArpEntry struct { func (m *OneAddDelL2ArpEntry) Reset() { *m = OneAddDelL2ArpEntry{} } func (*OneAddDelL2ArpEntry) GetMessageName() string { return "one_add_del_l2_arp_entry" } -func (*OneAddDelL2ArpEntry) GetCrcString() string { return "33209078" } +func (*OneAddDelL2ArpEntry) GetCrcString() string { return "1aa5e8b3" } func (*OneAddDelL2ArpEntry) GetMessageType() api.MessageType { return api.RequestMessage } @@ -282,7 +283,7 @@ type OneAddDelLocalEid struct { func (m *OneAddDelLocalEid) Reset() { *m = OneAddDelLocalEid{} } func (*OneAddDelLocalEid) GetMessageName() string { return "one_add_del_local_eid" } -func (*OneAddDelLocalEid) GetCrcString() string { return "21f573bd" } +func (*OneAddDelLocalEid) GetCrcString() string { return "4e5a83a2" } func (*OneAddDelLocalEid) GetMessageType() api.MessageType { return api.RequestMessage } @@ -293,7 +294,7 @@ func (m *OneAddDelLocalEid) Size() (size int) { } size += 1 // m.IsAdd size += 1 // m.Eid.Type - size += 1 * 6 // m.Eid.Address + size += 1 * 18 // m.Eid.Address size += 64 // m.LocatorSetName size += 4 // m.Vni size += 1 // m.Key.ID @@ -307,7 +308,7 @@ func (m *OneAddDelLocalEid) Marshal(b []byte) ([]byte, error) { buf := codec.NewBuffer(b) buf.EncodeBool(m.IsAdd) buf.EncodeUint8(uint8(m.Eid.Type)) - buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 18) buf.EncodeString(m.LocatorSetName, 64) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Key.ID)) @@ -318,7 +319,7 @@ func (m *OneAddDelLocalEid) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.LocatorSetName = buf.DecodeString(64) m.Vni = buf.DecodeUint32() m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) @@ -628,7 +629,7 @@ type OneAddDelMapResolver struct { func (m *OneAddDelMapResolver) Reset() { *m = OneAddDelMapResolver{} } func (*OneAddDelMapResolver) GetMessageName() string { return "one_add_del_map_resolver" } -func (*OneAddDelMapResolver) GetCrcString() string { return "6598ea7c" } +func (*OneAddDelMapResolver) GetCrcString() string { return "ce19e32d" } func (*OneAddDelMapResolver) GetMessageType() api.MessageType { return api.RequestMessage } @@ -701,7 +702,7 @@ type OneAddDelMapServer struct { func (m *OneAddDelMapServer) Reset() { *m = OneAddDelMapServer{} } func (*OneAddDelMapServer) GetMessageName() string { return "one_add_del_map_server" } -func (*OneAddDelMapServer) GetCrcString() string { return "6598ea7c" } +func (*OneAddDelMapServer) GetCrcString() string { return "ce19e32d" } func (*OneAddDelMapServer) GetMessageType() api.MessageType { return api.RequestMessage } @@ -775,7 +776,7 @@ type OneAddDelNdpEntry struct { func (m *OneAddDelNdpEntry) Reset() { *m = OneAddDelNdpEntry{} } func (*OneAddDelNdpEntry) GetMessageName() string { return "one_add_del_ndp_entry" } -func (*OneAddDelNdpEntry) GetCrcString() string { return "d1629a2f" } +func (*OneAddDelNdpEntry) GetCrcString() string { return "0f8a287c" } func (*OneAddDelNdpEntry) GetMessageType() api.MessageType { return api.RequestMessage } @@ -858,7 +859,7 @@ type OneAddDelRemoteMapping struct { func (m *OneAddDelRemoteMapping) Reset() { *m = OneAddDelRemoteMapping{} } func (*OneAddDelRemoteMapping) GetMessageName() string { return "one_add_del_remote_mapping" } -func (*OneAddDelRemoteMapping) GetCrcString() string { return "fae8ed77" } +func (*OneAddDelRemoteMapping) GetCrcString() string { return "6d5c789e" } func (*OneAddDelRemoteMapping) GetMessageType() api.MessageType { return api.RequestMessage } @@ -867,16 +868,16 @@ func (m *OneAddDelRemoteMapping) Size() (size int) { if m == nil { return 0 } - size += 1 // m.IsAdd - size += 1 // m.IsSrcDst - size += 1 // m.DelAll - size += 4 // m.Vni - size += 1 // m.Action - size += 1 // m.Deid.Type - size += 1 * 6 // m.Deid.Address - size += 1 // m.Seid.Type - size += 1 * 6 // m.Seid.Address - size += 4 // m.RlocNum + size += 1 // m.IsAdd + size += 1 // m.IsSrcDst + size += 1 // m.DelAll + size += 4 // m.Vni + size += 1 // m.Action + size += 1 // m.Deid.Type + size += 1 * 18 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 18 // m.Seid.Address + size += 4 // m.RlocNum for j1 := 0; j1 < len(m.Rlocs); j1++ { var s1 lisp_types.RemoteLocator _ = s1 @@ -901,9 +902,9 @@ func (m *OneAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) { buf.EncodeUint32(m.Vni) buf.EncodeUint8(m.Action) buf.EncodeUint8(uint8(m.Deid.Type)) - buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Seid.Type)) - buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(uint32(len(m.Rlocs))) for j0 := 0; j0 < len(m.Rlocs); j0++ { var v0 lisp_types.RemoteLocator // Rlocs @@ -925,9 +926,9 @@ func (m *OneAddDelRemoteMapping) Unmarshal(b []byte) error { m.Vni = buf.DecodeUint32() m.Action = buf.DecodeUint8() m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.RlocNum = buf.DecodeUint32() m.Rlocs = make([]lisp_types.RemoteLocator, m.RlocNum) for j0 := 0; j0 < len(m.Rlocs); j0++ { @@ -1016,7 +1017,7 @@ type OneAdjacenciesGetReply struct { func (m *OneAdjacenciesGetReply) Reset() { *m = OneAdjacenciesGetReply{} } func (*OneAdjacenciesGetReply) GetMessageName() string { return "one_adjacencies_get_reply" } -func (*OneAdjacenciesGetReply) GetCrcString() string { return "a8ed89a5" } +func (*OneAdjacenciesGetReply) GetCrcString() string { return "085bab89" } func (*OneAdjacenciesGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1033,10 +1034,10 @@ func (m *OneAdjacenciesGetReply) Size() (size int) { if j1 < len(m.Adjacencies) { s1 = m.Adjacencies[j1] } - size += 1 // s1.Reid.Type - size += 1 * 6 // s1.Reid.Address - size += 1 // s1.Leid.Type - size += 1 * 6 // s1.Leid.Address + size += 1 // s1.Reid.Type + size += 1 * 18 // s1.Reid.Address + size += 1 // s1.Leid.Type + size += 1 * 18 // s1.Leid.Address } return size } @@ -1053,9 +1054,9 @@ func (m *OneAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) { v0 = m.Adjacencies[j0] } buf.EncodeUint8(uint8(v0.Reid.Type)) - buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(v0.Leid.Type)) - buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 18) } return buf.Bytes(), nil } @@ -1066,9 +1067,9 @@ func (m *OneAdjacenciesGetReply) Unmarshal(b []byte) error { m.Adjacencies = make([]OneAdjacency, m.Count) for j0 := 0; j0 < len(m.Adjacencies); j0++ { m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Adjacencies[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) } return nil } @@ -1167,7 +1168,7 @@ type OneEidTableDetails struct { func (m *OneEidTableDetails) Reset() { *m = OneEidTableDetails{} } func (*OneEidTableDetails) GetMessageName() string { return "one_eid_table_details" } -func (*OneEidTableDetails) GetCrcString() string { return "4bc32e3a" } +func (*OneEidTableDetails) GetCrcString() string { return "1c29f792" } func (*OneEidTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1182,9 +1183,9 @@ func (m *OneEidTableDetails) Size() (size int) { size += 1 // m.IsSrcDst size += 4 // m.Vni size += 1 // m.Deid.Type - size += 1 * 6 // m.Deid.Address + size += 1 * 18 // m.Deid.Address size += 1 // m.Seid.Type - size += 1 * 6 // m.Seid.Address + size += 1 * 18 // m.Seid.Address size += 4 // m.TTL size += 1 // m.Authoritative size += 1 // m.Key.ID @@ -1202,9 +1203,9 @@ func (m *OneEidTableDetails) Marshal(b []byte) ([]byte, error) { buf.EncodeBool(m.IsSrcDst) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Deid.Type)) - buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Seid.Type)) - buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(m.TTL) buf.EncodeUint8(m.Authoritative) buf.EncodeUint8(uint8(m.Key.ID)) @@ -1219,9 +1220,9 @@ func (m *OneEidTableDetails) Unmarshal(b []byte) error { m.IsSrcDst = buf.DecodeBool() m.Vni = buf.DecodeUint32() m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.TTL = buf.DecodeUint32() m.Authoritative = buf.DecodeUint8() m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) @@ -1240,7 +1241,7 @@ type OneEidTableDump struct { func (m *OneEidTableDump) Reset() { *m = OneEidTableDump{} } func (*OneEidTableDump) GetMessageName() string { return "one_eid_table_dump" } -func (*OneEidTableDump) GetCrcString() string { return "95151038" } +func (*OneEidTableDump) GetCrcString() string { return "bd190269" } func (*OneEidTableDump) GetMessageType() api.MessageType { return api.RequestMessage } @@ -1249,11 +1250,11 @@ func (m *OneEidTableDump) Size() (size int) { if m == nil { return 0 } - size += 1 // m.EidSet - size += 4 // m.Vni - size += 1 // m.Eid.Type - size += 1 * 6 // m.Eid.Address - size += 4 // m.Filter + size += 1 // m.EidSet + size += 4 // m.Vni + size += 1 // m.Eid.Type + size += 1 * 18 // m.Eid.Address + size += 4 // m.Filter return size } func (m *OneEidTableDump) Marshal(b []byte) ([]byte, error) { @@ -1264,7 +1265,7 @@ func (m *OneEidTableDump) Marshal(b []byte) ([]byte, error) { buf.EncodeBool(m.EidSet) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Eid.Type)) - buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 18) buf.EncodeUint32(uint32(m.Filter)) return buf.Bytes(), nil } @@ -1273,7 +1274,7 @@ func (m *OneEidTableDump) Unmarshal(b []byte) error { m.EidSet = buf.DecodeBool() m.Vni = buf.DecodeUint32() m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Filter = OneFilter(buf.DecodeUint32()) return nil } @@ -1929,7 +1930,7 @@ type OneL2ArpEntriesGetReply struct { func (m *OneL2ArpEntriesGetReply) Reset() { *m = OneL2ArpEntriesGetReply{} } func (*OneL2ArpEntriesGetReply) GetMessageName() string { return "one_l2_arp_entries_get_reply" } -func (*OneL2ArpEntriesGetReply) GetCrcString() string { return "b0a47bbe" } +func (*OneL2ArpEntriesGetReply) GetCrcString() string { return "b0dd200f" } func (*OneL2ArpEntriesGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1991,7 +1992,7 @@ type OneLocatorDetails struct { func (m *OneLocatorDetails) Reset() { *m = OneLocatorDetails{} } func (*OneLocatorDetails) GetMessageName() string { return "one_locator_details" } -func (*OneLocatorDetails) GetCrcString() string { return "c0c4c2a7" } +func (*OneLocatorDetails) GetCrcString() string { return "2c620ffe" } func (*OneLocatorDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2420,7 +2421,7 @@ type OneMapResolverDetails struct { func (m *OneMapResolverDetails) Reset() { *m = OneMapResolverDetails{} } func (*OneMapResolverDetails) GetMessageName() string { return "one_map_resolver_details" } -func (*OneMapResolverDetails) GetCrcString() string { return "82a09deb" } +func (*OneMapResolverDetails) GetCrcString() string { return "3e78fc57" } func (*OneMapResolverDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2483,7 +2484,7 @@ type OneMapServerDetails struct { func (m *OneMapServerDetails) Reset() { *m = OneMapServerDetails{} } func (*OneMapServerDetails) GetMessageName() string { return "one_map_server_details" } -func (*OneMapServerDetails) GetCrcString() string { return "82a09deb" } +func (*OneMapServerDetails) GetCrcString() string { return "3e78fc57" } func (*OneMapServerDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -2658,7 +2659,7 @@ type OneNdpEntriesGetReply struct { func (m *OneNdpEntriesGetReply) Reset() { *m = OneNdpEntriesGetReply{} } func (*OneNdpEntriesGetReply) GetMessageName() string { return "one_ndp_entries_get_reply" } -func (*OneNdpEntriesGetReply) GetCrcString() string { return "0bd34161" } +func (*OneNdpEntriesGetReply) GetCrcString() string { return "70719b1a" } func (*OneNdpEntriesGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -3190,7 +3191,7 @@ type OneStatsDetails struct { func (m *OneStatsDetails) Reset() { *m = OneStatsDetails{} } func (*OneStatsDetails) GetMessageName() string { return "one_stats_details" } -func (*OneStatsDetails) GetCrcString() string { return "ff6ef238" } +func (*OneStatsDetails) GetCrcString() string { return "2eb74678" } func (*OneStatsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -3201,9 +3202,9 @@ func (m *OneStatsDetails) Size() (size int) { } size += 4 // m.Vni size += 1 // m.Deid.Type - size += 1 * 6 // m.Deid.Address + size += 1 * 18 // m.Deid.Address size += 1 // m.Seid.Type - size += 1 * 6 // m.Seid.Address + size += 1 * 18 // m.Seid.Address size += 1 // m.Rloc.Af size += 1 * 16 // m.Rloc.Un size += 1 // m.Lloc.Af @@ -3219,9 +3220,9 @@ func (m *OneStatsDetails) Marshal(b []byte) ([]byte, error) { buf := codec.NewBuffer(b) buf.EncodeUint32(m.Vni) buf.EncodeUint8(uint8(m.Deid.Type)) - buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Seid.Type)) - buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 18) buf.EncodeUint8(uint8(m.Rloc.Af)) buf.EncodeBytes(m.Rloc.Un.XXX_UnionData[:], 16) buf.EncodeUint8(uint8(m.Lloc.Af)) @@ -3234,9 +3235,9 @@ func (m *OneStatsDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Vni = buf.DecodeUint32() m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) - copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(18)) m.Rloc.Af = ip_types.AddressFamily(buf.DecodeUint8()) copy(m.Rloc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) m.Lloc.Af = ip_types.AddressFamily(buf.DecodeUint8()) @@ -3407,7 +3408,7 @@ type OneUsePetr struct { func (m *OneUsePetr) Reset() { *m = OneUsePetr{} } func (*OneUsePetr) GetMessageName() string { return "one_use_petr" } -func (*OneUsePetr) GetCrcString() string { return "9e141831" } +func (*OneUsePetr) GetCrcString() string { return "d87dbad9" } func (*OneUsePetr) GetMessageType() api.MessageType { return api.RequestMessage } @@ -4106,7 +4107,7 @@ type ShowOneUsePetrReply struct { func (m *ShowOneUsePetrReply) Reset() { *m = ShowOneUsePetrReply{} } func (*ShowOneUsePetrReply) GetMessageName() string { return "show_one_use_petr_reply" } -func (*ShowOneUsePetrReply) GetCrcString() string { return "10e744a6" } +func (*ShowOneUsePetrReply) GetCrcString() string { return "84a03528" } func (*ShowOneUsePetrReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -4143,11 +4144,11 @@ func (m *ShowOneUsePetrReply) Unmarshal(b []byte) error { func init() { file_one_binapi_init() } func file_one_binapi_init() { - api.RegisterMessage((*OneAddDelAdjacency)(nil), "one_add_del_adjacency_e48e7afe") + api.RegisterMessage((*OneAddDelAdjacency)(nil), "one_add_del_adjacency_9e830312") api.RegisterMessage((*OneAddDelAdjacencyReply)(nil), "one_add_del_adjacency_reply_e8d4e804") - api.RegisterMessage((*OneAddDelL2ArpEntry)(nil), "one_add_del_l2_arp_entry_33209078") + api.RegisterMessage((*OneAddDelL2ArpEntry)(nil), "one_add_del_l2_arp_entry_1aa5e8b3") api.RegisterMessage((*OneAddDelL2ArpEntryReply)(nil), "one_add_del_l2_arp_entry_reply_e8d4e804") - api.RegisterMessage((*OneAddDelLocalEid)(nil), "one_add_del_local_eid_21f573bd") + api.RegisterMessage((*OneAddDelLocalEid)(nil), "one_add_del_local_eid_4e5a83a2") api.RegisterMessage((*OneAddDelLocalEidReply)(nil), "one_add_del_local_eid_reply_e8d4e804") api.RegisterMessage((*OneAddDelLocator)(nil), "one_add_del_locator_af4d8f13") api.RegisterMessage((*OneAddDelLocatorReply)(nil), "one_add_del_locator_reply_e8d4e804") @@ -4155,20 +4156,20 @@ func file_one_binapi_init() { api.RegisterMessage((*OneAddDelLocatorSetReply)(nil), "one_add_del_locator_set_reply_b6666db4") api.RegisterMessage((*OneAddDelMapRequestItrRlocs)(nil), "one_add_del_map_request_itr_rlocs_6be88e45") api.RegisterMessage((*OneAddDelMapRequestItrRlocsReply)(nil), "one_add_del_map_request_itr_rlocs_reply_e8d4e804") - api.RegisterMessage((*OneAddDelMapResolver)(nil), "one_add_del_map_resolver_6598ea7c") + api.RegisterMessage((*OneAddDelMapResolver)(nil), "one_add_del_map_resolver_ce19e32d") api.RegisterMessage((*OneAddDelMapResolverReply)(nil), "one_add_del_map_resolver_reply_e8d4e804") - api.RegisterMessage((*OneAddDelMapServer)(nil), "one_add_del_map_server_6598ea7c") + api.RegisterMessage((*OneAddDelMapServer)(nil), "one_add_del_map_server_ce19e32d") api.RegisterMessage((*OneAddDelMapServerReply)(nil), "one_add_del_map_server_reply_e8d4e804") - api.RegisterMessage((*OneAddDelNdpEntry)(nil), "one_add_del_ndp_entry_d1629a2f") + api.RegisterMessage((*OneAddDelNdpEntry)(nil), "one_add_del_ndp_entry_0f8a287c") api.RegisterMessage((*OneAddDelNdpEntryReply)(nil), "one_add_del_ndp_entry_reply_e8d4e804") - api.RegisterMessage((*OneAddDelRemoteMapping)(nil), "one_add_del_remote_mapping_fae8ed77") + api.RegisterMessage((*OneAddDelRemoteMapping)(nil), "one_add_del_remote_mapping_6d5c789e") api.RegisterMessage((*OneAddDelRemoteMappingReply)(nil), "one_add_del_remote_mapping_reply_e8d4e804") api.RegisterMessage((*OneAdjacenciesGet)(nil), "one_adjacencies_get_8d1f2fe9") - api.RegisterMessage((*OneAdjacenciesGetReply)(nil), "one_adjacencies_get_reply_a8ed89a5") + api.RegisterMessage((*OneAdjacenciesGetReply)(nil), "one_adjacencies_get_reply_085bab89") api.RegisterMessage((*OneEidTableAddDelMap)(nil), "one_eid_table_add_del_map_9481416b") api.RegisterMessage((*OneEidTableAddDelMapReply)(nil), "one_eid_table_add_del_map_reply_e8d4e804") - api.RegisterMessage((*OneEidTableDetails)(nil), "one_eid_table_details_4bc32e3a") - api.RegisterMessage((*OneEidTableDump)(nil), "one_eid_table_dump_95151038") + api.RegisterMessage((*OneEidTableDetails)(nil), "one_eid_table_details_1c29f792") + api.RegisterMessage((*OneEidTableDump)(nil), "one_eid_table_dump_bd190269") api.RegisterMessage((*OneEidTableMapDetails)(nil), "one_eid_table_map_details_0b6859e2") api.RegisterMessage((*OneEidTableMapDump)(nil), "one_eid_table_map_dump_d6cf0c3d") api.RegisterMessage((*OneEidTableVniDetails)(nil), "one_eid_table_vni_details_64abc01e") @@ -4188,8 +4189,8 @@ func file_one_binapi_init() { api.RegisterMessage((*OneL2ArpBdGet)(nil), "one_l2_arp_bd_get_51077d14") api.RegisterMessage((*OneL2ArpBdGetReply)(nil), "one_l2_arp_bd_get_reply_221ac888") api.RegisterMessage((*OneL2ArpEntriesGet)(nil), "one_l2_arp_entries_get_4d418cf4") - api.RegisterMessage((*OneL2ArpEntriesGetReply)(nil), "one_l2_arp_entries_get_reply_b0a47bbe") - api.RegisterMessage((*OneLocatorDetails)(nil), "one_locator_details_c0c4c2a7") + api.RegisterMessage((*OneL2ArpEntriesGetReply)(nil), "one_l2_arp_entries_get_reply_b0dd200f") + api.RegisterMessage((*OneLocatorDetails)(nil), "one_locator_details_2c620ffe") api.RegisterMessage((*OneLocatorDump)(nil), "one_locator_dump_9b11076c") api.RegisterMessage((*OneLocatorSetDetails)(nil), "one_locator_set_details_5b33a105") api.RegisterMessage((*OneLocatorSetDump)(nil), "one_locator_set_dump_71190768") @@ -4201,14 +4202,14 @@ func file_one_binapi_init() { api.RegisterMessage((*OneMapRegisterSetTTLReply)(nil), "one_map_register_set_ttl_reply_e8d4e804") api.RegisterMessage((*OneMapRequestMode)(nil), "one_map_request_mode_ffa5d2f5") api.RegisterMessage((*OneMapRequestModeReply)(nil), "one_map_request_mode_reply_e8d4e804") - api.RegisterMessage((*OneMapResolverDetails)(nil), "one_map_resolver_details_82a09deb") + api.RegisterMessage((*OneMapResolverDetails)(nil), "one_map_resolver_details_3e78fc57") api.RegisterMessage((*OneMapResolverDump)(nil), "one_map_resolver_dump_51077d14") - api.RegisterMessage((*OneMapServerDetails)(nil), "one_map_server_details_82a09deb") + api.RegisterMessage((*OneMapServerDetails)(nil), "one_map_server_details_3e78fc57") api.RegisterMessage((*OneMapServerDump)(nil), "one_map_server_dump_51077d14") api.RegisterMessage((*OneNdpBdGet)(nil), "one_ndp_bd_get_51077d14") api.RegisterMessage((*OneNdpBdGetReply)(nil), "one_ndp_bd_get_reply_221ac888") api.RegisterMessage((*OneNdpEntriesGet)(nil), "one_ndp_entries_get_4d418cf4") - api.RegisterMessage((*OneNdpEntriesGetReply)(nil), "one_ndp_entries_get_reply_0bd34161") + api.RegisterMessage((*OneNdpEntriesGetReply)(nil), "one_ndp_entries_get_reply_70719b1a") api.RegisterMessage((*OneNshSetLocatorSet)(nil), "one_nsh_set_locator_set_486e2b76") api.RegisterMessage((*OneNshSetLocatorSetReply)(nil), "one_nsh_set_locator_set_reply_e8d4e804") api.RegisterMessage((*OnePitrSetLocatorSet)(nil), "one_pitr_set_locator_set_486e2b76") @@ -4223,13 +4224,13 @@ func file_one_binapi_init() { api.RegisterMessage((*OneShowPitrModeReply)(nil), "one_show_pitr_mode_reply_f15abb16") api.RegisterMessage((*OneShowXtrMode)(nil), "one_show_xtr_mode_51077d14") api.RegisterMessage((*OneShowXtrModeReply)(nil), "one_show_xtr_mode_reply_f15abb16") - api.RegisterMessage((*OneStatsDetails)(nil), "one_stats_details_ff6ef238") + api.RegisterMessage((*OneStatsDetails)(nil), "one_stats_details_2eb74678") api.RegisterMessage((*OneStatsDump)(nil), "one_stats_dump_51077d14") api.RegisterMessage((*OneStatsEnableDisable)(nil), "one_stats_enable_disable_c264d7bf") api.RegisterMessage((*OneStatsEnableDisableReply)(nil), "one_stats_enable_disable_reply_e8d4e804") api.RegisterMessage((*OneStatsFlush)(nil), "one_stats_flush_51077d14") api.RegisterMessage((*OneStatsFlushReply)(nil), "one_stats_flush_reply_e8d4e804") - api.RegisterMessage((*OneUsePetr)(nil), "one_use_petr_9e141831") + api.RegisterMessage((*OneUsePetr)(nil), "one_use_petr_d87dbad9") api.RegisterMessage((*OneUsePetrReply)(nil), "one_use_petr_reply_e8d4e804") api.RegisterMessage((*ShowOneMapRegisterFallbackThreshold)(nil), "show_one_map_register_fallback_threshold_51077d14") api.RegisterMessage((*ShowOneMapRegisterFallbackThresholdReply)(nil), "show_one_map_register_fallback_threshold_reply_c93a9113") @@ -4250,7 +4251,7 @@ func file_one_binapi_init() { api.RegisterMessage((*ShowOneStatus)(nil), "show_one_status_51077d14") api.RegisterMessage((*ShowOneStatusReply)(nil), "show_one_status_reply_961bb25b") api.RegisterMessage((*ShowOneUsePetr)(nil), "show_one_use_petr_51077d14") - api.RegisterMessage((*ShowOneUsePetrReply)(nil), "show_one_use_petr_reply_10e744a6") + api.RegisterMessage((*ShowOneUsePetrReply)(nil), "show_one_use_petr_reply_84a03528") } // Messages returns list of all messages in this module. diff --git a/binapi/one/one_rest.ba.go b/binapi/one/one_rest.ba.go deleted file mode 100644 index 2c3caca..0000000 --- a/binapi/one/one_rest.ba.go +++ /dev/null @@ -1,910 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package one - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/one_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelAdjacency) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelAdjacency(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_l2_arp_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelL2ArpEntry) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelL2ArpEntry(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocalEid) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelLocalEid(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_locator", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocator) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelLocator(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocatorSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelLocatorSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapRequestItrRlocs) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelMapRequestItrRlocs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapResolver) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelMapResolver(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapServer) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelMapServer(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_ndp_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelNdpEntry) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelNdpEntry(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelRemoteMapping) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAddDelRemoteMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAdjacenciesGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneAdjacenciesGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEidTableAddDelMap) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneEidTableAddDelMap(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_enable_disable_petr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisablePetrMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneEnableDisablePetrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_enable_disable_pitr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisablePitrMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneEnableDisablePitrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_enable_disable_xtr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisableXtrMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneEnableDisableXtrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneGetMapRequestItrRlocs) - reply, err := rpc.OneGetMapRequestItrRlocs(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_get_transport_protocol", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneGetTransportProtocol) - reply, err := rpc.OneGetTransportProtocol(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_l2_arp_bd_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneL2ArpBdGet) - reply, err := rpc.OneL2ArpBdGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_l2_arp_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneL2ArpEntriesGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneL2ArpEntriesGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneMapRegisterEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterFallbackThreshold) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneMapRegisterFallbackThreshold(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_map_register_set_ttl", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterSetTTL) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneMapRegisterSetTTL(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRequestMode) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneMapRequestMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_ndp_bd_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNdpBdGet) - reply, err := rpc.OneNdpBdGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_ndp_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNdpEntriesGet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneNdpEntriesGet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_nsh_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNshSetLocatorSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneNshSetLocatorSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OnePitrSetLocatorSet) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OnePitrSetLocatorSet(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneRlocProbeEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneRlocProbeEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_set_transport_protocol", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneSetTransportProtocol) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneSetTransportProtocol(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_show_petr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowPetrMode) - reply, err := rpc.OneShowPetrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_show_pitr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowPitrMode) - reply, err := rpc.OneShowPitrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_show_xtr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowXtrMode) - reply, err := rpc.OneShowXtrMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneStatsEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneStatsEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_stats_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneStatsFlush) - reply, err := rpc.OneStatsFlush(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/one_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneUsePetr) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.OneUsePetr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterFallbackThreshold) - reply, err := rpc.ShowOneMapRegisterFallbackThreshold(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_map_register_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterState) - reply, err := rpc.ShowOneMapRegisterState(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_map_register_ttl", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterTTL) - reply, err := rpc.ShowOneMapRegisterTTL(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRequestMode) - reply, err := rpc.ShowOneMapRequestMode(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_nsh_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneNshMapping) - reply, err := rpc.ShowOneNshMapping(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_pitr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOnePitr) - reply, err := rpc.ShowOnePitr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneRlocProbeState) - reply, err := rpc.ShowOneRlocProbeState(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneStatsEnableDisable) - reply, err := rpc.ShowOneStatsEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_status", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneStatus) - reply, err := rpc.ShowOneStatus(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_one_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneUsePetr) - reply, err := rpc.ShowOneUsePetr(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/one/one_rpc.ba.go b/binapi/one/one_rpc.ba.go index 46bf36c..ceb0ab2 100644 --- a/binapi/one/one_rpc.ba.go +++ b/binapi/one/one_rpc.ba.go @@ -5,12 +5,13 @@ package one import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service one. +// RPCService defines RPC service one. type RPCService interface { OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdjacency) (*OneAddDelAdjacencyReply, error) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) @@ -82,7 +83,7 @@ func (c *serviceClient) OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdj if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) { @@ -91,7 +92,7 @@ func (c *serviceClient) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocalEid(ctx context.Context, in *OneAddDelLocalEid) (*OneAddDelLocalEidReply, error) { @@ -100,7 +101,7 @@ func (c *serviceClient) OneAddDelLocalEid(ctx context.Context, in *OneAddDelLoca if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocator(ctx context.Context, in *OneAddDelLocator) (*OneAddDelLocatorReply, error) { @@ -109,7 +110,7 @@ func (c *serviceClient) OneAddDelLocator(ctx context.Context, in *OneAddDelLocat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLocatorSet) (*OneAddDelLocatorSetReply, error) { @@ -118,7 +119,7 @@ func (c *serviceClient) OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapRequestItrRlocs(ctx context.Context, in *OneAddDelMapRequestItrRlocs) (*OneAddDelMapRequestItrRlocsReply, error) { @@ -127,7 +128,7 @@ func (c *serviceClient) OneAddDelMapRequestItrRlocs(ctx context.Context, in *One if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapResolver(ctx context.Context, in *OneAddDelMapResolver) (*OneAddDelMapResolverReply, error) { @@ -136,7 +137,7 @@ func (c *serviceClient) OneAddDelMapResolver(ctx context.Context, in *OneAddDelM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapServer(ctx context.Context, in *OneAddDelMapServer) (*OneAddDelMapServerReply, error) { @@ -145,7 +146,7 @@ func (c *serviceClient) OneAddDelMapServer(ctx context.Context, in *OneAddDelMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpEntry) (*OneAddDelNdpEntryReply, error) { @@ -154,7 +155,7 @@ func (c *serviceClient) OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelRemoteMapping(ctx context.Context, in *OneAddDelRemoteMapping) (*OneAddDelRemoteMappingReply, error) { @@ -163,7 +164,7 @@ func (c *serviceClient) OneAddDelRemoteMapping(ctx context.Context, in *OneAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAdjacenciesGet(ctx context.Context, in *OneAdjacenciesGet) (*OneAdjacenciesGetReply, error) { @@ -172,7 +173,7 @@ func (c *serviceClient) OneAdjacenciesGet(ctx context.Context, in *OneAdjacencie if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEidTableAddDelMap(ctx context.Context, in *OneEidTableAddDelMap) (*OneEidTableAddDelMapReply, error) { @@ -181,7 +182,7 @@ func (c *serviceClient) OneEidTableAddDelMap(ctx context.Context, in *OneEidTabl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEidTableDump(ctx context.Context, in *OneEidTableDump) (RPCService_OneEidTableDumpClient, error) { @@ -193,7 +194,7 @@ func (c *serviceClient) OneEidTableDump(ctx context.Context, in *OneEidTableDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -216,7 +217,11 @@ func (c *serviceClient_OneEidTableDumpClient) Recv() (*OneEidTableDetails, error switch m := msg.(type) { case *OneEidTableDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -232,7 +237,7 @@ func (c *serviceClient) OneEidTableMapDump(ctx context.Context, in *OneEidTableM if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -255,7 +260,11 @@ func (c *serviceClient_OneEidTableMapDumpClient) Recv() (*OneEidTableMapDetails, switch m := msg.(type) { case *OneEidTableMapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -271,7 +280,7 @@ func (c *serviceClient) OneEidTableVniDump(ctx context.Context, in *OneEidTableV if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -294,7 +303,11 @@ func (c *serviceClient_OneEidTableVniDumpClient) Recv() (*OneEidTableVniDetails, switch m := msg.(type) { case *OneEidTableVniDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -307,7 +320,7 @@ func (c *serviceClient) OneEnableDisable(ctx context.Context, in *OneEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisablePetrMode(ctx context.Context, in *OneEnableDisablePetrMode) (*OneEnableDisablePetrModeReply, error) { @@ -316,7 +329,7 @@ func (c *serviceClient) OneEnableDisablePetrMode(ctx context.Context, in *OneEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisablePitrMode(ctx context.Context, in *OneEnableDisablePitrMode) (*OneEnableDisablePitrModeReply, error) { @@ -325,7 +338,7 @@ func (c *serviceClient) OneEnableDisablePitrMode(ctx context.Context, in *OneEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisableXtrMode(ctx context.Context, in *OneEnableDisableXtrMode) (*OneEnableDisableXtrModeReply, error) { @@ -334,7 +347,7 @@ func (c *serviceClient) OneEnableDisableXtrMode(ctx context.Context, in *OneEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneGetMapRequestItrRlocs(ctx context.Context, in *OneGetMapRequestItrRlocs) (*OneGetMapRequestItrRlocsReply, error) { @@ -343,7 +356,7 @@ func (c *serviceClient) OneGetMapRequestItrRlocs(ctx context.Context, in *OneGet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneGetTransportProtocol(ctx context.Context, in *OneGetTransportProtocol) (*OneGetTransportProtocolReply, error) { @@ -352,7 +365,7 @@ func (c *serviceClient) OneGetTransportProtocol(ctx context.Context, in *OneGetT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (*OneL2ArpBdGetReply, error) { @@ -361,7 +374,7 @@ func (c *serviceClient) OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntriesGet) (*OneL2ArpEntriesGetReply, error) { @@ -370,7 +383,7 @@ func (c *serviceClient) OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneLocatorDump(ctx context.Context, in *OneLocatorDump) (RPCService_OneLocatorDumpClient, error) { @@ -382,7 +395,7 @@ func (c *serviceClient) OneLocatorDump(ctx context.Context, in *OneLocatorDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -405,7 +418,11 @@ func (c *serviceClient_OneLocatorDumpClient) Recv() (*OneLocatorDetails, error) switch m := msg.(type) { case *OneLocatorDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -421,7 +438,7 @@ func (c *serviceClient) OneLocatorSetDump(ctx context.Context, in *OneLocatorSet if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -444,7 +461,11 @@ func (c *serviceClient_OneLocatorSetDumpClient) Recv() (*OneLocatorSetDetails, e switch m := msg.(type) { case *OneLocatorSetDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -457,7 +478,7 @@ func (c *serviceClient) OneMapRegisterEnableDisable(ctx context.Context, in *One if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRegisterFallbackThreshold(ctx context.Context, in *OneMapRegisterFallbackThreshold) (*OneMapRegisterFallbackThresholdReply, error) { @@ -466,7 +487,7 @@ func (c *serviceClient) OneMapRegisterFallbackThreshold(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegisterSetTTL) (*OneMapRegisterSetTTLReply, error) { @@ -475,7 +496,7 @@ func (c *serviceClient) OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRequestMode(ctx context.Context, in *OneMapRequestMode) (*OneMapRequestModeReply, error) { @@ -484,7 +505,7 @@ func (c *serviceClient) OneMapRequestMode(ctx context.Context, in *OneMapRequest if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapResolverDump(ctx context.Context, in *OneMapResolverDump) (RPCService_OneMapResolverDumpClient, error) { @@ -496,7 +517,7 @@ func (c *serviceClient) OneMapResolverDump(ctx context.Context, in *OneMapResolv if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -519,7 +540,11 @@ func (c *serviceClient_OneMapResolverDumpClient) Recv() (*OneMapResolverDetails, switch m := msg.(type) { case *OneMapResolverDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -535,7 +560,7 @@ func (c *serviceClient) OneMapServerDump(ctx context.Context, in *OneMapServerDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -558,7 +583,11 @@ func (c *serviceClient_OneMapServerDumpClient) Recv() (*OneMapServerDetails, err switch m := msg.(type) { case *OneMapServerDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -571,7 +600,7 @@ func (c *serviceClient) OneNdpBdGet(ctx context.Context, in *OneNdpBdGet) (*OneN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesGet) (*OneNdpEntriesGetReply, error) { @@ -580,7 +609,7 @@ func (c *serviceClient) OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLocatorSet) (*OneNshSetLocatorSetReply, error) { @@ -589,7 +618,7 @@ func (c *serviceClient) OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSetLocatorSet) (*OnePitrSetLocatorSetReply, error) { @@ -598,7 +627,7 @@ func (c *serviceClient) OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneRlocProbeEnableDisable(ctx context.Context, in *OneRlocProbeEnableDisable) (*OneRlocProbeEnableDisableReply, error) { @@ -607,7 +636,7 @@ func (c *serviceClient) OneRlocProbeEnableDisable(ctx context.Context, in *OneRl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneSetTransportProtocol(ctx context.Context, in *OneSetTransportProtocol) (*OneSetTransportProtocolReply, error) { @@ -616,7 +645,7 @@ func (c *serviceClient) OneSetTransportProtocol(ctx context.Context, in *OneSetT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowPetrMode(ctx context.Context, in *OneShowPetrMode) (*OneShowPetrModeReply, error) { @@ -625,7 +654,7 @@ func (c *serviceClient) OneShowPetrMode(ctx context.Context, in *OneShowPetrMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowPitrMode(ctx context.Context, in *OneShowPitrMode) (*OneShowPitrModeReply, error) { @@ -634,7 +663,7 @@ func (c *serviceClient) OneShowPitrMode(ctx context.Context, in *OneShowPitrMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) (*OneShowXtrModeReply, error) { @@ -643,7 +672,7 @@ func (c *serviceClient) OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneStatsDump(ctx context.Context, in *OneStatsDump) (RPCService_OneStatsDumpClient, error) { @@ -655,7 +684,7 @@ func (c *serviceClient) OneStatsDump(ctx context.Context, in *OneStatsDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -678,7 +707,11 @@ func (c *serviceClient_OneStatsDumpClient) Recv() (*OneStatsDetails, error) { switch m := msg.(type) { case *OneStatsDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -691,7 +724,7 @@ func (c *serviceClient) OneStatsEnableDisable(ctx context.Context, in *OneStatsE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneStatsFlush(ctx context.Context, in *OneStatsFlush) (*OneStatsFlushReply, error) { @@ -700,7 +733,7 @@ func (c *serviceClient) OneStatsFlush(ctx context.Context, in *OneStatsFlush) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUsePetrReply, error) { @@ -709,7 +742,7 @@ func (c *serviceClient) OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUse if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterFallbackThreshold(ctx context.Context, in *ShowOneMapRegisterFallbackThreshold) (*ShowOneMapRegisterFallbackThresholdReply, error) { @@ -718,7 +751,7 @@ func (c *serviceClient) ShowOneMapRegisterFallbackThreshold(ctx context.Context, if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterState(ctx context.Context, in *ShowOneMapRegisterState) (*ShowOneMapRegisterStateReply, error) { @@ -727,7 +760,7 @@ func (c *serviceClient) ShowOneMapRegisterState(ctx context.Context, in *ShowOne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMapRegisterTTL) (*ShowOneMapRegisterTTLReply, error) { @@ -736,7 +769,7 @@ func (c *serviceClient) ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRequestMode(ctx context.Context, in *ShowOneMapRequestMode) (*ShowOneMapRequestModeReply, error) { @@ -745,7 +778,7 @@ func (c *serviceClient) ShowOneMapRequestMode(ctx context.Context, in *ShowOneMa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneNshMapping(ctx context.Context, in *ShowOneNshMapping) (*ShowOneNshMappingReply, error) { @@ -754,7 +787,7 @@ func (c *serviceClient) ShowOneNshMapping(ctx context.Context, in *ShowOneNshMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*ShowOnePitrReply, error) { @@ -763,7 +796,7 @@ func (c *serviceClient) ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneRlocProbeState(ctx context.Context, in *ShowOneRlocProbeState) (*ShowOneRlocProbeStateReply, error) { @@ -772,7 +805,7 @@ func (c *serviceClient) ShowOneRlocProbeState(ctx context.Context, in *ShowOneRl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneStatsEnableDisable(ctx context.Context, in *ShowOneStatsEnableDisable) (*ShowOneStatsEnableDisableReply, error) { @@ -781,7 +814,7 @@ func (c *serviceClient) ShowOneStatsEnableDisable(ctx context.Context, in *ShowO if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneStatus(ctx context.Context, in *ShowOneStatus) (*ShowOneStatusReply, error) { @@ -790,7 +823,7 @@ func (c *serviceClient) ShowOneStatus(ctx context.Context, in *ShowOneStatus) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) (*ShowOneUsePetrReply, error) { @@ -799,5 +832,5 @@ func (c *serviceClient) ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/p2p_ethernet/p2p_ethernet.ba.go b/binapi/p2p_ethernet/p2p_ethernet.ba.go index 2f76041..05f6921 100644 --- a/binapi/p2p_ethernet/p2p_ethernet.ba.go +++ b/binapi/p2p_ethernet/p2p_ethernet.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/p2p_ethernet.api.json // Package p2p_ethernet contains generated bindings for API file p2p_ethernet.api. @@ -12,10 +12,10 @@ package p2p_ethernet import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "p2p_ethernet" APIVersion = "1.0.0" - VersionCrc = 0xe34f63cd + VersionCrc = 0x3cfe55da ) // P2pEthernetAdd defines message 'p2p_ethernet_add'. @@ -39,7 +39,7 @@ type P2pEthernetAdd struct { func (m *P2pEthernetAdd) Reset() { *m = P2pEthernetAdd{} } func (*P2pEthernetAdd) GetMessageName() string { return "p2p_ethernet_add" } -func (*P2pEthernetAdd) GetCrcString() string { return "eeb8e717" } +func (*P2pEthernetAdd) GetCrcString() string { return "36a1a6dc" } func (*P2pEthernetAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -116,7 +116,7 @@ type P2pEthernetDel struct { func (m *P2pEthernetDel) Reset() { *m = P2pEthernetDel{} } func (*P2pEthernetDel) GetMessageName() string { return "p2p_ethernet_del" } -func (*P2pEthernetDel) GetCrcString() string { return "0b62c386" } +func (*P2pEthernetDel) GetCrcString() string { return "62f81c8c" } func (*P2pEthernetDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -180,9 +180,9 @@ func (m *P2pEthernetDelReply) Unmarshal(b []byte) error { func init() { file_p2p_ethernet_binapi_init() } func file_p2p_ethernet_binapi_init() { - api.RegisterMessage((*P2pEthernetAdd)(nil), "p2p_ethernet_add_eeb8e717") + api.RegisterMessage((*P2pEthernetAdd)(nil), "p2p_ethernet_add_36a1a6dc") api.RegisterMessage((*P2pEthernetAddReply)(nil), "p2p_ethernet_add_reply_5383d31f") - api.RegisterMessage((*P2pEthernetDel)(nil), "p2p_ethernet_del_0b62c386") + api.RegisterMessage((*P2pEthernetDel)(nil), "p2p_ethernet_del_62f81c8c") api.RegisterMessage((*P2pEthernetDelReply)(nil), "p2p_ethernet_del_reply_e8d4e804") } diff --git a/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go deleted file mode 100644 index e154276..0000000 --- a/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package p2p_ethernet - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/p2p_ethernet_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(P2pEthernetAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.P2pEthernetAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/p2p_ethernet_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(P2pEthernetDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.P2pEthernetDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go index ed1e012..7e1573d 100644 --- a/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go +++ b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go @@ -4,10 +4,11 @@ package p2p_ethernet import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service p2p_ethernet. +// RPCService defines RPC service p2p_ethernet. type RPCService interface { P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/pci_types/pci_types.ba.go b/binapi/pci_types/pci_types.ba.go index 7b0d00c..a5205f5 100644 --- a/binapi/pci_types/pci_types.ba.go +++ b/binapi/pci_types/pci_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/pci_types.api.json // Package pci_types contains generated bindings for API file pci_types.api. @@ -12,7 +12,7 @@ package pci_types import ( - api "git.fd.io/govpp.git/api" + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -21,6 +21,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "pci_types" + APIVersion = "1.0.0" + VersionCrc = 0x5d418665 +) + // PciAddress defines type 'pci_address'. type PciAddress struct { Domain uint16 `binapi:"u16,name=domain" json:"domain,omitempty"` diff --git a/binapi/pg/pg.ba.go b/binapi/pg/pg.ba.go index 9a522c2..c59a8b1 100644 --- a/binapi/pg/pg.ba.go +++ b/binapi/pg/pg.ba.go @@ -1,20 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/pg.api.json // Package pg contains generated bindings for API file pg.api. // // Contents: -// 6 messages +// 1 enum +// 10 messages // package pg import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,9 +29,39 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "pg" APIVersion = "2.0.0" - VersionCrc = 0xb7fe86ae + VersionCrc = 0x32a1ad3b +) + +// PgInterfaceMode defines enum 'pg_interface_mode'. +type PgInterfaceMode uint8 + +const ( + PG_API_MODE_ETHERNET PgInterfaceMode = 0 + PG_API_MODE_IP4 PgInterfaceMode = 1 + PG_API_MODE_IP6 PgInterfaceMode = 2 +) + +var ( + PgInterfaceMode_name = map[uint8]string{ + 0: "PG_API_MODE_ETHERNET", + 1: "PG_API_MODE_IP4", + 2: "PG_API_MODE_IP6", + } + PgInterfaceMode_value = map[string]uint8{ + "PG_API_MODE_ETHERNET": 0, + "PG_API_MODE_IP4": 1, + "PG_API_MODE_IP6": 2, + } ) +func (x PgInterfaceMode) String() string { + s, ok := PgInterfaceMode_name[uint8(x)] + if ok { + return s + } + return "PgInterfaceMode(" + strconv.Itoa(int(x)) + ")" +} + // PgCapture defines message 'pg_capture'. type PgCapture struct { InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` @@ -185,6 +218,88 @@ func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error { return nil } +// PgCreateInterfaceV2 defines message 'pg_create_interface_v2'. +type PgCreateInterfaceV2 struct { + InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` + GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` + GsoSize uint32 `binapi:"u32,name=gso_size" json:"gso_size,omitempty"` + Mode PgInterfaceMode `binapi:"pg_interface_mode,name=mode" json:"mode,omitempty"` +} + +func (m *PgCreateInterfaceV2) Reset() { *m = PgCreateInterfaceV2{} } +func (*PgCreateInterfaceV2) GetMessageName() string { return "pg_create_interface_v2" } +func (*PgCreateInterfaceV2) GetCrcString() string { return "8657466a" } +func (*PgCreateInterfaceV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PgCreateInterfaceV2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.InterfaceID + size += 1 // m.GsoEnabled + size += 4 // m.GsoSize + size += 1 // m.Mode + return size +} +func (m *PgCreateInterfaceV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.InterfaceID)) + buf.EncodeBool(m.GsoEnabled) + buf.EncodeUint32(m.GsoSize) + buf.EncodeUint8(uint8(m.Mode)) + return buf.Bytes(), nil +} +func (m *PgCreateInterfaceV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.GsoEnabled = buf.DecodeBool() + m.GsoSize = buf.DecodeUint32() + m.Mode = PgInterfaceMode(buf.DecodeUint8()) + return nil +} + +// PgCreateInterfaceV2Reply defines message 'pg_create_interface_v2_reply'. +type PgCreateInterfaceV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PgCreateInterfaceV2Reply) Reset() { *m = PgCreateInterfaceV2Reply{} } +func (*PgCreateInterfaceV2Reply) GetMessageName() string { return "pg_create_interface_v2_reply" } +func (*PgCreateInterfaceV2Reply) GetCrcString() string { return "5383d31f" } +func (*PgCreateInterfaceV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PgCreateInterfaceV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *PgCreateInterfaceV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PgCreateInterfaceV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // PgEnableDisable defines message 'pg_enable_disable'. type PgEnableDisable struct { IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` @@ -255,14 +370,94 @@ func (m *PgEnableDisableReply) Unmarshal(b []byte) error { return nil } +// PgInterfaceEnableDisableCoalesce defines message 'pg_interface_enable_disable_coalesce'. +// InProgress: the message form may change in the future versions +type PgInterfaceEnableDisableCoalesce struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + CoalesceEnabled bool `binapi:"bool,name=coalesce_enabled" json:"coalesce_enabled,omitempty"` +} + +func (m *PgInterfaceEnableDisableCoalesce) Reset() { *m = PgInterfaceEnableDisableCoalesce{} } +func (*PgInterfaceEnableDisableCoalesce) GetMessageName() string { + return "pg_interface_enable_disable_coalesce" +} +func (*PgInterfaceEnableDisableCoalesce) GetCrcString() string { return "a2ef99e7" } +func (*PgInterfaceEnableDisableCoalesce) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PgInterfaceEnableDisableCoalesce) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.CoalesceEnabled + return size +} +func (m *PgInterfaceEnableDisableCoalesce) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.CoalesceEnabled) + return buf.Bytes(), nil +} +func (m *PgInterfaceEnableDisableCoalesce) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.CoalesceEnabled = buf.DecodeBool() + return nil +} + +// PgInterfaceEnableDisableCoalesceReply defines message 'pg_interface_enable_disable_coalesce_reply'. +// InProgress: the message form may change in the future versions +type PgInterfaceEnableDisableCoalesceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PgInterfaceEnableDisableCoalesceReply) Reset() { *m = PgInterfaceEnableDisableCoalesceReply{} } +func (*PgInterfaceEnableDisableCoalesceReply) GetMessageName() string { + return "pg_interface_enable_disable_coalesce_reply" +} +func (*PgInterfaceEnableDisableCoalesceReply) GetCrcString() string { return "e8d4e804" } +func (*PgInterfaceEnableDisableCoalesceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PgInterfaceEnableDisableCoalesceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PgInterfaceEnableDisableCoalesceReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PgInterfaceEnableDisableCoalesceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_pg_binapi_init() } func file_pg_binapi_init() { api.RegisterMessage((*PgCapture)(nil), "pg_capture_3712fb6c") api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804") api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b7c893d7") api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_5383d31f") + api.RegisterMessage((*PgCreateInterfaceV2)(nil), "pg_create_interface_v2_8657466a") + api.RegisterMessage((*PgCreateInterfaceV2Reply)(nil), "pg_create_interface_v2_reply_5383d31f") api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_01f94f3a") api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804") + api.RegisterMessage((*PgInterfaceEnableDisableCoalesce)(nil), "pg_interface_enable_disable_coalesce_a2ef99e7") + api.RegisterMessage((*PgInterfaceEnableDisableCoalesceReply)(nil), "pg_interface_enable_disable_coalesce_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -272,7 +467,11 @@ func AllMessages() []api.Message { (*PgCaptureReply)(nil), (*PgCreateInterface)(nil), (*PgCreateInterfaceReply)(nil), + (*PgCreateInterfaceV2)(nil), + (*PgCreateInterfaceV2Reply)(nil), (*PgEnableDisable)(nil), (*PgEnableDisableReply)(nil), + (*PgInterfaceEnableDisableCoalesce)(nil), + (*PgInterfaceEnableDisableCoalesceReply)(nil), } } diff --git a/binapi/pg/pg_rest.ba.go b/binapi/pg/pg_rest.ba.go deleted file mode 100644 index 6384ac4..0000000 --- a/binapi/pg/pg_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pg - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pg_capture", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCapture) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgCapture(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pg_create_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCreateInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgCreateInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pg_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pg/pg_rpc.ba.go b/binapi/pg/pg_rpc.ba.go index 1d905d0..9b1366c 100644 --- a/binapi/pg/pg_rpc.ba.go +++ b/binapi/pg/pg_rpc.ba.go @@ -4,14 +4,17 @@ package pg import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service pg. +// RPCService defines RPC service pg. type RPCService interface { PgCapture(ctx context.Context, in *PgCapture) (*PgCaptureReply, error) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) + PgCreateInterfaceV2(ctx context.Context, in *PgCreateInterfaceV2) (*PgCreateInterfaceV2Reply, error) PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) + PgInterfaceEnableDisableCoalesce(ctx context.Context, in *PgInterfaceEnableDisableCoalesce) (*PgInterfaceEnableDisableCoalesceReply, error) } type serviceClient struct { @@ -28,7 +31,7 @@ func (c *serviceClient) PgCapture(ctx context.Context, in *PgCapture) (*PgCaptur if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) { @@ -37,7 +40,16 @@ func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PgCreateInterfaceV2(ctx context.Context, in *PgCreateInterfaceV2) (*PgCreateInterfaceV2Reply, error) { + out := new(PgCreateInterfaceV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) { @@ -46,5 +58,14 @@ func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PgInterfaceEnableDisableCoalesce(ctx context.Context, in *PgInterfaceEnableDisableCoalesce) (*PgInterfaceEnableDisableCoalesceReply, error) { + out := new(PgInterfaceEnableDisableCoalesceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/pipe/pipe.ba.go b/binapi/pipe/pipe.ba.go index 6123059..e48a0c2 100644 --- a/binapi/pipe/pipe.ba.go +++ b/binapi/pipe/pipe.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/pipe.api.json // Package pipe contains generated bindings for API file pipe.api. @@ -12,9 +12,9 @@ package pipe import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "pipe" APIVersion = "1.0.1" - VersionCrc = 0xd22736c9 + VersionCrc = 0xc159134a ) // PipeCreate defines message 'pipe_create'. @@ -75,7 +75,7 @@ type PipeCreateReply struct { func (m *PipeCreateReply) Reset() { *m = PipeCreateReply{} } func (*PipeCreateReply) GetMessageName() string { return "pipe_create_reply" } -func (*PipeCreateReply) GetCrcString() string { return "d4c2c2b3" } +func (*PipeCreateReply) GetCrcString() string { return "b7ce310c" } func (*PipeCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -188,7 +188,7 @@ type PipeDetails struct { func (m *PipeDetails) Reset() { *m = PipeDetails{} } func (*PipeDetails) GetMessageName() string { return "pipe_details" } -func (*PipeDetails) GetCrcString() string { return "43ac107a" } +func (*PipeDetails) GetCrcString() string { return "c52b799d" } func (*PipeDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -256,10 +256,10 @@ func (m *PipeDump) Unmarshal(b []byte) error { func init() { file_pipe_binapi_init() } func file_pipe_binapi_init() { api.RegisterMessage((*PipeCreate)(nil), "pipe_create_bb263bd3") - api.RegisterMessage((*PipeCreateReply)(nil), "pipe_create_reply_d4c2c2b3") + api.RegisterMessage((*PipeCreateReply)(nil), "pipe_create_reply_b7ce310c") api.RegisterMessage((*PipeDelete)(nil), "pipe_delete_f9e6675e") api.RegisterMessage((*PipeDeleteReply)(nil), "pipe_delete_reply_e8d4e804") - api.RegisterMessage((*PipeDetails)(nil), "pipe_details_43ac107a") + api.RegisterMessage((*PipeDetails)(nil), "pipe_details_c52b799d") api.RegisterMessage((*PipeDump)(nil), "pipe_dump_51077d14") } diff --git a/binapi/pipe/pipe_rest.ba.go b/binapi/pipe/pipe_rest.ba.go deleted file mode 100644 index 8a2b900..0000000 --- a/binapi/pipe/pipe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pipe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pipe_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(PipeCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PipeCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pipe_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(PipeDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PipeDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pipe/pipe_rpc.ba.go b/binapi/pipe/pipe_rpc.ba.go index 3350ace..a3fd0d8 100644 --- a/binapi/pipe/pipe_rpc.ba.go +++ b/binapi/pipe/pipe_rpc.ba.go @@ -5,12 +5,13 @@ package pipe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service pipe. +// RPCService defines RPC service pipe. type RPCService interface { PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) @@ -31,7 +32,7 @@ func (c *serviceClient) PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) { @@ -40,7 +41,7 @@ func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) { @@ -52,7 +53,7 @@ func (c *serviceClient) PipeDump(ctx context.Context, in *PipeDump) (RPCService_ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -75,7 +76,11 @@ func (c *serviceClient_PipeDumpClient) Recv() (*PipeDetails, error) { switch m := msg.(type) { case *PipeDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/pnat/pnat.ba.go b/binapi/pnat/pnat.ba.go new file mode 100644 index 0000000..53ce0ee --- /dev/null +++ b/binapi/pnat/pnat.ba.go @@ -0,0 +1,771 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/pnat.api.json + +// Package pnat contains generated bindings for API file pnat.api. +// +// Contents: +// 2 enums +// 2 structs +// 14 messages +// +package pnat + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pnat" + APIVersion = "0.1.1" + VersionCrc = 0x108d3b87 +) + +// PnatAttachmentPoint defines enum 'pnat_attachment_point'. +type PnatAttachmentPoint uint32 + +const ( + PNAT_IP4_INPUT PnatAttachmentPoint = 0 + PNAT_IP4_OUTPUT PnatAttachmentPoint = 1 + PNAT_ATTACHMENT_POINT_MAX PnatAttachmentPoint = 2 +) + +var ( + PnatAttachmentPoint_name = map[uint32]string{ + 0: "PNAT_IP4_INPUT", + 1: "PNAT_IP4_OUTPUT", + 2: "PNAT_ATTACHMENT_POINT_MAX", + } + PnatAttachmentPoint_value = map[string]uint32{ + "PNAT_IP4_INPUT": 0, + "PNAT_IP4_OUTPUT": 1, + "PNAT_ATTACHMENT_POINT_MAX": 2, + } +) + +func (x PnatAttachmentPoint) String() string { + s, ok := PnatAttachmentPoint_name[uint32(x)] + if ok { + return s + } + return "PnatAttachmentPoint(" + strconv.Itoa(int(x)) + ")" +} + +// PnatMask defines enum 'pnat_mask'. +type PnatMask uint32 + +const ( + PNAT_SA PnatMask = 1 + PNAT_DA PnatMask = 2 + PNAT_SPORT PnatMask = 4 + PNAT_DPORT PnatMask = 8 + PNAT_COPY_BYTE PnatMask = 16 + PNAT_CLEAR_BYTE PnatMask = 32 +) + +var ( + PnatMask_name = map[uint32]string{ + 1: "PNAT_SA", + 2: "PNAT_DA", + 4: "PNAT_SPORT", + 8: "PNAT_DPORT", + 16: "PNAT_COPY_BYTE", + 32: "PNAT_CLEAR_BYTE", + } + PnatMask_value = map[string]uint32{ + "PNAT_SA": 1, + "PNAT_DA": 2, + "PNAT_SPORT": 4, + "PNAT_DPORT": 8, + "PNAT_COPY_BYTE": 16, + "PNAT_CLEAR_BYTE": 32, + } +) + +func (x PnatMask) String() string { + s, ok := PnatMask_name[uint32(x)] + if ok { + return s + } + return "PnatMask(" + strconv.Itoa(int(x)) + ")" +} + +// PnatMatchTuple defines type 'pnat_match_tuple'. +type PnatMatchTuple struct { + Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` + Dst ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"` + Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` + Sport uint16 `binapi:"u16,name=sport" json:"sport,omitempty"` + Dport uint16 `binapi:"u16,name=dport" json:"dport,omitempty"` + Mask PnatMask `binapi:"pnat_mask,name=mask" json:"mask,omitempty"` +} + +// PnatRewriteTuple defines type 'pnat_rewrite_tuple'. +type PnatRewriteTuple struct { + Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` + Dst ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"` + Sport uint16 `binapi:"u16,name=sport" json:"sport,omitempty"` + Dport uint16 `binapi:"u16,name=dport" json:"dport,omitempty"` + Mask PnatMask `binapi:"pnat_mask,name=mask" json:"mask,omitempty"` + FromOffset uint8 `binapi:"u8,name=from_offset" json:"from_offset,omitempty"` + ToOffset uint8 `binapi:"u8,name=to_offset" json:"to_offset,omitempty"` + ClearOffset uint8 `binapi:"u8,name=clear_offset" json:"clear_offset,omitempty"` +} + +// PnatBindingAdd defines message 'pnat_binding_add'. +// InProgress: the message form may change in the future versions +type PnatBindingAdd struct { + Match PnatMatchTuple `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"` + Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"` +} + +func (m *PnatBindingAdd) Reset() { *m = PnatBindingAdd{} } +func (*PnatBindingAdd) GetMessageName() string { return "pnat_binding_add" } +func (*PnatBindingAdd) GetCrcString() string { return "f00f79aa" } +func (*PnatBindingAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatBindingAdd) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.Match.Src + size += 1 * 4 // m.Match.Dst + size += 1 // m.Match.Proto + size += 2 // m.Match.Sport + size += 2 // m.Match.Dport + size += 4 // m.Match.Mask + size += 1 * 4 // m.Rewrite.Src + size += 1 * 4 // m.Rewrite.Dst + size += 2 // m.Rewrite.Sport + size += 2 // m.Rewrite.Dport + size += 4 // m.Rewrite.Mask + size += 1 // m.Rewrite.FromOffset + size += 1 // m.Rewrite.ToOffset + size += 1 // m.Rewrite.ClearOffset + return size +} +func (m *PnatBindingAdd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Match.Src[:], 4) + buf.EncodeBytes(m.Match.Dst[:], 4) + buf.EncodeUint8(uint8(m.Match.Proto)) + buf.EncodeUint16(m.Match.Sport) + buf.EncodeUint16(m.Match.Dport) + buf.EncodeUint32(uint32(m.Match.Mask)) + buf.EncodeBytes(m.Rewrite.Src[:], 4) + buf.EncodeBytes(m.Rewrite.Dst[:], 4) + buf.EncodeUint16(m.Rewrite.Sport) + buf.EncodeUint16(m.Rewrite.Dport) + buf.EncodeUint32(uint32(m.Rewrite.Mask)) + buf.EncodeUint8(m.Rewrite.FromOffset) + buf.EncodeUint8(m.Rewrite.ToOffset) + buf.EncodeUint8(m.Rewrite.ClearOffset) + return buf.Bytes(), nil +} +func (m *PnatBindingAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Match.Src[:], buf.DecodeBytes(4)) + copy(m.Match.Dst[:], buf.DecodeBytes(4)) + m.Match.Proto = ip_types.IPProto(buf.DecodeUint8()) + m.Match.Sport = buf.DecodeUint16() + m.Match.Dport = buf.DecodeUint16() + m.Match.Mask = PnatMask(buf.DecodeUint32()) + copy(m.Rewrite.Src[:], buf.DecodeBytes(4)) + copy(m.Rewrite.Dst[:], buf.DecodeBytes(4)) + m.Rewrite.Sport = buf.DecodeUint16() + m.Rewrite.Dport = buf.DecodeUint16() + m.Rewrite.Mask = PnatMask(buf.DecodeUint32()) + m.Rewrite.FromOffset = buf.DecodeUint8() + m.Rewrite.ToOffset = buf.DecodeUint8() + m.Rewrite.ClearOffset = buf.DecodeUint8() + return nil +} + +// PnatBindingAddReply defines message 'pnat_binding_add_reply'. +// InProgress: the message form may change in the future versions +type PnatBindingAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` +} + +func (m *PnatBindingAddReply) Reset() { *m = PnatBindingAddReply{} } +func (*PnatBindingAddReply) GetMessageName() string { return "pnat_binding_add_reply" } +func (*PnatBindingAddReply) GetCrcString() string { return "4cd980a7" } +func (*PnatBindingAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingAddReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.BindingIndex + return size +} +func (m *PnatBindingAddReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.BindingIndex) + return buf.Bytes(), nil +} +func (m *PnatBindingAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.BindingIndex = buf.DecodeUint32() + return nil +} + +// PnatBindingAttach defines message 'pnat_binding_attach'. +// InProgress: the message form may change in the future versions +type PnatBindingAttach struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Attachment PnatAttachmentPoint `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"` + BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` +} + +func (m *PnatBindingAttach) Reset() { *m = PnatBindingAttach{} } +func (*PnatBindingAttach) GetMessageName() string { return "pnat_binding_attach" } +func (*PnatBindingAttach) GetCrcString() string { return "6e074232" } +func (*PnatBindingAttach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatBindingAttach) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.Attachment + size += 4 // m.BindingIndex + return size +} +func (m *PnatBindingAttach) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attachment)) + buf.EncodeUint32(m.BindingIndex) + return buf.Bytes(), nil +} +func (m *PnatBindingAttach) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attachment = PnatAttachmentPoint(buf.DecodeUint32()) + m.BindingIndex = buf.DecodeUint32() + return nil +} + +// PnatBindingAttachReply defines message 'pnat_binding_attach_reply'. +// InProgress: the message form may change in the future versions +type PnatBindingAttachReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PnatBindingAttachReply) Reset() { *m = PnatBindingAttachReply{} } +func (*PnatBindingAttachReply) GetMessageName() string { return "pnat_binding_attach_reply" } +func (*PnatBindingAttachReply) GetCrcString() string { return "e8d4e804" } +func (*PnatBindingAttachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingAttachReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PnatBindingAttachReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PnatBindingAttachReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// PnatBindingDel defines message 'pnat_binding_del'. +// InProgress: the message form may change in the future versions +type PnatBindingDel struct { + BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` +} + +func (m *PnatBindingDel) Reset() { *m = PnatBindingDel{} } +func (*PnatBindingDel) GetMessageName() string { return "pnat_binding_del" } +func (*PnatBindingDel) GetCrcString() string { return "9259df7b" } +func (*PnatBindingDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatBindingDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.BindingIndex + return size +} +func (m *PnatBindingDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.BindingIndex) + return buf.Bytes(), nil +} +func (m *PnatBindingDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BindingIndex = buf.DecodeUint32() + return nil +} + +// PnatBindingDelReply defines message 'pnat_binding_del_reply'. +// InProgress: the message form may change in the future versions +type PnatBindingDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PnatBindingDelReply) Reset() { *m = PnatBindingDelReply{} } +func (*PnatBindingDelReply) GetMessageName() string { return "pnat_binding_del_reply" } +func (*PnatBindingDelReply) GetCrcString() string { return "e8d4e804" } +func (*PnatBindingDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PnatBindingDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PnatBindingDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// PnatBindingDetach defines message 'pnat_binding_detach'. +// InProgress: the message form may change in the future versions +type PnatBindingDetach struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Attachment PnatAttachmentPoint `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"` + BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` +} + +func (m *PnatBindingDetach) Reset() { *m = PnatBindingDetach{} } +func (*PnatBindingDetach) GetMessageName() string { return "pnat_binding_detach" } +func (*PnatBindingDetach) GetCrcString() string { return "6e074232" } +func (*PnatBindingDetach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatBindingDetach) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.Attachment + size += 4 // m.BindingIndex + return size +} +func (m *PnatBindingDetach) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attachment)) + buf.EncodeUint32(m.BindingIndex) + return buf.Bytes(), nil +} +func (m *PnatBindingDetach) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attachment = PnatAttachmentPoint(buf.DecodeUint32()) + m.BindingIndex = buf.DecodeUint32() + return nil +} + +// PnatBindingDetachReply defines message 'pnat_binding_detach_reply'. +// InProgress: the message form may change in the future versions +type PnatBindingDetachReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PnatBindingDetachReply) Reset() { *m = PnatBindingDetachReply{} } +func (*PnatBindingDetachReply) GetMessageName() string { return "pnat_binding_detach_reply" } +func (*PnatBindingDetachReply) GetCrcString() string { return "e8d4e804" } +func (*PnatBindingDetachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingDetachReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PnatBindingDetachReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PnatBindingDetachReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// PnatBindingsDetails defines message 'pnat_bindings_details'. +// InProgress: the message form may change in the future versions +type PnatBindingsDetails struct { + Match PnatMatchTuple `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"` + Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"` +} + +func (m *PnatBindingsDetails) Reset() { *m = PnatBindingsDetails{} } +func (*PnatBindingsDetails) GetMessageName() string { return "pnat_bindings_details" } +func (*PnatBindingsDetails) GetCrcString() string { return "78267a35" } +func (*PnatBindingsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingsDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 4 // m.Match.Src + size += 1 * 4 // m.Match.Dst + size += 1 // m.Match.Proto + size += 2 // m.Match.Sport + size += 2 // m.Match.Dport + size += 4 // m.Match.Mask + size += 1 * 4 // m.Rewrite.Src + size += 1 * 4 // m.Rewrite.Dst + size += 2 // m.Rewrite.Sport + size += 2 // m.Rewrite.Dport + size += 4 // m.Rewrite.Mask + size += 1 // m.Rewrite.FromOffset + size += 1 // m.Rewrite.ToOffset + size += 1 // m.Rewrite.ClearOffset + return size +} +func (m *PnatBindingsDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Match.Src[:], 4) + buf.EncodeBytes(m.Match.Dst[:], 4) + buf.EncodeUint8(uint8(m.Match.Proto)) + buf.EncodeUint16(m.Match.Sport) + buf.EncodeUint16(m.Match.Dport) + buf.EncodeUint32(uint32(m.Match.Mask)) + buf.EncodeBytes(m.Rewrite.Src[:], 4) + buf.EncodeBytes(m.Rewrite.Dst[:], 4) + buf.EncodeUint16(m.Rewrite.Sport) + buf.EncodeUint16(m.Rewrite.Dport) + buf.EncodeUint32(uint32(m.Rewrite.Mask)) + buf.EncodeUint8(m.Rewrite.FromOffset) + buf.EncodeUint8(m.Rewrite.ToOffset) + buf.EncodeUint8(m.Rewrite.ClearOffset) + return buf.Bytes(), nil +} +func (m *PnatBindingsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Match.Src[:], buf.DecodeBytes(4)) + copy(m.Match.Dst[:], buf.DecodeBytes(4)) + m.Match.Proto = ip_types.IPProto(buf.DecodeUint8()) + m.Match.Sport = buf.DecodeUint16() + m.Match.Dport = buf.DecodeUint16() + m.Match.Mask = PnatMask(buf.DecodeUint32()) + copy(m.Rewrite.Src[:], buf.DecodeBytes(4)) + copy(m.Rewrite.Dst[:], buf.DecodeBytes(4)) + m.Rewrite.Sport = buf.DecodeUint16() + m.Rewrite.Dport = buf.DecodeUint16() + m.Rewrite.Mask = PnatMask(buf.DecodeUint32()) + m.Rewrite.FromOffset = buf.DecodeUint8() + m.Rewrite.ToOffset = buf.DecodeUint8() + m.Rewrite.ClearOffset = buf.DecodeUint8() + return nil +} + +// PnatBindingsGet defines message 'pnat_bindings_get'. +// InProgress: the message form may change in the future versions +type PnatBindingsGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *PnatBindingsGet) Reset() { *m = PnatBindingsGet{} } +func (*PnatBindingsGet) GetMessageName() string { return "pnat_bindings_get" } +func (*PnatBindingsGet) GetCrcString() string { return "f75ba505" } +func (*PnatBindingsGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatBindingsGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *PnatBindingsGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *PnatBindingsGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// PnatBindingsGetReply defines message 'pnat_bindings_get_reply'. +// InProgress: the message form may change in the future versions +type PnatBindingsGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *PnatBindingsGetReply) Reset() { *m = PnatBindingsGetReply{} } +func (*PnatBindingsGetReply) GetMessageName() string { return "pnat_bindings_get_reply" } +func (*PnatBindingsGetReply) GetCrcString() string { return "53b48f5d" } +func (*PnatBindingsGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatBindingsGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *PnatBindingsGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *PnatBindingsGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +// PnatInterfacesDetails defines message 'pnat_interfaces_details'. +// InProgress: the message form may change in the future versions +type PnatInterfacesDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enabled []bool `binapi:"bool[2],name=enabled" json:"enabled,omitempty"` + LookupMask [2]PnatMask `binapi:"pnat_mask[2],name=lookup_mask" json:"lookup_mask,omitempty"` +} + +func (m *PnatInterfacesDetails) Reset() { *m = PnatInterfacesDetails{} } +func (*PnatInterfacesDetails) GetMessageName() string { return "pnat_interfaces_details" } +func (*PnatInterfacesDetails) GetCrcString() string { return "c7b0c4c0" } +func (*PnatInterfacesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatInterfacesDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 * 2 // m.Enabled + for j1 := 0; j1 < 2; j1++ { + size += 4 // m.LookupMask[j1] + } + return size +} +func (m *PnatInterfacesDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + for i := 0; i < 2; i++ { + var x bool + if i < len(m.Enabled) { + x = bool(m.Enabled[i]) + } + buf.EncodeBool(x) + } + for j0 := 0; j0 < 2; j0++ { + buf.EncodeUint32(uint32(m.LookupMask[j0])) + } + return buf.Bytes(), nil +} +func (m *PnatInterfacesDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enabled = make([]bool, 2) + for i := 0; i < len(m.Enabled); i++ { + m.Enabled[i] = buf.DecodeBool() + } + for j0 := 0; j0 < 2; j0++ { + m.LookupMask[j0] = PnatMask(buf.DecodeUint32()) + } + return nil +} + +// PnatInterfacesGet defines message 'pnat_interfaces_get'. +// InProgress: the message form may change in the future versions +type PnatInterfacesGet struct { + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *PnatInterfacesGet) Reset() { *m = PnatInterfacesGet{} } +func (*PnatInterfacesGet) GetMessageName() string { return "pnat_interfaces_get" } +func (*PnatInterfacesGet) GetCrcString() string { return "f75ba505" } +func (*PnatInterfacesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PnatInterfacesGet) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Cursor + return size +} +func (m *PnatInterfacesGet) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *PnatInterfacesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cursor = buf.DecodeUint32() + return nil +} + +// PnatInterfacesGetReply defines message 'pnat_interfaces_get_reply'. +// InProgress: the message form may change in the future versions +type PnatInterfacesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` +} + +func (m *PnatInterfacesGetReply) Reset() { *m = PnatInterfacesGetReply{} } +func (*PnatInterfacesGetReply) GetMessageName() string { return "pnat_interfaces_get_reply" } +func (*PnatInterfacesGetReply) GetCrcString() string { return "53b48f5d" } +func (*PnatInterfacesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PnatInterfacesGetReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Cursor + return size +} +func (m *PnatInterfacesGetReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.Cursor) + return buf.Bytes(), nil +} +func (m *PnatInterfacesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Cursor = buf.DecodeUint32() + return nil +} + +func init() { file_pnat_binapi_init() } +func file_pnat_binapi_init() { + api.RegisterMessage((*PnatBindingAdd)(nil), "pnat_binding_add_f00f79aa") + api.RegisterMessage((*PnatBindingAddReply)(nil), "pnat_binding_add_reply_4cd980a7") + api.RegisterMessage((*PnatBindingAttach)(nil), "pnat_binding_attach_6e074232") + api.RegisterMessage((*PnatBindingAttachReply)(nil), "pnat_binding_attach_reply_e8d4e804") + api.RegisterMessage((*PnatBindingDel)(nil), "pnat_binding_del_9259df7b") + api.RegisterMessage((*PnatBindingDelReply)(nil), "pnat_binding_del_reply_e8d4e804") + api.RegisterMessage((*PnatBindingDetach)(nil), "pnat_binding_detach_6e074232") + api.RegisterMessage((*PnatBindingDetachReply)(nil), "pnat_binding_detach_reply_e8d4e804") + api.RegisterMessage((*PnatBindingsDetails)(nil), "pnat_bindings_details_78267a35") + api.RegisterMessage((*PnatBindingsGet)(nil), "pnat_bindings_get_f75ba505") + api.RegisterMessage((*PnatBindingsGetReply)(nil), "pnat_bindings_get_reply_53b48f5d") + api.RegisterMessage((*PnatInterfacesDetails)(nil), "pnat_interfaces_details_c7b0c4c0") + api.RegisterMessage((*PnatInterfacesGet)(nil), "pnat_interfaces_get_f75ba505") + api.RegisterMessage((*PnatInterfacesGetReply)(nil), "pnat_interfaces_get_reply_53b48f5d") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PnatBindingAdd)(nil), + (*PnatBindingAddReply)(nil), + (*PnatBindingAttach)(nil), + (*PnatBindingAttachReply)(nil), + (*PnatBindingDel)(nil), + (*PnatBindingDelReply)(nil), + (*PnatBindingDetach)(nil), + (*PnatBindingDetachReply)(nil), + (*PnatBindingsDetails)(nil), + (*PnatBindingsGet)(nil), + (*PnatBindingsGetReply)(nil), + (*PnatInterfacesDetails)(nil), + (*PnatInterfacesGet)(nil), + (*PnatInterfacesGetReply)(nil), + } +} diff --git a/binapi/pnat/pnat_rpc.ba.go b/binapi/pnat/pnat_rpc.ba.go new file mode 100644 index 0000000..810489e --- /dev/null +++ b/binapi/pnat/pnat_rpc.ba.go @@ -0,0 +1,145 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pnat + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service pnat. +type RPCService interface { + PnatBindingAdd(ctx context.Context, in *PnatBindingAdd) (*PnatBindingAddReply, error) + PnatBindingAttach(ctx context.Context, in *PnatBindingAttach) (*PnatBindingAttachReply, error) + PnatBindingDel(ctx context.Context, in *PnatBindingDel) (*PnatBindingDelReply, error) + PnatBindingDetach(ctx context.Context, in *PnatBindingDetach) (*PnatBindingDetachReply, error) + PnatBindingsGet(ctx context.Context, in *PnatBindingsGet) (RPCService_PnatBindingsGetClient, error) + PnatInterfacesGet(ctx context.Context, in *PnatInterfacesGet) (RPCService_PnatInterfacesGetClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PnatBindingAdd(ctx context.Context, in *PnatBindingAdd) (*PnatBindingAddReply, error) { + out := new(PnatBindingAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PnatBindingAttach(ctx context.Context, in *PnatBindingAttach) (*PnatBindingAttachReply, error) { + out := new(PnatBindingAttachReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PnatBindingDel(ctx context.Context, in *PnatBindingDel) (*PnatBindingDelReply, error) { + out := new(PnatBindingDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PnatBindingDetach(ctx context.Context, in *PnatBindingDetach) (*PnatBindingDetachReply, error) { + out := new(PnatBindingDetachReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PnatBindingsGet(ctx context.Context, in *PnatBindingsGet) (RPCService_PnatBindingsGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PnatBindingsGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PnatBindingsGetClient interface { + Recv() (*PnatBindingsDetails, error) + api.Stream +} + +type serviceClient_PnatBindingsGetClient struct { + api.Stream +} + +func (c *serviceClient_PnatBindingsGetClient) Recv() (*PnatBindingsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PnatBindingsDetails: + return m, nil + case *PnatBindingsGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) PnatInterfacesGet(ctx context.Context, in *PnatInterfacesGet) (RPCService_PnatInterfacesGetClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PnatInterfacesGetClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PnatInterfacesGetClient interface { + Recv() (*PnatInterfacesDetails, error) + api.Stream +} + +type serviceClient_PnatInterfacesGetClient struct { + api.Stream +} + +func (c *serviceClient_PnatInterfacesGetClient) Recv() (*PnatInterfacesDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PnatInterfacesDetails: + return m, nil + case *PnatInterfacesGetReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go index 1314dce..e3c0a07 100644 --- a/binapi/policer/policer.ba.go +++ b/binapi/policer/policer.ba.go @@ -1,20 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/policer.api.json // Package policer contains generated bindings for API file policer.api. // // Contents: -// 4 messages +// 8 messages // package policer import ( - api "git.fd.io/govpp.git/api" - policer_types "git.fd.io/govpp.git/binapi/policer_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + policer_types "go.fd.io/govpp/binapi/policer_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "policer" APIVersion = "2.0.0" - VersionCrc = 0xd9188811 + VersionCrc = 0xf14848c ) // PolicerAddDel defines message 'policer_add_del'. @@ -48,7 +49,7 @@ type PolicerAddDel struct { func (m *PolicerAddDel) Reset() { *m = PolicerAddDel{} } func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" } -func (*PolicerAddDel) GetCrcString() string { return "cb948f6e" } +func (*PolicerAddDel) GetCrcString() string { return "2b31dd38" } func (*PolicerAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -156,6 +157,80 @@ func (m *PolicerAddDelReply) Unmarshal(b []byte) error { return nil } +// PolicerBind defines message 'policer_bind'. +type PolicerBind struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"` + BindEnable bool `binapi:"bool,name=bind_enable" json:"bind_enable,omitempty"` +} + +func (m *PolicerBind) Reset() { *m = PolicerBind{} } +func (*PolicerBind) GetMessageName() string { return "policer_bind" } +func (*PolicerBind) GetCrcString() string { return "dcf516f9" } +func (*PolicerBind) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerBind) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.Name + size += 4 // m.WorkerIndex + size += 1 // m.BindEnable + return size +} +func (m *PolicerBind) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(m.WorkerIndex) + buf.EncodeBool(m.BindEnable) + return buf.Bytes(), nil +} +func (m *PolicerBind) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.WorkerIndex = buf.DecodeUint32() + m.BindEnable = buf.DecodeBool() + return nil +} + +// PolicerBindReply defines message 'policer_bind_reply'. +type PolicerBindReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PolicerBindReply) Reset() { *m = PolicerBindReply{} } +func (*PolicerBindReply) GetMessageName() string { return "policer_bind_reply" } +func (*PolicerBindReply) GetCrcString() string { return "e8d4e804" } +func (*PolicerBindReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerBindReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PolicerBindReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PolicerBindReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // PolicerDetails defines message 'policer_details'. type PolicerDetails struct { Name string `binapi:"string[64],name=name" json:"name,omitempty"` @@ -183,7 +258,7 @@ type PolicerDetails struct { func (m *PolicerDetails) Reset() { *m = PolicerDetails{} } func (*PolicerDetails) GetMessageName() string { return "policer_details" } -func (*PolicerDetails) GetCrcString() string { return "a43f781a" } +func (*PolicerDetails) GetCrcString() string { return "72d0e248" } func (*PolicerDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -315,12 +390,90 @@ func (m *PolicerDump) Unmarshal(b []byte) error { return nil } +// PolicerInput defines message 'policer_input'. +type PolicerInput struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Apply bool `binapi:"bool,name=apply" json:"apply,omitempty"` +} + +func (m *PolicerInput) Reset() { *m = PolicerInput{} } +func (*PolicerInput) GetMessageName() string { return "policer_input" } +func (*PolicerInput) GetCrcString() string { return "233f0ef5" } +func (*PolicerInput) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerInput) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.Name + size += 4 // m.SwIfIndex + size += 1 // m.Apply + return size +} +func (m *PolicerInput) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Apply) + return buf.Bytes(), nil +} +func (m *PolicerInput) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Apply = buf.DecodeBool() + return nil +} + +// PolicerInputReply defines message 'policer_input_reply'. +type PolicerInputReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PolicerInputReply) Reset() { *m = PolicerInputReply{} } +func (*PolicerInputReply) GetMessageName() string { return "policer_input_reply" } +func (*PolicerInputReply) GetCrcString() string { return "e8d4e804" } +func (*PolicerInputReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerInputReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PolicerInputReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PolicerInputReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_policer_binapi_init() } func file_policer_binapi_init() { - api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e") + api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_2b31dd38") api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2") - api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a") + api.RegisterMessage((*PolicerBind)(nil), "policer_bind_dcf516f9") + api.RegisterMessage((*PolicerBindReply)(nil), "policer_bind_reply_e8d4e804") + api.RegisterMessage((*PolicerDetails)(nil), "policer_details_72d0e248") api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f") + api.RegisterMessage((*PolicerInput)(nil), "policer_input_233f0ef5") + api.RegisterMessage((*PolicerInputReply)(nil), "policer_input_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -328,7 +481,11 @@ func AllMessages() []api.Message { return []api.Message{ (*PolicerAddDel)(nil), (*PolicerAddDelReply)(nil), + (*PolicerBind)(nil), + (*PolicerBindReply)(nil), (*PolicerDetails)(nil), (*PolicerDump)(nil), + (*PolicerInput)(nil), + (*PolicerInputReply)(nil), } } diff --git a/binapi/policer/policer_rest.ba.go b/binapi/policer/policer_rest.ba.go deleted file mode 100644 index e53e42d..0000000 --- a/binapi/policer/policer_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package policer - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/policer_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(PolicerAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PolicerAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/policer/policer_rpc.ba.go b/binapi/policer/policer_rpc.ba.go index 9a7d8bf..8002bc0 100644 --- a/binapi/policer/policer_rpc.ba.go +++ b/binapi/policer/policer_rpc.ba.go @@ -5,15 +5,18 @@ package policer import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service policer. +// RPCService defines RPC service policer. type RPCService interface { PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error) + PolicerBind(ctx context.Context, in *PolicerBind) (*PolicerBindReply, error) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) + PolicerInput(ctx context.Context, in *PolicerInput) (*PolicerInputReply, error) } type serviceClient struct { @@ -30,7 +33,16 @@ func (c *serviceClient) PolicerAddDel(ctx context.Context, in *PolicerAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PolicerBind(ctx context.Context, in *PolicerBind) (*PolicerBindReply, error) { + out := new(PolicerBindReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) { @@ -42,7 +54,7 @@ func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -65,9 +77,22 @@ func (c *serviceClient_PolicerDumpClient) Recv() (*PolicerDetails, error) { switch m := msg.(type) { case *PolicerDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } + +func (c *serviceClient) PolicerInput(ctx context.Context, in *PolicerInput) (*PolicerInputReply, error) { + out := new(PolicerInputReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/policer_types/policer_types.ba.go b/binapi/policer_types/policer_types.ba.go index 5056fe5..2827d4a 100644 --- a/binapi/policer_types/policer_types.ba.go +++ b/binapi/policer_types/policer_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/policer_types.api.json // Package policer_types contains generated bindings for API file policer_types.api. @@ -13,8 +13,9 @@ package policer_types import ( - api "git.fd.io/govpp.git/api" "strconv" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -23,6 +24,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "policer_types" + APIVersion = "1.0.0" + VersionCrc = 0xae54624b +) + // Sse2QosActionType defines enum 'sse2_qos_action_type'. type Sse2QosActionType uint8 diff --git a/binapi/pot/pot.ba.go b/binapi/pot/pot.ba.go index 2c2d1f4..62c35ad 100644 --- a/binapi/pot/pot.ba.go +++ b/binapi/pot/pot.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/pot.api.json // Package pot contains generated bindings for API file pot.api. @@ -12,8 +12,8 @@ package pot import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/pot/pot_rest.ba.go b/binapi/pot/pot_rest.ba.go deleted file mode 100644 index 0cf6474..0000000 --- a/binapi/pot/pot_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pot - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pot_profile_activate", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileActivate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PotProfileActivate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pot_profile_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PotProfileAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pot_profile_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PotProfileDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pot/pot_rpc.ba.go b/binapi/pot/pot_rpc.ba.go index 7426e49..a75ab0c 100644 --- a/binapi/pot/pot_rpc.ba.go +++ b/binapi/pot/pot_rpc.ba.go @@ -5,12 +5,13 @@ package pot import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service pot. +// RPCService defines RPC service pot. type RPCService interface { PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) @@ -32,7 +33,7 @@ func (c *serviceClient) PotProfileActivate(ctx context.Context, in *PotProfileAc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) { @@ -41,7 +42,7 @@ func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error) { @@ -50,7 +51,7 @@ func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error) { @@ -62,7 +63,7 @@ func (c *serviceClient) PotProfileShowConfigDump(ctx context.Context, in *PotPro if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -85,7 +86,11 @@ func (c *serviceClient_PotProfileShowConfigDumpClient) Recv() (*PotProfileShowCo switch m := msg.(type) { case *PotProfileShowConfigDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/pp2/pp2.ba.go b/binapi/pp2/pp2.ba.go new file mode 100644 index 0000000..250695f --- /dev/null +++ b/binapi/pp2/pp2.ba.go @@ -0,0 +1,192 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/pp2.api.json + +// Package pp2 contains generated bindings for API file pp2.api. +// +// Contents: +// 4 messages +// +package pp2 + +import ( + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pp2" + APIVersion = "1.0.0" + VersionCrc = 0xd7ab5bd7 +) + +// MrvlPp2Create defines message 'mrvl_pp2_create'. +type MrvlPp2Create struct { + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` + RxQSz uint16 `binapi:"u16,name=rx_q_sz" json:"rx_q_sz,omitempty"` + TxQSz uint16 `binapi:"u16,name=tx_q_sz" json:"tx_q_sz,omitempty"` +} + +func (m *MrvlPp2Create) Reset() { *m = MrvlPp2Create{} } +func (*MrvlPp2Create) GetMessageName() string { return "mrvl_pp2_create" } +func (*MrvlPp2Create) GetCrcString() string { return "3a108396" } +func (*MrvlPp2Create) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MrvlPp2Create) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.IfName + size += 2 // m.RxQSz + size += 2 // m.TxQSz + return size +} +func (m *MrvlPp2Create) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.IfName, 64) + buf.EncodeUint16(m.RxQSz) + buf.EncodeUint16(m.TxQSz) + return buf.Bytes(), nil +} +func (m *MrvlPp2Create) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IfName = buf.DecodeString(64) + m.RxQSz = buf.DecodeUint16() + m.TxQSz = buf.DecodeUint16() + return nil +} + +// MrvlPp2CreateReply defines message 'mrvl_pp2_create_reply'. +type MrvlPp2CreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MrvlPp2CreateReply) Reset() { *m = MrvlPp2CreateReply{} } +func (*MrvlPp2CreateReply) GetMessageName() string { return "mrvl_pp2_create_reply" } +func (*MrvlPp2CreateReply) GetCrcString() string { return "5383d31f" } +func (*MrvlPp2CreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MrvlPp2CreateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *MrvlPp2CreateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MrvlPp2CreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MrvlPp2Delete defines message 'mrvl_pp2_delete'. +type MrvlPp2Delete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MrvlPp2Delete) Reset() { *m = MrvlPp2Delete{} } +func (*MrvlPp2Delete) GetMessageName() string { return "mrvl_pp2_delete" } +func (*MrvlPp2Delete) GetCrcString() string { return "f9e6675e" } +func (*MrvlPp2Delete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MrvlPp2Delete) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *MrvlPp2Delete) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MrvlPp2Delete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MrvlPp2DeleteReply defines message 'mrvl_pp2_delete_reply'. +type MrvlPp2DeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MrvlPp2DeleteReply) Reset() { *m = MrvlPp2DeleteReply{} } +func (*MrvlPp2DeleteReply) GetMessageName() string { return "mrvl_pp2_delete_reply" } +func (*MrvlPp2DeleteReply) GetCrcString() string { return "e8d4e804" } +func (*MrvlPp2DeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MrvlPp2DeleteReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *MrvlPp2DeleteReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *MrvlPp2DeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_pp2_binapi_init() } +func file_pp2_binapi_init() { + api.RegisterMessage((*MrvlPp2Create)(nil), "mrvl_pp2_create_3a108396") + api.RegisterMessage((*MrvlPp2CreateReply)(nil), "mrvl_pp2_create_reply_5383d31f") + api.RegisterMessage((*MrvlPp2Delete)(nil), "mrvl_pp2_delete_f9e6675e") + api.RegisterMessage((*MrvlPp2DeleteReply)(nil), "mrvl_pp2_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MrvlPp2Create)(nil), + (*MrvlPp2CreateReply)(nil), + (*MrvlPp2Delete)(nil), + (*MrvlPp2DeleteReply)(nil), + } +} diff --git a/binapi/pp2/pp2_rpc.ba.go b/binapi/pp2/pp2_rpc.ba.go new file mode 100644 index 0000000..467747c --- /dev/null +++ b/binapi/pp2/pp2_rpc.ba.go @@ -0,0 +1,41 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pp2 + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service pp2. +type RPCService interface { + MrvlPp2Create(ctx context.Context, in *MrvlPp2Create) (*MrvlPp2CreateReply, error) + MrvlPp2Delete(ctx context.Context, in *MrvlPp2Delete) (*MrvlPp2DeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MrvlPp2Create(ctx context.Context, in *MrvlPp2Create) (*MrvlPp2CreateReply, error) { + out := new(MrvlPp2CreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) MrvlPp2Delete(ctx context.Context, in *MrvlPp2Delete) (*MrvlPp2DeleteReply, error) { + out := new(MrvlPp2DeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go index e01d3b5..97d15ae 100644 --- a/binapi/pppoe/pppoe.ba.go +++ b/binapi/pppoe/pppoe.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/pppoe.api.json // Package pppoe contains generated bindings for API file pppoe.api. // // Contents: -// 4 messages +// 6 messages // package pppoe import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,9 +28,79 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "pppoe" APIVersion = "2.0.0" - VersionCrc = 0x24ebf557 + VersionCrc = 0xec9e86bf ) +// PppoeAddDelCp defines message 'pppoe_add_del_cp'. +type PppoeAddDelCp struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *PppoeAddDelCp) Reset() { *m = PppoeAddDelCp{} } +func (*PppoeAddDelCp) GetMessageName() string { return "pppoe_add_del_cp" } +func (*PppoeAddDelCp) GetCrcString() string { return "eacd9aaa" } +func (*PppoeAddDelCp) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeAddDelCp) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *PppoeAddDelCp) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(m.IsAdd) + return buf.Bytes(), nil +} +func (m *PppoeAddDelCp) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeUint8() + return nil +} + +// PppoeAddDelCpReply defines message 'pppoe_add_del_cp_reply'. +type PppoeAddDelCpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PppoeAddDelCpReply) Reset() { *m = PppoeAddDelCpReply{} } +func (*PppoeAddDelCpReply) GetMessageName() string { return "pppoe_add_del_cp_reply" } +func (*PppoeAddDelCpReply) GetCrcString() string { return "e8d4e804" } +func (*PppoeAddDelCpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeAddDelCpReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PppoeAddDelCpReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PppoeAddDelCpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // PppoeAddDelSession defines message 'pppoe_add_del_session'. type PppoeAddDelSession struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` @@ -42,7 +112,7 @@ type PppoeAddDelSession struct { func (m *PppoeAddDelSession) Reset() { *m = PppoeAddDelSession{} } func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" } -func (*PppoeAddDelSession) GetCrcString() string { return "46ace853" } +func (*PppoeAddDelSession) GetCrcString() string { return "f6fd759e" } func (*PppoeAddDelSession) GetMessageType() api.MessageType { return api.RequestMessage } @@ -133,7 +203,7 @@ type PppoeSessionDetails struct { func (m *PppoeSessionDetails) Reset() { *m = PppoeSessionDetails{} } func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" } -func (*PppoeSessionDetails) GetCrcString() string { return "332bc742" } +func (*PppoeSessionDetails) GetCrcString() string { return "4b8e8a4a" } func (*PppoeSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -215,15 +285,19 @@ func (m *PppoeSessionDump) Unmarshal(b []byte) error { func init() { file_pppoe_binapi_init() } func file_pppoe_binapi_init() { - api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_46ace853") + api.RegisterMessage((*PppoeAddDelCp)(nil), "pppoe_add_del_cp_eacd9aaa") + api.RegisterMessage((*PppoeAddDelCpReply)(nil), "pppoe_add_del_cp_reply_e8d4e804") + api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_f6fd759e") api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f") - api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_332bc742") + api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_4b8e8a4a") api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*PppoeAddDelCp)(nil), + (*PppoeAddDelCpReply)(nil), (*PppoeAddDelSession)(nil), (*PppoeAddDelSessionReply)(nil), (*PppoeSessionDetails)(nil), diff --git a/binapi/pppoe/pppoe_rest.ba.go b/binapi/pppoe/pppoe_rest.ba.go deleted file mode 100644 index 6b01227..0000000 --- a/binapi/pppoe/pppoe_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pppoe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pppoe_add_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(PppoeAddDelSession) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PppoeAddDelSession(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pppoe/pppoe_rpc.ba.go b/binapi/pppoe/pppoe_rpc.ba.go index 384d5a8..e743c58 100644 --- a/binapi/pppoe/pppoe_rpc.ba.go +++ b/binapi/pppoe/pppoe_rpc.ba.go @@ -5,13 +5,15 @@ package pppoe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service pppoe. +// RPCService defines RPC service pppoe. type RPCService interface { + PppoeAddDelCp(ctx context.Context, in *PppoeAddDelCp) (*PppoeAddDelCpReply, error) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) } @@ -24,13 +26,22 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) PppoeAddDelCp(ctx context.Context, in *PppoeAddDelCp) (*PppoeAddDelCpReply, error) { + out := new(PppoeAddDelCpReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) { out := new(PppoeAddDelSessionReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) { @@ -42,7 +53,7 @@ func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -65,7 +76,11 @@ func (c *serviceClient_PppoeSessionDumpClient) Recv() (*PppoeSessionDetails, err switch m := msg.(type) { case *PppoeSessionDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/punt/punt.ba.go b/binapi/punt/punt.ba.go index 18ff678..f32c8a7 100644 --- a/binapi/punt/punt.ba.go +++ b/binapi/punt/punt.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/punt.api.json // Package punt contains generated bindings for API file punt.api. @@ -15,10 +15,11 @@ package punt import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "punt" APIVersion = "2.2.1" - VersionCrc = 0x31354154 + VersionCrc = 0xee63b6c7 ) // PuntType defines enum 'punt_type'. @@ -95,9 +96,10 @@ type PuntReason struct { // PuntUnion defines union 'punt_union'. type PuntUnion struct { - // Exception *PuntException - // L4 *PuntL4 - // IPProto *PuntIPProto + // PuntUnion can be one of: + // - Exception *PuntException + // - L4 *PuntL4 + // - IPProto *PuntIPProto XXX_UnionData [4]byte } @@ -228,7 +230,7 @@ type PuntSocketDeregister struct { func (m *PuntSocketDeregister) Reset() { *m = PuntSocketDeregister{} } func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" } -func (*PuntSocketDeregister) GetCrcString() string { return "98a444f4" } +func (*PuntSocketDeregister) GetCrcString() string { return "98fc9102" } func (*PuntSocketDeregister) GetMessageType() api.MessageType { return api.RequestMessage } @@ -298,7 +300,7 @@ type PuntSocketDetails struct { func (m *PuntSocketDetails) Reset() { *m = PuntSocketDetails{} } func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" } -func (*PuntSocketDetails) GetCrcString() string { return "1de0ce75" } +func (*PuntSocketDetails) GetCrcString() string { return "de575080" } func (*PuntSocketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -372,7 +374,7 @@ type PuntSocketRegister struct { func (m *PuntSocketRegister) Reset() { *m = PuntSocketRegister{} } func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" } -func (*PuntSocketRegister) GetCrcString() string { return "c8cd10fa" } +func (*PuntSocketRegister) GetCrcString() string { return "95268cbf" } func (*PuntSocketRegister) GetMessageType() api.MessageType { return api.RequestMessage } @@ -452,7 +454,7 @@ type SetPunt struct { func (m *SetPunt) Reset() { *m = SetPunt{} } func (*SetPunt) GetMessageName() string { return "set_punt" } -func (*SetPunt) GetCrcString() string { return "83799618" } +func (*SetPunt) GetCrcString() string { return "aa83d523" } func (*SetPunt) GetMessageType() api.MessageType { return api.RequestMessage } @@ -521,13 +523,13 @@ func init() { file_punt_binapi_init() } func file_punt_binapi_init() { api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40") api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe") - api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98a444f4") + api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98fc9102") api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804") - api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_1de0ce75") + api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_de575080") api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935") - api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_c8cd10fa") + api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_95268cbf") api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90") - api.RegisterMessage((*SetPunt)(nil), "set_punt_83799618") + api.RegisterMessage((*SetPunt)(nil), "set_punt_aa83d523") api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804") } diff --git a/binapi/punt/punt_rest.ba.go b/binapi/punt/punt_rest.ba.go deleted file mode 100644 index 5b999b9..0000000 --- a/binapi/punt/punt_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package punt - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/punt_socket_deregister", func(w http.ResponseWriter, req *http.Request) { - var request = new(PuntSocketDeregister) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PuntSocketDeregister(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/punt_socket_register", func(w http.ResponseWriter, req *http.Request) { - var request = new(PuntSocketRegister) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PuntSocketRegister(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/set_punt", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetPunt) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SetPunt(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/punt/punt_rpc.ba.go b/binapi/punt/punt_rpc.ba.go index e2150ed..e9b0cf5 100644 --- a/binapi/punt/punt_rpc.ba.go +++ b/binapi/punt/punt_rpc.ba.go @@ -5,12 +5,13 @@ package punt import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service punt. +// RPCService defines RPC service punt. type RPCService interface { PuntReasonDump(ctx context.Context, in *PuntReasonDump) (RPCService_PuntReasonDumpClient, error) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) @@ -36,7 +37,7 @@ func (c *serviceClient) PuntReasonDump(ctx context.Context, in *PuntReasonDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -59,7 +60,11 @@ func (c *serviceClient_PuntReasonDumpClient) Recv() (*PuntReasonDetails, error) switch m := msg.(type) { case *PuntReasonDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -72,7 +77,7 @@ func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocket if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PuntSocketDump(ctx context.Context, in *PuntSocketDump) (RPCService_PuntSocketDumpClient, error) { @@ -84,7 +89,7 @@ func (c *serviceClient) PuntSocketDump(ctx context.Context, in *PuntSocketDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -107,7 +112,11 @@ func (c *serviceClient_PuntSocketDumpClient) Recv() (*PuntSocketDetails, error) switch m := msg.(type) { case *PuntSocketDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -120,7 +129,7 @@ func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { @@ -129,5 +138,5 @@ func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/qos/qos.ba.go b/binapi/qos/qos.ba.go index 2f889fd..76a1208 100644 --- a/binapi/qos/qos.ba.go +++ b/binapi/qos/qos.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/qos.api.json // Package qos contains generated bindings for API file qos.api. @@ -14,11 +14,12 @@ package qos import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - _ "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + _ "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "qos" APIVersion = "1.1.1" - VersionCrc = 0x1749d12c + VersionCrc = 0x7b7b5955 ) // QosSource defines enum 'qos_source'. @@ -497,7 +498,7 @@ type QosRecordDetails struct { func (m *QosRecordDetails) Reset() { *m = QosRecordDetails{} } func (*QosRecordDetails) GetMessageName() string { return "qos_record_details" } -func (*QosRecordDetails) GetCrcString() string { return "4956ccdd" } +func (*QosRecordDetails) GetCrcString() string { return "a425d4d3" } func (*QosRecordDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -561,7 +562,7 @@ type QosRecordEnableDisable struct { func (m *QosRecordEnableDisable) Reset() { *m = QosRecordEnableDisable{} } func (*QosRecordEnableDisable) GetMessageName() string { return "qos_record_enable_disable" } -func (*QosRecordEnableDisable) GetCrcString() string { return "25b33f88" } +func (*QosRecordEnableDisable) GetCrcString() string { return "2f1a4a38" } func (*QosRecordEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -633,7 +634,7 @@ type QosStoreDetails struct { func (m *QosStoreDetails) Reset() { *m = QosStoreDetails{} } func (*QosStoreDetails) GetMessageName() string { return "qos_store_details" } -func (*QosStoreDetails) GetCrcString() string { return "038a6d48" } +func (*QosStoreDetails) GetCrcString() string { return "3ee0aad7" } func (*QosStoreDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -700,7 +701,7 @@ type QosStoreEnableDisable struct { func (m *QosStoreEnableDisable) Reset() { *m = QosStoreEnableDisable{} } func (*QosStoreEnableDisable) GetMessageName() string { return "qos_store_enable_disable" } -func (*QosStoreEnableDisable) GetCrcString() string { return "3507235e" } +func (*QosStoreEnableDisable) GetCrcString() string { return "f3abcc8b" } func (*QosStoreEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -781,13 +782,13 @@ func file_qos_binapi_init() { api.RegisterMessage((*QosMarkDump)(nil), "qos_mark_dump_f9e6675e") api.RegisterMessage((*QosMarkEnableDisable)(nil), "qos_mark_enable_disable_1a010f74") api.RegisterMessage((*QosMarkEnableDisableReply)(nil), "qos_mark_enable_disable_reply_e8d4e804") - api.RegisterMessage((*QosRecordDetails)(nil), "qos_record_details_4956ccdd") + api.RegisterMessage((*QosRecordDetails)(nil), "qos_record_details_a425d4d3") api.RegisterMessage((*QosRecordDump)(nil), "qos_record_dump_51077d14") - api.RegisterMessage((*QosRecordEnableDisable)(nil), "qos_record_enable_disable_25b33f88") + api.RegisterMessage((*QosRecordEnableDisable)(nil), "qos_record_enable_disable_2f1a4a38") api.RegisterMessage((*QosRecordEnableDisableReply)(nil), "qos_record_enable_disable_reply_e8d4e804") - api.RegisterMessage((*QosStoreDetails)(nil), "qos_store_details_038a6d48") + api.RegisterMessage((*QosStoreDetails)(nil), "qos_store_details_3ee0aad7") api.RegisterMessage((*QosStoreDump)(nil), "qos_store_dump_51077d14") - api.RegisterMessage((*QosStoreEnableDisable)(nil), "qos_store_enable_disable_3507235e") + api.RegisterMessage((*QosStoreEnableDisable)(nil), "qos_store_enable_disable_f3abcc8b") api.RegisterMessage((*QosStoreEnableDisableReply)(nil), "qos_store_enable_disable_reply_e8d4e804") } diff --git a/binapi/qos/qos_rest.ba.go b/binapi/qos/qos_rest.ba.go deleted file mode 100644 index 2e0e546..0000000 --- a/binapi/qos/qos_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package qos - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/qos_egress_map_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosEgressMapDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.QosEgressMapDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/qos_egress_map_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosEgressMapUpdate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.QosEgressMapUpdate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/qos_mark_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosMarkEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.QosMarkEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/qos_record_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosRecordEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.QosRecordEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/qos_store_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosStoreEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.QosStoreEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/qos/qos_rpc.ba.go b/binapi/qos/qos_rpc.ba.go index a31f611..c45bbd3 100644 --- a/binapi/qos/qos_rpc.ba.go +++ b/binapi/qos/qos_rpc.ba.go @@ -5,12 +5,13 @@ package qos import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service qos. +// RPCService defines RPC service qos. type RPCService interface { QosEgressMapDelete(ctx context.Context, in *QosEgressMapDelete) (*QosEgressMapDeleteReply, error) QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) @@ -37,7 +38,7 @@ func (c *serviceClient) QosEgressMapDelete(ctx context.Context, in *QosEgressMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) { @@ -49,7 +50,7 @@ func (c *serviceClient) QosEgressMapDump(ctx context.Context, in *QosEgressMapDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -72,7 +73,11 @@ func (c *serviceClient_QosEgressMapDumpClient) Recv() (*QosEgressMapDetails, err switch m := msg.(type) { case *QosEgressMapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -85,7 +90,7 @@ func (c *serviceClient) QosEgressMapUpdate(ctx context.Context, in *QosEgressMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosMarkDump(ctx context.Context, in *QosMarkDump) (RPCService_QosMarkDumpClient, error) { @@ -97,7 +102,7 @@ func (c *serviceClient) QosMarkDump(ctx context.Context, in *QosMarkDump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -120,7 +125,11 @@ func (c *serviceClient_QosMarkDumpClient) Recv() (*QosMarkDetails, error) { switch m := msg.(type) { case *QosMarkDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -133,7 +142,7 @@ func (c *serviceClient) QosMarkEnableDisable(ctx context.Context, in *QosMarkEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosRecordDump(ctx context.Context, in *QosRecordDump) (RPCService_QosRecordDumpClient, error) { @@ -145,7 +154,7 @@ func (c *serviceClient) QosRecordDump(ctx context.Context, in *QosRecordDump) (R if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -168,7 +177,11 @@ func (c *serviceClient_QosRecordDumpClient) Recv() (*QosRecordDetails, error) { switch m := msg.(type) { case *QosRecordDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -181,7 +194,7 @@ func (c *serviceClient) QosRecordEnableDisable(ctx context.Context, in *QosRecor if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosStoreDump(ctx context.Context, in *QosStoreDump) (RPCService_QosStoreDumpClient, error) { @@ -193,7 +206,7 @@ func (c *serviceClient) QosStoreDump(ctx context.Context, in *QosStoreDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -216,7 +229,11 @@ func (c *serviceClient_QosStoreDumpClient) Recv() (*QosStoreDetails, error) { switch m := msg.(type) { case *QosStoreDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -229,5 +246,5 @@ func (c *serviceClient) QosStoreEnableDisable(ctx context.Context, in *QosStoreE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/rd_cp/rd_cp.ba.go b/binapi/rd_cp/rd_cp.ba.go index 8cafa0f..d88f710 100644 --- a/binapi/rd_cp/rd_cp.ba.go +++ b/binapi/rd_cp/rd_cp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/rd_cp.api.json // Package rd_cp contains generated bindings for API file rd_cp.api. @@ -12,9 +12,9 @@ package rd_cp import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "rd_cp" APIVersion = "1.0.1" - VersionCrc = 0x2caa616 + VersionCrc = 0x871c3bee ) // IP6NdAddressAutoconfig defines message 'ip6_nd_address_autoconfig'. diff --git a/binapi/rd_cp/rd_cp_rest.ba.go b/binapi/rd_cp/rd_cp_rest.ba.go deleted file mode 100644 index 75e75a0..0000000 --- a/binapi/rd_cp/rd_cp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package rd_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip6_nd_address_autoconfig", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6NdAddressAutoconfig) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.IP6NdAddressAutoconfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/rd_cp/rd_cp_rpc.ba.go b/binapi/rd_cp/rd_cp_rpc.ba.go index af7ba12..2507f12 100644 --- a/binapi/rd_cp/rd_cp_rpc.ba.go +++ b/binapi/rd_cp/rd_cp_rpc.ba.go @@ -4,10 +4,11 @@ package rd_cp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service rd_cp. +// RPCService defines RPC service rd_cp. type RPCService interface { IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/rdma/rdma.ba.go b/binapi/rdma/rdma.ba.go index 001fefe..d1399a6 100644 --- a/binapi/rdma/rdma.ba.go +++ b/binapi/rdma/rdma.ba.go @@ -1,22 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/rdma.api.json // Package rdma contains generated bindings for API file rdma.api. // // Contents: -// 1 enum -// 4 messages +// 3 enums +// 8 messages // package rdma import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,8 +28,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "rdma" - APIVersion = "1.0.0" - VersionCrc = 0x8b33158c + APIVersion = "3.0.0" + VersionCrc = 0xdab70fa9 ) // RdmaMode defines enum 'rdma_mode'. @@ -61,7 +62,74 @@ func (x RdmaMode) String() string { return "RdmaMode(" + strconv.Itoa(int(x)) + ")" } +// RdmaRss4 defines enum 'rdma_rss4'. +type RdmaRss4 uint32 + +const ( + RDMA_API_RSS4_AUTO RdmaRss4 = 0 + RDMA_API_RSS4_IP RdmaRss4 = 1 + RDMA_API_RSS4_IP_UDP RdmaRss4 = 2 + RDMA_API_RSS4_IP_TCP RdmaRss4 = 3 +) + +var ( + RdmaRss4_name = map[uint32]string{ + 0: "RDMA_API_RSS4_AUTO", + 1: "RDMA_API_RSS4_IP", + 2: "RDMA_API_RSS4_IP_UDP", + 3: "RDMA_API_RSS4_IP_TCP", + } + RdmaRss4_value = map[string]uint32{ + "RDMA_API_RSS4_AUTO": 0, + "RDMA_API_RSS4_IP": 1, + "RDMA_API_RSS4_IP_UDP": 2, + "RDMA_API_RSS4_IP_TCP": 3, + } +) + +func (x RdmaRss4) String() string { + s, ok := RdmaRss4_name[uint32(x)] + if ok { + return s + } + return "RdmaRss4(" + strconv.Itoa(int(x)) + ")" +} + +// RdmaRss6 defines enum 'rdma_rss6'. +type RdmaRss6 uint32 + +const ( + RDMA_API_RSS6_AUTO RdmaRss6 = 0 + RDMA_API_RSS6_IP RdmaRss6 = 1 + RDMA_API_RSS6_IP_UDP RdmaRss6 = 2 + RDMA_API_RSS6_IP_TCP RdmaRss6 = 3 +) + +var ( + RdmaRss6_name = map[uint32]string{ + 0: "RDMA_API_RSS6_AUTO", + 1: "RDMA_API_RSS6_IP", + 2: "RDMA_API_RSS6_IP_UDP", + 3: "RDMA_API_RSS6_IP_TCP", + } + RdmaRss6_value = map[string]uint32{ + "RDMA_API_RSS6_AUTO": 0, + "RDMA_API_RSS6_IP": 1, + "RDMA_API_RSS6_IP_UDP": 2, + "RDMA_API_RSS6_IP_TCP": 3, + } +) + +func (x RdmaRss6) String() string { + s, ok := RdmaRss6_name[uint32(x)] + if ok { + return s + } + return "RdmaRss6(" + strconv.Itoa(int(x)) + ")" +} + // RdmaCreate defines message 'rdma_create'. +// Deprecated: 21.01 type RdmaCreate struct { HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` Name string `binapi:"string[64],name=name" json:"name,omitempty"` @@ -151,6 +219,211 @@ func (m *RdmaCreateReply) Unmarshal(b []byte) error { return nil } +// RdmaCreateV2 defines message 'rdma_create_v2'. +// Deprecated: the message will be removed in the future versions +type RdmaCreateV2 struct { + HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size,default=1024" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size,default=1024" json:"txq_size,omitempty"` + Mode RdmaMode `binapi:"rdma_mode,name=mode,default=0" json:"mode,omitempty"` + NoMultiSeg bool `binapi:"bool,name=no_multi_seg,default=0" json:"no_multi_seg,omitempty"` + MaxPktlen uint16 `binapi:"u16,name=max_pktlen,default=0" json:"max_pktlen,omitempty"` +} + +func (m *RdmaCreateV2) Reset() { *m = RdmaCreateV2{} } +func (*RdmaCreateV2) GetMessageName() string { return "rdma_create_v2" } +func (*RdmaCreateV2) GetCrcString() string { return "5826a4f3" } +func (*RdmaCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *RdmaCreateV2) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.HostIf + size += 64 // m.Name + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + size += 4 // m.Mode + size += 1 // m.NoMultiSeg + size += 2 // m.MaxPktlen + return size +} +func (m *RdmaCreateV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.HostIf, 64) + buf.EncodeString(m.Name, 64) + buf.EncodeUint16(m.RxqNum) + buf.EncodeUint16(m.RxqSize) + buf.EncodeUint16(m.TxqSize) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeBool(m.NoMultiSeg) + buf.EncodeUint16(m.MaxPktlen) + return buf.Bytes(), nil +} +func (m *RdmaCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIf = buf.DecodeString(64) + m.Name = buf.DecodeString(64) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.Mode = RdmaMode(buf.DecodeUint32()) + m.NoMultiSeg = buf.DecodeBool() + m.MaxPktlen = buf.DecodeUint16() + return nil +} + +// RdmaCreateV2Reply defines message 'rdma_create_v2_reply'. +type RdmaCreateV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *RdmaCreateV2Reply) Reset() { *m = RdmaCreateV2Reply{} } +func (*RdmaCreateV2Reply) GetMessageName() string { return "rdma_create_v2_reply" } +func (*RdmaCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*RdmaCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *RdmaCreateV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *RdmaCreateV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *RdmaCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// RdmaCreateV3 defines message 'rdma_create_v3'. +type RdmaCreateV3 struct { + HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size,default=1024" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size,default=1024" json:"txq_size,omitempty"` + Mode RdmaMode `binapi:"rdma_mode,name=mode,default=0" json:"mode,omitempty"` + NoMultiSeg bool `binapi:"bool,name=no_multi_seg,default=0" json:"no_multi_seg,omitempty"` + MaxPktlen uint16 `binapi:"u16,name=max_pktlen,default=0" json:"max_pktlen,omitempty"` + Rss4 RdmaRss4 `binapi:"rdma_rss4,name=rss4,default=0" json:"rss4,omitempty"` + Rss6 RdmaRss6 `binapi:"rdma_rss6,name=rss6,default=0" json:"rss6,omitempty"` +} + +func (m *RdmaCreateV3) Reset() { *m = RdmaCreateV3{} } +func (*RdmaCreateV3) GetMessageName() string { return "rdma_create_v3" } +func (*RdmaCreateV3) GetCrcString() string { return "c6287ea8" } +func (*RdmaCreateV3) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *RdmaCreateV3) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.HostIf + size += 64 // m.Name + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + size += 4 // m.Mode + size += 1 // m.NoMultiSeg + size += 2 // m.MaxPktlen + size += 4 // m.Rss4 + size += 4 // m.Rss6 + return size +} +func (m *RdmaCreateV3) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.HostIf, 64) + buf.EncodeString(m.Name, 64) + buf.EncodeUint16(m.RxqNum) + buf.EncodeUint16(m.RxqSize) + buf.EncodeUint16(m.TxqSize) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeBool(m.NoMultiSeg) + buf.EncodeUint16(m.MaxPktlen) + buf.EncodeUint32(uint32(m.Rss4)) + buf.EncodeUint32(uint32(m.Rss6)) + return buf.Bytes(), nil +} +func (m *RdmaCreateV3) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIf = buf.DecodeString(64) + m.Name = buf.DecodeString(64) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.Mode = RdmaMode(buf.DecodeUint32()) + m.NoMultiSeg = buf.DecodeBool() + m.MaxPktlen = buf.DecodeUint16() + m.Rss4 = RdmaRss4(buf.DecodeUint32()) + m.Rss6 = RdmaRss6(buf.DecodeUint32()) + return nil +} + +// RdmaCreateV3Reply defines message 'rdma_create_v3_reply'. +type RdmaCreateV3Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *RdmaCreateV3Reply) Reset() { *m = RdmaCreateV3Reply{} } +func (*RdmaCreateV3Reply) GetMessageName() string { return "rdma_create_v3_reply" } +func (*RdmaCreateV3Reply) GetCrcString() string { return "5383d31f" } +func (*RdmaCreateV3Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *RdmaCreateV3Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *RdmaCreateV3Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *RdmaCreateV3Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // RdmaDelete defines message 'rdma_delete'. type RdmaDelete struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -221,6 +494,10 @@ func init() { file_rdma_binapi_init() } func file_rdma_binapi_init() { api.RegisterMessage((*RdmaCreate)(nil), "rdma_create_076fe418") api.RegisterMessage((*RdmaCreateReply)(nil), "rdma_create_reply_5383d31f") + api.RegisterMessage((*RdmaCreateV2)(nil), "rdma_create_v2_5826a4f3") + api.RegisterMessage((*RdmaCreateV2Reply)(nil), "rdma_create_v2_reply_5383d31f") + api.RegisterMessage((*RdmaCreateV3)(nil), "rdma_create_v3_c6287ea8") + api.RegisterMessage((*RdmaCreateV3Reply)(nil), "rdma_create_v3_reply_5383d31f") api.RegisterMessage((*RdmaDelete)(nil), "rdma_delete_f9e6675e") api.RegisterMessage((*RdmaDeleteReply)(nil), "rdma_delete_reply_e8d4e804") } @@ -230,6 +507,10 @@ func AllMessages() []api.Message { return []api.Message{ (*RdmaCreate)(nil), (*RdmaCreateReply)(nil), + (*RdmaCreateV2)(nil), + (*RdmaCreateV2Reply)(nil), + (*RdmaCreateV3)(nil), + (*RdmaCreateV3Reply)(nil), (*RdmaDelete)(nil), (*RdmaDeleteReply)(nil), } diff --git a/binapi/rdma/rdma_rest.ba.go b/binapi/rdma/rdma_rest.ba.go deleted file mode 100644 index 83346d9..0000000 --- a/binapi/rdma/rdma_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package rdma - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/rdma_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(RdmaCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.RdmaCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/rdma_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(RdmaDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.RdmaDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/rdma/rdma_rpc.ba.go b/binapi/rdma/rdma_rpc.ba.go index 850f04a..77db494 100644 --- a/binapi/rdma/rdma_rpc.ba.go +++ b/binapi/rdma/rdma_rpc.ba.go @@ -4,12 +4,15 @@ package rdma import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service rdma. +// RPCService defines RPC service rdma. type RPCService interface { RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCreateReply, error) + RdmaCreateV2(ctx context.Context, in *RdmaCreateV2) (*RdmaCreateV2Reply, error) + RdmaCreateV3(ctx context.Context, in *RdmaCreateV3) (*RdmaCreateV3Reply, error) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) } @@ -27,7 +30,25 @@ func (c *serviceClient) RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) RdmaCreateV2(ctx context.Context, in *RdmaCreateV2) (*RdmaCreateV2Reply, error) { + out := new(RdmaCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) RdmaCreateV3(ctx context.Context, in *RdmaCreateV3) (*RdmaCreateV3Reply, error) { + out := new(RdmaCreateV3Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) { @@ -36,5 +57,5 @@ func (c *serviceClient) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/session/session.ba.go b/binapi/session/session.ba.go index 6e20c49..967f8c3 100644 --- a/binapi/session/session.ba.go +++ b/binapi/session/session.ba.go @@ -1,23 +1,24 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/session.api.json // Package session contains generated bindings for API file session.api. // // Contents: // 2 enums -// 22 messages +// 28 messages // package session import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,8 +29,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "session" - APIVersion = "3.2.0" - VersionCrc = 0x9aa0ebc0 + APIVersion = "4.0.0" + VersionCrc = 0x44a59e26 ) // SessionRuleScope defines enum 'session_rule_scope'. @@ -359,6 +360,7 @@ func (m *AppDelCertKeyPairReply) Unmarshal(b []byte) error { } // AppNamespaceAddDel defines message 'app_namespace_add_del'. +// Deprecated: the message will be removed in the future versions type AppNamespaceAddDel struct { Secret uint64 `binapi:"u64,name=secret" json:"secret,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` @@ -408,6 +410,7 @@ func (m *AppNamespaceAddDel) Unmarshal(b []byte) error { } // AppNamespaceAddDelReply defines message 'app_namespace_add_del_reply'. +// Deprecated: the message will be removed in the future versions type AppNamespaceAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` @@ -444,6 +447,194 @@ func (m *AppNamespaceAddDelReply) Unmarshal(b []byte) error { return nil } +// AppNamespaceAddDelV2 defines message 'app_namespace_add_del_v2'. +type AppNamespaceAddDelV2 struct { + Secret uint64 `binapi:"u64,name=secret" json:"secret,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + IP4FibID uint32 `binapi:"u32,name=ip4_fib_id" json:"ip4_fib_id,omitempty"` + IP6FibID uint32 `binapi:"u32,name=ip6_fib_id" json:"ip6_fib_id,omitempty"` + NamespaceID string `binapi:"string[64],name=namespace_id" json:"namespace_id,omitempty"` + Netns string `binapi:"string[64],name=netns" json:"netns,omitempty"` +} + +func (m *AppNamespaceAddDelV2) Reset() { *m = AppNamespaceAddDelV2{} } +func (*AppNamespaceAddDelV2) GetMessageName() string { return "app_namespace_add_del_v2" } +func (*AppNamespaceAddDelV2) GetCrcString() string { return "ee0755cf" } +func (*AppNamespaceAddDelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppNamespaceAddDelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.Secret + size += 4 // m.SwIfIndex + size += 4 // m.IP4FibID + size += 4 // m.IP6FibID + size += 64 // m.NamespaceID + size += 64 // m.Netns + return size +} +func (m *AppNamespaceAddDelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint64(m.Secret) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.IP4FibID) + buf.EncodeUint32(m.IP6FibID) + buf.EncodeString(m.NamespaceID, 64) + buf.EncodeString(m.Netns, 64) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Secret = buf.DecodeUint64() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4FibID = buf.DecodeUint32() + m.IP6FibID = buf.DecodeUint32() + m.NamespaceID = buf.DecodeString(64) + m.Netns = buf.DecodeString(64) + return nil +} + +// AppNamespaceAddDelV2Reply defines message 'app_namespace_add_del_v2_reply'. +type AppNamespaceAddDelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` +} + +func (m *AppNamespaceAddDelV2Reply) Reset() { *m = AppNamespaceAddDelV2Reply{} } +func (*AppNamespaceAddDelV2Reply) GetMessageName() string { return "app_namespace_add_del_v2_reply" } +func (*AppNamespaceAddDelV2Reply) GetCrcString() string { return "85137120" } +func (*AppNamespaceAddDelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppNamespaceAddDelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.AppnsIndex + return size +} +func (m *AppNamespaceAddDelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.AppnsIndex) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.AppnsIndex = buf.DecodeUint32() + return nil +} + +// AppNamespaceAddDelV3 defines message 'app_namespace_add_del_v3'. +type AppNamespaceAddDelV3 struct { + Secret uint64 `binapi:"u64,name=secret" json:"secret,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + IP4FibID uint32 `binapi:"u32,name=ip4_fib_id" json:"ip4_fib_id,omitempty"` + IP6FibID uint32 `binapi:"u32,name=ip6_fib_id" json:"ip6_fib_id,omitempty"` + NamespaceID string `binapi:"string[64],name=namespace_id" json:"namespace_id,omitempty"` + Netns string `binapi:"string[64],name=netns" json:"netns,omitempty"` + SockName string `binapi:"string[],name=sock_name" json:"sock_name,omitempty"` +} + +func (m *AppNamespaceAddDelV3) Reset() { *m = AppNamespaceAddDelV3{} } +func (*AppNamespaceAddDelV3) GetMessageName() string { return "app_namespace_add_del_v3" } +func (*AppNamespaceAddDelV3) GetCrcString() string { return "8a7e40a1" } +func (*AppNamespaceAddDelV3) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppNamespaceAddDelV3) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.Secret + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.IP4FibID + size += 4 // m.IP6FibID + size += 64 // m.NamespaceID + size += 64 // m.Netns + size += 4 + len(m.SockName) // m.SockName + return size +} +func (m *AppNamespaceAddDelV3) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint64(m.Secret) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.IP4FibID) + buf.EncodeUint32(m.IP6FibID) + buf.EncodeString(m.NamespaceID, 64) + buf.EncodeString(m.Netns, 64) + buf.EncodeString(m.SockName, 0) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDelV3) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Secret = buf.DecodeUint64() + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4FibID = buf.DecodeUint32() + m.IP6FibID = buf.DecodeUint32() + m.NamespaceID = buf.DecodeString(64) + m.Netns = buf.DecodeString(64) + m.SockName = buf.DecodeString(0) + return nil +} + +// AppNamespaceAddDelV3Reply defines message 'app_namespace_add_del_v3_reply'. +type AppNamespaceAddDelV3Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` +} + +func (m *AppNamespaceAddDelV3Reply) Reset() { *m = AppNamespaceAddDelV3Reply{} } +func (*AppNamespaceAddDelV3Reply) GetMessageName() string { return "app_namespace_add_del_v3_reply" } +func (*AppNamespaceAddDelV3Reply) GetCrcString() string { return "85137120" } +func (*AppNamespaceAddDelV3Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppNamespaceAddDelV3Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.AppnsIndex + return size +} +func (m *AppNamespaceAddDelV3Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.AppnsIndex) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDelV3Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.AppnsIndex = buf.DecodeUint32() + return nil +} + // AppWorkerAddDel defines message 'app_worker_add_del'. type AppWorkerAddDel struct { AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` @@ -607,6 +798,7 @@ func (m *ApplicationDetachReply) Unmarshal(b []byte) error { } // ApplicationTLSCertAdd defines message 'application_tls_cert_add'. +// Deprecated: to be removed post 21.06 type ApplicationTLSCertAdd struct { AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` CertLen uint16 `binapi:"u16,name=cert_len" json:"-"` @@ -649,6 +841,7 @@ func (m *ApplicationTLSCertAdd) Unmarshal(b []byte) error { } // ApplicationTLSCertAddReply defines message 'application_tls_cert_add_reply'. +// Deprecated: to be removed post 21.06 type ApplicationTLSCertAddReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -682,6 +875,7 @@ func (m *ApplicationTLSCertAddReply) Unmarshal(b []byte) error { } // ApplicationTLSKeyAdd defines message 'application_tls_key_add'. +// Deprecated: to be removed post 21.06 type ApplicationTLSKeyAdd struct { AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` KeyLen uint16 `binapi:"u16,name=key_len" json:"-"` @@ -724,6 +918,7 @@ func (m *ApplicationTLSKeyAdd) Unmarshal(b []byte) error { } // ApplicationTLSKeyAddReply defines message 'application_tls_key_add_reply'. +// Deprecated: to be removed post 21.06 type ApplicationTLSKeyAddReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -838,7 +1033,7 @@ type SessionRuleAddDel struct { func (m *SessionRuleAddDel) Reset() { *m = SessionRuleAddDel{} } func (*SessionRuleAddDel) GetMessageName() string { return "session_rule_add_del" } -func (*SessionRuleAddDel) GetCrcString() string { return "e31f9443" } +func (*SessionRuleAddDel) GetCrcString() string { return "e4895422" } func (*SessionRuleAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -951,7 +1146,7 @@ type SessionRulesDetails struct { func (m *SessionRulesDetails) Reset() { *m = SessionRulesDetails{} } func (*SessionRulesDetails) GetMessageName() string { return "session_rules_details" } -func (*SessionRulesDetails) GetCrcString() string { return "304b91f0" } +func (*SessionRulesDetails) GetCrcString() string { return "28d71830" } func (*SessionRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -1040,6 +1235,74 @@ func (m *SessionRulesDump) Unmarshal(b []byte) error { return nil } +// SessionSapiEnableDisable defines message 'session_sapi_enable_disable'. +type SessionSapiEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *SessionSapiEnableDisable) Reset() { *m = SessionSapiEnableDisable{} } +func (*SessionSapiEnableDisable) GetMessageName() string { return "session_sapi_enable_disable" } +func (*SessionSapiEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*SessionSapiEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SessionSapiEnableDisable) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsEnable + return size +} +func (m *SessionSapiEnableDisable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *SessionSapiEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// SessionSapiEnableDisableReply defines message 'session_sapi_enable_disable_reply'. +type SessionSapiEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SessionSapiEnableDisableReply) Reset() { *m = SessionSapiEnableDisableReply{} } +func (*SessionSapiEnableDisableReply) GetMessageName() string { + return "session_sapi_enable_disable_reply" +} +func (*SessionSapiEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SessionSapiEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SessionSapiEnableDisableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SessionSapiEnableDisableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SessionSapiEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_session_binapi_init() } func file_session_binapi_init() { api.RegisterMessage((*AppAddCertKeyPair)(nil), "app_add_cert_key_pair_02eb8016") @@ -1050,6 +1313,10 @@ func file_session_binapi_init() { api.RegisterMessage((*AppDelCertKeyPairReply)(nil), "app_del_cert_key_pair_reply_e8d4e804") api.RegisterMessage((*AppNamespaceAddDel)(nil), "app_namespace_add_del_6306aecb") api.RegisterMessage((*AppNamespaceAddDelReply)(nil), "app_namespace_add_del_reply_85137120") + api.RegisterMessage((*AppNamespaceAddDelV2)(nil), "app_namespace_add_del_v2_ee0755cf") + api.RegisterMessage((*AppNamespaceAddDelV2Reply)(nil), "app_namespace_add_del_v2_reply_85137120") + api.RegisterMessage((*AppNamespaceAddDelV3)(nil), "app_namespace_add_del_v3_8a7e40a1") + api.RegisterMessage((*AppNamespaceAddDelV3Reply)(nil), "app_namespace_add_del_v3_reply_85137120") api.RegisterMessage((*AppWorkerAddDel)(nil), "app_worker_add_del_753253dc") api.RegisterMessage((*AppWorkerAddDelReply)(nil), "app_worker_add_del_reply_5735ffe7") api.RegisterMessage((*ApplicationDetach)(nil), "application_detach_51077d14") @@ -1060,10 +1327,12 @@ func file_session_binapi_init() { api.RegisterMessage((*ApplicationTLSKeyAddReply)(nil), "application_tls_key_add_reply_e8d4e804") api.RegisterMessage((*SessionEnableDisable)(nil), "session_enable_disable_c264d7bf") api.RegisterMessage((*SessionEnableDisableReply)(nil), "session_enable_disable_reply_e8d4e804") - api.RegisterMessage((*SessionRuleAddDel)(nil), "session_rule_add_del_e31f9443") + api.RegisterMessage((*SessionRuleAddDel)(nil), "session_rule_add_del_e4895422") api.RegisterMessage((*SessionRuleAddDelReply)(nil), "session_rule_add_del_reply_e8d4e804") - api.RegisterMessage((*SessionRulesDetails)(nil), "session_rules_details_304b91f0") + api.RegisterMessage((*SessionRulesDetails)(nil), "session_rules_details_28d71830") api.RegisterMessage((*SessionRulesDump)(nil), "session_rules_dump_51077d14") + api.RegisterMessage((*SessionSapiEnableDisable)(nil), "session_sapi_enable_disable_c264d7bf") + api.RegisterMessage((*SessionSapiEnableDisableReply)(nil), "session_sapi_enable_disable_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -1077,6 +1346,10 @@ func AllMessages() []api.Message { (*AppDelCertKeyPairReply)(nil), (*AppNamespaceAddDel)(nil), (*AppNamespaceAddDelReply)(nil), + (*AppNamespaceAddDelV2)(nil), + (*AppNamespaceAddDelV2Reply)(nil), + (*AppNamespaceAddDelV3)(nil), + (*AppNamespaceAddDelV3Reply)(nil), (*AppWorkerAddDel)(nil), (*AppWorkerAddDelReply)(nil), (*ApplicationDetach)(nil), @@ -1091,5 +1364,7 @@ func AllMessages() []api.Message { (*SessionRuleAddDelReply)(nil), (*SessionRulesDetails)(nil), (*SessionRulesDump)(nil), + (*SessionSapiEnableDisable)(nil), + (*SessionSapiEnableDisableReply)(nil), } } diff --git a/binapi/session/session_rest.ba.go b/binapi/session/session_rest.ba.go deleted file mode 100644 index 1ef2085..0000000 --- a/binapi/session/session_rest.ba.go +++ /dev/null @@ -1,235 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package session - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/app_add_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppAddCertKeyPair) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AppAddCertKeyPair(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/app_attach", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppAttach) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AppAttach(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/app_del_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppDelCertKeyPair) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AppDelCertKeyPair(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/app_namespace_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppNamespaceAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AppNamespaceAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/app_worker_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppWorkerAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AppWorkerAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/application_detach", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationDetach) - reply, err := rpc.ApplicationDetach(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/application_tls_cert_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationTLSCertAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ApplicationTLSCertAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/application_tls_key_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationTLSKeyAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ApplicationTLSKeyAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/session_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SessionEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SessionEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/session_rule_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SessionRuleAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SessionRuleAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/session/session_rpc.ba.go b/binapi/session/session_rpc.ba.go index 1737ef5..6e15321 100644 --- a/binapi/session/session_rpc.ba.go +++ b/binapi/session/session_rpc.ba.go @@ -5,17 +5,20 @@ package session import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service session. +// RPCService defines RPC service session. type RPCService interface { AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) + AppNamespaceAddDelV2(ctx context.Context, in *AppNamespaceAddDelV2) (*AppNamespaceAddDelV2Reply, error) + AppNamespaceAddDelV3(ctx context.Context, in *AppNamespaceAddDelV3) (*AppNamespaceAddDelV3Reply, error) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) @@ -23,6 +26,7 @@ type RPCService interface { SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) + SessionSapiEnableDisable(ctx context.Context, in *SessionSapiEnableDisable) (*SessionSapiEnableDisableReply, error) } type serviceClient struct { @@ -39,7 +43,7 @@ func (c *serviceClient) AppAddCertKeyPair(ctx context.Context, in *AppAddCertKey if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) { @@ -48,7 +52,7 @@ func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) { @@ -57,7 +61,7 @@ func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKey if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { @@ -66,7 +70,25 @@ func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespace if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AppNamespaceAddDelV2(ctx context.Context, in *AppNamespaceAddDelV2) (*AppNamespaceAddDelV2Reply, error) { + out := new(AppNamespaceAddDelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) AppNamespaceAddDelV3(ctx context.Context, in *AppNamespaceAddDelV3) (*AppNamespaceAddDelV3Reply, error) { + out := new(AppNamespaceAddDelV3Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { @@ -75,7 +97,7 @@ func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { @@ -84,7 +106,7 @@ func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { @@ -93,7 +115,7 @@ func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *Applicati if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { @@ -102,7 +124,7 @@ func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *Applicatio if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { @@ -111,7 +133,7 @@ func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { @@ -120,7 +142,7 @@ func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) { @@ -132,7 +154,7 @@ func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDu if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -155,9 +177,22 @@ func (c *serviceClient_SessionRulesDumpClient) Recv() (*SessionRulesDetails, err switch m := msg.(type) { case *SessionRulesDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } + +func (c *serviceClient) SessionSapiEnableDisable(ctx context.Context, in *SessionSapiEnableDisable) (*SessionSapiEnableDisableReply, error) { + out := new(SessionSapiEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/span/span.ba.go b/binapi/span/span.ba.go index 2dcbc37..8d3512c 100644 --- a/binapi/span/span.ba.go +++ b/binapi/span/span.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/span.api.json // Package span contains generated bindings for API file span.api. @@ -13,10 +13,11 @@ package span import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "span" APIVersion = "2.0.0" - VersionCrc = 0x9f4dec7c + VersionCrc = 0x34ee02b ) // SpanState defines enum 'span_state'. @@ -74,7 +75,7 @@ type SwInterfaceSpanDetails struct { func (m *SwInterfaceSpanDetails) Reset() { *m = SwInterfaceSpanDetails{} } func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" } -func (*SwInterfaceSpanDetails) GetCrcString() string { return "055643fc" } +func (*SwInterfaceSpanDetails) GetCrcString() string { return "8a20e79f" } func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -154,7 +155,7 @@ func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisab func (*SwInterfaceSpanEnableDisable) GetMessageName() string { return "sw_interface_span_enable_disable" } -func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "acc8fea1" } +func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "23ddd96b" } func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -226,9 +227,9 @@ func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error { func init() { file_span_binapi_init() } func file_span_binapi_init() { - api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_055643fc") + api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_8a20e79f") api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d") - api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_acc8fea1") + api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_23ddd96b") api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804") } diff --git a/binapi/span/span_rest.ba.go b/binapi/span/span_rest.ba.go deleted file mode 100644 index 0c2d959..0000000 --- a/binapi/span/span_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package span - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_span_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSpanEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSpanEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/span/span_rpc.ba.go b/binapi/span/span_rpc.ba.go index 3f34859..1aff05c 100644 --- a/binapi/span/span_rpc.ba.go +++ b/binapi/span/span_rpc.ba.go @@ -5,12 +5,13 @@ package span import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service span. +// RPCService defines RPC service span. type RPCService interface { SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) @@ -33,7 +34,7 @@ func (c *serviceClient) SwInterfaceSpanDump(ctx context.Context, in *SwInterface if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -56,7 +57,11 @@ func (c *serviceClient_SwInterfaceSpanDumpClient) Recv() (*SwInterfaceSpanDetail switch m := msg.(type) { case *SwInterfaceSpanDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -69,5 +74,5 @@ func (c *serviceClient) SwInterfaceSpanEnableDisable(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/sr/sr.ba.go b/binapi/sr/sr.ba.go index 2b98b8a..44d5f8f 100644 --- a/binapi/sr/sr.ba.go +++ b/binapi/sr/sr.ba.go @@ -1,23 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/sr.api.json // Package sr contains generated bindings for API file sr.api. // // Contents: -// 1 struct -// 20 messages +// 2 structs +// 22 messages // package sr import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - sr_types "git.fd.io/govpp.git/binapi/sr_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + sr_types "go.fd.io/govpp/binapi/sr_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "sr" APIVersion = "2.0.0" - VersionCrc = 0xd85c77ca + VersionCrc = 0xb17a64be ) // Srv6SidList defines type 'srv6_sid_list'. @@ -39,6 +39,14 @@ type Srv6SidList struct { Sids [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty"` } +// Srv6SidListWithSlIndex defines type 'srv6_sid_list_with_sl_index'. +type Srv6SidListWithSlIndex struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Sids [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty"` +} + // SrLocalsidAddDel defines message 'sr_localsid_add_del'. type SrLocalsidAddDel struct { IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` @@ -53,7 +61,7 @@ type SrLocalsidAddDel struct { func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } -func (*SrLocalsidAddDel) GetCrcString() string { return "26fa3309" } +func (*SrLocalsidAddDel) GetCrcString() string { return "5a36c324" } func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -149,7 +157,7 @@ type SrLocalsidsDetails struct { func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } -func (*SrLocalsidsDetails) GetCrcString() string { return "6a6c0265" } +func (*SrLocalsidsDetails) GetCrcString() string { return "2e9221b9" } func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -235,7 +243,7 @@ type SrPoliciesDetails struct { func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } -func (*SrPoliciesDetails) GetCrcString() string { return "07ec2d93" } +func (*SrPoliciesDetails) GetCrcString() string { return "db6ff2a1" } func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -331,6 +339,121 @@ func (m *SrPoliciesDump) Unmarshal(b []byte) error { return nil } +// SrPoliciesWithSlIndexDetails defines message 'sr_policies_with_sl_index_details'. +// InProgress: the message form may change in the future versions +type SrPoliciesWithSlIndexDetails struct { + Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"-"` + SidLists []Srv6SidListWithSlIndex `binapi:"srv6_sid_list_with_sl_index[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesWithSlIndexDetails) Reset() { *m = SrPoliciesWithSlIndexDetails{} } +func (*SrPoliciesWithSlIndexDetails) GetMessageName() string { + return "sr_policies_with_sl_index_details" +} +func (*SrPoliciesWithSlIndexDetails) GetCrcString() string { return "ca2e9bc8" } +func (*SrPoliciesWithSlIndexDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrPoliciesWithSlIndexDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 16 // m.Bsid + size += 1 // m.IsSpray + size += 1 // m.IsEncap + size += 4 // m.FibTable + size += 1 // m.NumSidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidListWithSlIndex + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + size += 1 // s1.NumSids + size += 4 // s1.Weight + size += 4 // s1.SlIndex + for j2 := 0; j2 < 16; j2++ { + size += 1 * 16 // s1.Sids[j2] + } + } + return size +} +func (m *SrPoliciesWithSlIndexDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Bsid[:], 16) + buf.EncodeBool(m.IsSpray) + buf.EncodeBool(m.IsEncap) + buf.EncodeUint32(m.FibTable) + buf.EncodeUint8(uint8(len(m.SidLists))) + for j0 := 0; j0 < len(m.SidLists); j0++ { + var v0 Srv6SidListWithSlIndex // SidLists + if j0 < len(m.SidLists) { + v0 = m.SidLists[j0] + } + buf.EncodeUint8(v0.NumSids) + buf.EncodeUint32(v0.Weight) + buf.EncodeUint32(v0.SlIndex) + for j1 := 0; j1 < 16; j1++ { + buf.EncodeBytes(v0.Sids[j1][:], 16) + } + } + return buf.Bytes(), nil +} +func (m *SrPoliciesWithSlIndexDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Bsid[:], buf.DecodeBytes(16)) + m.IsSpray = buf.DecodeBool() + m.IsEncap = buf.DecodeBool() + m.FibTable = buf.DecodeUint32() + m.NumSidLists = buf.DecodeUint8() + m.SidLists = make([]Srv6SidListWithSlIndex, m.NumSidLists) + for j0 := 0; j0 < len(m.SidLists); j0++ { + m.SidLists[j0].NumSids = buf.DecodeUint8() + m.SidLists[j0].Weight = buf.DecodeUint32() + m.SidLists[j0].SlIndex = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + copy(m.SidLists[j0].Sids[j1][:], buf.DecodeBytes(16)) + } + } + return nil +} + +// SrPoliciesWithSlIndexDump defines message 'sr_policies_with_sl_index_dump'. +// InProgress: the message form may change in the future versions +type SrPoliciesWithSlIndexDump struct{} + +func (m *SrPoliciesWithSlIndexDump) Reset() { *m = SrPoliciesWithSlIndexDump{} } +func (*SrPoliciesWithSlIndexDump) GetMessageName() string { return "sr_policies_with_sl_index_dump" } +func (*SrPoliciesWithSlIndexDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesWithSlIndexDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrPoliciesWithSlIndexDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *SrPoliciesWithSlIndexDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *SrPoliciesWithSlIndexDump) Unmarshal(b []byte) error { + return nil +} + // SrPolicyAdd defines message 'sr_policy_add'. type SrPolicyAdd struct { BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` @@ -343,7 +466,7 @@ type SrPolicyAdd struct { func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } -func (*SrPolicyAdd) GetCrcString() string { return "ec79ee6a" } +func (*SrPolicyAdd) GetCrcString() string { return "44ac92e8" } func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -512,7 +635,7 @@ type SrPolicyMod struct { func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } -func (*SrPolicyMod) GetCrcString() string { return "e531a102" } +func (*SrPolicyMod) GetCrcString() string { return "b97bb56e" } func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } @@ -746,7 +869,7 @@ type SrSteeringAddDel struct { func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } -func (*SrSteeringAddDel) GetCrcString() string { return "3711dace" } +func (*SrSteeringAddDel) GetCrcString() string { return "e46b0a0f" } func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -840,7 +963,7 @@ type SrSteeringPolDetails struct { func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } -func (*SrSteeringPolDetails) GetCrcString() string { return "1c1ee786" } +func (*SrSteeringPolDetails) GetCrcString() string { return "d41258c9" } func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -913,25 +1036,27 @@ func (m *SrSteeringPolDump) Unmarshal(b []byte) error { func init() { file_sr_binapi_init() } func file_sr_binapi_init() { - api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr_localsid_add_del_26fa3309") + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr_localsid_add_del_5a36c324") api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr_localsid_add_del_reply_e8d4e804") - api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr_localsids_details_6a6c0265") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr_localsids_details_2e9221b9") api.RegisterMessage((*SrLocalsidsDump)(nil), "sr_localsids_dump_51077d14") - api.RegisterMessage((*SrPoliciesDetails)(nil), "sr_policies_details_07ec2d93") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr_policies_details_db6ff2a1") api.RegisterMessage((*SrPoliciesDump)(nil), "sr_policies_dump_51077d14") - api.RegisterMessage((*SrPolicyAdd)(nil), "sr_policy_add_ec79ee6a") + api.RegisterMessage((*SrPoliciesWithSlIndexDetails)(nil), "sr_policies_with_sl_index_details_ca2e9bc8") + api.RegisterMessage((*SrPoliciesWithSlIndexDump)(nil), "sr_policies_with_sl_index_dump_51077d14") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr_policy_add_44ac92e8") api.RegisterMessage((*SrPolicyAddReply)(nil), "sr_policy_add_reply_e8d4e804") api.RegisterMessage((*SrPolicyDel)(nil), "sr_policy_del_cb4d48d5") api.RegisterMessage((*SrPolicyDelReply)(nil), "sr_policy_del_reply_e8d4e804") - api.RegisterMessage((*SrPolicyMod)(nil), "sr_policy_mod_e531a102") + api.RegisterMessage((*SrPolicyMod)(nil), "sr_policy_mod_b97bb56e") api.RegisterMessage((*SrPolicyModReply)(nil), "sr_policy_mod_reply_e8d4e804") api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr_set_encap_hop_limit_aa75d7d0") api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr_set_encap_hop_limit_reply_e8d4e804") api.RegisterMessage((*SrSetEncapSource)(nil), "sr_set_encap_source_d3bad5e1") api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr_set_encap_source_reply_e8d4e804") - api.RegisterMessage((*SrSteeringAddDel)(nil), "sr_steering_add_del_3711dace") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr_steering_add_del_e46b0a0f") api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr_steering_add_del_reply_e8d4e804") - api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr_steering_pol_details_1c1ee786") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr_steering_pol_details_d41258c9") api.RegisterMessage((*SrSteeringPolDump)(nil), "sr_steering_pol_dump_51077d14") } @@ -944,6 +1069,8 @@ func AllMessages() []api.Message { (*SrLocalsidsDump)(nil), (*SrPoliciesDetails)(nil), (*SrPoliciesDump)(nil), + (*SrPoliciesWithSlIndexDetails)(nil), + (*SrPoliciesWithSlIndexDump)(nil), (*SrPolicyAdd)(nil), (*SrPolicyAddReply)(nil), (*SrPolicyDel)(nil), diff --git a/binapi/sr/sr_rest.ba.go b/binapi/sr/sr_rest.ba.go deleted file mode 100644 index 0d3acfc..0000000 --- a/binapi/sr/sr_rest.ba.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sr_localsid_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrLocalsidAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrLocalsidAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_policy_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrPolicyAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_policy_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrPolicyDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_policy_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyMod) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrPolicyMod(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_set_encap_hop_limit", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSetEncapHopLimit) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrSetEncapHopLimit(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_set_encap_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSetEncapSource) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrSetEncapSource(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_steering_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSteeringAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrSteeringAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/sr/sr_rpc.ba.go b/binapi/sr/sr_rpc.ba.go index 59a2909..7c71e95 100644 --- a/binapi/sr/sr_rpc.ba.go +++ b/binapi/sr/sr_rpc.ba.go @@ -5,16 +5,18 @@ package sr import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service sr. +// RPCService defines RPC service sr. type RPCService interface { SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) (RPCService_SrPoliciesDumpClient, error) + SrPoliciesWithSlIndexDump(ctx context.Context, in *SrPoliciesWithSlIndexDump) (RPCService_SrPoliciesWithSlIndexDumpClient, error) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) @@ -38,7 +40,7 @@ func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) { @@ -50,7 +52,7 @@ func (c *serviceClient) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -73,7 +75,11 @@ func (c *serviceClient_SrLocalsidsDumpClient) Recv() (*SrLocalsidsDetails, error switch m := msg.(type) { case *SrLocalsidsDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -89,7 +95,7 @@ func (c *serviceClient) SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -112,7 +118,54 @@ func (c *serviceClient_SrPoliciesDumpClient) Recv() (*SrPoliciesDetails, error) switch m := msg.(type) { case *SrPoliciesDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SrPoliciesWithSlIndexDump(ctx context.Context, in *SrPoliciesWithSlIndexDump) (RPCService_SrPoliciesWithSlIndexDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SrPoliciesWithSlIndexDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SrPoliciesWithSlIndexDumpClient interface { + Recv() (*SrPoliciesWithSlIndexDetails, error) + api.Stream +} + +type serviceClient_SrPoliciesWithSlIndexDumpClient struct { + api.Stream +} + +func (c *serviceClient_SrPoliciesWithSlIndexDumpClient) Recv() (*SrPoliciesWithSlIndexDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SrPoliciesWithSlIndexDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -125,7 +178,7 @@ func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { @@ -134,7 +187,7 @@ func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { @@ -143,7 +196,7 @@ func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { @@ -152,7 +205,7 @@ func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { @@ -161,7 +214,7 @@ func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSour if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { @@ -170,7 +223,7 @@ func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error) { @@ -182,7 +235,7 @@ func (c *serviceClient) SrSteeringPolDump(ctx context.Context, in *SrSteeringPol if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -205,7 +258,11 @@ func (c *serviceClient_SrSteeringPolDumpClient) Recv() (*SrSteeringPolDetails, e switch m := msg.(type) { case *SrSteeringPolDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/sr_mpls/sr_mpls.ba.go b/binapi/sr_mpls/sr_mpls.ba.go index e6bd9f0..1308b35 100644 --- a/binapi/sr_mpls/sr_mpls.ba.go +++ b/binapi/sr_mpls/sr_mpls.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/sr_mpls.api.json // Package sr_mpls contains generated bindings for API file sr_mpls.api. @@ -12,11 +12,11 @@ package sr_mpls import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - sr_types "git.fd.io/govpp.git/binapi/sr_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + sr_types "go.fd.io/govpp/binapi/sr_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "sr_mpls" APIVersion = "3.0.0" - VersionCrc = 0xaf471151 + VersionCrc = 0x156edb17 ) // SrMplsPolicyAdd defines message 'sr_mpls_policy_add'. @@ -133,7 +133,7 @@ func (m *SrMplsPolicyAssignEndpointColor) Reset() { *m = SrMplsPolicyAssignEndpo func (*SrMplsPolicyAssignEndpointColor) GetMessageName() string { return "sr_mpls_policy_assign_endpoint_color" } -func (*SrMplsPolicyAssignEndpointColor) GetCrcString() string { return "5e1c5c13" } +func (*SrMplsPolicyAssignEndpointColor) GetCrcString() string { return "0e7eb978" } func (*SrMplsPolicyAssignEndpointColor) GetMessageType() api.MessageType { return api.RequestMessage } @@ -379,7 +379,7 @@ type SrMplsSteeringAddDel struct { func (m *SrMplsSteeringAddDel) Reset() { *m = SrMplsSteeringAddDel{} } func (*SrMplsSteeringAddDel) GetMessageName() string { return "sr_mpls_steering_add_del" } -func (*SrMplsSteeringAddDel) GetCrcString() string { return "7d1b0a0b" } +func (*SrMplsSteeringAddDel) GetCrcString() string { return "64acff63" } func (*SrMplsSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -475,13 +475,13 @@ func init() { file_sr_mpls_binapi_init() } func file_sr_mpls_binapi_init() { api.RegisterMessage((*SrMplsPolicyAdd)(nil), "sr_mpls_policy_add_a1a70c70") api.RegisterMessage((*SrMplsPolicyAddReply)(nil), "sr_mpls_policy_add_reply_e8d4e804") - api.RegisterMessage((*SrMplsPolicyAssignEndpointColor)(nil), "sr_mpls_policy_assign_endpoint_color_5e1c5c13") + api.RegisterMessage((*SrMplsPolicyAssignEndpointColor)(nil), "sr_mpls_policy_assign_endpoint_color_0e7eb978") api.RegisterMessage((*SrMplsPolicyAssignEndpointColorReply)(nil), "sr_mpls_policy_assign_endpoint_color_reply_e8d4e804") api.RegisterMessage((*SrMplsPolicyDel)(nil), "sr_mpls_policy_del_e29d34fa") api.RegisterMessage((*SrMplsPolicyDelReply)(nil), "sr_mpls_policy_del_reply_e8d4e804") api.RegisterMessage((*SrMplsPolicyMod)(nil), "sr_mpls_policy_mod_88482c17") api.RegisterMessage((*SrMplsPolicyModReply)(nil), "sr_mpls_policy_mod_reply_e8d4e804") - api.RegisterMessage((*SrMplsSteeringAddDel)(nil), "sr_mpls_steering_add_del_7d1b0a0b") + api.RegisterMessage((*SrMplsSteeringAddDel)(nil), "sr_mpls_steering_add_del_64acff63") api.RegisterMessage((*SrMplsSteeringAddDelReply)(nil), "sr_mpls_steering_add_del_reply_e8d4e804") } diff --git a/binapi/sr_mpls/sr_mpls_rest.ba.go b/binapi/sr_mpls/sr_mpls_rest.ba.go deleted file mode 100644 index 85edbf0..0000000 --- a/binapi/sr_mpls/sr_mpls_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr_mpls - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sr_mpls_policy_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrMplsPolicyAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_mpls_policy_assign_endpoint_color", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyAssignEndpointColor) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrMplsPolicyAssignEndpointColor(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_mpls_policy_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrMplsPolicyDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_mpls_policy_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyMod) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrMplsPolicyMod(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/sr_mpls_steering_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsSteeringAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SrMplsSteeringAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/sr_mpls/sr_mpls_rpc.ba.go b/binapi/sr_mpls/sr_mpls_rpc.ba.go index 8669e70..c4e18a2 100644 --- a/binapi/sr_mpls/sr_mpls_rpc.ba.go +++ b/binapi/sr_mpls/sr_mpls_rpc.ba.go @@ -4,10 +4,11 @@ package sr_mpls import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service sr_mpls. +// RPCService defines RPC service sr_mpls. type RPCService interface { SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd) (*SrMplsPolicyAddReply, error) SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) @@ -30,7 +31,7 @@ func (c *serviceClient) SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) { @@ -39,7 +40,7 @@ func (c *serviceClient) SrMplsPolicyAssignEndpointColor(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel) (*SrMplsPolicyDelReply, error) { @@ -48,7 +49,7 @@ func (c *serviceClient) SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod) (*SrMplsPolicyModReply, error) { @@ -57,7 +58,7 @@ func (c *serviceClient) SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsSteeringAddDel(ctx context.Context, in *SrMplsSteeringAddDel) (*SrMplsSteeringAddDelReply, error) { @@ -66,5 +67,5 @@ func (c *serviceClient) SrMplsSteeringAddDel(ctx context.Context, in *SrMplsStee if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/sr_types/sr_types.ba.go b/binapi/sr_types/sr_types.ba.go index df9f0f6..52f7d76 100644 --- a/binapi/sr_types/sr_types.ba.go +++ b/binapi/sr_types/sr_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/sr_types.api.json // Package sr_types contains generated bindings for API file sr_types.api. @@ -12,8 +12,9 @@ package sr_types import ( - api "git.fd.io/govpp.git/api" "strconv" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -22,6 +23,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "sr_types" + APIVersion = "1.0.0" + VersionCrc = 0x7955bd50 +) + // SrBehavior defines enum 'sr_behavior'. type SrBehavior uint8 diff --git a/binapi/stn/stn.ba.go b/binapi/stn/stn.ba.go index b44adf5..96f778f 100644 --- a/binapi/stn/stn.ba.go +++ b/binapi/stn/stn.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/stn.api.json // Package stn contains generated bindings for API file stn.api. @@ -12,10 +12,10 @@ package stn import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "stn" APIVersion = "2.0.0" - VersionCrc = 0x5a5079cd + VersionCrc = 0x9cfaef64 ) // StnAddDelRule defines message 'stn_add_del_rule'. @@ -39,7 +39,7 @@ type StnAddDelRule struct { func (m *StnAddDelRule) Reset() { *m = StnAddDelRule{} } func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" } -func (*StnAddDelRule) GetCrcString() string { return "53f751e6" } +func (*StnAddDelRule) GetCrcString() string { return "224c6edd" } func (*StnAddDelRule) GetMessageType() api.MessageType { return api.RequestMessage } @@ -115,7 +115,7 @@ type StnRulesDetails struct { func (m *StnRulesDetails) Reset() { *m = StnRulesDetails{} } func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" } -func (*StnRulesDetails) GetCrcString() string { return "b0f6606c" } +func (*StnRulesDetails) GetCrcString() string { return "a51935a6" } func (*StnRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -176,9 +176,9 @@ func (m *StnRulesDump) Unmarshal(b []byte) error { func init() { file_stn_binapi_init() } func file_stn_binapi_init() { - api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_53f751e6") + api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_224c6edd") api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804") - api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_b0f6606c") + api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_a51935a6") api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14") } diff --git a/binapi/stn/stn_rest.ba.go b/binapi/stn/stn_rest.ba.go deleted file mode 100644 index 826aee9..0000000 --- a/binapi/stn/stn_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package stn - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/stn_add_del_rule", func(w http.ResponseWriter, req *http.Request) { - var request = new(StnAddDelRule) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.StnAddDelRule(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/stn/stn_rpc.ba.go b/binapi/stn/stn_rpc.ba.go index 932074c..ae387a1 100644 --- a/binapi/stn/stn_rpc.ba.go +++ b/binapi/stn/stn_rpc.ba.go @@ -5,12 +5,13 @@ package stn import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service stn. +// RPCService defines RPC service stn. type RPCService interface { StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) @@ -30,7 +31,7 @@ func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) { @@ -42,7 +43,7 @@ func (c *serviceClient) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -65,7 +66,11 @@ func (c *serviceClient_StnRulesDumpClient) Recv() (*StnRulesDetails, error) { switch m := msg.(type) { case *StnRulesDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/svs/svs.ba.go b/binapi/svs/svs.ba.go index 911e936..d08173a 100644 --- a/binapi/svs/svs.ba.go +++ b/binapi/svs/svs.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/svs.api.json // Package svs contains generated bindings for API file svs.api. @@ -12,10 +12,10 @@ package svs import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "svs" APIVersion = "1.0.0" - VersionCrc = 0x1644b2d6 + VersionCrc = 0x816cf275 ) // SvsDetails defines message 'svs_details'. @@ -39,7 +39,7 @@ type SvsDetails struct { func (m *SvsDetails) Reset() { *m = SvsDetails{} } func (*SvsDetails) GetMessageName() string { return "svs_details" } -func (*SvsDetails) GetCrcString() string { return "b8523d64" } +func (*SvsDetails) GetCrcString() string { return "6282cd55" } func (*SvsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -250,7 +250,7 @@ type SvsRouteAddDel struct { func (m *SvsRouteAddDel) Reset() { *m = SvsRouteAddDel{} } func (*SvsRouteAddDel) GetMessageName() string { return "svs_route_add_del" } -func (*SvsRouteAddDel) GetCrcString() string { return "d39e31fc" } +func (*SvsRouteAddDel) GetCrcString() string { return "e49bc63c" } func (*SvsRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -400,13 +400,13 @@ func (m *SvsTableAddDelReply) Unmarshal(b []byte) error { func init() { file_svs_binapi_init() } func file_svs_binapi_init() { - api.RegisterMessage((*SvsDetails)(nil), "svs_details_b8523d64") + api.RegisterMessage((*SvsDetails)(nil), "svs_details_6282cd55") api.RegisterMessage((*SvsDump)(nil), "svs_dump_51077d14") api.RegisterMessage((*SvsEnableDisable)(nil), "svs_enable_disable_634b89d2") api.RegisterMessage((*SvsEnableDisableReply)(nil), "svs_enable_disable_reply_e8d4e804") api.RegisterMessage((*SvsPluginGetVersion)(nil), "svs_plugin_get_version_51077d14") api.RegisterMessage((*SvsPluginGetVersionReply)(nil), "svs_plugin_get_version_reply_9b32cf86") - api.RegisterMessage((*SvsRouteAddDel)(nil), "svs_route_add_del_d39e31fc") + api.RegisterMessage((*SvsRouteAddDel)(nil), "svs_route_add_del_e49bc63c") api.RegisterMessage((*SvsRouteAddDelReply)(nil), "svs_route_add_del_reply_e8d4e804") api.RegisterMessage((*SvsTableAddDel)(nil), "svs_table_add_del_7d21cb2a") api.RegisterMessage((*SvsTableAddDelReply)(nil), "svs_table_add_del_reply_e8d4e804") diff --git a/binapi/svs/svs_rest.ba.go b/binapi/svs/svs_rest.ba.go deleted file mode 100644 index 4293223..0000000 --- a/binapi/svs/svs_rest.ba.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package svs - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/svs_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SvsEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/svs_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsPluginGetVersion) - reply, err := rpc.SvsPluginGetVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/svs_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsRouteAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SvsRouteAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/svs_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsTableAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SvsTableAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/svs/svs_rpc.ba.go b/binapi/svs/svs_rpc.ba.go index d934f9e..8a4d78c 100644 --- a/binapi/svs/svs_rpc.ba.go +++ b/binapi/svs/svs_rpc.ba.go @@ -5,12 +5,13 @@ package svs import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service svs. +// RPCService defines RPC service svs. type RPCService interface { SvsDump(ctx context.Context, in *SvsDump) (RPCService_SvsDumpClient, error) SvsEnableDisable(ctx context.Context, in *SvsEnableDisable) (*SvsEnableDisableReply, error) @@ -36,7 +37,7 @@ func (c *serviceClient) SvsDump(ctx context.Context, in *SvsDump) (RPCService_Sv if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -59,7 +60,11 @@ func (c *serviceClient_SvsDumpClient) Recv() (*SvsDetails, error) { switch m := msg.(type) { case *SvsDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -72,7 +77,7 @@ func (c *serviceClient) SvsEnableDisable(ctx context.Context, in *SvsEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SvsPluginGetVersion(ctx context.Context, in *SvsPluginGetVersion) (*SvsPluginGetVersionReply, error) { @@ -90,7 +95,7 @@ func (c *serviceClient) SvsRouteAddDel(ctx context.Context, in *SvsRouteAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) (*SvsTableAddDelReply, error) { @@ -99,5 +104,5 @@ func (c *serviceClient) SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/syslog/syslog.ba.go b/binapi/syslog/syslog.ba.go index c9bdab7..d447be5 100644 --- a/binapi/syslog/syslog.ba.go +++ b/binapi/syslog/syslog.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/syslog.api.json // Package syslog contains generated bindings for API file syslog.api. @@ -13,10 +13,11 @@ package syslog import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "syslog" APIVersion = "1.0.0" - VersionCrc = 0x95b7380f + VersionCrc = 0x5ad12a74 ) // SyslogSeverity defines enum 'syslog_severity'. @@ -179,7 +180,7 @@ type SyslogGetSenderReply struct { func (m *SyslogGetSenderReply) Reset() { *m = SyslogGetSenderReply{} } func (*SyslogGetSenderReply) GetMessageName() string { return "syslog_get_sender_reply" } -func (*SyslogGetSenderReply) GetCrcString() string { return "d3da60ac" } +func (*SyslogGetSenderReply) GetCrcString() string { return "424cfa4e" } func (*SyslogGetSenderReply) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -297,7 +298,7 @@ type SyslogSetSender struct { func (m *SyslogSetSender) Reset() { *m = SyslogSetSender{} } func (*SyslogSetSender) GetMessageName() string { return "syslog_set_sender" } -func (*SyslogSetSender) GetCrcString() string { return "bb641285" } +func (*SyslogSetSender) GetCrcString() string { return "b8011d0b" } func (*SyslogSetSender) GetMessageType() api.MessageType { return api.RequestMessage } @@ -373,10 +374,10 @@ func file_syslog_binapi_init() { api.RegisterMessage((*SyslogGetFilter)(nil), "syslog_get_filter_51077d14") api.RegisterMessage((*SyslogGetFilterReply)(nil), "syslog_get_filter_reply_eb1833f8") api.RegisterMessage((*SyslogGetSender)(nil), "syslog_get_sender_51077d14") - api.RegisterMessage((*SyslogGetSenderReply)(nil), "syslog_get_sender_reply_d3da60ac") + api.RegisterMessage((*SyslogGetSenderReply)(nil), "syslog_get_sender_reply_424cfa4e") api.RegisterMessage((*SyslogSetFilter)(nil), "syslog_set_filter_571348c3") api.RegisterMessage((*SyslogSetFilterReply)(nil), "syslog_set_filter_reply_e8d4e804") - api.RegisterMessage((*SyslogSetSender)(nil), "syslog_set_sender_bb641285") + api.RegisterMessage((*SyslogSetSender)(nil), "syslog_set_sender_b8011d0b") api.RegisterMessage((*SyslogSetSenderReply)(nil), "syslog_set_sender_reply_e8d4e804") } diff --git a/binapi/syslog/syslog_rest.ba.go b/binapi/syslog/syslog_rest.ba.go deleted file mode 100644 index e9098e8..0000000 --- a/binapi/syslog/syslog_rest.ba.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package syslog - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/syslog_get_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogGetFilter) - reply, err := rpc.SyslogGetFilter(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/syslog_get_sender", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogGetSender) - reply, err := rpc.SyslogGetSender(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/syslog_set_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogSetFilter) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SyslogSetFilter(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/syslog_set_sender", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogSetSender) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SyslogSetSender(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/syslog/syslog_rpc.ba.go b/binapi/syslog/syslog_rpc.ba.go index a1f4a27..c5aa113 100644 --- a/binapi/syslog/syslog_rpc.ba.go +++ b/binapi/syslog/syslog_rpc.ba.go @@ -4,10 +4,11 @@ package syslog import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service syslog. +// RPCService defines RPC service syslog. type RPCService interface { SyslogGetFilter(ctx context.Context, in *SyslogGetFilter) (*SyslogGetFilterReply, error) SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) @@ -29,7 +30,7 @@ func (c *serviceClient) SyslogGetFilter(ctx context.Context, in *SyslogGetFilter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) { @@ -38,7 +39,7 @@ func (c *serviceClient) SyslogGetSender(ctx context.Context, in *SyslogGetSender if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogSetFilter(ctx context.Context, in *SyslogSetFilter) (*SyslogSetFilterReply, error) { @@ -47,7 +48,7 @@ func (c *serviceClient) SyslogSetFilter(ctx context.Context, in *SyslogSetFilter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogSetSender(ctx context.Context, in *SyslogSetSender) (*SyslogSetSenderReply, error) { @@ -56,5 +57,5 @@ func (c *serviceClient) SyslogSetSender(ctx context.Context, in *SyslogSetSender if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tapv2/tapv2.ba.go b/binapi/tapv2/tapv2.ba.go index 3745c83..238d013 100644 --- a/binapi/tapv2/tapv2.ba.go +++ b/binapi/tapv2/tapv2.ba.go @@ -1,24 +1,25 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/tapv2.api.json // Package tapv2 contains generated bindings for API file tapv2.api. // // Contents: // 1 enum -// 6 messages +// 8 messages // package tapv2 import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "tapv2" APIVersion = "4.0.0" - VersionCrc = 0x3ed7c42d + VersionCrc = 0xc2f80dc7 ) // TapFlags defines enum 'tap_flags'. @@ -43,16 +44,20 @@ const ( TAP_API_FLAG_ATTACH TapFlags = 8 TAP_API_FLAG_TUN TapFlags = 16 TAP_API_FLAG_GRO_COALESCE TapFlags = 32 + TAP_API_FLAG_PACKED TapFlags = 64 + TAP_API_FLAG_IN_ORDER TapFlags = 128 ) var ( TapFlags_name = map[uint32]string{ - 1: "TAP_API_FLAG_GSO", - 2: "TAP_API_FLAG_CSUM_OFFLOAD", - 4: "TAP_API_FLAG_PERSIST", - 8: "TAP_API_FLAG_ATTACH", - 16: "TAP_API_FLAG_TUN", - 32: "TAP_API_FLAG_GRO_COALESCE", + 1: "TAP_API_FLAG_GSO", + 2: "TAP_API_FLAG_CSUM_OFFLOAD", + 4: "TAP_API_FLAG_PERSIST", + 8: "TAP_API_FLAG_ATTACH", + 16: "TAP_API_FLAG_TUN", + 32: "TAP_API_FLAG_GRO_COALESCE", + 64: "TAP_API_FLAG_PACKED", + 128: "TAP_API_FLAG_IN_ORDER", } TapFlags_value = map[string]uint32{ "TAP_API_FLAG_GSO": 1, @@ -61,6 +66,8 @@ var ( "TAP_API_FLAG_ATTACH": 8, "TAP_API_FLAG_TUN": 16, "TAP_API_FLAG_GRO_COALESCE": 32, + "TAP_API_FLAG_PACKED": 64, + "TAP_API_FLAG_IN_ORDER": 128, } ) @@ -110,7 +117,7 @@ type SwInterfaceTapV2Details struct { func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} } func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" } -func (*SwInterfaceTapV2Details) GetCrcString() string { return "e53c16de" } +func (*SwInterfaceTapV2Details) GetCrcString() string { return "1e2b2a47" } func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -243,7 +250,7 @@ type TapCreateV2 struct { func (m *TapCreateV2) Reset() { *m = TapCreateV2{} } func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" } -func (*TapCreateV2) GetCrcString() string { return "445835fd" } +func (*TapCreateV2) GetCrcString() string { return "2d0d6570" } func (*TapCreateV2) GetMessageType() api.MessageType { return api.RequestMessage } @@ -387,6 +394,186 @@ func (m *TapCreateV2Reply) Unmarshal(b []byte) error { return nil } +// TapCreateV3 defines message 'tap_create_v3'. +type TapCreateV3 struct { + ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` + UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + NumRxQueues uint16 `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` + NumTxQueues uint16 `binapi:"u16,name=num_tx_queues,default=1" json:"num_tx_queues,omitempty"` + TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"` + RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"` + HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` + HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` + HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` + HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` + HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` + HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` + HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` + HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` + HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` + HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` + HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` + HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` + TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` + HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` + HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` + HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` + HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` + HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` + Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` +} + +func (m *TapCreateV3) Reset() { *m = TapCreateV3{} } +func (*TapCreateV3) GetMessageName() string { return "tap_create_v3" } +func (*TapCreateV3) GetCrcString() string { return "3f3fd1df" } +func (*TapCreateV3) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TapCreateV3) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.ID + size += 1 // m.UseRandomMac + size += 1 * 6 // m.MacAddress + size += 2 // m.NumRxQueues + size += 2 // m.NumTxQueues + size += 2 // m.TxRingSz + size += 2 // m.RxRingSz + size += 1 // m.HostMtuSet + size += 4 // m.HostMtuSize + size += 1 // m.HostMacAddrSet + size += 1 * 6 // m.HostMacAddr + size += 1 // m.HostIP4PrefixSet + size += 1 * 4 // m.HostIP4Prefix.Address + size += 1 // m.HostIP4Prefix.Len + size += 1 // m.HostIP6PrefixSet + size += 1 * 16 // m.HostIP6Prefix.Address + size += 1 // m.HostIP6Prefix.Len + size += 1 // m.HostIP4GwSet + size += 1 * 4 // m.HostIP4Gw + size += 1 // m.HostIP6GwSet + size += 1 * 16 // m.HostIP6Gw + size += 4 // m.TapFlags + size += 1 // m.HostNamespaceSet + size += 64 // m.HostNamespace + size += 1 // m.HostIfNameSet + size += 64 // m.HostIfName + size += 1 // m.HostBridgeSet + size += 64 // m.HostBridge + size += 4 + len(m.Tag) // m.Tag + return size +} +func (m *TapCreateV3) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.ID) + buf.EncodeBool(m.UseRandomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint16(m.NumRxQueues) + buf.EncodeUint16(m.NumTxQueues) + buf.EncodeUint16(m.TxRingSz) + buf.EncodeUint16(m.RxRingSz) + buf.EncodeBool(m.HostMtuSet) + buf.EncodeUint32(m.HostMtuSize) + buf.EncodeBool(m.HostMacAddrSet) + buf.EncodeBytes(m.HostMacAddr[:], 6) + buf.EncodeBool(m.HostIP4PrefixSet) + buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) + buf.EncodeUint8(m.HostIP4Prefix.Len) + buf.EncodeBool(m.HostIP6PrefixSet) + buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) + buf.EncodeUint8(m.HostIP6Prefix.Len) + buf.EncodeBool(m.HostIP4GwSet) + buf.EncodeBytes(m.HostIP4Gw[:], 4) + buf.EncodeBool(m.HostIP6GwSet) + buf.EncodeBytes(m.HostIP6Gw[:], 16) + buf.EncodeUint32(uint32(m.TapFlags)) + buf.EncodeBool(m.HostNamespaceSet) + buf.EncodeString(m.HostNamespace, 64) + buf.EncodeBool(m.HostIfNameSet) + buf.EncodeString(m.HostIfName, 64) + buf.EncodeBool(m.HostBridgeSet) + buf.EncodeString(m.HostBridge, 64) + buf.EncodeString(m.Tag, 0) + return buf.Bytes(), nil +} +func (m *TapCreateV3) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + m.UseRandomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.NumRxQueues = buf.DecodeUint16() + m.NumTxQueues = buf.DecodeUint16() + m.TxRingSz = buf.DecodeUint16() + m.RxRingSz = buf.DecodeUint16() + m.HostMtuSet = buf.DecodeBool() + m.HostMtuSize = buf.DecodeUint32() + m.HostMacAddrSet = buf.DecodeBool() + copy(m.HostMacAddr[:], buf.DecodeBytes(6)) + m.HostIP4PrefixSet = buf.DecodeBool() + copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) + m.HostIP4Prefix.Len = buf.DecodeUint8() + m.HostIP6PrefixSet = buf.DecodeBool() + copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) + m.HostIP6Prefix.Len = buf.DecodeUint8() + m.HostIP4GwSet = buf.DecodeBool() + copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) + m.HostIP6GwSet = buf.DecodeBool() + copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) + m.TapFlags = TapFlags(buf.DecodeUint32()) + m.HostNamespaceSet = buf.DecodeBool() + m.HostNamespace = buf.DecodeString(64) + m.HostIfNameSet = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + m.HostBridgeSet = buf.DecodeBool() + m.HostBridge = buf.DecodeString(64) + m.Tag = buf.DecodeString(0) + return nil +} + +// TapCreateV3Reply defines message 'tap_create_v3_reply'. +type TapCreateV3Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *TapCreateV3Reply) Reset() { *m = TapCreateV3Reply{} } +func (*TapCreateV3Reply) GetMessageName() string { return "tap_create_v3_reply" } +func (*TapCreateV3Reply) GetCrcString() string { return "5383d31f" } +func (*TapCreateV3Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TapCreateV3Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *TapCreateV3Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *TapCreateV3Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // TapDeleteV2 defines message 'tap_delete_v2'. type TapDeleteV2 struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -455,10 +642,12 @@ func (m *TapDeleteV2Reply) Unmarshal(b []byte) error { func init() { file_tapv2_binapi_init() } func file_tapv2_binapi_init() { - api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de") + api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_1e2b2a47") api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e") - api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd") + api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_2d0d6570") api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f") + api.RegisterMessage((*TapCreateV3)(nil), "tap_create_v3_3f3fd1df") + api.RegisterMessage((*TapCreateV3Reply)(nil), "tap_create_v3_reply_5383d31f") api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e") api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804") } @@ -470,6 +659,8 @@ func AllMessages() []api.Message { (*SwInterfaceTapV2Dump)(nil), (*TapCreateV2)(nil), (*TapCreateV2Reply)(nil), + (*TapCreateV3)(nil), + (*TapCreateV3Reply)(nil), (*TapDeleteV2)(nil), (*TapDeleteV2Reply)(nil), } diff --git a/binapi/tapv2/tapv2_rest.ba.go b/binapi/tapv2/tapv2_rest.ba.go deleted file mode 100644 index b1d1111..0000000 --- a/binapi/tapv2/tapv2_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tapv2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tap_create_v2", func(w http.ResponseWriter, req *http.Request) { - var request = new(TapCreateV2) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TapCreateV2(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/tap_delete_v2", func(w http.ResponseWriter, req *http.Request) { - var request = new(TapDeleteV2) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TapDeleteV2(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/tapv2/tapv2_rpc.ba.go b/binapi/tapv2/tapv2_rpc.ba.go index ab530eb..a32a21b 100644 --- a/binapi/tapv2/tapv2_rpc.ba.go +++ b/binapi/tapv2/tapv2_rpc.ba.go @@ -5,15 +5,17 @@ package tapv2 import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service tapv2. +// RPCService defines RPC service tapv2. type RPCService interface { SwInterfaceTapV2Dump(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_SwInterfaceTapV2DumpClient, error) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) + TapCreateV3(ctx context.Context, in *TapCreateV3) (*TapCreateV3Reply, error) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) } @@ -34,7 +36,7 @@ func (c *serviceClient) SwInterfaceTapV2Dump(ctx context.Context, in *SwInterfac if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -57,7 +59,11 @@ func (c *serviceClient_SwInterfaceTapV2DumpClient) Recv() (*SwInterfaceTapV2Deta switch m := msg.(type) { case *SwInterfaceTapV2Details: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -70,7 +76,16 @@ func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) TapCreateV3(ctx context.Context, in *TapCreateV3) (*TapCreateV3Reply, error) { + out := new(TapCreateV3Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { @@ -79,5 +94,5 @@ func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tcp/tcp.ba.go b/binapi/tcp/tcp.ba.go index 7ae3ecc..1176381 100644 --- a/binapi/tcp/tcp.ba.go +++ b/binapi/tcp/tcp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/tcp.api.json // Package tcp contains generated bindings for API file tcp.api. @@ -12,9 +12,9 @@ package tcp import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "tcp" APIVersion = "2.0.0" - VersionCrc = 0xf586c9ba + VersionCrc = 0x93d07485 ) // TCPConfigureSrcAddresses defines message 'tcp_configure_src_addresses'. @@ -38,7 +38,7 @@ type TCPConfigureSrcAddresses struct { func (m *TCPConfigureSrcAddresses) Reset() { *m = TCPConfigureSrcAddresses{} } func (*TCPConfigureSrcAddresses) GetMessageName() string { return "tcp_configure_src_addresses" } -func (*TCPConfigureSrcAddresses) GetCrcString() string { return "4b02b946" } +func (*TCPConfigureSrcAddresses) GetCrcString() string { return "67eede0d" } func (*TCPConfigureSrcAddresses) GetMessageType() api.MessageType { return api.RequestMessage } @@ -113,7 +113,7 @@ func (m *TCPConfigureSrcAddressesReply) Unmarshal(b []byte) error { func init() { file_tcp_binapi_init() } func file_tcp_binapi_init() { - api.RegisterMessage((*TCPConfigureSrcAddresses)(nil), "tcp_configure_src_addresses_4b02b946") + api.RegisterMessage((*TCPConfigureSrcAddresses)(nil), "tcp_configure_src_addresses_67eede0d") api.RegisterMessage((*TCPConfigureSrcAddressesReply)(nil), "tcp_configure_src_addresses_reply_e8d4e804") } diff --git a/binapi/tcp/tcp_rest.ba.go b/binapi/tcp/tcp_rest.ba.go deleted file mode 100644 index 8fa0b79..0000000 --- a/binapi/tcp/tcp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tcp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tcp_configure_src_addresses", func(w http.ResponseWriter, req *http.Request) { - var request = new(TCPConfigureSrcAddresses) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TCPConfigureSrcAddresses(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/tcp/tcp_rpc.ba.go b/binapi/tcp/tcp_rpc.ba.go index 8be3619..5a28d67 100644 --- a/binapi/tcp/tcp_rpc.ba.go +++ b/binapi/tcp/tcp_rpc.ba.go @@ -4,10 +4,11 @@ package tcp import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service tcp. +// RPCService defines RPC service tcp. type RPCService interface { TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) TCPConfigureSrcAddresses(ctx context.Context, in *TCPCon if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/teib/teib.ba.go b/binapi/teib/teib.ba.go index d37f391..af6dcaf 100644 --- a/binapi/teib/teib.ba.go +++ b/binapi/teib/teib.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/teib.api.json // Package teib contains generated bindings for API file teib.api. @@ -13,10 +13,10 @@ package teib import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "teib" APIVersion = "1.0.0" - VersionCrc = 0xaac93c17 + VersionCrc = 0x14ded985 ) // TeibEntry defines type 'teib_entry'. @@ -46,7 +46,7 @@ type TeibDetails struct { func (m *TeibDetails) Reset() { *m = TeibDetails{} } func (*TeibDetails) GetMessageName() string { return "teib_details" } -func (*TeibDetails) GetCrcString() string { return "e3b6a503" } +func (*TeibDetails) GetCrcString() string { return "981ee1a1" } func (*TeibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -122,7 +122,7 @@ type TeibEntryAddDel struct { func (m *TeibEntryAddDel) Reset() { *m = TeibEntryAddDel{} } func (*TeibEntryAddDel) GetMessageName() string { return "teib_entry_add_del" } -func (*TeibEntryAddDel) GetCrcString() string { return "5aa0a538" } +func (*TeibEntryAddDel) GetCrcString() string { return "8016cfd2" } func (*TeibEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -201,9 +201,9 @@ func (m *TeibEntryAddDelReply) Unmarshal(b []byte) error { func init() { file_teib_binapi_init() } func file_teib_binapi_init() { - api.RegisterMessage((*TeibDetails)(nil), "teib_details_e3b6a503") + api.RegisterMessage((*TeibDetails)(nil), "teib_details_981ee1a1") api.RegisterMessage((*TeibDump)(nil), "teib_dump_51077d14") - api.RegisterMessage((*TeibEntryAddDel)(nil), "teib_entry_add_del_5aa0a538") + api.RegisterMessage((*TeibEntryAddDel)(nil), "teib_entry_add_del_8016cfd2") api.RegisterMessage((*TeibEntryAddDelReply)(nil), "teib_entry_add_del_reply_e8d4e804") } diff --git a/binapi/teib/teib_rest.ba.go b/binapi/teib/teib_rest.ba.go deleted file mode 100644 index fb8bc17..0000000 --- a/binapi/teib/teib_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package teib - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/teib_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(TeibEntryAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TeibEntryAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/teib/teib_rpc.ba.go b/binapi/teib/teib_rpc.ba.go index 4803c2d..b02876b 100644 --- a/binapi/teib/teib_rpc.ba.go +++ b/binapi/teib/teib_rpc.ba.go @@ -5,12 +5,13 @@ package teib import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service teib. +// RPCService defines RPC service teib. type RPCService interface { TeibDump(ctx context.Context, in *TeibDump) (RPCService_TeibDumpClient, error) TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel) (*TeibEntryAddDelReply, error) @@ -33,7 +34,7 @@ func (c *serviceClient) TeibDump(ctx context.Context, in *TeibDump) (RPCService_ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -56,7 +57,11 @@ func (c *serviceClient_TeibDumpClient) Recv() (*TeibDetails, error) { switch m := msg.(type) { case *TeibDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -69,5 +74,5 @@ func (c *serviceClient) TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tls_openssl/tls_openssl.ba.go b/binapi/tls_openssl/tls_openssl.ba.go index 938a9df..3721ec8 100644 --- a/binapi/tls_openssl/tls_openssl.ba.go +++ b/binapi/tls_openssl/tls_openssl.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/tls_openssl.api.json // Package tls_openssl contains generated bindings for API file tls_openssl.api. @@ -12,8 +12,8 @@ package tls_openssl import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/tls_openssl/tls_openssl_rest.ba.go b/binapi/tls_openssl/tls_openssl_rest.ba.go deleted file mode 100644 index bfabb43..0000000 --- a/binapi/tls_openssl/tls_openssl_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tls_openssl - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tls_openssl_set_engine", func(w http.ResponseWriter, req *http.Request) { - var request = new(TLSOpensslSetEngine) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TLSOpensslSetEngine(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/tls_openssl/tls_openssl_rpc.ba.go b/binapi/tls_openssl/tls_openssl_rpc.ba.go index 2575bf2..b785a9b 100644 --- a/binapi/tls_openssl/tls_openssl_rpc.ba.go +++ b/binapi/tls_openssl/tls_openssl_rpc.ba.go @@ -4,10 +4,11 @@ package tls_openssl import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service tls_openssl. +// RPCService defines RPC service tls_openssl. type RPCService interface { TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/trace/trace.ba.go b/binapi/trace/trace.ba.go index 9bc330b..4c64f10 100644 --- a/binapi/trace/trace.ba.go +++ b/binapi/trace/trace.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/trace.api.json // Package trace contains generated bindings for API file trace.api. @@ -12,8 +12,8 @@ package trace import ( - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file diff --git a/binapi/trace/trace_rest.ba.go b/binapi/trace/trace_rest.ba.go deleted file mode 100644 index d7d2244..0000000 --- a/binapi/trace/trace_rest.ba.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package trace - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/trace_profile_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.TraceProfileAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/trace_profile_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileDel) - reply, err := rpc.TraceProfileDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/trace_profile_show_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileShowConfig) - reply, err := rpc.TraceProfileShowConfig(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/trace/trace_rpc.ba.go b/binapi/trace/trace_rpc.ba.go index f0f2ca7..849729d 100644 --- a/binapi/trace/trace_rpc.ba.go +++ b/binapi/trace/trace_rpc.ba.go @@ -4,10 +4,11 @@ package trace import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service trace. +// RPCService defines RPC service trace. type RPCService interface { TraceProfileAdd(ctx context.Context, in *TraceProfileAdd) (*TraceProfileAddReply, error) TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) @@ -28,7 +29,7 @@ func (c *serviceClient) TraceProfileAdd(ctx context.Context, in *TraceProfileAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) { @@ -37,7 +38,7 @@ func (c *serviceClient) TraceProfileDel(ctx context.Context, in *TraceProfileDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TraceProfileShowConfig(ctx context.Context, in *TraceProfileShowConfig) (*TraceProfileShowConfigReply, error) { @@ -46,5 +47,5 @@ func (c *serviceClient) TraceProfileShowConfig(ctx context.Context, in *TracePro if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tracedump/tracedump.ba.go b/binapi/tracedump/tracedump.ba.go new file mode 100644 index 0000000..c1b95a1 --- /dev/null +++ b/binapi/tracedump/tracedump.ba.go @@ -0,0 +1,484 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/tracedump.api.json + +// Package tracedump contains generated bindings for API file tracedump.api. +// +// Contents: +// 1 enum +// 9 messages +// +package tracedump + +import ( + "strconv" + + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "tracedump" + APIVersion = "0.1.0" + VersionCrc = 0x691543d5 +) + +// TraceFilterFlag defines enum 'trace_filter_flag'. +type TraceFilterFlag uint32 + +const ( + TRACE_FF_NONE TraceFilterFlag = 0 + TRACE_FF_INCLUDE_NODE TraceFilterFlag = 1 + TRACE_FF_EXCLUDE_NODE TraceFilterFlag = 2 + TRACE_FF_INCLUDE_CLASSIFIER TraceFilterFlag = 3 + TRACE_FF_EXCLUDE_CLASSIFIER TraceFilterFlag = 4 +) + +var ( + TraceFilterFlag_name = map[uint32]string{ + 0: "TRACE_FF_NONE", + 1: "TRACE_FF_INCLUDE_NODE", + 2: "TRACE_FF_EXCLUDE_NODE", + 3: "TRACE_FF_INCLUDE_CLASSIFIER", + 4: "TRACE_FF_EXCLUDE_CLASSIFIER", + } + TraceFilterFlag_value = map[string]uint32{ + "TRACE_FF_NONE": 0, + "TRACE_FF_INCLUDE_NODE": 1, + "TRACE_FF_EXCLUDE_NODE": 2, + "TRACE_FF_INCLUDE_CLASSIFIER": 3, + "TRACE_FF_EXCLUDE_CLASSIFIER": 4, + } +) + +func (x TraceFilterFlag) String() string { + s, ok := TraceFilterFlag_name[uint32(x)] + if ok { + return s + } + return "TraceFilterFlag(" + strconv.Itoa(int(x)) + ")" +} + +// TraceCapturePackets defines message 'trace_capture_packets'. +// InProgress: the message form may change in the future versions +type TraceCapturePackets struct { + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` + MaxPackets uint32 `binapi:"u32,name=max_packets" json:"max_packets,omitempty"` + UseFilter bool `binapi:"bool,name=use_filter" json:"use_filter,omitempty"` + Verbose bool `binapi:"bool,name=verbose" json:"verbose,omitempty"` + PreCaptureClear bool `binapi:"bool,name=pre_capture_clear" json:"pre_capture_clear,omitempty"` +} + +func (m *TraceCapturePackets) Reset() { *m = TraceCapturePackets{} } +func (*TraceCapturePackets) GetMessageName() string { return "trace_capture_packets" } +func (*TraceCapturePackets) GetCrcString() string { return "9e791a9b" } +func (*TraceCapturePackets) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceCapturePackets) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.NodeIndex + size += 4 // m.MaxPackets + size += 1 // m.UseFilter + size += 1 // m.Verbose + size += 1 // m.PreCaptureClear + return size +} +func (m *TraceCapturePackets) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.NodeIndex) + buf.EncodeUint32(m.MaxPackets) + buf.EncodeBool(m.UseFilter) + buf.EncodeBool(m.Verbose) + buf.EncodeBool(m.PreCaptureClear) + return buf.Bytes(), nil +} +func (m *TraceCapturePackets) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeIndex = buf.DecodeUint32() + m.MaxPackets = buf.DecodeUint32() + m.UseFilter = buf.DecodeBool() + m.Verbose = buf.DecodeBool() + m.PreCaptureClear = buf.DecodeBool() + return nil +} + +// TraceCapturePacketsReply defines message 'trace_capture_packets_reply'. +// InProgress: the message form may change in the future versions +type TraceCapturePacketsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TraceCapturePacketsReply) Reset() { *m = TraceCapturePacketsReply{} } +func (*TraceCapturePacketsReply) GetMessageName() string { return "trace_capture_packets_reply" } +func (*TraceCapturePacketsReply) GetCrcString() string { return "e8d4e804" } +func (*TraceCapturePacketsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceCapturePacketsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *TraceCapturePacketsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *TraceCapturePacketsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// TraceClearCapture defines message 'trace_clear_capture'. +// InProgress: the message form may change in the future versions +type TraceClearCapture struct{} + +func (m *TraceClearCapture) Reset() { *m = TraceClearCapture{} } +func (*TraceClearCapture) GetMessageName() string { return "trace_clear_capture" } +func (*TraceClearCapture) GetCrcString() string { return "51077d14" } +func (*TraceClearCapture) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceClearCapture) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *TraceClearCapture) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *TraceClearCapture) Unmarshal(b []byte) error { + return nil +} + +// TraceClearCaptureReply defines message 'trace_clear_capture_reply'. +// InProgress: the message form may change in the future versions +type TraceClearCaptureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TraceClearCaptureReply) Reset() { *m = TraceClearCaptureReply{} } +func (*TraceClearCaptureReply) GetMessageName() string { return "trace_clear_capture_reply" } +func (*TraceClearCaptureReply) GetCrcString() string { return "e8d4e804" } +func (*TraceClearCaptureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceClearCaptureReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *TraceClearCaptureReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *TraceClearCaptureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// TraceDetails defines message 'trace_details'. +// InProgress: the message form may change in the future versions +type TraceDetails struct { + ThreadID uint32 `binapi:"u32,name=thread_id" json:"thread_id,omitempty"` + Position uint32 `binapi:"u32,name=position" json:"position,omitempty"` + MoreThisThread uint8 `binapi:"u8,name=more_this_thread" json:"more_this_thread,omitempty"` + MoreThreads uint8 `binapi:"u8,name=more_threads" json:"more_threads,omitempty"` + Done uint8 `binapi:"u8,name=done" json:"done,omitempty"` + PacketNumber uint32 `binapi:"u32,name=packet_number" json:"packet_number,omitempty"` + TraceData string `binapi:"string[],name=trace_data" json:"trace_data,omitempty"` +} + +func (m *TraceDetails) Reset() { *m = TraceDetails{} } +func (*TraceDetails) GetMessageName() string { return "trace_details" } +func (*TraceDetails) GetCrcString() string { return "1553e9eb" } +func (*TraceDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.ThreadID + size += 4 // m.Position + size += 1 // m.MoreThisThread + size += 1 // m.MoreThreads + size += 1 // m.Done + size += 4 // m.PacketNumber + size += 4 + len(m.TraceData) // m.TraceData + return size +} +func (m *TraceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.ThreadID) + buf.EncodeUint32(m.Position) + buf.EncodeUint8(m.MoreThisThread) + buf.EncodeUint8(m.MoreThreads) + buf.EncodeUint8(m.Done) + buf.EncodeUint32(m.PacketNumber) + buf.EncodeString(m.TraceData, 0) + return buf.Bytes(), nil +} +func (m *TraceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ThreadID = buf.DecodeUint32() + m.Position = buf.DecodeUint32() + m.MoreThisThread = buf.DecodeUint8() + m.MoreThreads = buf.DecodeUint8() + m.Done = buf.DecodeUint8() + m.PacketNumber = buf.DecodeUint32() + m.TraceData = buf.DecodeString(0) + return nil +} + +// TraceDump defines message 'trace_dump'. +// InProgress: the message form may change in the future versions +type TraceDump struct { + ClearCache uint8 `binapi:"u8,name=clear_cache" json:"clear_cache,omitempty"` + ThreadID uint32 `binapi:"u32,name=thread_id" json:"thread_id,omitempty"` + Position uint32 `binapi:"u32,name=position" json:"position,omitempty"` + MaxRecords uint32 `binapi:"u32,name=max_records" json:"max_records,omitempty"` +} + +func (m *TraceDump) Reset() { *m = TraceDump{} } +func (*TraceDump) GetMessageName() string { return "trace_dump" } +func (*TraceDump) GetCrcString() string { return "c7d6681f" } +func (*TraceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.ClearCache + size += 4 // m.ThreadID + size += 4 // m.Position + size += 4 // m.MaxRecords + return size +} +func (m *TraceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.ClearCache) + buf.EncodeUint32(m.ThreadID) + buf.EncodeUint32(m.Position) + buf.EncodeUint32(m.MaxRecords) + return buf.Bytes(), nil +} +func (m *TraceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ClearCache = buf.DecodeUint8() + m.ThreadID = buf.DecodeUint32() + m.Position = buf.DecodeUint32() + m.MaxRecords = buf.DecodeUint32() + return nil +} + +// TraceDumpReply defines message 'trace_dump_reply'. +// InProgress: the message form may change in the future versions +type TraceDumpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + LastThreadID uint32 `binapi:"u32,name=last_thread_id" json:"last_thread_id,omitempty"` + LastPosition uint32 `binapi:"u32,name=last_position" json:"last_position,omitempty"` + MoreThisThread uint8 `binapi:"u8,name=more_this_thread" json:"more_this_thread,omitempty"` + MoreThreads uint8 `binapi:"u8,name=more_threads" json:"more_threads,omitempty"` + FlushOnly uint8 `binapi:"u8,name=flush_only" json:"flush_only,omitempty"` + Done uint8 `binapi:"u8,name=done" json:"done,omitempty"` +} + +func (m *TraceDumpReply) Reset() { *m = TraceDumpReply{} } +func (*TraceDumpReply) GetMessageName() string { return "trace_dump_reply" } +func (*TraceDumpReply) GetCrcString() string { return "e0e87f9d" } +func (*TraceDumpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceDumpReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.LastThreadID + size += 4 // m.LastPosition + size += 1 // m.MoreThisThread + size += 1 // m.MoreThreads + size += 1 // m.FlushOnly + size += 1 // m.Done + return size +} +func (m *TraceDumpReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.LastThreadID) + buf.EncodeUint32(m.LastPosition) + buf.EncodeUint8(m.MoreThisThread) + buf.EncodeUint8(m.MoreThreads) + buf.EncodeUint8(m.FlushOnly) + buf.EncodeUint8(m.Done) + return buf.Bytes(), nil +} +func (m *TraceDumpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.LastThreadID = buf.DecodeUint32() + m.LastPosition = buf.DecodeUint32() + m.MoreThisThread = buf.DecodeUint8() + m.MoreThreads = buf.DecodeUint8() + m.FlushOnly = buf.DecodeUint8() + m.Done = buf.DecodeUint8() + return nil +} + +// TraceSetFilters defines message 'trace_set_filters'. +// InProgress: the message form may change in the future versions +type TraceSetFilters struct { + Flag TraceFilterFlag `binapi:"trace_filter_flag,name=flag" json:"flag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index,default=4294967295" json:"node_index,omitempty"` + ClassifierTableIndex uint32 `binapi:"u32,name=classifier_table_index,default=4294967295" json:"classifier_table_index,omitempty"` +} + +func (m *TraceSetFilters) Reset() { *m = TraceSetFilters{} } +func (*TraceSetFilters) GetMessageName() string { return "trace_set_filters" } +func (*TraceSetFilters) GetCrcString() string { return "f522b44a" } +func (*TraceSetFilters) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceSetFilters) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Flag + size += 4 // m.Count + size += 4 // m.NodeIndex + size += 4 // m.ClassifierTableIndex + return size +} +func (m *TraceSetFilters) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Flag)) + buf.EncodeUint32(m.Count) + buf.EncodeUint32(m.NodeIndex) + buf.EncodeUint32(m.ClassifierTableIndex) + return buf.Bytes(), nil +} +func (m *TraceSetFilters) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flag = TraceFilterFlag(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.NodeIndex = buf.DecodeUint32() + m.ClassifierTableIndex = buf.DecodeUint32() + return nil +} + +// TraceSetFiltersReply defines message 'trace_set_filters_reply'. +// InProgress: the message form may change in the future versions +type TraceSetFiltersReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TraceSetFiltersReply) Reset() { *m = TraceSetFiltersReply{} } +func (*TraceSetFiltersReply) GetMessageName() string { return "trace_set_filters_reply" } +func (*TraceSetFiltersReply) GetCrcString() string { return "e8d4e804" } +func (*TraceSetFiltersReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceSetFiltersReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *TraceSetFiltersReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *TraceSetFiltersReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_tracedump_binapi_init() } +func file_tracedump_binapi_init() { + api.RegisterMessage((*TraceCapturePackets)(nil), "trace_capture_packets_9e791a9b") + api.RegisterMessage((*TraceCapturePacketsReply)(nil), "trace_capture_packets_reply_e8d4e804") + api.RegisterMessage((*TraceClearCapture)(nil), "trace_clear_capture_51077d14") + api.RegisterMessage((*TraceClearCaptureReply)(nil), "trace_clear_capture_reply_e8d4e804") + api.RegisterMessage((*TraceDetails)(nil), "trace_details_1553e9eb") + api.RegisterMessage((*TraceDump)(nil), "trace_dump_c7d6681f") + api.RegisterMessage((*TraceDumpReply)(nil), "trace_dump_reply_e0e87f9d") + api.RegisterMessage((*TraceSetFilters)(nil), "trace_set_filters_f522b44a") + api.RegisterMessage((*TraceSetFiltersReply)(nil), "trace_set_filters_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*TraceCapturePackets)(nil), + (*TraceCapturePacketsReply)(nil), + (*TraceClearCapture)(nil), + (*TraceClearCaptureReply)(nil), + (*TraceDetails)(nil), + (*TraceDump)(nil), + (*TraceDumpReply)(nil), + (*TraceSetFilters)(nil), + (*TraceSetFiltersReply)(nil), + } +} diff --git a/binapi/tracedump/tracedump_rpc.ba.go b/binapi/tracedump/tracedump_rpc.ba.go new file mode 100644 index 0000000..a3f9a0e --- /dev/null +++ b/binapi/tracedump/tracedump_rpc.ba.go @@ -0,0 +1,94 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tracedump + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service tracedump. +type RPCService interface { + TraceCapturePackets(ctx context.Context, in *TraceCapturePackets) (*TraceCapturePacketsReply, error) + TraceClearCapture(ctx context.Context, in *TraceClearCapture) (*TraceClearCaptureReply, error) + TraceDump(ctx context.Context, in *TraceDump) (RPCService_TraceDumpClient, error) + TraceSetFilters(ctx context.Context, in *TraceSetFilters) (*TraceSetFiltersReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) TraceCapturePackets(ctx context.Context, in *TraceCapturePackets) (*TraceCapturePacketsReply, error) { + out := new(TraceCapturePacketsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) TraceClearCapture(ctx context.Context, in *TraceClearCapture) (*TraceClearCaptureReply, error) { + out := new(TraceClearCaptureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) TraceDump(ctx context.Context, in *TraceDump) (RPCService_TraceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_TraceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_TraceDumpClient interface { + Recv() (*TraceDetails, error) + api.Stream +} + +type serviceClient_TraceDumpClient struct { + api.Stream +} + +func (c *serviceClient_TraceDumpClient) Recv() (*TraceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *TraceDetails: + return m, nil + case *TraceDumpReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) TraceSetFilters(ctx context.Context, in *TraceSetFilters) (*TraceSetFiltersReply, error) { + out := new(TraceSetFiltersReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/tunnel_types/tunnel_types.ba.go b/binapi/tunnel_types/tunnel_types.ba.go index 30cdba8..6d9e382 100644 --- a/binapi/tunnel_types/tunnel_types.ba.go +++ b/binapi/tunnel_types/tunnel_types.ba.go @@ -1,19 +1,23 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/tunnel_types.api.json // Package tunnel_types contains generated bindings for API file tunnel_types.api. // // Contents: -// 2 enums +// 3 enums +// 1 struct // package tunnel_types import ( - api "git.fd.io/govpp.git/api" "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -22,34 +26,49 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "tunnel_types" + APIVersion = "1.0.1" + VersionCrc = 0x882f6758 +) + // TunnelEncapDecapFlags defines enum 'tunnel_encap_decap_flags'. type TunnelEncapDecapFlags uint8 const ( - TUNNEL_API_ENCAP_DECAP_FLAG_NONE TunnelEncapDecapFlags = 0 - TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF TunnelEncapDecapFlags = 1 - TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF TunnelEncapDecapFlags = 2 - TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP TunnelEncapDecapFlags = 4 - TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN TunnelEncapDecapFlags = 8 - TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN TunnelEncapDecapFlags = 16 + TUNNEL_API_ENCAP_DECAP_FLAG_NONE TunnelEncapDecapFlags = 0 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF TunnelEncapDecapFlags = 1 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF TunnelEncapDecapFlags = 2 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP TunnelEncapDecapFlags = 4 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN TunnelEncapDecapFlags = 8 + TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN TunnelEncapDecapFlags = 16 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH TunnelEncapDecapFlags = 32 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_HOP_LIMIT TunnelEncapDecapFlags = 64 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_FLOW_LABEL TunnelEncapDecapFlags = 128 ) var ( TunnelEncapDecapFlags_name = map[uint8]string{ - 0: "TUNNEL_API_ENCAP_DECAP_FLAG_NONE", - 1: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF", - 2: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF", - 4: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP", - 8: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN", - 16: "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN", + 0: "TUNNEL_API_ENCAP_DECAP_FLAG_NONE", + 1: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF", + 2: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF", + 4: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP", + 8: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN", + 16: "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN", + 32: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH", + 64: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_HOP_LIMIT", + 128: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_FLOW_LABEL", } TunnelEncapDecapFlags_value = map[string]uint8{ - "TUNNEL_API_ENCAP_DECAP_FLAG_NONE": 0, - "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF": 1, - "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF": 2, - "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP": 4, - "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN": 8, - "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN": 16, + "TUNNEL_API_ENCAP_DECAP_FLAG_NONE": 0, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF": 1, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF": 2, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP": 4, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN": 8, + "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN": 16, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH": 32, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_HOP_LIMIT": 64, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_FLOW_LABEL": 128, } ) @@ -106,3 +125,60 @@ func (x TunnelMode) String() string { } return "TunnelMode(" + strconv.Itoa(int(x)) + ")" } + +// TunnelFlags defines enum 'tunnel_flags'. +type TunnelFlags uint8 + +const ( + TUNNEL_API_FLAG_TRACK_MTU TunnelFlags = 1 +) + +var ( + TunnelFlags_name = map[uint8]string{ + 1: "TUNNEL_API_FLAG_TRACK_MTU", + } + TunnelFlags_value = map[string]uint8{ + "TUNNEL_API_FLAG_TRACK_MTU": 1, + } +) + +func (x TunnelFlags) String() string { + s, ok := TunnelFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := TunnelFlags_name[uint8(n)] + if ok { + return s + } + return "TunnelFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// Tunnel defines type 'tunnel'. +type Tunnel struct { + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EncapDecapFlags TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=encap_decap_flags" json:"encap_decap_flags,omitempty"` + Mode TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"` + Flags TunnelFlags `binapi:"tunnel_flags,name=flags" json:"flags,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go index 7795100..b1a51d1 100644 --- a/binapi/udp/udp.ba.go +++ b/binapi/udp/udp.ba.go @@ -1,21 +1,24 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/udp.api.json // Package udp contains generated bindings for API file udp.api. // // Contents: -// 1 struct -// 6 messages +// 1 enum +// 2 structs +// 8 messages // package udp import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + "strconv" + + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,9 +30,46 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "udp" APIVersion = "1.1.0" - VersionCrc = 0xb827bf4f + VersionCrc = 0x2d3db5fa +) + +// UDPDecapNextProto defines enum 'udp_decap_next_proto'. +type UDPDecapNextProto uint32 + +const ( + UDP_API_DECAP_PROTO_IP4 UDPDecapNextProto = 1 + UDP_API_DECAP_PROTO_IP6 UDPDecapNextProto = 2 + UDP_API_DECAP_PROTO_MPLS UDPDecapNextProto = 3 ) +var ( + UDPDecapNextProto_name = map[uint32]string{ + 1: "UDP_API_DECAP_PROTO_IP4", + 2: "UDP_API_DECAP_PROTO_IP6", + 3: "UDP_API_DECAP_PROTO_MPLS", + } + UDPDecapNextProto_value = map[string]uint32{ + "UDP_API_DECAP_PROTO_IP4": 1, + "UDP_API_DECAP_PROTO_IP6": 2, + "UDP_API_DECAP_PROTO_MPLS": 3, + } +) + +func (x UDPDecapNextProto) String() string { + s, ok := UDPDecapNextProto_name[uint32(x)] + if ok { + return s + } + return "UDPDecapNextProto(" + strconv.Itoa(int(x)) + ")" +} + +// UDPDecap defines type 'udp_decap'. +type UDPDecap struct { + IsIP4 uint8 `binapi:"u8,name=is_ip4" json:"is_ip4,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + NextProto UDPDecapNextProto `binapi:"udp_decap_next_proto,name=next_proto" json:"next_proto,omitempty"` +} + // UDPEncap defines type 'udp_encap'. type UDPEncap struct { TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` @@ -40,6 +80,82 @@ type UDPEncap struct { ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` } +// UDPDecapAddDel defines message 'udp_decap_add_del'. +type UDPDecapAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + UDPDecap UDPDecap `binapi:"udp_decap,name=udp_decap" json:"udp_decap,omitempty"` +} + +func (m *UDPDecapAddDel) Reset() { *m = UDPDecapAddDel{} } +func (*UDPDecapAddDel) GetMessageName() string { return "udp_decap_add_del" } +func (*UDPDecapAddDel) GetCrcString() string { return "d155c6ac" } +func (*UDPDecapAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPDecapAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.UDPDecap.IsIP4 + size += 2 // m.UDPDecap.Port + size += 4 // m.UDPDecap.NextProto + return size +} +func (m *UDPDecapAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(m.UDPDecap.IsIP4) + buf.EncodeUint16(m.UDPDecap.Port) + buf.EncodeUint32(uint32(m.UDPDecap.NextProto)) + return buf.Bytes(), nil +} +func (m *UDPDecapAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.UDPDecap.IsIP4 = buf.DecodeUint8() + m.UDPDecap.Port = buf.DecodeUint16() + m.UDPDecap.NextProto = UDPDecapNextProto(buf.DecodeUint32()) + return nil +} + +// UDPDecapAddDelReply defines message 'udp_decap_add_del_reply'. +type UDPDecapAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UDPDecapAddDelReply) Reset() { *m = UDPDecapAddDelReply{} } +func (*UDPDecapAddDelReply) GetMessageName() string { return "udp_decap_add_del_reply" } +func (*UDPDecapAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*UDPDecapAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPDecapAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *UDPDecapAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *UDPDecapAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // UDPEncapAdd defines message 'udp_encap_add'. type UDPEncapAdd struct { UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` @@ -47,7 +163,7 @@ type UDPEncapAdd struct { func (m *UDPEncapAdd) Reset() { *m = UDPEncapAdd{} } func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" } -func (*UDPEncapAdd) GetCrcString() string { return "61d5fc48" } +func (*UDPEncapAdd) GetCrcString() string { return "f74a60b1" } func (*UDPEncapAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -204,7 +320,7 @@ type UDPEncapDetails struct { func (m *UDPEncapDetails) Reset() { *m = UDPEncapDetails{} } func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" } -func (*UDPEncapDetails) GetCrcString() string { return "87c82821" } +func (*UDPEncapDetails) GetCrcString() string { return "8cfb9c76" } func (*UDPEncapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -280,17 +396,21 @@ func (m *UDPEncapDump) Unmarshal(b []byte) error { func init() { file_udp_binapi_init() } func file_udp_binapi_init() { - api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_61d5fc48") + api.RegisterMessage((*UDPDecapAddDel)(nil), "udp_decap_add_del_d155c6ac") + api.RegisterMessage((*UDPDecapAddDelReply)(nil), "udp_decap_add_del_reply_e8d4e804") + api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_f74a60b1") api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294") api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5") api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804") - api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_87c82821") + api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_8cfb9c76") api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*UDPDecapAddDel)(nil), + (*UDPDecapAddDelReply)(nil), (*UDPEncapAdd)(nil), (*UDPEncapAddReply)(nil), (*UDPEncapDel)(nil), diff --git a/binapi/udp/udp_rest.ba.go b/binapi/udp/udp_rest.ba.go deleted file mode 100644 index fc584bb..0000000 --- a/binapi/udp/udp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package udp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/udp_encap_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPEncapAdd) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.UDPEncapAdd(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/udp_encap_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPEncapDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.UDPEncapDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/udp/udp_rpc.ba.go b/binapi/udp/udp_rpc.ba.go index adb495c..5a7a2e8 100644 --- a/binapi/udp/udp_rpc.ba.go +++ b/binapi/udp/udp_rpc.ba.go @@ -5,13 +5,15 @@ package udp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service udp. +// RPCService defines RPC service udp. type RPCService interface { + UDPDecapAddDel(ctx context.Context, in *UDPDecapAddDel) (*UDPDecapAddDelReply, error) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) @@ -25,13 +27,22 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) UDPDecapAddDel(ctx context.Context, in *UDPDecapAddDel) (*UDPDecapAddDelReply, error) { + out := new(UDPDecapAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) { out := new(UDPEncapAddReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) { @@ -40,7 +51,7 @@ func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) { @@ -52,7 +63,7 @@ func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -75,7 +86,11 @@ func (c *serviceClient_UDPEncapDumpClient) Recv() (*UDPEncapDetails, error) { switch m := msg.(type) { case *UDPEncapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/udp_ping/udp_ping.ba.go b/binapi/udp_ping/udp_ping.ba.go index 7247b38..0ac85ae 100644 --- a/binapi/udp_ping/udp_ping.ba.go +++ b/binapi/udp_ping/udp_ping.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/udp_ping.api.json // Package udp_ping contains generated bindings for API file udp_ping.api. @@ -12,9 +12,9 @@ package udp_ping import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "udp_ping" APIVersion = "3.0.0" - VersionCrc = 0x3b2c67de + VersionCrc = 0x16d961db ) // UDPPingAddDel defines message 'udp_ping_add_del'. @@ -45,7 +45,7 @@ type UDPPingAddDel struct { func (m *UDPPingAddDel) Reset() { *m = UDPPingAddDel{} } func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" } -func (*UDPPingAddDel) GetCrcString() string { return "c692b188" } +func (*UDPPingAddDel) GetCrcString() string { return "fa2628fc" } func (*UDPPingAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -206,7 +206,7 @@ func (m *UDPPingExportReply) Unmarshal(b []byte) error { func init() { file_udp_ping_binapi_init() } func file_udp_ping_binapi_init() { - api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_c692b188") + api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_fa2628fc") api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804") api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2") api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804") diff --git a/binapi/udp_ping/udp_ping_rest.ba.go b/binapi/udp_ping/udp_ping_rest.ba.go deleted file mode 100644 index 41317c4..0000000 --- a/binapi/udp_ping/udp_ping_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package udp_ping - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/udp_ping_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPPingAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.UDPPingAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/udp_ping_export", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPPingExport) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.UDPPingExport(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/udp_ping/udp_ping_rpc.ba.go b/binapi/udp_ping/udp_ping_rpc.ba.go index eae0ab4..03b6154 100644 --- a/binapi/udp_ping/udp_ping_rpc.ba.go +++ b/binapi/udp_ping/udp_ping_rpc.ba.go @@ -4,10 +4,11 @@ package udp_ping import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service udp_ping. +// RPCService defines RPC service udp_ping. type RPCService interface { UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) @@ -27,7 +28,7 @@ func (c *serviceClient) UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) { @@ -36,5 +37,5 @@ func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/urpf/urpf.ba.go b/binapi/urpf/urpf.ba.go index c504cfb..6cc1176 100644 --- a/binapi/urpf/urpf.ba.go +++ b/binapi/urpf/urpf.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/urpf.api.json // Package urpf contains generated bindings for API file urpf.api. @@ -13,12 +13,13 @@ package urpf import ( - api "git.fd.io/govpp.git/api" - _ "git.fd.io/govpp.git/binapi/fib_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + _ "go.fd.io/govpp/binapi/fib_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -30,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "urpf" APIVersion = "1.0.0" - VersionCrc = 0x3e2ebd8a + VersionCrc = 0xb2bfd2c4 ) // UrpfMode defines enum 'urpf_mode'. diff --git a/binapi/urpf/urpf_rest.ba.go b/binapi/urpf/urpf_rest.ba.go deleted file mode 100644 index cbe7875..0000000 --- a/binapi/urpf/urpf_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package urpf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/urpf_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(UrpfUpdate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.UrpfUpdate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/urpf/urpf_rpc.ba.go b/binapi/urpf/urpf_rpc.ba.go index 92441b1..7d89387 100644 --- a/binapi/urpf/urpf_rpc.ba.go +++ b/binapi/urpf/urpf_rpc.ba.go @@ -4,10 +4,11 @@ package urpf import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service urpf. +// RPCService defines RPC service urpf. type RPCService interface { UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUpdateReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/vhost_user/vhost_user.ba.go b/binapi/vhost_user/vhost_user.ba.go index 0ca7119..3c19d0d 100644 --- a/binapi/vhost_user/vhost_user.ba.go +++ b/binapi/vhost_user/vhost_user.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/vhost_user.api.json // Package vhost_user contains generated bindings for API file vhost_user.api. // // Contents: -// 8 messages +// 12 messages // package vhost_user import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - virtio_types "git.fd.io/govpp.git/binapi/virtio_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + virtio_types "go.fd.io/govpp/binapi/virtio_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,11 +27,12 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vhost_user" - APIVersion = "4.0.1" - VersionCrc = 0x3df14dfe + APIVersion = "4.1.1" + VersionCrc = 0xd49ae8cd ) // CreateVhostUserIf defines message 'create_vhost_user_if'. +// Deprecated: the message will be removed in the future versions type CreateVhostUserIf struct { IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` @@ -105,6 +106,7 @@ func (m *CreateVhostUserIf) Unmarshal(b []byte) error { } // CreateVhostUserIfReply defines message 'create_vhost_user_if_reply'. +// Deprecated: the message will be removed in the future versions type CreateVhostUserIfReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -141,6 +143,120 @@ func (m *CreateVhostUserIfReply) Unmarshal(b []byte) error { return nil } +// CreateVhostUserIfV2 defines message 'create_vhost_user_if_v2'. +type CreateVhostUserIfV2 struct { + IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` + SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` + Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` + DisableMrgRxbuf bool `binapi:"bool,name=disable_mrg_rxbuf" json:"disable_mrg_rxbuf,omitempty"` + DisableIndirectDesc bool `binapi:"bool,name=disable_indirect_desc" json:"disable_indirect_desc,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` + EnablePacked bool `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"` + EnableEventIdx bool `binapi:"bool,name=enable_event_idx" json:"enable_event_idx,omitempty"` + CustomDevInstance uint32 `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"` + UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *CreateVhostUserIfV2) Reset() { *m = CreateVhostUserIfV2{} } +func (*CreateVhostUserIfV2) GetMessageName() string { return "create_vhost_user_if_v2" } +func (*CreateVhostUserIfV2) GetCrcString() string { return "dba1cc1d" } +func (*CreateVhostUserIfV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateVhostUserIfV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsServer + size += 256 // m.SockFilename + size += 1 // m.Renumber + size += 1 // m.DisableMrgRxbuf + size += 1 // m.DisableIndirectDesc + size += 1 // m.EnableGso + size += 1 // m.EnablePacked + size += 1 // m.EnableEventIdx + size += 4 // m.CustomDevInstance + size += 1 // m.UseCustomMac + size += 1 * 6 // m.MacAddress + size += 64 // m.Tag + return size +} +func (m *CreateVhostUserIfV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsServer) + buf.EncodeString(m.SockFilename, 256) + buf.EncodeBool(m.Renumber) + buf.EncodeBool(m.DisableMrgRxbuf) + buf.EncodeBool(m.DisableIndirectDesc) + buf.EncodeBool(m.EnableGso) + buf.EncodeBool(m.EnablePacked) + buf.EncodeBool(m.EnableEventIdx) + buf.EncodeUint32(m.CustomDevInstance) + buf.EncodeBool(m.UseCustomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *CreateVhostUserIfV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsServer = buf.DecodeBool() + m.SockFilename = buf.DecodeString(256) + m.Renumber = buf.DecodeBool() + m.DisableMrgRxbuf = buf.DecodeBool() + m.DisableIndirectDesc = buf.DecodeBool() + m.EnableGso = buf.DecodeBool() + m.EnablePacked = buf.DecodeBool() + m.EnableEventIdx = buf.DecodeBool() + m.CustomDevInstance = buf.DecodeUint32() + m.UseCustomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.Tag = buf.DecodeString(64) + return nil +} + +// CreateVhostUserIfV2Reply defines message 'create_vhost_user_if_v2_reply'. +type CreateVhostUserIfV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVhostUserIfV2Reply) Reset() { *m = CreateVhostUserIfV2Reply{} } +func (*CreateVhostUserIfV2Reply) GetMessageName() string { return "create_vhost_user_if_v2_reply" } +func (*CreateVhostUserIfV2Reply) GetCrcString() string { return "5383d31f" } +func (*CreateVhostUserIfV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateVhostUserIfV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateVhostUserIfV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateVhostUserIfV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // DeleteVhostUserIf defines message 'delete_vhost_user_if'. type DeleteVhostUserIf struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -208,6 +324,7 @@ func (m *DeleteVhostUserIfReply) Unmarshal(b []byte) error { } // ModifyVhostUserIf defines message 'modify_vhost_user_if'. +// Deprecated: the message will be removed in the future versions type ModifyVhostUserIf struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` @@ -265,6 +382,7 @@ func (m *ModifyVhostUserIf) Unmarshal(b []byte) error { } // ModifyVhostUserIfReply defines message 'modify_vhost_user_if_reply'. +// Deprecated: the message will be removed in the future versions type ModifyVhostUserIfReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -297,6 +415,100 @@ func (m *ModifyVhostUserIfReply) Unmarshal(b []byte) error { return nil } +// ModifyVhostUserIfV2 defines message 'modify_vhost_user_if_v2'. +type ModifyVhostUserIfV2 struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` + SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` + Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` + EnablePacked bool `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"` + EnableEventIdx bool `binapi:"bool,name=enable_event_idx" json:"enable_event_idx,omitempty"` + CustomDevInstance uint32 `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"` +} + +func (m *ModifyVhostUserIfV2) Reset() { *m = ModifyVhostUserIfV2{} } +func (*ModifyVhostUserIfV2) GetMessageName() string { return "modify_vhost_user_if_v2" } +func (*ModifyVhostUserIfV2) GetCrcString() string { return "b2483771" } +func (*ModifyVhostUserIfV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ModifyVhostUserIfV2) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsServer + size += 256 // m.SockFilename + size += 1 // m.Renumber + size += 1 // m.EnableGso + size += 1 // m.EnablePacked + size += 1 // m.EnableEventIdx + size += 4 // m.CustomDevInstance + return size +} +func (m *ModifyVhostUserIfV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsServer) + buf.EncodeString(m.SockFilename, 256) + buf.EncodeBool(m.Renumber) + buf.EncodeBool(m.EnableGso) + buf.EncodeBool(m.EnablePacked) + buf.EncodeBool(m.EnableEventIdx) + buf.EncodeUint32(m.CustomDevInstance) + return buf.Bytes(), nil +} +func (m *ModifyVhostUserIfV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsServer = buf.DecodeBool() + m.SockFilename = buf.DecodeString(256) + m.Renumber = buf.DecodeBool() + m.EnableGso = buf.DecodeBool() + m.EnablePacked = buf.DecodeBool() + m.EnableEventIdx = buf.DecodeBool() + m.CustomDevInstance = buf.DecodeUint32() + return nil +} + +// ModifyVhostUserIfV2Reply defines message 'modify_vhost_user_if_v2_reply'. +type ModifyVhostUserIfV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ModifyVhostUserIfV2Reply) Reset() { *m = ModifyVhostUserIfV2Reply{} } +func (*ModifyVhostUserIfV2Reply) GetMessageName() string { return "modify_vhost_user_if_v2_reply" } +func (*ModifyVhostUserIfV2Reply) GetCrcString() string { return "e8d4e804" } +func (*ModifyVhostUserIfV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ModifyVhostUserIfV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *ModifyVhostUserIfV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *ModifyVhostUserIfV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // SwInterfaceVhostUserDetails defines message 'sw_interface_vhost_user_details'. type SwInterfaceVhostUserDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -312,7 +524,7 @@ type SwInterfaceVhostUserDetails struct { func (m *SwInterfaceVhostUserDetails) Reset() { *m = SwInterfaceVhostUserDetails{} } func (*SwInterfaceVhostUserDetails) GetMessageName() string { return "sw_interface_vhost_user_details" } -func (*SwInterfaceVhostUserDetails) GetCrcString() string { return "98530df1" } +func (*SwInterfaceVhostUserDetails) GetCrcString() string { return "0cee1e53" } func (*SwInterfaceVhostUserDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -399,11 +611,15 @@ func init() { file_vhost_user_binapi_init() } func file_vhost_user_binapi_init() { api.RegisterMessage((*CreateVhostUserIf)(nil), "create_vhost_user_if_c785c6fc") api.RegisterMessage((*CreateVhostUserIfReply)(nil), "create_vhost_user_if_reply_5383d31f") + api.RegisterMessage((*CreateVhostUserIfV2)(nil), "create_vhost_user_if_v2_dba1cc1d") + api.RegisterMessage((*CreateVhostUserIfV2Reply)(nil), "create_vhost_user_if_v2_reply_5383d31f") api.RegisterMessage((*DeleteVhostUserIf)(nil), "delete_vhost_user_if_f9e6675e") api.RegisterMessage((*DeleteVhostUserIfReply)(nil), "delete_vhost_user_if_reply_e8d4e804") api.RegisterMessage((*ModifyVhostUserIf)(nil), "modify_vhost_user_if_0e71d40b") api.RegisterMessage((*ModifyVhostUserIfReply)(nil), "modify_vhost_user_if_reply_e8d4e804") - api.RegisterMessage((*SwInterfaceVhostUserDetails)(nil), "sw_interface_vhost_user_details_98530df1") + api.RegisterMessage((*ModifyVhostUserIfV2)(nil), "modify_vhost_user_if_v2_b2483771") + api.RegisterMessage((*ModifyVhostUserIfV2Reply)(nil), "modify_vhost_user_if_v2_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceVhostUserDetails)(nil), "sw_interface_vhost_user_details_0cee1e53") api.RegisterMessage((*SwInterfaceVhostUserDump)(nil), "sw_interface_vhost_user_dump_f9e6675e") } @@ -412,10 +628,14 @@ func AllMessages() []api.Message { return []api.Message{ (*CreateVhostUserIf)(nil), (*CreateVhostUserIfReply)(nil), + (*CreateVhostUserIfV2)(nil), + (*CreateVhostUserIfV2Reply)(nil), (*DeleteVhostUserIf)(nil), (*DeleteVhostUserIfReply)(nil), (*ModifyVhostUserIf)(nil), (*ModifyVhostUserIfReply)(nil), + (*ModifyVhostUserIfV2)(nil), + (*ModifyVhostUserIfV2Reply)(nil), (*SwInterfaceVhostUserDetails)(nil), (*SwInterfaceVhostUserDump)(nil), } diff --git a/binapi/vhost_user/vhost_user_rest.ba.go b/binapi/vhost_user/vhost_user_rest.ba.go deleted file mode 100644 index c2f687b..0000000 --- a/binapi/vhost_user/vhost_user_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vhost_user - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/create_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateVhostUserIf) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CreateVhostUserIf(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/delete_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteVhostUserIf) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.DeleteVhostUserIf(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/modify_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(ModifyVhostUserIf) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.ModifyVhostUserIf(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vhost_user/vhost_user_rpc.ba.go b/binapi/vhost_user/vhost_user_rpc.ba.go index 091ed53..e04dbcf 100644 --- a/binapi/vhost_user/vhost_user_rpc.ba.go +++ b/binapi/vhost_user/vhost_user_rpc.ba.go @@ -5,16 +5,19 @@ package vhost_user import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vhost_user. +// RPCService defines RPC service vhost_user. type RPCService interface { CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) + CreateVhostUserIfV2(ctx context.Context, in *CreateVhostUserIfV2) (*CreateVhostUserIfV2Reply, error) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) + ModifyVhostUserIfV2(ctx context.Context, in *ModifyVhostUserIfV2) (*ModifyVhostUserIfV2Reply, error) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) } @@ -32,7 +35,16 @@ func (c *serviceClient) CreateVhostUserIf(ctx context.Context, in *CreateVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CreateVhostUserIfV2(ctx context.Context, in *CreateVhostUserIfV2) (*CreateVhostUserIfV2Reply, error) { + out := new(CreateVhostUserIfV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) { @@ -41,7 +53,7 @@ func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) { @@ -50,7 +62,16 @@ func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ModifyVhostUserIfV2(ctx context.Context, in *ModifyVhostUserIfV2) (*ModifyVhostUserIfV2Reply, error) { + out := new(ModifyVhostUserIfV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) { @@ -62,7 +83,7 @@ func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInte if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -85,7 +106,11 @@ func (c *serviceClient_SwInterfaceVhostUserDumpClient) Recv() (*SwInterfaceVhost switch m := msg.(type) { case *SwInterfaceVhostUserDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/virtio/virtio.ba.go b/binapi/virtio/virtio.ba.go index b29b52f..7cb371b 100644 --- a/binapi/virtio/virtio.ba.go +++ b/binapi/virtio/virtio.ba.go @@ -1,22 +1,25 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/virtio.api.json // Package virtio contains generated bindings for API file virtio.api. // // Contents: -// 6 messages +// 1 enum +// 8 messages // package virtio import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - pci_types "git.fd.io/govpp.git/binapi/pci_types" - codec "git.fd.io/govpp.git/codec" + "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + pci_types "go.fd.io/govpp/binapi/pci_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,10 +30,68 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "virtio" - APIVersion = "2.0.0" - VersionCrc = 0x601b1fdc + APIVersion = "3.0.0" + VersionCrc = 0xa507d784 +) + +// VirtioFlags defines enum 'virtio_flags'. +type VirtioFlags uint32 + +const ( + VIRTIO_API_FLAG_GSO VirtioFlags = 1 + VIRTIO_API_FLAG_CSUM_OFFLOAD VirtioFlags = 2 + VIRTIO_API_FLAG_GRO_COALESCE VirtioFlags = 4 + VIRTIO_API_FLAG_PACKED VirtioFlags = 8 + VIRTIO_API_FLAG_IN_ORDER VirtioFlags = 16 + VIRTIO_API_FLAG_BUFFERING VirtioFlags = 32 ) +var ( + VirtioFlags_name = map[uint32]string{ + 1: "VIRTIO_API_FLAG_GSO", + 2: "VIRTIO_API_FLAG_CSUM_OFFLOAD", + 4: "VIRTIO_API_FLAG_GRO_COALESCE", + 8: "VIRTIO_API_FLAG_PACKED", + 16: "VIRTIO_API_FLAG_IN_ORDER", + 32: "VIRTIO_API_FLAG_BUFFERING", + } + VirtioFlags_value = map[string]uint32{ + "VIRTIO_API_FLAG_GSO": 1, + "VIRTIO_API_FLAG_CSUM_OFFLOAD": 2, + "VIRTIO_API_FLAG_GRO_COALESCE": 4, + "VIRTIO_API_FLAG_PACKED": 8, + "VIRTIO_API_FLAG_IN_ORDER": 16, + "VIRTIO_API_FLAG_BUFFERING": 32, + } +) + +func (x VirtioFlags) String() string { + s, ok := VirtioFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := VirtioFlags_name[uint32(n)] + if ok { + return s + } + return "VirtioFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'. type SwInterfaceVirtioPciDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -43,7 +104,7 @@ type SwInterfaceVirtioPciDetails struct { func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} } func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" } -func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "16187f3a" } +func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "6ca9c167" } func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -121,6 +182,7 @@ func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error { } // VirtioPciCreate defines message 'virtio_pci_create'. +// Deprecated: the message will be removed in the future versions type VirtioPciCreate struct { PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"` @@ -132,7 +194,7 @@ type VirtioPciCreate struct { func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} } func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" } -func (*VirtioPciCreate) GetCrcString() string { return "a9f1370c" } +func (*VirtioPciCreate) GetCrcString() string { return "1944f8db" } func (*VirtioPciCreate) GetMessageType() api.MessageType { return api.RequestMessage } @@ -183,6 +245,7 @@ func (m *VirtioPciCreate) Unmarshal(b []byte) error { } // VirtioPciCreateReply defines message 'virtio_pci_create_reply'. +// Deprecated: the message will be removed in the future versions type VirtioPciCreateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -219,6 +282,101 @@ func (m *VirtioPciCreateReply) Unmarshal(b []byte) error { return nil } +// VirtioPciCreateV2 defines message 'virtio_pci_create_v2'. +type VirtioPciCreateV2 struct { + PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` + UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + VirtioFlags VirtioFlags `binapi:"virtio_flags,name=virtio_flags" json:"virtio_flags,omitempty"` + Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` +} + +func (m *VirtioPciCreateV2) Reset() { *m = VirtioPciCreateV2{} } +func (*VirtioPciCreateV2) GetMessageName() string { return "virtio_pci_create_v2" } +func (*VirtioPciCreateV2) GetCrcString() string { return "5d096e1a" } +func (*VirtioPciCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VirtioPciCreateV2) Size() (size int) { + if m == nil { + return 0 + } + size += 2 // m.PciAddr.Domain + size += 1 // m.PciAddr.Bus + size += 1 // m.PciAddr.Slot + size += 1 // m.PciAddr.Function + size += 1 // m.UseRandomMac + size += 1 * 6 // m.MacAddress + size += 4 // m.VirtioFlags + size += 8 // m.Features + return size +} +func (m *VirtioPciCreateV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint16(m.PciAddr.Domain) + buf.EncodeUint8(m.PciAddr.Bus) + buf.EncodeUint8(m.PciAddr.Slot) + buf.EncodeUint8(m.PciAddr.Function) + buf.EncodeBool(m.UseRandomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint32(uint32(m.VirtioFlags)) + buf.EncodeUint64(m.Features) + return buf.Bytes(), nil +} +func (m *VirtioPciCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PciAddr.Domain = buf.DecodeUint16() + m.PciAddr.Bus = buf.DecodeUint8() + m.PciAddr.Slot = buf.DecodeUint8() + m.PciAddr.Function = buf.DecodeUint8() + m.UseRandomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.VirtioFlags = VirtioFlags(buf.DecodeUint32()) + m.Features = buf.DecodeUint64() + return nil +} + +// VirtioPciCreateV2Reply defines message 'virtio_pci_create_v2_reply'. +type VirtioPciCreateV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VirtioPciCreateV2Reply) Reset() { *m = VirtioPciCreateV2Reply{} } +func (*VirtioPciCreateV2Reply) GetMessageName() string { return "virtio_pci_create_v2_reply" } +func (*VirtioPciCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*VirtioPciCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VirtioPciCreateV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VirtioPciCreateV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VirtioPciCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // VirtioPciDelete defines message 'virtio_pci_delete'. type VirtioPciDelete struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -287,10 +445,12 @@ func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error { func init() { file_virtio_binapi_init() } func file_virtio_binapi_init() { - api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a") + api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_6ca9c167") api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14") - api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c") + api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_1944f8db") api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f") + api.RegisterMessage((*VirtioPciCreateV2)(nil), "virtio_pci_create_v2_5d096e1a") + api.RegisterMessage((*VirtioPciCreateV2Reply)(nil), "virtio_pci_create_v2_reply_5383d31f") api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e") api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804") } @@ -302,6 +462,8 @@ func AllMessages() []api.Message { (*SwInterfaceVirtioPciDump)(nil), (*VirtioPciCreate)(nil), (*VirtioPciCreateReply)(nil), + (*VirtioPciCreateV2)(nil), + (*VirtioPciCreateV2Reply)(nil), (*VirtioPciDelete)(nil), (*VirtioPciDeleteReply)(nil), } diff --git a/binapi/virtio/virtio_rest.ba.go b/binapi/virtio/virtio_rest.ba.go deleted file mode 100644 index bd97059..0000000 --- a/binapi/virtio/virtio_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package virtio - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/virtio_pci_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(VirtioPciCreate) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VirtioPciCreate(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/virtio_pci_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(VirtioPciDelete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VirtioPciDelete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/virtio/virtio_rpc.ba.go b/binapi/virtio/virtio_rpc.ba.go index 785a460..cba32e3 100644 --- a/binapi/virtio/virtio_rpc.ba.go +++ b/binapi/virtio/virtio_rpc.ba.go @@ -5,15 +5,17 @@ package virtio import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service virtio. +// RPCService defines RPC service virtio. type RPCService interface { SwInterfaceVirtioPciDump(ctx context.Context, in *SwInterfaceVirtioPciDump) (RPCService_SwInterfaceVirtioPciDumpClient, error) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate) (*VirtioPciCreateReply, error) + VirtioPciCreateV2(ctx context.Context, in *VirtioPciCreateV2) (*VirtioPciCreateV2Reply, error) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) } @@ -34,7 +36,7 @@ func (c *serviceClient) SwInterfaceVirtioPciDump(ctx context.Context, in *SwInte if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -57,7 +59,11 @@ func (c *serviceClient_SwInterfaceVirtioPciDumpClient) Recv() (*SwInterfaceVirti switch m := msg.(type) { case *SwInterfaceVirtioPciDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -70,7 +76,16 @@ func (c *serviceClient) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) VirtioPciCreateV2(ctx context.Context, in *VirtioPciCreateV2) (*VirtioPciCreateV2Reply, error) { + out := new(VirtioPciCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) { @@ -79,5 +94,5 @@ func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/virtio_types/virtio_types.ba.go b/binapi/virtio_types/virtio_types.ba.go index 2b8fa5d..3e0c773 100644 --- a/binapi/virtio_types/virtio_types.ba.go +++ b/binapi/virtio_types/virtio_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/virtio_types.api.json // Package virtio_types contains generated bindings for API file virtio_types.api. @@ -12,8 +12,9 @@ package virtio_types import ( - api "git.fd.io/govpp.git/api" "strconv" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -22,6 +23,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "virtio_types" + APIVersion = "1.0.0" + VersionCrc = 0x7a70a44e +) + // VirtioNetFeaturesFirst32 defines enum 'virtio_net_features_first_32'. type VirtioNetFeaturesFirst32 uint32 diff --git a/binapi/vlib/vlib.ba.go b/binapi/vlib/vlib.ba.go new file mode 100644 index 0000000..37f7587 --- /dev/null +++ b/binapi/vlib/vlib.ba.go @@ -0,0 +1,751 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/core/vlib.api.json + +// Package vlib contains generated bindings for API file vlib.api. +// +// Contents: +// 1 struct +// 18 messages +// +package vlib + +import ( + api "go.fd.io/govpp/api" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vlib" + APIVersion = "1.0.0" + VersionCrc = 0x9a9e84e4 +) + +// ThreadData defines type 'thread_data'. +type ThreadData struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Type string `binapi:"string[64],name=type" json:"type,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` + Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` + CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` +} + +// AddNodeNext defines message 'add_node_next'. +type AddNodeNext struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` +} + +func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } +func (*AddNodeNext) GetMessageName() string { return "add_node_next" } +func (*AddNodeNext) GetCrcString() string { return "2457116d" } +func (*AddNodeNext) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AddNodeNext) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.NodeName + size += 64 // m.NextName + return size +} +func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.NodeName, 64) + buf.EncodeString(m.NextName, 64) + return buf.Bytes(), nil +} +func (m *AddNodeNext) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + m.NextName = buf.DecodeString(64) + return nil +} + +// AddNodeNextReply defines message 'add_node_next_reply'. +type AddNodeNextReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } +func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } +func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } +func (*AddNodeNextReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AddNodeNextReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.NextIndex + return size +} +func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.NextIndex) + return buf.Bytes(), nil +} +func (m *AddNodeNextReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.NextIndex = buf.DecodeUint32() + return nil +} + +// Cli defines message 'cli'. +type Cli struct { + CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` +} + +func (m *Cli) Reset() { *m = Cli{} } +func (*Cli) GetMessageName() string { return "cli" } +func (*Cli) GetCrcString() string { return "23bfbfff" } +func (*Cli) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Cli) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.CmdInShmem + return size +} +func (m *Cli) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint64(m.CmdInShmem) + return buf.Bytes(), nil +} +func (m *Cli) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CmdInShmem = buf.DecodeUint64() + return nil +} + +// CliInband defines message 'cli_inband'. +type CliInband struct { + Cmd string `binapi:"string[],name=cmd" json:"cmd,omitempty"` +} + +func (m *CliInband) Reset() { *m = CliInband{} } +func (*CliInband) GetMessageName() string { return "cli_inband" } +func (*CliInband) GetCrcString() string { return "f8377302" } +func (*CliInband) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CliInband) Size() (size int) { + if m == nil { + return 0 + } + size += 4 + len(m.Cmd) // m.Cmd + return size +} +func (m *CliInband) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.Cmd, 0) + return buf.Bytes(), nil +} +func (m *CliInband) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cmd = buf.DecodeString(0) + return nil +} + +// CliInbandReply defines message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Reply string `binapi:"string[],name=reply" json:"reply,omitempty"` +} + +func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } +func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } +func (*CliInbandReply) GetCrcString() string { return "05879051" } +func (*CliInbandReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CliInbandReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 + len(m.Reply) // m.Reply + return size +} +func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeString(m.Reply, 0) + return buf.Bytes(), nil +} +func (m *CliInbandReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Reply = buf.DecodeString(0) + return nil +} + +// CliReply defines message 'cli_reply'. +type CliReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *CliReply) Reset() { *m = CliReply{} } +func (*CliReply) GetMessageName() string { return "cli_reply" } +func (*CliReply) GetCrcString() string { return "06d68297" } +func (*CliReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CliReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 8 // m.ReplyInShmem + return size +} +func (m *CliReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint64(m.ReplyInShmem) + return buf.Bytes(), nil +} +func (m *CliReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ReplyInShmem = buf.DecodeUint64() + return nil +} + +// GetF64EndianValue defines message 'get_f64_endian_value'. +type GetF64EndianValue struct { + F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` +} + +func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } +func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } +func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } +func (*GetF64EndianValue) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetF64EndianValue) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.F64One + return size +} +func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeFloat64(m.F64One) + return buf.Bytes(), nil +} +func (m *GetF64EndianValue) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.F64One = buf.DecodeFloat64() + return nil +} + +// GetF64EndianValueReply defines message 'get_f64_endian_value_reply'. +type GetF64EndianValueReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` +} + +func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } +func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } +func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } +func (*GetF64EndianValueReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetF64EndianValueReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 8 // m.F64OneResult + return size +} +func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Retval) + buf.EncodeFloat64(m.F64OneResult) + return buf.Bytes(), nil +} +func (m *GetF64EndianValueReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeUint32() + m.F64OneResult = buf.DecodeFloat64() + return nil +} + +// GetF64IncrementByOne defines message 'get_f64_increment_by_one'. +type GetF64IncrementByOne struct { + F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } +func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } +func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } +func (*GetF64IncrementByOne) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetF64IncrementByOne) Size() (size int) { + if m == nil { + return 0 + } + size += 8 // m.F64Value + return size +} +func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeFloat64(m.F64Value) + return buf.Bytes(), nil +} +func (m *GetF64IncrementByOne) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.F64Value = buf.DecodeFloat64() + return nil +} + +// GetF64IncrementByOneReply defines message 'get_f64_increment_by_one_reply'. +type GetF64IncrementByOneReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } +func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } +func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } +func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetF64IncrementByOneReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 8 // m.F64Value + return size +} +func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Retval) + buf.EncodeFloat64(m.F64Value) + return buf.Bytes(), nil +} +func (m *GetF64IncrementByOneReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeUint32() + m.F64Value = buf.DecodeFloat64() + return nil +} + +// GetNextIndex defines message 'get_next_index'. +type GetNextIndex struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` +} + +func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } +func (*GetNextIndex) GetMessageName() string { return "get_next_index" } +func (*GetNextIndex) GetCrcString() string { return "2457116d" } +func (*GetNextIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNextIndex) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.NodeName + size += 64 // m.NextName + return size +} +func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.NodeName, 64) + buf.EncodeString(m.NextName, 64) + return buf.Bytes(), nil +} +func (m *GetNextIndex) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + m.NextName = buf.DecodeString(64) + return nil +} + +// GetNextIndexReply defines message 'get_next_index_reply'. +type GetNextIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } +func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } +func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } +func (*GetNextIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNextIndexReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.NextIndex + return size +} +func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.NextIndex) + return buf.Bytes(), nil +} +func (m *GetNextIndexReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.NextIndex = buf.DecodeUint32() + return nil +} + +// GetNodeGraph defines message 'get_node_graph'. +type GetNodeGraph struct{} + +func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } +func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } +func (*GetNodeGraph) GetCrcString() string { return "51077d14" } +func (*GetNodeGraph) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNodeGraph) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *GetNodeGraph) Unmarshal(b []byte) error { + return nil +} + +// GetNodeGraphReply defines message 'get_node_graph_reply'. +type GetNodeGraphReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } +func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } +func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } +func (*GetNodeGraphReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNodeGraphReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 8 // m.ReplyInShmem + return size +} +func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint64(m.ReplyInShmem) + return buf.Bytes(), nil +} +func (m *GetNodeGraphReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.ReplyInShmem = buf.DecodeUint64() + return nil +} + +// GetNodeIndex defines message 'get_node_index'. +type GetNodeIndex struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` +} + +func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } +func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } +func (*GetNodeIndex) GetCrcString() string { return "f1984c64" } +func (*GetNodeIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNodeIndex) Size() (size int) { + if m == nil { + return 0 + } + size += 64 // m.NodeName + return size +} +func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeString(m.NodeName, 64) + return buf.Bytes(), nil +} +func (m *GetNodeIndex) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + return nil +} + +// GetNodeIndexReply defines message 'get_node_index_reply'. +type GetNodeIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` +} + +func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } +func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } +func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } +func (*GetNodeIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNodeIndexReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.NodeIndex + return size +} +func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.NodeIndex) + return buf.Bytes(), nil +} +func (m *GetNodeIndexReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.NodeIndex = buf.DecodeUint32() + return nil +} + +// ShowThreads defines message 'show_threads'. +type ShowThreads struct{} + +func (m *ShowThreads) Reset() { *m = ShowThreads{} } +func (*ShowThreads) GetMessageName() string { return "show_threads" } +func (*ShowThreads) GetCrcString() string { return "51077d14" } +func (*ShowThreads) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowThreads) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *ShowThreads) Unmarshal(b []byte) error { + return nil +} + +// ShowThreadsReply defines message 'show_threads_reply'. +type ShowThreadsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` +} + +func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } +func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } +func (*ShowThreadsReply) GetCrcString() string { return "efd78e83" } +func (*ShowThreadsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowThreadsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var s1 ThreadData + _ = s1 + if j1 < len(m.ThreadData) { + s1 = m.ThreadData[j1] + } + size += 4 // s1.ID + size += 64 // s1.Name + size += 64 // s1.Type + size += 4 // s1.PID + size += 4 // s1.CPUID + size += 4 // s1.Core + size += 4 // s1.CPUSocket + } + return size +} +func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(len(m.ThreadData))) + for j0 := 0; j0 < len(m.ThreadData); j0++ { + var v0 ThreadData // ThreadData + if j0 < len(m.ThreadData) { + v0 = m.ThreadData[j0] + } + buf.EncodeUint32(v0.ID) + buf.EncodeString(v0.Name, 64) + buf.EncodeString(v0.Type, 64) + buf.EncodeUint32(v0.PID) + buf.EncodeUint32(v0.CPUID) + buf.EncodeUint32(v0.Core) + buf.EncodeUint32(v0.CPUSocket) + } + return buf.Bytes(), nil +} +func (m *ShowThreadsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.Count = buf.DecodeUint32() + m.ThreadData = make([]ThreadData, m.Count) + for j0 := 0; j0 < len(m.ThreadData); j0++ { + m.ThreadData[j0].ID = buf.DecodeUint32() + m.ThreadData[j0].Name = buf.DecodeString(64) + m.ThreadData[j0].Type = buf.DecodeString(64) + m.ThreadData[j0].PID = buf.DecodeUint32() + m.ThreadData[j0].CPUID = buf.DecodeUint32() + m.ThreadData[j0].Core = buf.DecodeUint32() + m.ThreadData[j0].CPUSocket = buf.DecodeUint32() + } + return nil +} + +func init() { file_vlib_binapi_init() } +func file_vlib_binapi_init() { + api.RegisterMessage((*AddNodeNext)(nil), "add_node_next_2457116d") + api.RegisterMessage((*AddNodeNextReply)(nil), "add_node_next_reply_2ed75f32") + api.RegisterMessage((*Cli)(nil), "cli_23bfbfff") + api.RegisterMessage((*CliInband)(nil), "cli_inband_f8377302") + api.RegisterMessage((*CliInbandReply)(nil), "cli_inband_reply_05879051") + api.RegisterMessage((*CliReply)(nil), "cli_reply_06d68297") + api.RegisterMessage((*GetF64EndianValue)(nil), "get_f64_endian_value_809fcd44") + api.RegisterMessage((*GetF64EndianValueReply)(nil), "get_f64_endian_value_reply_7e02e404") + api.RegisterMessage((*GetF64IncrementByOne)(nil), "get_f64_increment_by_one_b64f027e") + api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "get_f64_increment_by_one_reply_d25dbaa3") + api.RegisterMessage((*GetNextIndex)(nil), "get_next_index_2457116d") + api.RegisterMessage((*GetNextIndexReply)(nil), "get_next_index_reply_2ed75f32") + api.RegisterMessage((*GetNodeGraph)(nil), "get_node_graph_51077d14") + api.RegisterMessage((*GetNodeGraphReply)(nil), "get_node_graph_reply_06d68297") + api.RegisterMessage((*GetNodeIndex)(nil), "get_node_index_f1984c64") + api.RegisterMessage((*GetNodeIndexReply)(nil), "get_node_index_reply_a8600b89") + api.RegisterMessage((*ShowThreads)(nil), "show_threads_51077d14") + api.RegisterMessage((*ShowThreadsReply)(nil), "show_threads_reply_efd78e83") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*GetF64EndianValue)(nil), + (*GetF64EndianValueReply)(nil), + (*GetF64IncrementByOne)(nil), + (*GetF64IncrementByOneReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + } +} diff --git a/binapi/vlib/vlib_rpc.ba.go b/binapi/vlib/vlib_rpc.ba.go new file mode 100644 index 0000000..f12427e --- /dev/null +++ b/binapi/vlib/vlib_rpc.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vlib + +import ( + "context" + + api "go.fd.io/govpp/api" +) + +// RPCService defines RPC service vlib. +type RPCService interface { + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(int32(out.Retval)) +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(int32(out.Retval)) +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/vmxnet3/vmxnet3.ba.go b/binapi/vmxnet3/vmxnet3.ba.go index 77937fa..2c43e71 100644 --- a/binapi/vmxnet3/vmxnet3.ba.go +++ b/binapi/vmxnet3/vmxnet3.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/vmxnet3.api.json // Package vmxnet3 contains generated bindings for API file vmxnet3.api. // // Contents: // 2 structs -// 6 messages +// 8 messages // package vmxnet3 import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -27,8 +27,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vmxnet3" - APIVersion = "1.1.0" - VersionCrc = 0x38928311 + APIVersion = "1.2.0" + VersionCrc = 0x609454ea ) // Vmxnet3RxList defines type 'vmxnet3_rx_list'. @@ -48,6 +48,168 @@ type Vmxnet3TxList struct { TxConsume uint16 `binapi:"u16,name=tx_consume" json:"tx_consume,omitempty"` } +// SwVmxnet3InterfaceDetails defines message 'sw_vmxnet3_interface_details'. +type SwVmxnet3InterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` + Version uint8 `binapi:"u8,name=version" json:"version,omitempty"` + AdminUpDown bool `binapi:"bool,name=admin_up_down" json:"admin_up_down,omitempty"` + RxCount uint8 `binapi:"u8,name=rx_count" json:"rx_count,omitempty"` + RxList [16]Vmxnet3RxList `binapi:"vmxnet3_rx_list[16],name=rx_list" json:"rx_list,omitempty"` + TxCount uint8 `binapi:"u8,name=tx_count" json:"tx_count,omitempty"` + TxList [8]Vmxnet3TxList `binapi:"vmxnet3_tx_list[8],name=tx_list" json:"tx_list,omitempty"` +} + +func (m *SwVmxnet3InterfaceDetails) Reset() { *m = SwVmxnet3InterfaceDetails{} } +func (*SwVmxnet3InterfaceDetails) GetMessageName() string { return "sw_vmxnet3_interface_details" } +func (*SwVmxnet3InterfaceDetails) GetCrcString() string { return "6a1a5498" } +func (*SwVmxnet3InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwVmxnet3InterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 64 // m.IfName + size += 1 * 6 // m.HwAddr + size += 4 // m.PciAddr + size += 1 // m.Version + size += 1 // m.AdminUpDown + size += 1 // m.RxCount + for j1 := 0; j1 < 16; j1++ { + size += 2 // m.RxList[j1].RxQsize + size += 2 * 2 // m.RxList[j1].RxFill + size += 2 // m.RxList[j1].RxNext + size += 2 * 2 // m.RxList[j1].RxProduce + size += 2 * 2 // m.RxList[j1].RxConsume + } + size += 1 // m.TxCount + for j1 := 0; j1 < 8; j1++ { + size += 2 // m.TxList[j1].TxQsize + size += 2 // m.TxList[j1].TxNext + size += 2 // m.TxList[j1].TxProduce + size += 2 // m.TxList[j1].TxConsume + } + return size +} +func (m *SwVmxnet3InterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.IfName, 64) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeUint32(m.PciAddr) + buf.EncodeUint8(m.Version) + buf.EncodeBool(m.AdminUpDown) + buf.EncodeUint8(m.RxCount) + for j0 := 0; j0 < 16; j0++ { + buf.EncodeUint16(m.RxList[j0].RxQsize) + for i := 0; i < 2; i++ { + var x uint16 + if i < len(m.RxList[j0].RxFill) { + x = uint16(m.RxList[j0].RxFill[i]) + } + buf.EncodeUint16(x) + } + buf.EncodeUint16(m.RxList[j0].RxNext) + for i := 0; i < 2; i++ { + var x uint16 + if i < len(m.RxList[j0].RxProduce) { + x = uint16(m.RxList[j0].RxProduce[i]) + } + buf.EncodeUint16(x) + } + for i := 0; i < 2; i++ { + var x uint16 + if i < len(m.RxList[j0].RxConsume) { + x = uint16(m.RxList[j0].RxConsume[i]) + } + buf.EncodeUint16(x) + } + } + buf.EncodeUint8(m.TxCount) + for j0 := 0; j0 < 8; j0++ { + buf.EncodeUint16(m.TxList[j0].TxQsize) + buf.EncodeUint16(m.TxList[j0].TxNext) + buf.EncodeUint16(m.TxList[j0].TxProduce) + buf.EncodeUint16(m.TxList[j0].TxConsume) + } + return buf.Bytes(), nil +} +func (m *SwVmxnet3InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IfName = buf.DecodeString(64) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.PciAddr = buf.DecodeUint32() + m.Version = buf.DecodeUint8() + m.AdminUpDown = buf.DecodeBool() + m.RxCount = buf.DecodeUint8() + for j0 := 0; j0 < 16; j0++ { + m.RxList[j0].RxQsize = buf.DecodeUint16() + m.RxList[j0].RxFill = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxFill); i++ { + m.RxList[j0].RxFill[i] = buf.DecodeUint16() + } + m.RxList[j0].RxNext = buf.DecodeUint16() + m.RxList[j0].RxProduce = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxProduce); i++ { + m.RxList[j0].RxProduce[i] = buf.DecodeUint16() + } + m.RxList[j0].RxConsume = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxConsume); i++ { + m.RxList[j0].RxConsume[i] = buf.DecodeUint16() + } + } + m.TxCount = buf.DecodeUint8() + for j0 := 0; j0 < 8; j0++ { + m.TxList[j0].TxQsize = buf.DecodeUint16() + m.TxList[j0].TxNext = buf.DecodeUint16() + m.TxList[j0].TxProduce = buf.DecodeUint16() + m.TxList[j0].TxConsume = buf.DecodeUint16() + } + return nil +} + +// SwVmxnet3InterfaceDump defines message 'sw_vmxnet3_interface_dump'. +type SwVmxnet3InterfaceDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` +} + +func (m *SwVmxnet3InterfaceDump) Reset() { *m = SwVmxnet3InterfaceDump{} } +func (*SwVmxnet3InterfaceDump) GetMessageName() string { return "sw_vmxnet3_interface_dump" } +func (*SwVmxnet3InterfaceDump) GetCrcString() string { return "f9e6675e" } +func (*SwVmxnet3InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwVmxnet3InterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwVmxnet3InterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwVmxnet3InterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // Vmxnet3Create defines message 'vmxnet3_create'. type Vmxnet3Create struct { PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` @@ -228,7 +390,7 @@ type Vmxnet3Details struct { func (m *Vmxnet3Details) Reset() { *m = Vmxnet3Details{} } func (*Vmxnet3Details) GetMessageName() string { return "vmxnet3_details" } -func (*Vmxnet3Details) GetCrcString() string { return "829ba055" } +func (*Vmxnet3Details) GetCrcString() string { return "6a1a5498" } func (*Vmxnet3Details) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -342,6 +504,7 @@ func (m *Vmxnet3Details) Unmarshal(b []byte) error { } // Vmxnet3Dump defines message 'vmxnet3_dump'. +// Deprecated: the message will be removed in the future versions type Vmxnet3Dump struct{} func (m *Vmxnet3Dump) Reset() { *m = Vmxnet3Dump{} } @@ -370,17 +533,21 @@ func (m *Vmxnet3Dump) Unmarshal(b []byte) error { func init() { file_vmxnet3_binapi_init() } func file_vmxnet3_binapi_init() { + api.RegisterMessage((*SwVmxnet3InterfaceDetails)(nil), "sw_vmxnet3_interface_details_6a1a5498") + api.RegisterMessage((*SwVmxnet3InterfaceDump)(nil), "sw_vmxnet3_interface_dump_f9e6675e") api.RegisterMessage((*Vmxnet3Create)(nil), "vmxnet3_create_71a07314") api.RegisterMessage((*Vmxnet3CreateReply)(nil), "vmxnet3_create_reply_5383d31f") api.RegisterMessage((*Vmxnet3Delete)(nil), "vmxnet3_delete_f9e6675e") api.RegisterMessage((*Vmxnet3DeleteReply)(nil), "vmxnet3_delete_reply_e8d4e804") - api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3_details_829ba055") + api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3_details_6a1a5498") api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3_dump_51077d14") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*SwVmxnet3InterfaceDetails)(nil), + (*SwVmxnet3InterfaceDump)(nil), (*Vmxnet3Create)(nil), (*Vmxnet3CreateReply)(nil), (*Vmxnet3Delete)(nil), diff --git a/binapi/vmxnet3/vmxnet3_rest.ba.go b/binapi/vmxnet3/vmxnet3_rest.ba.go deleted file mode 100644 index 3280f8c..0000000 --- a/binapi/vmxnet3/vmxnet3_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vmxnet3 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vmxnet3_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(Vmxnet3Create) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Vmxnet3Create(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vmxnet3_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(Vmxnet3Delete) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Vmxnet3Delete(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vmxnet3/vmxnet3_rpc.ba.go b/binapi/vmxnet3/vmxnet3_rpc.ba.go index cb4020d..2d5329c 100644 --- a/binapi/vmxnet3/vmxnet3_rpc.ba.go +++ b/binapi/vmxnet3/vmxnet3_rpc.ba.go @@ -5,13 +5,15 @@ package vmxnet3 import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vmxnet3. +// RPCService defines RPC service vmxnet3. type RPCService interface { + SwVmxnet3InterfaceDump(ctx context.Context, in *SwVmxnet3InterfaceDump) (RPCService_SwVmxnet3InterfaceDumpClient, error) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCService_Vmxnet3DumpClient, error) @@ -25,13 +27,56 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) SwVmxnet3InterfaceDump(ctx context.Context, in *SwVmxnet3InterfaceDump) (RPCService_SwVmxnet3InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwVmxnet3InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwVmxnet3InterfaceDumpClient interface { + Recv() (*SwVmxnet3InterfaceDetails, error) + api.Stream +} + +type serviceClient_SwVmxnet3InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwVmxnet3InterfaceDumpClient) Recv() (*SwVmxnet3InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwVmxnet3InterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) { out := new(Vmxnet3CreateReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { @@ -40,7 +85,7 @@ func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCService_Vmxnet3DumpClient, error) { @@ -52,7 +97,7 @@ func (c *serviceClient) Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCSe if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -75,7 +120,11 @@ func (c *serviceClient_Vmxnet3DumpClient) Recv() (*Vmxnet3Details, error) { switch m := msg.(type) { case *Vmxnet3Details: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/vpe/vpe.ba.go b/binapi/vpe/vpe.ba.go index 046bd68..bb25552 100644 --- a/binapi/vpe/vpe.ba.go +++ b/binapi/vpe/vpe.ba.go @@ -1,21 +1,20 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/vpe.api.json // Package vpe contains generated bindings for API file vpe.api. // // Contents: -// 1 struct -// 26 messages +// 6 messages // package vpe import ( - api "git.fd.io/govpp.git/api" - vpe_types "git.fd.io/govpp.git/binapi/vpe_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + vpe_types "go.fd.io/govpp/binapi/vpe_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,651 +25,10 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vpe" - APIVersion = "1.6.1" - VersionCrc = 0xbd2c94f4 + APIVersion = "1.7.0" + VersionCrc = 0xbbfa7484 ) -// ThreadData defines type 'thread_data'. -type ThreadData struct { - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty"` - Type string `binapi:"string[64],name=type" json:"type,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` - Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` - CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` -} - -// AddNodeNext defines message 'add_node_next'. -type AddNodeNext struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` - NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` -} - -func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } -func (*AddNodeNext) GetMessageName() string { return "add_node_next" } -func (*AddNodeNext) GetCrcString() string { return "2457116d" } -func (*AddNodeNext) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *AddNodeNext) Size() (size int) { - if m == nil { - return 0 - } - size += 64 // m.NodeName - size += 64 // m.NextName - return size -} -func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeString(m.NodeName, 64) - buf.EncodeString(m.NextName, 64) - return buf.Bytes(), nil -} -func (m *AddNodeNext) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.NodeName = buf.DecodeString(64) - m.NextName = buf.DecodeString(64) - return nil -} - -// AddNodeNextReply defines message 'add_node_next_reply'. -type AddNodeNextReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } -func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } -func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } -func (*AddNodeNextReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *AddNodeNextReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.NextIndex - return size -} -func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.NextIndex) - return buf.Bytes(), nil -} -func (m *AddNodeNextReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.NextIndex = buf.DecodeUint32() - return nil -} - -// Cli defines message 'cli'. -type Cli struct { - CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` -} - -func (m *Cli) Reset() { *m = Cli{} } -func (*Cli) GetMessageName() string { return "cli" } -func (*Cli) GetCrcString() string { return "23bfbfff" } -func (*Cli) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *Cli) Size() (size int) { - if m == nil { - return 0 - } - size += 8 // m.CmdInShmem - return size -} -func (m *Cli) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint64(m.CmdInShmem) - return buf.Bytes(), nil -} -func (m *Cli) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.CmdInShmem = buf.DecodeUint64() - return nil -} - -// CliInband defines message 'cli_inband'. -type CliInband struct { - Cmd string `binapi:"string[],name=cmd" json:"cmd,omitempty"` -} - -func (m *CliInband) Reset() { *m = CliInband{} } -func (*CliInband) GetMessageName() string { return "cli_inband" } -func (*CliInband) GetCrcString() string { return "f8377302" } -func (*CliInband) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *CliInband) Size() (size int) { - if m == nil { - return 0 - } - size += 4 + len(m.Cmd) // m.Cmd - return size -} -func (m *CliInband) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeString(m.Cmd, 0) - return buf.Bytes(), nil -} -func (m *CliInband) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Cmd = buf.DecodeString(0) - return nil -} - -// CliInbandReply defines message 'cli_inband_reply'. -type CliInbandReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Reply string `binapi:"string[],name=reply" json:"reply,omitempty"` -} - -func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } -func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } -func (*CliInbandReply) GetCrcString() string { return "05879051" } -func (*CliInbandReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *CliInbandReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 + len(m.Reply) // m.Reply - return size -} -func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeString(m.Reply, 0) - return buf.Bytes(), nil -} -func (m *CliInbandReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.Reply = buf.DecodeString(0) - return nil -} - -// CliReply defines message 'cli_reply'. -type CliReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *CliReply) Reset() { *m = CliReply{} } -func (*CliReply) GetMessageName() string { return "cli_reply" } -func (*CliReply) GetCrcString() string { return "06d68297" } -func (*CliReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *CliReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 8 // m.ReplyInShmem - return size -} -func (m *CliReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint64(m.ReplyInShmem) - return buf.Bytes(), nil -} -func (m *CliReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.ReplyInShmem = buf.DecodeUint64() - return nil -} - -// ControlPing defines message 'control_ping'. -type ControlPing struct{} - -func (m *ControlPing) Reset() { *m = ControlPing{} } -func (*ControlPing) GetMessageName() string { return "control_ping" } -func (*ControlPing) GetCrcString() string { return "51077d14" } -func (*ControlPing) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *ControlPing) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *ControlPing) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *ControlPing) Unmarshal(b []byte) error { - return nil -} - -// ControlPingReply defines message 'control_ping_reply'. -type ControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } -func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } -func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*ControlPingReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *ControlPingReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.ClientIndex - size += 4 // m.VpePID - return size -} -func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.ClientIndex) - buf.EncodeUint32(m.VpePID) - return buf.Bytes(), nil -} -func (m *ControlPingReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.ClientIndex = buf.DecodeUint32() - m.VpePID = buf.DecodeUint32() - return nil -} - -// GetF64EndianValue defines message 'get_f64_endian_value'. -type GetF64EndianValue struct { - F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` -} - -func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } -func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } -func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } -func (*GetF64EndianValue) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GetF64EndianValue) Size() (size int) { - if m == nil { - return 0 - } - size += 8 // m.F64One - return size -} -func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeFloat64(m.F64One) - return buf.Bytes(), nil -} -func (m *GetF64EndianValue) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.F64One = buf.DecodeFloat64() - return nil -} - -// GetF64EndianValueReply defines message 'get_f64_endian_value_reply'. -type GetF64EndianValueReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` -} - -func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } -func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } -func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } -func (*GetF64EndianValueReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GetF64EndianValueReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 8 // m.F64OneResult - return size -} -func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Retval) - buf.EncodeFloat64(m.F64OneResult) - return buf.Bytes(), nil -} -func (m *GetF64EndianValueReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeUint32() - m.F64OneResult = buf.DecodeFloat64() - return nil -} - -// GetF64IncrementByOne defines message 'get_f64_increment_by_one'. -type GetF64IncrementByOne struct { - F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } -func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } -func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } -func (*GetF64IncrementByOne) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GetF64IncrementByOne) Size() (size int) { - if m == nil { - return 0 - } - size += 8 // m.F64Value - return size -} -func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeFloat64(m.F64Value) - return buf.Bytes(), nil -} -func (m *GetF64IncrementByOne) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.F64Value = buf.DecodeFloat64() - return nil -} - -// GetF64IncrementByOneReply defines message 'get_f64_increment_by_one_reply'. -type GetF64IncrementByOneReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } -func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } -func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } -func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GetF64IncrementByOneReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 8 // m.F64Value - return size -} -func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Retval) - buf.EncodeFloat64(m.F64Value) - return buf.Bytes(), nil -} -func (m *GetF64IncrementByOneReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeUint32() - m.F64Value = buf.DecodeFloat64() - return nil -} - -// GetNextIndex defines message 'get_next_index'. -type GetNextIndex struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` - NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` -} - -func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } -func (*GetNextIndex) GetMessageName() string { return "get_next_index" } -func (*GetNextIndex) GetCrcString() string { return "2457116d" } -func (*GetNextIndex) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GetNextIndex) Size() (size int) { - if m == nil { - return 0 - } - size += 64 // m.NodeName - size += 64 // m.NextName - return size -} -func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeString(m.NodeName, 64) - buf.EncodeString(m.NextName, 64) - return buf.Bytes(), nil -} -func (m *GetNextIndex) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.NodeName = buf.DecodeString(64) - m.NextName = buf.DecodeString(64) - return nil -} - -// GetNextIndexReply defines message 'get_next_index_reply'. -type GetNextIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } -func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } -func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } -func (*GetNextIndexReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GetNextIndexReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.NextIndex - return size -} -func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.NextIndex) - return buf.Bytes(), nil -} -func (m *GetNextIndexReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.NextIndex = buf.DecodeUint32() - return nil -} - -// GetNodeGraph defines message 'get_node_graph'. -type GetNodeGraph struct{} - -func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } -func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } -func (*GetNodeGraph) GetCrcString() string { return "51077d14" } -func (*GetNodeGraph) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GetNodeGraph) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *GetNodeGraph) Unmarshal(b []byte) error { - return nil -} - -// GetNodeGraphReply defines message 'get_node_graph_reply'. -type GetNodeGraphReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } -func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } -func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } -func (*GetNodeGraphReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GetNodeGraphReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 8 // m.ReplyInShmem - return size -} -func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint64(m.ReplyInShmem) - return buf.Bytes(), nil -} -func (m *GetNodeGraphReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.ReplyInShmem = buf.DecodeUint64() - return nil -} - -// GetNodeIndex defines message 'get_node_index'. -type GetNodeIndex struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` -} - -func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } -func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } -func (*GetNodeIndex) GetCrcString() string { return "f1984c64" } -func (*GetNodeIndex) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *GetNodeIndex) Size() (size int) { - if m == nil { - return 0 - } - size += 64 // m.NodeName - return size -} -func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeString(m.NodeName, 64) - return buf.Bytes(), nil -} -func (m *GetNodeIndex) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.NodeName = buf.DecodeString(64) - return nil -} - -// GetNodeIndexReply defines message 'get_node_index_reply'. -type GetNodeIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` -} - -func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } -func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } -func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } -func (*GetNodeIndexReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *GetNodeIndexReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.NodeIndex - return size -} -func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.NodeIndex) - return buf.Bytes(), nil -} -func (m *GetNodeIndexReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.NodeIndex = buf.DecodeUint32() - return nil -} - // LogDetails defines message 'log_details'. type LogDetails struct { Timestamp vpe_types.Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` @@ -681,7 +39,7 @@ type LogDetails struct { func (m *LogDetails) Reset() { *m = LogDetails{} } func (*LogDetails) GetMessageName() string { return "log_details" } -func (*LogDetails) GetCrcString() string { return "255827a1" } +func (*LogDetails) GetCrcString() string { return "03d61cc0" } func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -749,108 +107,6 @@ func (m *LogDump) Unmarshal(b []byte) error { return nil } -// ShowThreads defines message 'show_threads'. -type ShowThreads struct{} - -func (m *ShowThreads) Reset() { *m = ShowThreads{} } -func (*ShowThreads) GetMessageName() string { return "show_threads" } -func (*ShowThreads) GetCrcString() string { return "51077d14" } -func (*ShowThreads) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *ShowThreads) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *ShowThreads) Unmarshal(b []byte) error { - return nil -} - -// ShowThreadsReply defines message 'show_threads_reply'. -type ShowThreadsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Count uint32 `binapi:"u32,name=count" json:"-"` - ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` -} - -func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } -func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } -func (*ShowThreadsReply) GetCrcString() string { return "efd78e83" } -func (*ShowThreadsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *ShowThreadsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.Count - for j1 := 0; j1 < len(m.ThreadData); j1++ { - var s1 ThreadData - _ = s1 - if j1 < len(m.ThreadData) { - s1 = m.ThreadData[j1] - } - size += 4 // s1.ID - size += 64 // s1.Name - size += 64 // s1.Type - size += 4 // s1.PID - size += 4 // s1.CPUID - size += 4 // s1.Core - size += 4 // s1.CPUSocket - } - return size -} -func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(uint32(len(m.ThreadData))) - for j0 := 0; j0 < len(m.ThreadData); j0++ { - var v0 ThreadData // ThreadData - if j0 < len(m.ThreadData) { - v0 = m.ThreadData[j0] - } - buf.EncodeUint32(v0.ID) - buf.EncodeString(v0.Name, 64) - buf.EncodeString(v0.Type, 64) - buf.EncodeUint32(v0.PID) - buf.EncodeUint32(v0.CPUID) - buf.EncodeUint32(v0.Core) - buf.EncodeUint32(v0.CPUSocket) - } - return buf.Bytes(), nil -} -func (m *ShowThreadsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.Count = buf.DecodeUint32() - m.ThreadData = make([]ThreadData, m.Count) - for j0 := 0; j0 < len(m.ThreadData); j0++ { - m.ThreadData[j0].ID = buf.DecodeUint32() - m.ThreadData[j0].Name = buf.DecodeString(64) - m.ThreadData[j0].Type = buf.DecodeString(64) - m.ThreadData[j0].PID = buf.DecodeUint32() - m.ThreadData[j0].CPUID = buf.DecodeUint32() - m.ThreadData[j0].Core = buf.DecodeUint32() - m.ThreadData[j0].CPUSocket = buf.DecodeUint32() - } - return nil -} - // ShowVersion defines message 'show_version'. type ShowVersion struct{} @@ -993,28 +249,8 @@ func (m *ShowVpeSystemTimeReply) Unmarshal(b []byte) error { func init() { file_vpe_binapi_init() } func file_vpe_binapi_init() { - api.RegisterMessage((*AddNodeNext)(nil), "add_node_next_2457116d") - api.RegisterMessage((*AddNodeNextReply)(nil), "add_node_next_reply_2ed75f32") - api.RegisterMessage((*Cli)(nil), "cli_23bfbfff") - api.RegisterMessage((*CliInband)(nil), "cli_inband_f8377302") - api.RegisterMessage((*CliInbandReply)(nil), "cli_inband_reply_05879051") - api.RegisterMessage((*CliReply)(nil), "cli_reply_06d68297") - api.RegisterMessage((*ControlPing)(nil), "control_ping_51077d14") - api.RegisterMessage((*ControlPingReply)(nil), "control_ping_reply_f6b0b8ca") - api.RegisterMessage((*GetF64EndianValue)(nil), "get_f64_endian_value_809fcd44") - api.RegisterMessage((*GetF64EndianValueReply)(nil), "get_f64_endian_value_reply_7e02e404") - api.RegisterMessage((*GetF64IncrementByOne)(nil), "get_f64_increment_by_one_b64f027e") - api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "get_f64_increment_by_one_reply_d25dbaa3") - api.RegisterMessage((*GetNextIndex)(nil), "get_next_index_2457116d") - api.RegisterMessage((*GetNextIndexReply)(nil), "get_next_index_reply_2ed75f32") - api.RegisterMessage((*GetNodeGraph)(nil), "get_node_graph_51077d14") - api.RegisterMessage((*GetNodeGraphReply)(nil), "get_node_graph_reply_06d68297") - api.RegisterMessage((*GetNodeIndex)(nil), "get_node_index_f1984c64") - api.RegisterMessage((*GetNodeIndexReply)(nil), "get_node_index_reply_a8600b89") - api.RegisterMessage((*LogDetails)(nil), "log_details_255827a1") + api.RegisterMessage((*LogDetails)(nil), "log_details_03d61cc0") api.RegisterMessage((*LogDump)(nil), "log_dump_6ab31753") - api.RegisterMessage((*ShowThreads)(nil), "show_threads_51077d14") - api.RegisterMessage((*ShowThreadsReply)(nil), "show_threads_reply_efd78e83") api.RegisterMessage((*ShowVersion)(nil), "show_version_51077d14") api.RegisterMessage((*ShowVersionReply)(nil), "show_version_reply_c919bde1") api.RegisterMessage((*ShowVpeSystemTime)(nil), "show_vpe_system_time_51077d14") @@ -1024,28 +260,8 @@ func file_vpe_binapi_init() { // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetF64EndianValue)(nil), - (*GetF64EndianValueReply)(nil), - (*GetF64IncrementByOne)(nil), - (*GetF64IncrementByOneReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), (*LogDetails)(nil), (*LogDump)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), (*ShowVersion)(nil), (*ShowVersionReply)(nil), (*ShowVpeSystemTime)(nil), diff --git a/binapi/vpe/vpe_http.ba.go b/binapi/vpe/vpe_http.ba.go new file mode 100644 index 0000000..cf66380 --- /dev/null +++ b/binapi/vpe/vpe_http.ba.go @@ -0,0 +1,41 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "encoding/json" + "net/http" +) + +func HTTPHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/show_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowVersion) + reply, err := rpc.ShowVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_vpe_system_time", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowVpeSystemTime) + reply, err := rpc.ShowVpeSystemTime(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vpe/vpe_rest.ba.go b/binapi/vpe/vpe_rest.ba.go deleted file mode 100644 index 2f92a62..0000000 --- a/binapi/vpe/vpe_rest.ba.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/add_node_next", func(w http.ResponseWriter, req *http.Request) { - var request = new(AddNodeNext) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.AddNodeNext(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/cli", func(w http.ResponseWriter, req *http.Request) { - var request = new(Cli) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.Cli(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/cli_inband", func(w http.ResponseWriter, req *http.Request) { - var request = new(CliInband) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.CliInband(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ControlPing) - reply, err := rpc.ControlPing(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_f64_endian_value", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetF64EndianValue) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GetF64EndianValue(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_f64_increment_by_one", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetF64IncrementByOne) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GetF64IncrementByOne(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_next_index", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNextIndex) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GetNextIndex(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_node_graph", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNodeGraph) - reply, err := rpc.GetNodeGraph(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/get_node_index", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNodeIndex) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.GetNodeIndex(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_threads", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowThreads) - reply, err := rpc.ShowThreads(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowVersion) - reply, err := rpc.ShowVersion(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/show_vpe_system_time", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowVpeSystemTime) - reply, err := rpc.ShowVpeSystemTime(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vpe/vpe_rpc.ba.go b/binapi/vpe/vpe_rpc.ba.go index dfa669f..a9f41e6 100644 --- a/binapi/vpe/vpe_rpc.ba.go +++ b/binapi/vpe/vpe_rpc.ba.go @@ -5,23 +5,15 @@ package vpe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vpe. +// RPCService defines RPC service vpe. type RPCService interface { - AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) - Cli(ctx context.Context, in *Cli) (*CliReply, error) - CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) - ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) - GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) - GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) - GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) - ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) } @@ -34,87 +26,6 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } -func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { - out := new(AddNodeNextReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { - out := new(CliReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { - out := new(CliInbandReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { - out := new(ControlPingReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { - out := new(GetF64EndianValueReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { - out := new(GetF64IncrementByOneReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { - out := new(GetNextIndexReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { - out := new(GetNodeGraphReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { - out := new(GetNodeIndexReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - func (c *serviceClient) LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) { stream, err := c.conn.NewStream(ctx) if err != nil { @@ -124,7 +35,7 @@ func (c *serviceClient) LogDump(ctx context.Context, in *LogDump) (RPCService_Lo if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -147,29 +58,24 @@ func (c *serviceClient_LogDumpClient) Recv() (*LogDetails, error) { switch m := msg.(type) { case *LogDetails: return m, nil - case *ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } -func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { - out := new(ShowThreadsReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { out := new(ShowVersionReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { @@ -178,5 +84,5 @@ func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystem if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/vpe_types/vpe_types.ba.go b/binapi/vpe_types/vpe_types.ba.go index 538b497..fc44700 100644 --- a/binapi/vpe_types/vpe_types.ba.go +++ b/binapi/vpe_types/vpe_types.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/vpe_types.api.json // Package vpe_types contains generated bindings for API file vpe_types.api. @@ -14,8 +14,10 @@ package vpe_types import ( - api "git.fd.io/govpp.git/api" "strconv" + "time" + + api "go.fd.io/govpp/api" ) // This is a compile-time assertion to ensure that this generated file @@ -24,6 +26,12 @@ import ( // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 +const ( + APIFile = "vpe_types" + APIVersion = "1.0.0" + VersionCrc = 0x5f754a1c +) + // LogLevel defines enum 'log_level'. type LogLevel uint32 @@ -78,6 +86,37 @@ type Timedelta float64 // Timestamp defines alias 'timestamp'. type Timestamp float64 +func NewTimestamp(t time.Time) Timestamp { + sec := int64(t.Unix()) + nsec := int32(t.Nanosecond()) + ns := float64(sec) + float64(nsec/1e9) + return Timestamp(ns) +} + +func (x Timestamp) ToTime() time.Time { + ns := int64(x * 1e9) + sec := ns / 1e9 + nsec := ns % 1e9 + return time.Unix(sec, nsec) +} + +func (x Timestamp) String() string { + return x.ToTime().String() +} + +func (x *Timestamp) MarshalText() ([]byte, error) { + return []byte(x.ToTime().Format(time.RFC3339Nano)), nil +} + +func (x *Timestamp) UnmarshalText(text []byte) error { + t, err := time.Parse(time.RFC3339Nano, string(text)) + if err != nil { + return err + } + *x = NewTimestamp(t) + return nil +} + // Version defines type 'version'. type Version struct { Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` diff --git a/binapi/vrrp/vrrp.ba.go b/binapi/vrrp/vrrp.ba.go index ef34cdd..752a6f9 100644 --- a/binapi/vrrp/vrrp.ba.go +++ b/binapi/vrrp/vrrp.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/vrrp.api.json // Package vrrp contains generated bindings for API file vrrp.api. @@ -9,17 +9,18 @@ // Contents: // 2 enums // 5 structs -// 14 messages +// 17 messages // package vrrp import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" "strconv" + + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -31,7 +32,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vrrp" APIVersion = "1.0.1" - VersionCrc = 0x1903f1f1 + VersionCrc = 0x6a3c71cd ) // VrrpVrFlags defines enum 'vrrp_vr_flags'. @@ -171,7 +172,7 @@ type VrrpVrAddDel struct { func (m *VrrpVrAddDel) Reset() { *m = VrrpVrAddDel{} } func (*VrrpVrAddDel) GetMessageName() string { return "vrrp_vr_add_del" } -func (*VrrpVrAddDel) GetCrcString() string { return "6dc4b881" } +func (*VrrpVrAddDel) GetCrcString() string { return "c5cf15aa" } func (*VrrpVrAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -280,7 +281,7 @@ type VrrpVrDetails struct { func (m *VrrpVrDetails) Reset() { *m = VrrpVrDetails{} } func (*VrrpVrDetails) GetMessageName() string { return "vrrp_vr_details" } -func (*VrrpVrDetails) GetCrcString() string { return "0412fa71" } +func (*VrrpVrDetails) GetCrcString() string { return "46edcebd" } func (*VrrpVrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -397,6 +398,57 @@ func (m *VrrpVrDump) Unmarshal(b []byte) error { return nil } +// VrrpVrEvent defines message 'vrrp_vr_event'. +type VrrpVrEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + Vr VrrpVrKey `binapi:"vrrp_vr_key,name=vr" json:"vr,omitempty"` + OldState VrrpVrState `binapi:"vrrp_vr_state,name=old_state" json:"old_state,omitempty"` + NewState VrrpVrState `binapi:"vrrp_vr_state,name=new_state" json:"new_state,omitempty"` +} + +func (m *VrrpVrEvent) Reset() { *m = VrrpVrEvent{} } +func (*VrrpVrEvent) GetMessageName() string { return "vrrp_vr_event" } +func (*VrrpVrEvent) GetCrcString() string { return "c1fea6a5" } +func (*VrrpVrEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *VrrpVrEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.Vr.SwIfIndex + size += 1 // m.Vr.VrID + size += 1 // m.Vr.IsIPv6 + size += 4 // m.OldState + size += 4 // m.NewState + return size +} +func (m *VrrpVrEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(uint32(m.Vr.SwIfIndex)) + buf.EncodeUint8(m.Vr.VrID) + buf.EncodeUint8(m.Vr.IsIPv6) + buf.EncodeUint32(uint32(m.OldState)) + buf.EncodeUint32(uint32(m.NewState)) + return buf.Bytes(), nil +} +func (m *VrrpVrEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.Vr.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Vr.VrID = buf.DecodeUint8() + m.Vr.IsIPv6 = buf.DecodeUint8() + m.OldState = VrrpVrState(buf.DecodeUint32()) + m.NewState = VrrpVrState(buf.DecodeUint32()) + return nil +} + // VrrpVrPeerDetails defines message 'vrrp_vr_peer_details'. type VrrpVrPeerDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -408,7 +460,7 @@ type VrrpVrPeerDetails struct { func (m *VrrpVrPeerDetails) Reset() { *m = VrrpVrPeerDetails{} } func (*VrrpVrPeerDetails) GetMessageName() string { return "vrrp_vr_peer_details" } -func (*VrrpVrPeerDetails) GetCrcString() string { return "abd9145e" } +func (*VrrpVrPeerDetails) GetCrcString() string { return "3d99c108" } func (*VrrpVrPeerDetails) GetMessageType() api.MessageType { return api.RequestMessage } @@ -517,7 +569,7 @@ type VrrpVrSetPeers struct { func (m *VrrpVrSetPeers) Reset() { *m = VrrpVrSetPeers{} } func (*VrrpVrSetPeers) GetMessageName() string { return "vrrp_vr_set_peers" } -func (*VrrpVrSetPeers) GetCrcString() string { return "baa2e52b" } +func (*VrrpVrSetPeers) GetCrcString() string { return "20bec71f" } func (*VrrpVrSetPeers) GetMessageType() api.MessageType { return api.RequestMessage } @@ -697,7 +749,7 @@ type VrrpVrTrackIfAddDel struct { func (m *VrrpVrTrackIfAddDel) Reset() { *m = VrrpVrTrackIfAddDel{} } func (*VrrpVrTrackIfAddDel) GetMessageName() string { return "vrrp_vr_track_if_add_del" } -func (*VrrpVrTrackIfAddDel) GetCrcString() string { return "337f4ba4" } +func (*VrrpVrTrackIfAddDel) GetCrcString() string { return "d67df299" } func (*VrrpVrTrackIfAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -801,7 +853,7 @@ type VrrpVrTrackIfDetails struct { func (m *VrrpVrTrackIfDetails) Reset() { *m = VrrpVrTrackIfDetails{} } func (*VrrpVrTrackIfDetails) GetMessageName() string { return "vrrp_vr_track_if_details" } -func (*VrrpVrTrackIfDetails) GetCrcString() string { return "99bcca9c" } +func (*VrrpVrTrackIfDetails) GetCrcString() string { return "73c36f81" } func (*VrrpVrTrackIfDetails) GetMessageType() api.MessageType { return api.RequestMessage } @@ -903,22 +955,95 @@ func (m *VrrpVrTrackIfDump) Unmarshal(b []byte) error { return nil } +// WantVrrpVrEvents defines message 'want_vrrp_vr_events'. +type WantVrrpVrEvents struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantVrrpVrEvents) Reset() { *m = WantVrrpVrEvents{} } +func (*WantVrrpVrEvents) GetMessageName() string { return "want_vrrp_vr_events" } +func (*WantVrrpVrEvents) GetCrcString() string { return "c5e2af94" } +func (*WantVrrpVrEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantVrrpVrEvents) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantVrrpVrEvents) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *WantVrrpVrEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantVrrpVrEventsReply defines message 'want_vrrp_vr_events_reply'. +type WantVrrpVrEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantVrrpVrEventsReply) Reset() { *m = WantVrrpVrEventsReply{} } +func (*WantVrrpVrEventsReply) GetMessageName() string { return "want_vrrp_vr_events_reply" } +func (*WantVrrpVrEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantVrrpVrEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantVrrpVrEventsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantVrrpVrEventsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WantVrrpVrEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + func init() { file_vrrp_binapi_init() } func file_vrrp_binapi_init() { - api.RegisterMessage((*VrrpVrAddDel)(nil), "vrrp_vr_add_del_6dc4b881") + api.RegisterMessage((*VrrpVrAddDel)(nil), "vrrp_vr_add_del_c5cf15aa") api.RegisterMessage((*VrrpVrAddDelReply)(nil), "vrrp_vr_add_del_reply_e8d4e804") - api.RegisterMessage((*VrrpVrDetails)(nil), "vrrp_vr_details_0412fa71") + api.RegisterMessage((*VrrpVrDetails)(nil), "vrrp_vr_details_46edcebd") api.RegisterMessage((*VrrpVrDump)(nil), "vrrp_vr_dump_f9e6675e") - api.RegisterMessage((*VrrpVrPeerDetails)(nil), "vrrp_vr_peer_details_abd9145e") + api.RegisterMessage((*VrrpVrEvent)(nil), "vrrp_vr_event_c1fea6a5") + api.RegisterMessage((*VrrpVrPeerDetails)(nil), "vrrp_vr_peer_details_3d99c108") api.RegisterMessage((*VrrpVrPeerDump)(nil), "vrrp_vr_peer_dump_6fa3f7c4") - api.RegisterMessage((*VrrpVrSetPeers)(nil), "vrrp_vr_set_peers_baa2e52b") + api.RegisterMessage((*VrrpVrSetPeers)(nil), "vrrp_vr_set_peers_20bec71f") api.RegisterMessage((*VrrpVrSetPeersReply)(nil), "vrrp_vr_set_peers_reply_e8d4e804") api.RegisterMessage((*VrrpVrStartStop)(nil), "vrrp_vr_start_stop_0662a3b7") api.RegisterMessage((*VrrpVrStartStopReply)(nil), "vrrp_vr_start_stop_reply_e8d4e804") - api.RegisterMessage((*VrrpVrTrackIfAddDel)(nil), "vrrp_vr_track_if_add_del_337f4ba4") + api.RegisterMessage((*VrrpVrTrackIfAddDel)(nil), "vrrp_vr_track_if_add_del_d67df299") api.RegisterMessage((*VrrpVrTrackIfAddDelReply)(nil), "vrrp_vr_track_if_add_del_reply_e8d4e804") - api.RegisterMessage((*VrrpVrTrackIfDetails)(nil), "vrrp_vr_track_if_details_99bcca9c") + api.RegisterMessage((*VrrpVrTrackIfDetails)(nil), "vrrp_vr_track_if_details_73c36f81") api.RegisterMessage((*VrrpVrTrackIfDump)(nil), "vrrp_vr_track_if_dump_a34dfc6d") + api.RegisterMessage((*WantVrrpVrEvents)(nil), "want_vrrp_vr_events_c5e2af94") + api.RegisterMessage((*WantVrrpVrEventsReply)(nil), "want_vrrp_vr_events_reply_e8d4e804") } // Messages returns list of all messages in this module. @@ -928,6 +1053,7 @@ func AllMessages() []api.Message { (*VrrpVrAddDelReply)(nil), (*VrrpVrDetails)(nil), (*VrrpVrDump)(nil), + (*VrrpVrEvent)(nil), (*VrrpVrPeerDetails)(nil), (*VrrpVrPeerDump)(nil), (*VrrpVrSetPeers)(nil), @@ -938,5 +1064,7 @@ func AllMessages() []api.Message { (*VrrpVrTrackIfAddDelReply)(nil), (*VrrpVrTrackIfDetails)(nil), (*VrrpVrTrackIfDump)(nil), + (*WantVrrpVrEvents)(nil), + (*WantVrrpVrEventsReply)(nil), } } diff --git a/binapi/vrrp/vrrp_rest.ba.go b/binapi/vrrp/vrrp_rest.ba.go deleted file mode 100644 index 35cedfe..0000000 --- a/binapi/vrrp/vrrp_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vrrp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vrrp_vr_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VrrpVrAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vrrp_vr_set_peers", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrSetPeers) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VrrpVrSetPeers(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vrrp_vr_start_stop", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrStartStop) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VrrpVrStartStop(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vrrp_vr_track_if_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrTrackIfAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VrrpVrTrackIfAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vrrp/vrrp_rpc.ba.go b/binapi/vrrp/vrrp_rpc.ba.go index c001082..5f18b1c 100644 --- a/binapi/vrrp/vrrp_rpc.ba.go +++ b/binapi/vrrp/vrrp_rpc.ba.go @@ -5,12 +5,13 @@ package vrrp import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vrrp. +// RPCService defines RPC service vrrp. type RPCService interface { VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) @@ -19,6 +20,7 @@ type RPCService interface { VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) + WantVrrpVrEvents(ctx context.Context, in *WantVrrpVrEvents) (*WantVrrpVrEventsReply, error) } type serviceClient struct { @@ -35,7 +37,7 @@ func (c *serviceClient) VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*Vr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) { @@ -47,7 +49,7 @@ func (c *serviceClient) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCServ if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -70,7 +72,11 @@ func (c *serviceClient_VrrpVrDumpClient) Recv() (*VrrpVrDetails, error) { switch m := msg.(type) { case *VrrpVrDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -86,7 +92,7 @@ func (c *serviceClient) VrrpVrPeerDump(ctx context.Context, in *VrrpVrPeerDump) if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -109,7 +115,11 @@ func (c *serviceClient_VrrpVrPeerDumpClient) Recv() (*VrrpVrPeerDetails, error) switch m := msg.(type) { case *VrrpVrPeerDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -122,7 +132,7 @@ func (c *serviceClient) VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) { @@ -131,7 +141,7 @@ func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) { @@ -140,7 +150,7 @@ func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrack if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) { @@ -152,7 +162,7 @@ func (c *serviceClient) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIf if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -175,9 +185,22 @@ func (c *serviceClient_VrrpVrTrackIfDumpClient) Recv() (*VrrpVrTrackIfDetails, e switch m := msg.(type) { case *VrrpVrTrackIfDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) } } + +func (c *serviceClient) WantVrrpVrEvents(ctx context.Context, in *WantVrrpVrEvents) (*WantVrrpVrEventsReply, error) { + out := new(WantVrrpVrEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} diff --git a/binapi/vxlan/vxlan.ba.go b/binapi/vxlan/vxlan.ba.go index 048b2fa..84b4c64 100644 --- a/binapi/vxlan/vxlan.ba.go +++ b/binapi/vxlan/vxlan.ba.go @@ -1,21 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/vxlan.api.json // Package vxlan contains generated bindings for API file vxlan.api. // // Contents: -// 8 messages +// 14 messages // package vxlan import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,8 +26,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vxlan" - APIVersion = "2.0.0" - VersionCrc = 0xf11ad29f + APIVersion = "2.1.0" + VersionCrc = 0x95381587 ) // SwInterfaceSetVxlanBypass defines message 'sw_interface_set_vxlan_bypass'. @@ -120,7 +120,7 @@ type VxlanAddDelTunnel struct { func (m *VxlanAddDelTunnel) Reset() { *m = VxlanAddDelTunnel{} } func (*VxlanAddDelTunnel) GetMessageName() string { return "vxlan_add_del_tunnel" } -func (*VxlanAddDelTunnel) GetCrcString() string { return "a35dc8f5" } +func (*VxlanAddDelTunnel) GetCrcString() string { return "0c09dc80" } func (*VxlanAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -210,6 +210,234 @@ func (m *VxlanAddDelTunnelReply) Unmarshal(b []byte) error { return nil } +// VxlanAddDelTunnelV2 defines message 'vxlan_add_del_tunnel_v2'. +type VxlanAddDelTunnelV2 struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Instance uint32 `binapi:"u32,name=instance,default=4294967295" json:"instance,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *VxlanAddDelTunnelV2) Reset() { *m = VxlanAddDelTunnelV2{} } +func (*VxlanAddDelTunnelV2) GetMessageName() string { return "vxlan_add_del_tunnel_v2" } +func (*VxlanAddDelTunnelV2) GetCrcString() string { return "4f223f40" } +func (*VxlanAddDelTunnelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanAddDelTunnelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Instance + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 2 // m.SrcPort + size += 2 // m.DstPort + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *VxlanAddDelTunnelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(m.Instance) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.SrcPort) + buf.EncodeUint16(m.DstPort) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapNextIndex) + buf.EncodeUint32(m.Vni) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Instance = buf.DecodeUint32() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SrcPort = buf.DecodeUint16() + m.DstPort = buf.DecodeUint16() + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// VxlanAddDelTunnelV2Reply defines message 'vxlan_add_del_tunnel_v2_reply'. +type VxlanAddDelTunnelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanAddDelTunnelV2Reply) Reset() { *m = VxlanAddDelTunnelV2Reply{} } +func (*VxlanAddDelTunnelV2Reply) GetMessageName() string { return "vxlan_add_del_tunnel_v2_reply" } +func (*VxlanAddDelTunnelV2Reply) GetCrcString() string { return "5383d31f" } +func (*VxlanAddDelTunnelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanAddDelTunnelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanAddDelTunnelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VxlanAddDelTunnelV3 defines message 'vxlan_add_del_tunnel_v3'. +type VxlanAddDelTunnelV3 struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Instance uint32 `binapi:"u32,name=instance,default=4294967295" json:"instance,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + IsL3 bool `binapi:"bool,name=is_l3,default=false" json:"is_l3,omitempty"` +} + +func (m *VxlanAddDelTunnelV3) Reset() { *m = VxlanAddDelTunnelV3{} } +func (*VxlanAddDelTunnelV3) GetMessageName() string { return "vxlan_add_del_tunnel_v3" } +func (*VxlanAddDelTunnelV3) GetCrcString() string { return "0072b037" } +func (*VxlanAddDelTunnelV3) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanAddDelTunnelV3) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Instance + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 2 // m.SrcPort + size += 2 // m.DstPort + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + size += 1 // m.IsL3 + return size +} +func (m *VxlanAddDelTunnelV3) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(m.Instance) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.SrcPort) + buf.EncodeUint16(m.DstPort) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapNextIndex) + buf.EncodeUint32(m.Vni) + buf.EncodeBool(m.IsL3) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnelV3) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Instance = buf.DecodeUint32() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SrcPort = buf.DecodeUint16() + m.DstPort = buf.DecodeUint16() + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + m.IsL3 = buf.DecodeBool() + return nil +} + +// VxlanAddDelTunnelV3Reply defines message 'vxlan_add_del_tunnel_v3_reply'. +type VxlanAddDelTunnelV3Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanAddDelTunnelV3Reply) Reset() { *m = VxlanAddDelTunnelV3Reply{} } +func (*VxlanAddDelTunnelV3Reply) GetMessageName() string { return "vxlan_add_del_tunnel_v3_reply" } +func (*VxlanAddDelTunnelV3Reply) GetCrcString() string { return "5383d31f" } +func (*VxlanAddDelTunnelV3Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanAddDelTunnelV3Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanAddDelTunnelV3Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnelV3Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // VxlanOffloadRx defines message 'vxlan_offload_rx'. type VxlanOffloadRx struct { HwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=hw_if_index" json:"hw_if_index,omitempty"` @@ -219,7 +447,7 @@ type VxlanOffloadRx struct { func (m *VxlanOffloadRx) Reset() { *m = VxlanOffloadRx{} } func (*VxlanOffloadRx) GetMessageName() string { return "vxlan_offload_rx" } -func (*VxlanOffloadRx) GetCrcString() string { return "89a1564b" } +func (*VxlanOffloadRx) GetCrcString() string { return "9cc95087" } func (*VxlanOffloadRx) GetMessageType() api.MessageType { return api.RequestMessage } @@ -298,7 +526,7 @@ type VxlanTunnelDetails struct { func (m *VxlanTunnelDetails) Reset() { *m = VxlanTunnelDetails{} } func (*VxlanTunnelDetails) GetMessageName() string { return "vxlan_tunnel_details" } -func (*VxlanTunnelDetails) GetCrcString() string { return "e782f70f" } +func (*VxlanTunnelDetails) GetCrcString() string { return "c3916cb1" } func (*VxlanTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -384,16 +612,130 @@ func (m *VxlanTunnelDump) Unmarshal(b []byte) error { return nil } +// VxlanTunnelV2Details defines message 'vxlan_tunnel_v2_details'. +type VxlanTunnelV2Details struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *VxlanTunnelV2Details) Reset() { *m = VxlanTunnelV2Details{} } +func (*VxlanTunnelV2Details) GetMessageName() string { return "vxlan_tunnel_v2_details" } +func (*VxlanTunnelV2Details) GetCrcString() string { return "d3bdd4d9" } +func (*VxlanTunnelV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanTunnelV2Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.Instance + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 2 // m.SrcPort + size += 2 // m.DstPort + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *VxlanTunnelV2Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.Instance) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.SrcPort) + buf.EncodeUint16(m.DstPort) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapNextIndex) + buf.EncodeUint32(m.Vni) + return buf.Bytes(), nil +} +func (m *VxlanTunnelV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Instance = buf.DecodeUint32() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SrcPort = buf.DecodeUint16() + m.DstPort = buf.DecodeUint16() + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// VxlanTunnelV2Dump defines message 'vxlan_tunnel_v2_dump'. +type VxlanTunnelV2Dump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanTunnelV2Dump) Reset() { *m = VxlanTunnelV2Dump{} } +func (*VxlanTunnelV2Dump) GetMessageName() string { return "vxlan_tunnel_v2_dump" } +func (*VxlanTunnelV2Dump) GetCrcString() string { return "f9e6675e" } +func (*VxlanTunnelV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanTunnelV2Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanTunnelV2Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanTunnelV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + func init() { file_vxlan_binapi_init() } func file_vxlan_binapi_init() { api.RegisterMessage((*SwInterfaceSetVxlanBypass)(nil), "sw_interface_set_vxlan_bypass_65247409") api.RegisterMessage((*SwInterfaceSetVxlanBypassReply)(nil), "sw_interface_set_vxlan_bypass_reply_e8d4e804") - api.RegisterMessage((*VxlanAddDelTunnel)(nil), "vxlan_add_del_tunnel_a35dc8f5") + api.RegisterMessage((*VxlanAddDelTunnel)(nil), "vxlan_add_del_tunnel_0c09dc80") api.RegisterMessage((*VxlanAddDelTunnelReply)(nil), "vxlan_add_del_tunnel_reply_5383d31f") - api.RegisterMessage((*VxlanOffloadRx)(nil), "vxlan_offload_rx_89a1564b") + api.RegisterMessage((*VxlanAddDelTunnelV2)(nil), "vxlan_add_del_tunnel_v2_4f223f40") + api.RegisterMessage((*VxlanAddDelTunnelV2Reply)(nil), "vxlan_add_del_tunnel_v2_reply_5383d31f") + api.RegisterMessage((*VxlanAddDelTunnelV3)(nil), "vxlan_add_del_tunnel_v3_0072b037") + api.RegisterMessage((*VxlanAddDelTunnelV3Reply)(nil), "vxlan_add_del_tunnel_v3_reply_5383d31f") + api.RegisterMessage((*VxlanOffloadRx)(nil), "vxlan_offload_rx_9cc95087") api.RegisterMessage((*VxlanOffloadRxReply)(nil), "vxlan_offload_rx_reply_e8d4e804") - api.RegisterMessage((*VxlanTunnelDetails)(nil), "vxlan_tunnel_details_e782f70f") + api.RegisterMessage((*VxlanTunnelDetails)(nil), "vxlan_tunnel_details_c3916cb1") api.RegisterMessage((*VxlanTunnelDump)(nil), "vxlan_tunnel_dump_f9e6675e") + api.RegisterMessage((*VxlanTunnelV2Details)(nil), "vxlan_tunnel_v2_details_d3bdd4d9") + api.RegisterMessage((*VxlanTunnelV2Dump)(nil), "vxlan_tunnel_v2_dump_f9e6675e") } // Messages returns list of all messages in this module. @@ -403,9 +745,15 @@ func AllMessages() []api.Message { (*SwInterfaceSetVxlanBypassReply)(nil), (*VxlanAddDelTunnel)(nil), (*VxlanAddDelTunnelReply)(nil), + (*VxlanAddDelTunnelV2)(nil), + (*VxlanAddDelTunnelV2Reply)(nil), + (*VxlanAddDelTunnelV3)(nil), + (*VxlanAddDelTunnelV3Reply)(nil), (*VxlanOffloadRx)(nil), (*VxlanOffloadRxReply)(nil), (*VxlanTunnelDetails)(nil), (*VxlanTunnelDump)(nil), + (*VxlanTunnelV2Details)(nil), + (*VxlanTunnelV2Dump)(nil), } } diff --git a/binapi/vxlan/vxlan_rest.ba.go b/binapi/vxlan/vxlan_rest.ba.go deleted file mode 100644 index ee35144..0000000 --- a/binapi/vxlan/vxlan_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanBypass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetVxlanBypass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanAddDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanAddDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_offload_rx", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanOffloadRx) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanOffloadRx(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vxlan/vxlan_rpc.ba.go b/binapi/vxlan/vxlan_rpc.ba.go index 5284fab..04d4635 100644 --- a/binapi/vxlan/vxlan_rpc.ba.go +++ b/binapi/vxlan/vxlan_rpc.ba.go @@ -5,17 +5,21 @@ package vxlan import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vxlan. +// RPCService defines RPC service vxlan. type RPCService interface { SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) + VxlanAddDelTunnelV2(ctx context.Context, in *VxlanAddDelTunnelV2) (*VxlanAddDelTunnelV2Reply, error) + VxlanAddDelTunnelV3(ctx context.Context, in *VxlanAddDelTunnelV3) (*VxlanAddDelTunnelV3Reply, error) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump) (RPCService_VxlanTunnelDumpClient, error) + VxlanTunnelV2Dump(ctx context.Context, in *VxlanTunnelV2Dump) (RPCService_VxlanTunnelV2DumpClient, error) } type serviceClient struct { @@ -32,7 +36,7 @@ func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { @@ -41,7 +45,25 @@ func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTu if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) VxlanAddDelTunnelV2(ctx context.Context, in *VxlanAddDelTunnelV2) (*VxlanAddDelTunnelV2Reply, error) { + out := new(VxlanAddDelTunnelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) VxlanAddDelTunnelV3(ctx context.Context, in *VxlanAddDelTunnelV3) (*VxlanAddDelTunnelV3Reply, error) { + out := new(VxlanAddDelTunnelV3Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { @@ -50,7 +72,7 @@ func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump) (RPCService_VxlanTunnelDumpClient, error) { @@ -62,7 +84,7 @@ func (c *serviceClient) VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -85,7 +107,54 @@ func (c *serviceClient_VxlanTunnelDumpClient) Recv() (*VxlanTunnelDetails, error switch m := msg.(type) { case *VxlanTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) VxlanTunnelV2Dump(ctx context.Context, in *VxlanTunnelV2Dump) (RPCService_VxlanTunnelV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanTunnelV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanTunnelV2DumpClient interface { + Recv() (*VxlanTunnelV2Details, error) + api.Stream +} + +type serviceClient_VxlanTunnelV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanTunnelV2DumpClient) Recv() (*VxlanTunnelV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanTunnelV2Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/vxlan_gbp/vxlan_gbp.ba.go b/binapi/vxlan_gbp/vxlan_gbp.ba.go deleted file mode 100644 index 886d30a..0000000 --- a/binapi/vxlan_gbp/vxlan_gbp.ba.go +++ /dev/null @@ -1,367 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/vxlan_gbp.api.json - -// Package vxlan_gbp contains generated bindings for API file vxlan_gbp.api. -// -// Contents: -// 1 enum -// 1 struct -// 6 messages -// -package vxlan_gbp - -import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" - "strconv" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "vxlan_gbp" - APIVersion = "1.1.1" - VersionCrc = 0xfa8aff54 -) - -// VxlanGbpAPITunnelMode defines enum 'vxlan_gbp_api_tunnel_mode'. -type VxlanGbpAPITunnelMode uint32 - -const ( - VXLAN_GBP_API_TUNNEL_MODE_L2 VxlanGbpAPITunnelMode = 1 - VXLAN_GBP_API_TUNNEL_MODE_L3 VxlanGbpAPITunnelMode = 2 -) - -var ( - VxlanGbpAPITunnelMode_name = map[uint32]string{ - 1: "VXLAN_GBP_API_TUNNEL_MODE_L2", - 2: "VXLAN_GBP_API_TUNNEL_MODE_L3", - } - VxlanGbpAPITunnelMode_value = map[string]uint32{ - "VXLAN_GBP_API_TUNNEL_MODE_L2": 1, - "VXLAN_GBP_API_TUNNEL_MODE_L3": 2, - } -) - -func (x VxlanGbpAPITunnelMode) String() string { - s, ok := VxlanGbpAPITunnelMode_name[uint32(x)] - if ok { - return s - } - return "VxlanGbpAPITunnelMode(" + strconv.Itoa(int(x)) + ")" -} - -// VxlanGbpTunnel defines type 'vxlan_gbp_tunnel'. -type VxlanGbpTunnel struct { - Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` - Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` - Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` - McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` - EncapTableID uint32 `binapi:"u32,name=encap_table_id" json:"encap_table_id,omitempty"` - Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mode VxlanGbpAPITunnelMode `binapi:"vxlan_gbp_api_tunnel_mode,name=mode" json:"mode,omitempty"` -} - -// SwInterfaceSetVxlanGbpBypass defines message 'sw_interface_set_vxlan_gbp_bypass'. -type SwInterfaceSetVxlanGbpBypass struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` -} - -func (m *SwInterfaceSetVxlanGbpBypass) Reset() { *m = SwInterfaceSetVxlanGbpBypass{} } -func (*SwInterfaceSetVxlanGbpBypass) GetMessageName() string { - return "sw_interface_set_vxlan_gbp_bypass" -} -func (*SwInterfaceSetVxlanGbpBypass) GetCrcString() string { return "65247409" } -func (*SwInterfaceSetVxlanGbpBypass) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *SwInterfaceSetVxlanGbpBypass) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 1 // m.IsIPv6 - size += 1 // m.Enable - return size -} -func (m *SwInterfaceSetVxlanGbpBypass) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeBool(m.IsIPv6) - buf.EncodeBool(m.Enable) - return buf.Bytes(), nil -} -func (m *SwInterfaceSetVxlanGbpBypass) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.IsIPv6 = buf.DecodeBool() - m.Enable = buf.DecodeBool() - return nil -} - -// SwInterfaceSetVxlanGbpBypassReply defines message 'sw_interface_set_vxlan_gbp_bypass_reply'. -type SwInterfaceSetVxlanGbpBypassReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetVxlanGbpBypassReply) Reset() { *m = SwInterfaceSetVxlanGbpBypassReply{} } -func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageName() string { - return "sw_interface_set_vxlan_gbp_bypass_reply" -} -func (*SwInterfaceSetVxlanGbpBypassReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceSetVxlanGbpBypassReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *SwInterfaceSetVxlanGbpBypassReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *SwInterfaceSetVxlanGbpBypassReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// VxlanGbpTunnelAddDel defines message 'vxlan_gbp_tunnel_add_del'. -type VxlanGbpTunnelAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` -} - -func (m *VxlanGbpTunnelAddDel) Reset() { *m = VxlanGbpTunnelAddDel{} } -func (*VxlanGbpTunnelAddDel) GetMessageName() string { return "vxlan_gbp_tunnel_add_del" } -func (*VxlanGbpTunnelAddDel) GetCrcString() string { return "8c819166" } -func (*VxlanGbpTunnelAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *VxlanGbpTunnelAddDel) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.Tunnel.Instance - size += 1 // m.Tunnel.Src.Af - size += 1 * 16 // m.Tunnel.Src.Un - size += 1 // m.Tunnel.Dst.Af - size += 1 * 16 // m.Tunnel.Dst.Un - size += 4 // m.Tunnel.McastSwIfIndex - size += 4 // m.Tunnel.EncapTableID - size += 4 // m.Tunnel.Vni - size += 4 // m.Tunnel.SwIfIndex - size += 4 // m.Tunnel.Mode - return size -} -func (m *VxlanGbpTunnelAddDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(m.Tunnel.Instance) - buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) - buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) - buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) - buf.EncodeUint32(m.Tunnel.EncapTableID) - buf.EncodeUint32(m.Tunnel.Vni) - buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) - buf.EncodeUint32(uint32(m.Tunnel.Mode)) - return buf.Bytes(), nil -} -func (m *VxlanGbpTunnelAddDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Tunnel.Instance = buf.DecodeUint32() - m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Tunnel.EncapTableID = buf.DecodeUint32() - m.Tunnel.Vni = buf.DecodeUint32() - m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) - return nil -} - -// VxlanGbpTunnelAddDelReply defines message 'vxlan_gbp_tunnel_add_del_reply'. -type VxlanGbpTunnelAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *VxlanGbpTunnelAddDelReply) Reset() { *m = VxlanGbpTunnelAddDelReply{} } -func (*VxlanGbpTunnelAddDelReply) GetMessageName() string { return "vxlan_gbp_tunnel_add_del_reply" } -func (*VxlanGbpTunnelAddDelReply) GetCrcString() string { return "5383d31f" } -func (*VxlanGbpTunnelAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *VxlanGbpTunnelAddDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.SwIfIndex - return size -} -func (m *VxlanGbpTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *VxlanGbpTunnelAddDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// VxlanGbpTunnelDetails defines message 'vxlan_gbp_tunnel_details'. -type VxlanGbpTunnelDetails struct { - Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` -} - -func (m *VxlanGbpTunnelDetails) Reset() { *m = VxlanGbpTunnelDetails{} } -func (*VxlanGbpTunnelDetails) GetMessageName() string { return "vxlan_gbp_tunnel_details" } -func (*VxlanGbpTunnelDetails) GetCrcString() string { return "1da24016" } -func (*VxlanGbpTunnelDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *VxlanGbpTunnelDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Tunnel.Instance - size += 1 // m.Tunnel.Src.Af - size += 1 * 16 // m.Tunnel.Src.Un - size += 1 // m.Tunnel.Dst.Af - size += 1 * 16 // m.Tunnel.Dst.Un - size += 4 // m.Tunnel.McastSwIfIndex - size += 4 // m.Tunnel.EncapTableID - size += 4 // m.Tunnel.Vni - size += 4 // m.Tunnel.SwIfIndex - size += 4 // m.Tunnel.Mode - return size -} -func (m *VxlanGbpTunnelDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Tunnel.Instance) - buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) - buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) - buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) - buf.EncodeUint32(m.Tunnel.EncapTableID) - buf.EncodeUint32(m.Tunnel.Vni) - buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) - buf.EncodeUint32(uint32(m.Tunnel.Mode)) - return buf.Bytes(), nil -} -func (m *VxlanGbpTunnelDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Tunnel.Instance = buf.DecodeUint32() - m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Tunnel.EncapTableID = buf.DecodeUint32() - m.Tunnel.Vni = buf.DecodeUint32() - m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) - return nil -} - -// VxlanGbpTunnelDump defines message 'vxlan_gbp_tunnel_dump'. -type VxlanGbpTunnelDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` -} - -func (m *VxlanGbpTunnelDump) Reset() { *m = VxlanGbpTunnelDump{} } -func (*VxlanGbpTunnelDump) GetMessageName() string { return "vxlan_gbp_tunnel_dump" } -func (*VxlanGbpTunnelDump) GetCrcString() string { return "f9e6675e" } -func (*VxlanGbpTunnelDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *VxlanGbpTunnelDump) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - return size -} -func (m *VxlanGbpTunnelDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *VxlanGbpTunnelDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - return nil -} - -func init() { file_vxlan_gbp_binapi_init() } -func file_vxlan_gbp_binapi_init() { - api.RegisterMessage((*SwInterfaceSetVxlanGbpBypass)(nil), "sw_interface_set_vxlan_gbp_bypass_65247409") - api.RegisterMessage((*SwInterfaceSetVxlanGbpBypassReply)(nil), "sw_interface_set_vxlan_gbp_bypass_reply_e8d4e804") - api.RegisterMessage((*VxlanGbpTunnelAddDel)(nil), "vxlan_gbp_tunnel_add_del_8c819166") - api.RegisterMessage((*VxlanGbpTunnelAddDelReply)(nil), "vxlan_gbp_tunnel_add_del_reply_5383d31f") - api.RegisterMessage((*VxlanGbpTunnelDetails)(nil), "vxlan_gbp_tunnel_details_1da24016") - api.RegisterMessage((*VxlanGbpTunnelDump)(nil), "vxlan_gbp_tunnel_dump_f9e6675e") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*SwInterfaceSetVxlanGbpBypass)(nil), - (*SwInterfaceSetVxlanGbpBypassReply)(nil), - (*VxlanGbpTunnelAddDel)(nil), - (*VxlanGbpTunnelAddDelReply)(nil), - (*VxlanGbpTunnelDetails)(nil), - (*VxlanGbpTunnelDump)(nil), - } -} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go deleted file mode 100644 index 5d94785..0000000 --- a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gbp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_gbp_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanGbpBypass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetVxlanGbpBypass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gbp_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGbpTunnelAddDel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGbpTunnelAddDel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go deleted file mode 100644 index 7d23984..0000000 --- a/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gbp - -import ( - "context" - "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" - "io" -) - -// RPCService defines RPC service vxlan_gbp. -type RPCService interface { - SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) - VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) - VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) { - out := new(SwInterfaceSetVxlanGbpBypassReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) { - out := new(VxlanGbpTunnelAddDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_VxlanGbpTunnelDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_VxlanGbpTunnelDumpClient interface { - Recv() (*VxlanGbpTunnelDetails, error) - api.Stream -} - -type serviceClient_VxlanGbpTunnelDumpClient struct { - api.Stream -} - -func (c *serviceClient_VxlanGbpTunnelDumpClient) Recv() (*VxlanGbpTunnelDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *VxlanGbpTunnelDetails: - return m, nil - case *vpe.ControlPingReply: - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} diff --git a/binapi/vxlan_gpe/vxlan_gpe.ba.go b/binapi/vxlan_gpe/vxlan_gpe.ba.go index 0858ada..d108f28 100644 --- a/binapi/vxlan_gpe/vxlan_gpe.ba.go +++ b/binapi/vxlan_gpe/vxlan_gpe.ba.go @@ -1,21 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/core/vxlan_gpe.api.json // Package vxlan_gpe contains generated bindings for API file vxlan_gpe.api. // // Contents: -// 6 messages +// 10 messages // package vxlan_gpe import ( - api "git.fd.io/govpp.git/api" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,8 +26,8 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vxlan_gpe" - APIVersion = "2.0.0" - VersionCrc = 0x8295f28f + APIVersion = "2.1.0" + VersionCrc = 0x3bc06278 ) // SwInterfaceSetVxlanGpeBypass defines message 'sw_interface_set_vxlan_gpe_bypass'. @@ -122,7 +122,7 @@ type VxlanGpeAddDelTunnel struct { func (m *VxlanGpeAddDelTunnel) Reset() { *m = VxlanGpeAddDelTunnel{} } func (*VxlanGpeAddDelTunnel) GetMessageName() string { return "vxlan_gpe_add_del_tunnel" } -func (*VxlanGpeAddDelTunnel) GetCrcString() string { return "7c6da6ae" } +func (*VxlanGpeAddDelTunnel) GetCrcString() string { return "a645b2b0" } func (*VxlanGpeAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -212,6 +212,120 @@ func (m *VxlanGpeAddDelTunnelReply) Unmarshal(b []byte) error { return nil } +// VxlanGpeAddDelTunnelV2 defines message 'vxlan_gpe_add_del_tunnel_v2'. +type VxlanGpeAddDelTunnelV2 struct { + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + RemotePort uint16 `binapi:"u16,name=remote_port" json:"remote_port,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *VxlanGpeAddDelTunnelV2) Reset() { *m = VxlanGpeAddDelTunnelV2{} } +func (*VxlanGpeAddDelTunnelV2) GetMessageName() string { return "vxlan_gpe_add_del_tunnel_v2" } +func (*VxlanGpeAddDelTunnelV2) GetCrcString() string { return "d62fdb35" } +func (*VxlanGpeAddDelTunnelV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeAddDelTunnelV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + size += 2 // m.LocalPort + size += 2 // m.RemotePort + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapVrfID + size += 1 // m.Protocol + size += 4 // m.Vni + size += 1 // m.IsAdd + return size +} +func (m *VxlanGpeAddDelTunnelV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.LocalPort) + buf.EncodeUint16(m.RemotePort) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapVrfID) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint32(m.Vni) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *VxlanGpeAddDelTunnelV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalPort = buf.DecodeUint16() + m.RemotePort = buf.DecodeUint16() + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapVrfID = buf.DecodeUint32() + m.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.Vni = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// VxlanGpeAddDelTunnelV2Reply defines message 'vxlan_gpe_add_del_tunnel_v2_reply'. +type VxlanGpeAddDelTunnelV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGpeAddDelTunnelV2Reply) Reset() { *m = VxlanGpeAddDelTunnelV2Reply{} } +func (*VxlanGpeAddDelTunnelV2Reply) GetMessageName() string { + return "vxlan_gpe_add_del_tunnel_v2_reply" +} +func (*VxlanGpeAddDelTunnelV2Reply) GetCrcString() string { return "5383d31f" } +func (*VxlanGpeAddDelTunnelV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeAddDelTunnelV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGpeAddDelTunnelV2Reply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGpeAddDelTunnelV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // VxlanGpeTunnelDetails defines message 'vxlan_gpe_tunnel_details'. type VxlanGpeTunnelDetails struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -227,7 +341,7 @@ type VxlanGpeTunnelDetails struct { func (m *VxlanGpeTunnelDetails) Reset() { *m = VxlanGpeTunnelDetails{} } func (*VxlanGpeTunnelDetails) GetMessageName() string { return "vxlan_gpe_tunnel_details" } -func (*VxlanGpeTunnelDetails) GetCrcString() string { return "57712346" } +func (*VxlanGpeTunnelDetails) GetCrcString() string { return "0968fc8b" } func (*VxlanGpeTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -316,14 +430,130 @@ func (m *VxlanGpeTunnelDump) Unmarshal(b []byte) error { return nil } +// VxlanGpeTunnelV2Details defines message 'vxlan_gpe_tunnel_v2_details'. +type VxlanGpeTunnelV2Details struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + RemotePort uint16 `binapi:"u16,name=remote_port" json:"remote_port,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *VxlanGpeTunnelV2Details) Reset() { *m = VxlanGpeTunnelV2Details{} } +func (*VxlanGpeTunnelV2Details) GetMessageName() string { return "vxlan_gpe_tunnel_v2_details" } +func (*VxlanGpeTunnelV2Details) GetCrcString() string { return "06be4870" } +func (*VxlanGpeTunnelV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeTunnelV2Details) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + size += 2 // m.LocalPort + size += 2 // m.RemotePort + size += 4 // m.Vni + size += 1 // m.Protocol + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapVrfID + size += 1 // m.IsIPv6 + return size +} +func (m *VxlanGpeTunnelV2Details) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.LocalPort) + buf.EncodeUint16(m.RemotePort) + buf.EncodeUint32(m.Vni) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(m.EncapVrfID) + buf.EncodeUint32(m.DecapVrfID) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *VxlanGpeTunnelV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalPort = buf.DecodeUint16() + m.RemotePort = buf.DecodeUint16() + m.Vni = buf.DecodeUint32() + m.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapVrfID = buf.DecodeUint32() + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// VxlanGpeTunnelV2Dump defines message 'vxlan_gpe_tunnel_v2_dump'. +type VxlanGpeTunnelV2Dump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGpeTunnelV2Dump) Reset() { *m = VxlanGpeTunnelV2Dump{} } +func (*VxlanGpeTunnelV2Dump) GetMessageName() string { return "vxlan_gpe_tunnel_v2_dump" } +func (*VxlanGpeTunnelV2Dump) GetCrcString() string { return "f9e6675e" } +func (*VxlanGpeTunnelV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeTunnelV2Dump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGpeTunnelV2Dump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGpeTunnelV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + func init() { file_vxlan_gpe_binapi_init() } func file_vxlan_gpe_binapi_init() { api.RegisterMessage((*SwInterfaceSetVxlanGpeBypass)(nil), "sw_interface_set_vxlan_gpe_bypass_65247409") api.RegisterMessage((*SwInterfaceSetVxlanGpeBypassReply)(nil), "sw_interface_set_vxlan_gpe_bypass_reply_e8d4e804") - api.RegisterMessage((*VxlanGpeAddDelTunnel)(nil), "vxlan_gpe_add_del_tunnel_7c6da6ae") + api.RegisterMessage((*VxlanGpeAddDelTunnel)(nil), "vxlan_gpe_add_del_tunnel_a645b2b0") api.RegisterMessage((*VxlanGpeAddDelTunnelReply)(nil), "vxlan_gpe_add_del_tunnel_reply_5383d31f") - api.RegisterMessage((*VxlanGpeTunnelDetails)(nil), "vxlan_gpe_tunnel_details_57712346") + api.RegisterMessage((*VxlanGpeAddDelTunnelV2)(nil), "vxlan_gpe_add_del_tunnel_v2_d62fdb35") + api.RegisterMessage((*VxlanGpeAddDelTunnelV2Reply)(nil), "vxlan_gpe_add_del_tunnel_v2_reply_5383d31f") + api.RegisterMessage((*VxlanGpeTunnelDetails)(nil), "vxlan_gpe_tunnel_details_0968fc8b") api.RegisterMessage((*VxlanGpeTunnelDump)(nil), "vxlan_gpe_tunnel_dump_f9e6675e") + api.RegisterMessage((*VxlanGpeTunnelV2Details)(nil), "vxlan_gpe_tunnel_v2_details_06be4870") + api.RegisterMessage((*VxlanGpeTunnelV2Dump)(nil), "vxlan_gpe_tunnel_v2_dump_f9e6675e") } // Messages returns list of all messages in this module. @@ -333,7 +563,11 @@ func AllMessages() []api.Message { (*SwInterfaceSetVxlanGpeBypassReply)(nil), (*VxlanGpeAddDelTunnel)(nil), (*VxlanGpeAddDelTunnelReply)(nil), + (*VxlanGpeAddDelTunnelV2)(nil), + (*VxlanGpeAddDelTunnelV2Reply)(nil), (*VxlanGpeTunnelDetails)(nil), (*VxlanGpeTunnelDump)(nil), + (*VxlanGpeTunnelV2Details)(nil), + (*VxlanGpeTunnelV2Dump)(nil), } } diff --git a/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go deleted file mode 100644 index 0761ca3..0000000 --- a/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_gpe_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanGpeBypass) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.SwInterfaceSetVxlanGpeBypass(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/vxlan_gpe_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeAddDelTunnel) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeAddDelTunnel(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go index f36262e..bb03ec6 100644 --- a/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go +++ b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go @@ -5,16 +5,19 @@ package vxlan_gpe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service vxlan_gpe. +// RPCService defines RPC service vxlan_gpe. type RPCService interface { SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *SwInterfaceSetVxlanGpeBypass) (*SwInterfaceSetVxlanGpeBypassReply, error) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) + VxlanGpeAddDelTunnelV2(ctx context.Context, in *VxlanGpeAddDelTunnelV2) (*VxlanGpeAddDelTunnelV2Reply, error) VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunnelDump) (RPCService_VxlanGpeTunnelDumpClient, error) + VxlanGpeTunnelV2Dump(ctx context.Context, in *VxlanGpeTunnelV2Dump) (RPCService_VxlanGpeTunnelV2DumpClient, error) } type serviceClient struct { @@ -31,7 +34,7 @@ func (c *serviceClient) SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) { @@ -40,7 +43,16 @@ func (c *serviceClient) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) VxlanGpeAddDelTunnelV2(ctx context.Context, in *VxlanGpeAddDelTunnelV2) (*VxlanGpeAddDelTunnelV2Reply, error) { + out := new(VxlanGpeAddDelTunnelV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunnelDump) (RPCService_VxlanGpeTunnelDumpClient, error) { @@ -52,7 +64,7 @@ func (c *serviceClient) VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunn if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -75,7 +87,54 @@ func (c *serviceClient_VxlanGpeTunnelDumpClient) Recv() (*VxlanGpeTunnelDetails, switch m := msg.(type) { case *VxlanGpeTunnelDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) VxlanGpeTunnelV2Dump(ctx context.Context, in *VxlanGpeTunnelV2Dump) (RPCService_VxlanGpeTunnelV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanGpeTunnelV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanGpeTunnelV2DumpClient interface { + Recv() (*VxlanGpeTunnelV2Details, error) + api.Stream +} + +type serviceClient_VxlanGpeTunnelV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanGpeTunnelV2DumpClient) Recv() (*VxlanGpeTunnelV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanGpeTunnelV2Details: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go index 8820fab..e828b80 100644 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/vxlan_gpe_ioam_export.api.json // Package vxlan_gpe_ioam_export contains generated bindings for API file vxlan_gpe_ioam_export.api. @@ -12,9 +12,9 @@ package vxlan_gpe_ioam_export import ( - api "git.fd.io/govpp.git/api" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -26,7 +26,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "vxlan_gpe_ioam_export" APIVersion = "1.0.0" - VersionCrc = 0x56bd3b73 + VersionCrc = 0x26bebf64 ) // VxlanGpeIoamExportEnableDisable defines message 'vxlan_gpe_ioam_export_enable_disable'. @@ -40,7 +40,7 @@ func (m *VxlanGpeIoamExportEnableDisable) Reset() { *m = VxlanGpeIoamExportEnabl func (*VxlanGpeIoamExportEnableDisable) GetMessageName() string { return "vxlan_gpe_ioam_export_enable_disable" } -func (*VxlanGpeIoamExportEnableDisable) GetCrcString() string { return "e4d4ebfa" } +func (*VxlanGpeIoamExportEnableDisable) GetCrcString() string { return "d4c76d3a" } func (*VxlanGpeIoamExportEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } @@ -109,7 +109,7 @@ func (m *VxlanGpeIoamExportEnableDisableReply) Unmarshal(b []byte) error { func init() { file_vxlan_gpe_ioam_export_binapi_init() } func file_vxlan_gpe_ioam_export_binapi_init() { - api.RegisterMessage((*VxlanGpeIoamExportEnableDisable)(nil), "vxlan_gpe_ioam_export_enable_disable_e4d4ebfa") + api.RegisterMessage((*VxlanGpeIoamExportEnableDisable)(nil), "vxlan_gpe_ioam_export_enable_disable_d4c76d3a") api.RegisterMessage((*VxlanGpeIoamExportEnableDisableReply)(nil), "vxlan_gpe_ioam_export_enable_disable_reply_e8d4e804") } diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go deleted file mode 100644 index b2cf182..0000000 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gpe_ioam_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vxlan_gpe_ioam_export_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamExportEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.VxlanGpeIoamExportEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go index ce35b62..35823a4 100644 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go @@ -4,10 +4,11 @@ package vxlan_gpe_ioam_export import ( "context" - api "git.fd.io/govpp.git/api" + + api "go.fd.io/govpp/api" ) -// RPCService defines RPC service vxlan_gpe_ioam_export. +// RPCService defines RPC service vxlan_gpe_ioam_export. type RPCService interface { VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error) } @@ -26,5 +27,5 @@ func (c *serviceClient) VxlanGpeIoamExportEnableDisable(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/wireguard/wireguard.ba.go b/binapi/wireguard/wireguard.ba.go new file mode 100644 index 0000000..227e93a --- /dev/null +++ b/binapi/wireguard/wireguard.ba.go @@ -0,0 +1,908 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release +// source: /usr/share/vpp/api/plugins/wireguard.api.json + +// Package wireguard contains generated bindings for API file wireguard.api. +// +// Contents: +// 1 enum +// 2 structs +// 17 messages +// +package wireguard + +import ( + "strconv" + + api "go.fd.io/govpp/api" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "wireguard" + APIVersion = "0.1.0" + VersionCrc = 0xb58de7e +) + +// WireguardPeerFlags defines enum 'wireguard_peer_flags'. +type WireguardPeerFlags uint8 + +const ( + WIREGUARD_PEER_STATUS_DEAD WireguardPeerFlags = 1 + WIREGUARD_PEER_ESTABLISHED WireguardPeerFlags = 2 +) + +var ( + WireguardPeerFlags_name = map[uint8]string{ + 1: "WIREGUARD_PEER_STATUS_DEAD", + 2: "WIREGUARD_PEER_ESTABLISHED", + } + WireguardPeerFlags_value = map[string]uint8{ + "WIREGUARD_PEER_STATUS_DEAD": 1, + "WIREGUARD_PEER_ESTABLISHED": 2, + } +) + +func (x WireguardPeerFlags) String() string { + s, ok := WireguardPeerFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := WireguardPeerFlags_name[uint8(n)] + if ok { + return s + } + return "WireguardPeerFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// WireguardInterface defines type 'wireguard_interface'. +type WireguardInterface struct { + UserInstance uint32 `binapi:"u32,name=user_instance,default=4294967295" json:"user_instance,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PrivateKey []byte `binapi:"u8[32],name=private_key" json:"private_key,omitempty"` + PublicKey []byte `binapi:"u8[32],name=public_key" json:"public_key,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SrcIP ip_types.Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"` +} + +// WireguardPeer defines type 'wireguard_peer'. +type WireguardPeer struct { + PublicKey []byte `binapi:"u8[32],name=public_key" json:"public_key,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + PersistentKeepalive uint16 `binapi:"u16,name=persistent_keepalive" json:"persistent_keepalive,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Endpoint ip_types.Address `binapi:"address,name=endpoint" json:"endpoint,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags WireguardPeerFlags `binapi:"wireguard_peer_flags,name=flags" json:"flags,omitempty"` + NAllowedIps uint8 `binapi:"u8,name=n_allowed_ips" json:"-"` + AllowedIps []ip_types.Prefix `binapi:"prefix[n_allowed_ips],name=allowed_ips" json:"allowed_ips,omitempty"` +} + +// WantWireguardPeerEvents defines message 'want_wireguard_peer_events'. +// InProgress: the message form may change in the future versions +type WantWireguardPeerEvents struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + PeerIndex uint32 `binapi:"u32,name=peer_index,default=4294967295" json:"peer_index,omitempty"` + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantWireguardPeerEvents) Reset() { *m = WantWireguardPeerEvents{} } +func (*WantWireguardPeerEvents) GetMessageName() string { return "want_wireguard_peer_events" } +func (*WantWireguardPeerEvents) GetCrcString() string { return "3bc666c8" } +func (*WantWireguardPeerEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantWireguardPeerEvents) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.PeerIndex + size += 4 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantWireguardPeerEvents) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.PeerIndex) + buf.EncodeUint32(m.EnableDisable) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *WantWireguardPeerEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PeerIndex = buf.DecodeUint32() + m.EnableDisable = buf.DecodeUint32() + m.PID = buf.DecodeUint32() + return nil +} + +// WantWireguardPeerEventsReply defines message 'want_wireguard_peer_events_reply'. +// InProgress: the message form may change in the future versions +type WantWireguardPeerEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantWireguardPeerEventsReply) Reset() { *m = WantWireguardPeerEventsReply{} } +func (*WantWireguardPeerEventsReply) GetMessageName() string { + return "want_wireguard_peer_events_reply" +} +func (*WantWireguardPeerEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantWireguardPeerEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantWireguardPeerEventsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantWireguardPeerEventsReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WantWireguardPeerEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WgSetAsyncMode defines message 'wg_set_async_mode'. +// InProgress: the message form may change in the future versions +type WgSetAsyncMode struct { + AsyncEnable bool `binapi:"bool,name=async_enable" json:"async_enable,omitempty"` +} + +func (m *WgSetAsyncMode) Reset() { *m = WgSetAsyncMode{} } +func (*WgSetAsyncMode) GetMessageName() string { return "wg_set_async_mode" } +func (*WgSetAsyncMode) GetCrcString() string { return "a6465f7c" } +func (*WgSetAsyncMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WgSetAsyncMode) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.AsyncEnable + return size +} +func (m *WgSetAsyncMode) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.AsyncEnable) + return buf.Bytes(), nil +} +func (m *WgSetAsyncMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AsyncEnable = buf.DecodeBool() + return nil +} + +// WgSetAsyncModeReply defines message 'wg_set_async_mode_reply'. +// InProgress: the message form may change in the future versions +type WgSetAsyncModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WgSetAsyncModeReply) Reset() { *m = WgSetAsyncModeReply{} } +func (*WgSetAsyncModeReply) GetMessageName() string { return "wg_set_async_mode_reply" } +func (*WgSetAsyncModeReply) GetCrcString() string { return "e8d4e804" } +func (*WgSetAsyncModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WgSetAsyncModeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WgSetAsyncModeReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WgSetAsyncModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WireguardInterfaceCreate defines message 'wireguard_interface_create'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceCreate struct { + Interface WireguardInterface `binapi:"wireguard_interface,name=interface" json:"interface,omitempty"` + GenerateKey bool `binapi:"bool,name=generate_key" json:"generate_key,omitempty"` +} + +func (m *WireguardInterfaceCreate) Reset() { *m = WireguardInterfaceCreate{} } +func (*WireguardInterfaceCreate) GetMessageName() string { return "wireguard_interface_create" } +func (*WireguardInterfaceCreate) GetCrcString() string { return "a530137e" } +func (*WireguardInterfaceCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardInterfaceCreate) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Interface.UserInstance + size += 4 // m.Interface.SwIfIndex + size += 1 * 32 // m.Interface.PrivateKey + size += 1 * 32 // m.Interface.PublicKey + size += 2 // m.Interface.Port + size += 1 // m.Interface.SrcIP.Af + size += 1 * 16 // m.Interface.SrcIP.Un + size += 1 // m.GenerateKey + return size +} +func (m *WireguardInterfaceCreate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Interface.UserInstance) + buf.EncodeUint32(uint32(m.Interface.SwIfIndex)) + buf.EncodeBytes(m.Interface.PrivateKey, 32) + buf.EncodeBytes(m.Interface.PublicKey, 32) + buf.EncodeUint16(m.Interface.Port) + buf.EncodeUint8(uint8(m.Interface.SrcIP.Af)) + buf.EncodeBytes(m.Interface.SrcIP.Un.XXX_UnionData[:], 16) + buf.EncodeBool(m.GenerateKey) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Interface.UserInstance = buf.DecodeUint32() + m.Interface.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Interface.PrivateKey = make([]byte, 32) + copy(m.Interface.PrivateKey, buf.DecodeBytes(len(m.Interface.PrivateKey))) + m.Interface.PublicKey = make([]byte, 32) + copy(m.Interface.PublicKey, buf.DecodeBytes(len(m.Interface.PublicKey))) + m.Interface.Port = buf.DecodeUint16() + m.Interface.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Interface.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.GenerateKey = buf.DecodeBool() + return nil +} + +// WireguardInterfaceCreateReply defines message 'wireguard_interface_create_reply'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *WireguardInterfaceCreateReply) Reset() { *m = WireguardInterfaceCreateReply{} } +func (*WireguardInterfaceCreateReply) GetMessageName() string { + return "wireguard_interface_create_reply" +} +func (*WireguardInterfaceCreateReply) GetCrcString() string { return "5383d31f" } +func (*WireguardInterfaceCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardInterfaceCreateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *WireguardInterfaceCreateReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// WireguardInterfaceDelete defines message 'wireguard_interface_delete'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *WireguardInterfaceDelete) Reset() { *m = WireguardInterfaceDelete{} } +func (*WireguardInterfaceDelete) GetMessageName() string { return "wireguard_interface_delete" } +func (*WireguardInterfaceDelete) GetCrcString() string { return "f9e6675e" } +func (*WireguardInterfaceDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardInterfaceDelete) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *WireguardInterfaceDelete) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// WireguardInterfaceDeleteReply defines message 'wireguard_interface_delete_reply'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WireguardInterfaceDeleteReply) Reset() { *m = WireguardInterfaceDeleteReply{} } +func (*WireguardInterfaceDeleteReply) GetMessageName() string { + return "wireguard_interface_delete_reply" +} +func (*WireguardInterfaceDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*WireguardInterfaceDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardInterfaceDeleteReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WireguardInterfaceDeleteReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WireguardInterfaceDetails defines message 'wireguard_interface_details'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceDetails struct { + Interface WireguardInterface `binapi:"wireguard_interface,name=interface" json:"interface,omitempty"` +} + +func (m *WireguardInterfaceDetails) Reset() { *m = WireguardInterfaceDetails{} } +func (*WireguardInterfaceDetails) GetMessageName() string { return "wireguard_interface_details" } +func (*WireguardInterfaceDetails) GetCrcString() string { return "0dd4865d" } +func (*WireguardInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Interface.UserInstance + size += 4 // m.Interface.SwIfIndex + size += 1 * 32 // m.Interface.PrivateKey + size += 1 * 32 // m.Interface.PublicKey + size += 2 // m.Interface.Port + size += 1 // m.Interface.SrcIP.Af + size += 1 * 16 // m.Interface.SrcIP.Un + return size +} +func (m *WireguardInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Interface.UserInstance) + buf.EncodeUint32(uint32(m.Interface.SwIfIndex)) + buf.EncodeBytes(m.Interface.PrivateKey, 32) + buf.EncodeBytes(m.Interface.PublicKey, 32) + buf.EncodeUint16(m.Interface.Port) + buf.EncodeUint8(uint8(m.Interface.SrcIP.Af)) + buf.EncodeBytes(m.Interface.SrcIP.Un.XXX_UnionData[:], 16) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Interface.UserInstance = buf.DecodeUint32() + m.Interface.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Interface.PrivateKey = make([]byte, 32) + copy(m.Interface.PrivateKey, buf.DecodeBytes(len(m.Interface.PrivateKey))) + m.Interface.PublicKey = make([]byte, 32) + copy(m.Interface.PublicKey, buf.DecodeBytes(len(m.Interface.PublicKey))) + m.Interface.Port = buf.DecodeUint16() + m.Interface.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Interface.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// WireguardInterfaceDump defines message 'wireguard_interface_dump'. +// InProgress: the message form may change in the future versions +type WireguardInterfaceDump struct { + ShowPrivateKey bool `binapi:"bool,name=show_private_key" json:"show_private_key,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *WireguardInterfaceDump) Reset() { *m = WireguardInterfaceDump{} } +func (*WireguardInterfaceDump) GetMessageName() string { return "wireguard_interface_dump" } +func (*WireguardInterfaceDump) GetCrcString() string { return "2c954158" } +func (*WireguardInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.ShowPrivateKey + size += 4 // m.SwIfIndex + return size +} +func (m *WireguardInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.ShowPrivateKey) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *WireguardInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ShowPrivateKey = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// WireguardPeerAdd defines message 'wireguard_peer_add'. +// InProgress: the message form may change in the future versions +type WireguardPeerAdd struct { + Peer WireguardPeer `binapi:"wireguard_peer,name=peer" json:"peer,omitempty"` +} + +func (m *WireguardPeerAdd) Reset() { *m = WireguardPeerAdd{} } +func (*WireguardPeerAdd) GetMessageName() string { return "wireguard_peer_add" } +func (*WireguardPeerAdd) GetCrcString() string { return "aedf8d59" } +func (*WireguardPeerAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardPeerAdd) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 32 // m.Peer.PublicKey + size += 2 // m.Peer.Port + size += 2 // m.Peer.PersistentKeepalive + size += 4 // m.Peer.TableID + size += 1 // m.Peer.Endpoint.Af + size += 1 * 16 // m.Peer.Endpoint.Un + size += 4 // m.Peer.SwIfIndex + size += 1 // m.Peer.Flags + size += 1 // m.Peer.NAllowedIps + for j2 := 0; j2 < len(m.Peer.AllowedIps); j2++ { + var s2 ip_types.Prefix + _ = s2 + if j2 < len(m.Peer.AllowedIps) { + s2 = m.Peer.AllowedIps[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + size += 1 // s2.Len + } + return size +} +func (m *WireguardPeerAdd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Peer.PublicKey, 32) + buf.EncodeUint16(m.Peer.Port) + buf.EncodeUint16(m.Peer.PersistentKeepalive) + buf.EncodeUint32(m.Peer.TableID) + buf.EncodeUint8(uint8(m.Peer.Endpoint.Af)) + buf.EncodeBytes(m.Peer.Endpoint.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Peer.SwIfIndex)) + buf.EncodeUint8(uint8(m.Peer.Flags)) + buf.EncodeUint8(uint8(len(m.Peer.AllowedIps))) + for j1 := 0; j1 < len(m.Peer.AllowedIps); j1++ { + var v1 ip_types.Prefix // AllowedIps + if j1 < len(m.Peer.AllowedIps) { + v1 = m.Peer.AllowedIps[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(v1.Len) + } + return buf.Bytes(), nil +} +func (m *WireguardPeerAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Peer.PublicKey = make([]byte, 32) + copy(m.Peer.PublicKey, buf.DecodeBytes(len(m.Peer.PublicKey))) + m.Peer.Port = buf.DecodeUint16() + m.Peer.PersistentKeepalive = buf.DecodeUint16() + m.Peer.TableID = buf.DecodeUint32() + m.Peer.Endpoint.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Peer.Endpoint.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Peer.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Peer.Flags = WireguardPeerFlags(buf.DecodeUint8()) + m.Peer.NAllowedIps = buf.DecodeUint8() + m.Peer.AllowedIps = make([]ip_types.Prefix, m.Peer.NAllowedIps) + for j1 := 0; j1 < len(m.Peer.AllowedIps); j1++ { + m.Peer.AllowedIps[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Peer.AllowedIps[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Peer.AllowedIps[j1].Len = buf.DecodeUint8() + } + return nil +} + +// WireguardPeerAddReply defines message 'wireguard_peer_add_reply'. +// InProgress: the message form may change in the future versions +type WireguardPeerAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + PeerIndex uint32 `binapi:"u32,name=peer_index" json:"peer_index,omitempty"` +} + +func (m *WireguardPeerAddReply) Reset() { *m = WireguardPeerAddReply{} } +func (*WireguardPeerAddReply) GetMessageName() string { return "wireguard_peer_add_reply" } +func (*WireguardPeerAddReply) GetCrcString() string { return "084a0cd3" } +func (*WireguardPeerAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardPeerAddReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.PeerIndex + return size +} +func (m *WireguardPeerAddReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.PeerIndex) + return buf.Bytes(), nil +} +func (m *WireguardPeerAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.PeerIndex = buf.DecodeUint32() + return nil +} + +// WireguardPeerEvent defines message 'wireguard_peer_event'. +// InProgress: the message form may change in the future versions +type WireguardPeerEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + PeerIndex uint32 `binapi:"u32,name=peer_index" json:"peer_index,omitempty"` + Flags WireguardPeerFlags `binapi:"wireguard_peer_flags,name=flags" json:"flags,omitempty"` +} + +func (m *WireguardPeerEvent) Reset() { *m = WireguardPeerEvent{} } +func (*WireguardPeerEvent) GetMessageName() string { return "wireguard_peer_event" } +func (*WireguardPeerEvent) GetCrcString() string { return "4e1b5d67" } +func (*WireguardPeerEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *WireguardPeerEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.PeerIndex + size += 1 // m.Flags + return size +} +func (m *WireguardPeerEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(m.PeerIndex) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *WireguardPeerEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.PeerIndex = buf.DecodeUint32() + m.Flags = WireguardPeerFlags(buf.DecodeUint8()) + return nil +} + +// WireguardPeerRemove defines message 'wireguard_peer_remove'. +// InProgress: the message form may change in the future versions +type WireguardPeerRemove struct { + PeerIndex uint32 `binapi:"u32,name=peer_index" json:"peer_index,omitempty"` +} + +func (m *WireguardPeerRemove) Reset() { *m = WireguardPeerRemove{} } +func (*WireguardPeerRemove) GetMessageName() string { return "wireguard_peer_remove" } +func (*WireguardPeerRemove) GetCrcString() string { return "3b74607a" } +func (*WireguardPeerRemove) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardPeerRemove) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PeerIndex + return size +} +func (m *WireguardPeerRemove) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PeerIndex) + return buf.Bytes(), nil +} +func (m *WireguardPeerRemove) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PeerIndex = buf.DecodeUint32() + return nil +} + +// WireguardPeerRemoveReply defines message 'wireguard_peer_remove_reply'. +// InProgress: the message form may change in the future versions +type WireguardPeerRemoveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WireguardPeerRemoveReply) Reset() { *m = WireguardPeerRemoveReply{} } +func (*WireguardPeerRemoveReply) GetMessageName() string { return "wireguard_peer_remove_reply" } +func (*WireguardPeerRemoveReply) GetCrcString() string { return "e8d4e804" } +func (*WireguardPeerRemoveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardPeerRemoveReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WireguardPeerRemoveReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *WireguardPeerRemoveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WireguardPeersDetails defines message 'wireguard_peers_details'. +// InProgress: the message form may change in the future versions +type WireguardPeersDetails struct { + Peer WireguardPeer `binapi:"wireguard_peer,name=peer" json:"peer,omitempty"` +} + +func (m *WireguardPeersDetails) Reset() { *m = WireguardPeersDetails{} } +func (*WireguardPeersDetails) GetMessageName() string { return "wireguard_peers_details" } +func (*WireguardPeersDetails) GetCrcString() string { return "29269d0e" } +func (*WireguardPeersDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WireguardPeersDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 32 // m.Peer.PublicKey + size += 2 // m.Peer.Port + size += 2 // m.Peer.PersistentKeepalive + size += 4 // m.Peer.TableID + size += 1 // m.Peer.Endpoint.Af + size += 1 * 16 // m.Peer.Endpoint.Un + size += 4 // m.Peer.SwIfIndex + size += 1 // m.Peer.Flags + size += 1 // m.Peer.NAllowedIps + for j2 := 0; j2 < len(m.Peer.AllowedIps); j2++ { + var s2 ip_types.Prefix + _ = s2 + if j2 < len(m.Peer.AllowedIps) { + s2 = m.Peer.AllowedIps[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + size += 1 // s2.Len + } + return size +} +func (m *WireguardPeersDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Peer.PublicKey, 32) + buf.EncodeUint16(m.Peer.Port) + buf.EncodeUint16(m.Peer.PersistentKeepalive) + buf.EncodeUint32(m.Peer.TableID) + buf.EncodeUint8(uint8(m.Peer.Endpoint.Af)) + buf.EncodeBytes(m.Peer.Endpoint.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Peer.SwIfIndex)) + buf.EncodeUint8(uint8(m.Peer.Flags)) + buf.EncodeUint8(uint8(len(m.Peer.AllowedIps))) + for j1 := 0; j1 < len(m.Peer.AllowedIps); j1++ { + var v1 ip_types.Prefix // AllowedIps + if j1 < len(m.Peer.AllowedIps) { + v1 = m.Peer.AllowedIps[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(v1.Len) + } + return buf.Bytes(), nil +} +func (m *WireguardPeersDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Peer.PublicKey = make([]byte, 32) + copy(m.Peer.PublicKey, buf.DecodeBytes(len(m.Peer.PublicKey))) + m.Peer.Port = buf.DecodeUint16() + m.Peer.PersistentKeepalive = buf.DecodeUint16() + m.Peer.TableID = buf.DecodeUint32() + m.Peer.Endpoint.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Peer.Endpoint.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Peer.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Peer.Flags = WireguardPeerFlags(buf.DecodeUint8()) + m.Peer.NAllowedIps = buf.DecodeUint8() + m.Peer.AllowedIps = make([]ip_types.Prefix, m.Peer.NAllowedIps) + for j1 := 0; j1 < len(m.Peer.AllowedIps); j1++ { + m.Peer.AllowedIps[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Peer.AllowedIps[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Peer.AllowedIps[j1].Len = buf.DecodeUint8() + } + return nil +} + +// WireguardPeersDump defines message 'wireguard_peers_dump'. +// InProgress: the message form may change in the future versions +type WireguardPeersDump struct { + PeerIndex uint32 `binapi:"u32,name=peer_index,default=4294967295" json:"peer_index,omitempty"` +} + +func (m *WireguardPeersDump) Reset() { *m = WireguardPeersDump{} } +func (*WireguardPeersDump) GetMessageName() string { return "wireguard_peers_dump" } +func (*WireguardPeersDump) GetCrcString() string { return "3b74607a" } +func (*WireguardPeersDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WireguardPeersDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PeerIndex + return size +} +func (m *WireguardPeersDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PeerIndex) + return buf.Bytes(), nil +} +func (m *WireguardPeersDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PeerIndex = buf.DecodeUint32() + return nil +} + +func init() { file_wireguard_binapi_init() } +func file_wireguard_binapi_init() { + api.RegisterMessage((*WantWireguardPeerEvents)(nil), "want_wireguard_peer_events_3bc666c8") + api.RegisterMessage((*WantWireguardPeerEventsReply)(nil), "want_wireguard_peer_events_reply_e8d4e804") + api.RegisterMessage((*WgSetAsyncMode)(nil), "wg_set_async_mode_a6465f7c") + api.RegisterMessage((*WgSetAsyncModeReply)(nil), "wg_set_async_mode_reply_e8d4e804") + api.RegisterMessage((*WireguardInterfaceCreate)(nil), "wireguard_interface_create_a530137e") + api.RegisterMessage((*WireguardInterfaceCreateReply)(nil), "wireguard_interface_create_reply_5383d31f") + api.RegisterMessage((*WireguardInterfaceDelete)(nil), "wireguard_interface_delete_f9e6675e") + api.RegisterMessage((*WireguardInterfaceDeleteReply)(nil), "wireguard_interface_delete_reply_e8d4e804") + api.RegisterMessage((*WireguardInterfaceDetails)(nil), "wireguard_interface_details_0dd4865d") + api.RegisterMessage((*WireguardInterfaceDump)(nil), "wireguard_interface_dump_2c954158") + api.RegisterMessage((*WireguardPeerAdd)(nil), "wireguard_peer_add_aedf8d59") + api.RegisterMessage((*WireguardPeerAddReply)(nil), "wireguard_peer_add_reply_084a0cd3") + api.RegisterMessage((*WireguardPeerEvent)(nil), "wireguard_peer_event_4e1b5d67") + api.RegisterMessage((*WireguardPeerRemove)(nil), "wireguard_peer_remove_3b74607a") + api.RegisterMessage((*WireguardPeerRemoveReply)(nil), "wireguard_peer_remove_reply_e8d4e804") + api.RegisterMessage((*WireguardPeersDetails)(nil), "wireguard_peers_details_29269d0e") + api.RegisterMessage((*WireguardPeersDump)(nil), "wireguard_peers_dump_3b74607a") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*WantWireguardPeerEvents)(nil), + (*WantWireguardPeerEventsReply)(nil), + (*WgSetAsyncMode)(nil), + (*WgSetAsyncModeReply)(nil), + (*WireguardInterfaceCreate)(nil), + (*WireguardInterfaceCreateReply)(nil), + (*WireguardInterfaceDelete)(nil), + (*WireguardInterfaceDeleteReply)(nil), + (*WireguardInterfaceDetails)(nil), + (*WireguardInterfaceDump)(nil), + (*WireguardPeerAdd)(nil), + (*WireguardPeerAddReply)(nil), + (*WireguardPeerEvent)(nil), + (*WireguardPeerRemove)(nil), + (*WireguardPeerRemoveReply)(nil), + (*WireguardPeersDetails)(nil), + (*WireguardPeersDump)(nil), + } +} diff --git a/binapi/wireguard/wireguard_rpc.ba.go b/binapi/wireguard/wireguard_rpc.ba.go new file mode 100644 index 0000000..16c882f --- /dev/null +++ b/binapi/wireguard/wireguard_rpc.ba.go @@ -0,0 +1,172 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package wireguard + +import ( + "context" + "fmt" + "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" +) + +// RPCService defines RPC service wireguard. +type RPCService interface { + WantWireguardPeerEvents(ctx context.Context, in *WantWireguardPeerEvents) (*WantWireguardPeerEventsReply, error) + WgSetAsyncMode(ctx context.Context, in *WgSetAsyncMode) (*WgSetAsyncModeReply, error) + WireguardInterfaceCreate(ctx context.Context, in *WireguardInterfaceCreate) (*WireguardInterfaceCreateReply, error) + WireguardInterfaceDelete(ctx context.Context, in *WireguardInterfaceDelete) (*WireguardInterfaceDeleteReply, error) + WireguardInterfaceDump(ctx context.Context, in *WireguardInterfaceDump) (RPCService_WireguardInterfaceDumpClient, error) + WireguardPeerAdd(ctx context.Context, in *WireguardPeerAdd) (*WireguardPeerAddReply, error) + WireguardPeerRemove(ctx context.Context, in *WireguardPeerRemove) (*WireguardPeerRemoveReply, error) + WireguardPeersDump(ctx context.Context, in *WireguardPeersDump) (RPCService_WireguardPeersDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) WantWireguardPeerEvents(ctx context.Context, in *WantWireguardPeerEvents) (*WantWireguardPeerEventsReply, error) { + out := new(WantWireguardPeerEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WgSetAsyncMode(ctx context.Context, in *WgSetAsyncMode) (*WgSetAsyncModeReply, error) { + out := new(WgSetAsyncModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WireguardInterfaceCreate(ctx context.Context, in *WireguardInterfaceCreate) (*WireguardInterfaceCreateReply, error) { + out := new(WireguardInterfaceCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WireguardInterfaceDelete(ctx context.Context, in *WireguardInterfaceDelete) (*WireguardInterfaceDeleteReply, error) { + out := new(WireguardInterfaceDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WireguardInterfaceDump(ctx context.Context, in *WireguardInterfaceDump) (RPCService_WireguardInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_WireguardInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_WireguardInterfaceDumpClient interface { + Recv() (*WireguardInterfaceDetails, error) + api.Stream +} + +type serviceClient_WireguardInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_WireguardInterfaceDumpClient) Recv() (*WireguardInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *WireguardInterfaceDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) WireguardPeerAdd(ctx context.Context, in *WireguardPeerAdd) (*WireguardPeerAddReply, error) { + out := new(WireguardPeerAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WireguardPeerRemove(ctx context.Context, in *WireguardPeerRemove) (*WireguardPeerRemoveReply, error) { + out := new(WireguardPeerRemoveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WireguardPeersDump(ctx context.Context, in *WireguardPeersDump) (RPCService_WireguardPeersDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_WireguardPeersDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_WireguardPeersDumpClient interface { + Recv() (*WireguardPeersDetails, error) + api.Stream +} + +type serviceClient_WireguardPeersDumpClient struct { + api.Stream +} + +func (c *serviceClient_WireguardPeersDumpClient) Recv() (*WireguardPeersDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *WireguardPeersDetails: + return m, nil + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} |