diff options
Diffstat (limited to 'binapi/session')
-rw-r--r-- | binapi/session/session.ba.go | 301 | ||||
-rw-r--r-- | binapi/session/session_rest.ba.go | 235 | ||||
-rw-r--r-- | binapi/session/session_rpc.ba.go | 65 |
3 files changed, 338 insertions, 263 deletions
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) +} |