aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/openconfig/openconfig_local_routing.c
diff options
context:
space:
mode:
authorYohanPipereau <ypiperea@cisco.com>2019-02-28 17:21:51 +0100
committerYohanPipereau <ypiperea@cisco.com>2019-03-05 16:36:48 +0100
commit3430b042873f2eac94acd323125eaaa4a5f7f3e9 (patch)
tree45335d45b94259f53426413bc5333a36dcfb8f07 /src/plugins/openconfig/openconfig_local_routing.c
parent793682e6fcb9e39891c59c696e5f8e9c18f9d8e7 (diff)
Merge IETF and Openconfig to use SCVPP
scvpp should eventually be the only interface with VAPI and should not depend on sysrepo. -All sysrepo error codes in scvpp codes have been changed for errno error codes. scvpp might eventually needs its own error codes. -All log messages in scvpp have been removed as error codes are the only way of reporting failures in a library. -Move VAPI symbol definition to SCVPP. In scvpp, unused maccros SC_VPP_VAPI_RECV and SC_REGISTER_RPC_EVT_HANDLER have been removed. Regarding plugins update: -Use Openconfig way to convert interface name to interface index. -Use Openconfig way to enable/disable an interface. -Use Openconfig way of configuring interface IPs but use more arguments like IETF. -Use Openconfig way of adding a new route. -Use Openconfig way of dumping an IP. -Use common interface dump operation for get_name and get_id. -Delete unused create loopback Change-Id: Icc513a064a2528c2b4cbda2b0dd57755a3b08ef9 Signed-off-by: Yohan Pipereau <ypiperea@cisco.com>
Diffstat (limited to 'src/plugins/openconfig/openconfig_local_routing.c')
-rw-r--r--src/plugins/openconfig/openconfig_local_routing.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/plugins/openconfig/openconfig_local_routing.c b/src/plugins/openconfig/openconfig_local_routing.c
index 59574a2..39481e1 100644
--- a/src/plugins/openconfig/openconfig_local_routing.c
+++ b/src/plugins/openconfig/openconfig_local_routing.c
@@ -14,18 +14,17 @@
* limitations under the License.
*/
+#include <assert.h>
+#include <string.h>
+
#include "openconfig_local_routing.h"
+
#include "sys_util.h"
+
#include "sc_vpp_comm.h"
#include "sc_vpp_interface.h"
#include "sc_vpp_ip.h"
-#include <assert.h>
-#include <string.h>
-#include <sysrepo.h>
-#include <sysrepo/xpath.h>
-#include <sysrepo/values.h>
-
#define XPATH_SIZE 2000
int openconfig_local_routing_mod_cb(
@@ -87,15 +86,13 @@ static int set_route(sr_session_ctx_t *sess, const char *index,
return SR_ERR_INVAL_ARG;
}
- vapi_payload_ip_add_del_route_reply reply = {0};
-
- vapi_error_e rv = bin_api_ip_add_del_route(&reply, prefix, mask,
- next_hop, is_add, 0, interface);
- if (VAPI_OK != rv || reply.retval > 0) {
+ rc = ipv46_config_add_del_route(prefix, mask, next_hop, is_add, 0,
+ interface);
+ if (!rc) {
return SR_ERR_INVAL_ARG;
}
- return VAPI_OK;
+ return SR_ERR_OK;
}
// XPATH: /openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/config/