aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/openconfig
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/openconfig')
-rw-r--r--src/plugins/openconfig/openconfig_interfaces.c2
-rw-r--r--src/plugins/openconfig/openconfig_local_routing.c2
-rw-r--r--src/plugins/openconfig/sys_util.c83
-rw-r--r--src/plugins/openconfig/sys_util.h38
4 files changed, 2 insertions, 123 deletions
diff --git a/src/plugins/openconfig/openconfig_interfaces.c b/src/plugins/openconfig/openconfig_interfaces.c
index 85339af..c72ad7f 100644
--- a/src/plugins/openconfig/openconfig_interfaces.c
+++ b/src/plugins/openconfig/openconfig_interfaces.c
@@ -18,7 +18,7 @@
#include <string.h>
#include "openconfig_interfaces.h"
-#include "sys_util.h"
+#include "../sys_util.h"
#include "sc_vpp_comm.h"
#include "sc_vpp_interface.h"
diff --git a/src/plugins/openconfig/openconfig_local_routing.c b/src/plugins/openconfig/openconfig_local_routing.c
index 39481e1..5c63eaa 100644
--- a/src/plugins/openconfig/openconfig_local_routing.c
+++ b/src/plugins/openconfig/openconfig_local_routing.c
@@ -19,7 +19,7 @@
#include "openconfig_local_routing.h"
-#include "sys_util.h"
+#include "../sys_util.h"
#include "sc_vpp_comm.h"
#include "sc_vpp_interface.h"
diff --git a/src/plugins/openconfig/sys_util.c b/src/plugins/openconfig/sys_util.c
deleted file mode 100644
index 1a0ee9b..0000000
--- a/src/plugins/openconfig/sys_util.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2018 PANTHEON.tech.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "sys_util.h"
-#include "sc_vpp_comm.h"
-
-#include <string.h>
-#include <vppinfra/types.h>
-
-char* xpath_find_first_key(const char *xpath, char *key, sr_xpath_ctx_t *state)
-{
- char *value = NULL;
-
- if (sr_xpath_next_node((char *)xpath, state) == NULL) {
- return NULL;
- }
-
- while (((value = sr_xpath_node_key_value(NULL,
- key, state)) == NULL) &&
- (sr_xpath_next_node(NULL, state) != NULL));
-
- return value;
-}
-
-// we can call sr_get_item after change is called to see if the value has or has not
-// changed (simpleton solution :D)
-// sr_get_item(sess, "/ietf-interfaces:interfaces/interface[name='eth0']/enabled", &value);
-
-void log_recv_event(sr_notif_event_t event, const char *msg) {
- const char *event_s;
- switch (event) {
- case SR_EV_VERIFY: event_s = "SR_EV_VERIFY"; break;
- case SR_EV_APPLY: event_s = "SR_EV_APPLY"; break;
- case SR_EV_ABORT: event_s = "SR_EV_ABORT"; break;
- default: event_s = "SR_EV_UNKNOWN";
- }
- SRP_LOG_DBG("%s: %s\n", msg, event_s);
-}
-
-void log_recv_oper(sr_change_oper_t oper, const char *msg) {
- const char *oper_s;
- switch (oper) {
- case SR_OP_CREATED: oper_s = "SR_OP_CREATED"; break;
- case SR_OP_DELETED: oper_s = "SR_OP_DELETED"; break;
- case SR_OP_MODIFIED: oper_s = "SR_OP_MODIFIED"; break;
- case SR_OP_MOVED: oper_s = "SR_OP_MOVED"; break;
- default: oper_s = "SR_OP_UNKNOWN"; break;
- }
- SRP_LOG_DBG("%s: %s\n", msg, oper_s);
-}
-
-int ip_prefix_split(const char* ip_prefix)
-{
- //find the slash
- char* slash = strchr(ip_prefix, '/');
- if (NULL == slash)
- return -1;
-
- //extract subnet mask length
- char * eptr = NULL;
- u8 mask = strtoul(slash + 1, &eptr, 10);
- if (*eptr || mask <= 0)
- return -1;
-
- //keep just the address part
- *slash = '\0'; //replace '/' with 0
-
- //return mask length
- return mask;
-}
diff --git a/src/plugins/openconfig/sys_util.h b/src/plugins/openconfig/sys_util.h
deleted file mode 100644
index d525066..0000000
--- a/src/plugins/openconfig/sys_util.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2018 PANTHEON.tech.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SYS_UTIL_H__
-#define __SYS_UTIL_H__
-
-#include <sysrepo.h>
-#include <sysrepo/xpath.h>
-#include <sysrepo/plugins.h>
-
-#define XPATH_SIZE 2000
-
-typedef struct
-{
- char xpath_root[XPATH_SIZE];
- sr_val_t * values;
- size_t values_cnt;
-} sysr_values_ctx_t;
-
-char* xpath_find_first_key(const char *xpath, char *key, sr_xpath_ctx_t *state);
-void log_recv_event(sr_notif_event_t event, const char *msg);
-void log_recv_oper(sr_change_oper_t oper, const char *msg);
-int ip_prefix_split(const char* ip_prefix);
-
-#endif /* __SYS_UTIL_H__ */