aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/CMakeLists.txt1
-rw-r--r--src/plugins/ietf/ietf_interface.c194
-rw-r--r--src/plugins/ietf/ietf_interface.h25
-rw-r--r--src/plugins/ietf/ietf_nat.c54
-rw-r--r--src/plugins/ietf/ietf_nat.h25
-rw-r--r--src/plugins/openconfig/openconfig_interfaces.c759
-rw-r--r--src/plugins/openconfig/openconfig_interfaces.h26
-rw-r--r--src/plugins/openconfig/openconfig_local_routing.c888
-rw-r--r--src/plugins/openconfig/openconfig_local_routing.h25
-rw-r--r--src/plugins/sc_model.h16
-rw-r--r--src/plugins/sc_plugins.c5
-rw-r--r--src/plugins/sys_util.c170
-rw-r--r--src/plugins/sys_util.h163
-rw-r--r--src/plugins/yang/ietf-interfaces.data.xml21
-rw-r--r--src/plugins/yang/ietf/iana-if-type@2017-01-19.yang1619
-rw-r--r--src/plugins/yang/ietf/ietf-interfaces@2014-05-08.yang707
-rw-r--r--src/plugins/yang/ietf/ietf-interfaces@2018-02-20.yang (renamed from src/plugins/yang/ietf/ietf-interfaces.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-extensions@2017-04-11.yang (renamed from src/plugins/yang/openconfig/openconfig-extensions.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-if-aggregate@2018-03-23.yang (renamed from src/plugins/yang/openconfig/openconfig-if-aggregate.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-if-ethernet@2018-09-04.yang (renamed from src/plugins/yang/openconfig/openconfig-if-ethernet.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-if-ip@2018-01-05.yang (renamed from src/plugins/yang/openconfig/openconfig-if-ip.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-if-types@2018-01-05.yang (renamed from src/plugins/yang/openconfig/openconfig-if-types.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-inet-types@2017-08-24.yang (renamed from src/plugins/yang/openconfig/openconfig-inet-types.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-interfaces@2018-08-07.yang (renamed from src/plugins/yang/openconfig/openconfig-interfaces.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-local-routing@2017-05-15.yang (renamed from src/plugins/yang/openconfig/openconfig-local-routing.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-policy-types@2018-06-05.yang (renamed from src/plugins/yang/openconfig/openconfig-policy-types.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-types@2018-05-05.yang (renamed from src/plugins/yang/openconfig/openconfig-types.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-vlan-types@2018-02-14.yang (renamed from src/plugins/yang/openconfig/openconfig-vlan-types.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-vlan@2018-06-05.yang (renamed from src/plugins/yang/openconfig/openconfig-vlan.yang)0
-rw-r--r--src/plugins/yang/openconfig/openconfig-yang-types@2018-04-24.yang (renamed from src/plugins/yang/openconfig/openconfig-yang-types.yang)0
30 files changed, 2468 insertions, 2230 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index d8dba04..d7f38e0 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -55,7 +55,6 @@ set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -std=gnu99 -DNDEBUG -O2 ${RIGOROUS_C_FL
set(PLUGINS_SOURCES
sc_plugins.c
sc_model.c
- sys_util.c
ietf/ietf_interface.c
ietf/ietf_nat.c
openconfig/openconfig_interfaces.c
diff --git a/src/plugins/ietf/ietf_interface.c b/src/plugins/ietf/ietf_interface.c
index 922c84f..0f8c37e 100644
--- a/src/plugins/ietf/ietf_interface.c
+++ b/src/plugins/ietf/ietf_interface.c
@@ -15,33 +15,12 @@
#include <stdio.h>
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include "ietf_interface.h"
+#include "../sc_model.h"
+#include "../sys_util.h"
-#include "sc_vpp_interface.h"
-#include "sc_vpp_ip.h"
-
-/**
- * @brief Helper function for converting netmask (ex: 255.255.255.0)
- * to prefix length (ex: 24).
- */
-static uint8_t
-netmask_to_prefix(const char *netmask)
-{
- in_addr_t n = 0;
- uint8_t i = 0;
-
- inet_pton(AF_INET, netmask, &n);
-
- while (n > 0) {
- n = n >> 1;
- i++;
- }
-
- return i;
-}
+#include <scvpp/interface.h>
+#include <scvpp/ip.h>
/**
* @brief Callback to be called by any config change of
@@ -51,6 +30,7 @@ static int
ietf_interface_enable_disable_cb(sr_session_ctx_t *session, const char *xpath,
sr_notif_event_t event, void *private_ctx)
{
+ UNUSED(private_ctx);
char *if_name = NULL;
sr_change_iter_t *iter = NULL;
sr_change_oper_t op = SR_OP_CREATED;
@@ -60,22 +40,22 @@ ietf_interface_enable_disable_cb(sr_session_ctx_t *session, const char *xpath,
int rc = SR_ERR_OK, op_rc = SR_ERR_OK;
SRP_LOG_INF("In %s", __FUNCTION__);
+
/* no-op for apply, we only care about SR_EV_ENABLED, SR_EV_VERIFY, SR_EV_ABORT */
- if (SR_EV_APPLY == event) {
+ if (SR_EV_APPLY == event)
return SR_ERR_OK;
- }
+
SRP_LOG_DBG("'%s' modified, event=%d", xpath, event);
/* get changes iterator */
rc = sr_get_changes_iter(session, xpath, &iter);
if (SR_ERR_OK != rc) {
+ sr_free_change_iter(iter);
SRP_LOG_ERR("Unable to retrieve change iterator: %s", sr_strerror(rc));
return rc;
}
- /* iterate over all changes */
- while ((SR_ERR_OK == op_rc || event == SR_EV_ABORT) &&
- (SR_ERR_OK == (rc = sr_get_change_next(session, iter, &op, &old_val, &new_val)))) {
+ foreach_change (session, iter, op, old_val, new_val) {
SRP_LOG_DBG("A change detected in '%s', op=%d", new_val ? new_val->xpath : old_val->xpath, op);
if_name = sr_xpath_key_value(new_val ? new_val->xpath : old_val->xpath, "interface", "name", &xpath_ctx);
@@ -102,23 +82,6 @@ ietf_interface_enable_disable_cb(sr_session_ctx_t *session, const char *xpath,
return op_rc;
}
-static int free_sw_interface_dump_ctx(dump_all_ctx * dctx)
-{
- if(dctx == NULL)
- return -1;
-
- if(dctx->intfcArray != NULL)
- {
- free(dctx->intfcArray);
- }
-
- dctx->intfcArray = NULL;
- dctx->capacity = 0;
- dctx->num_ifs = 0;
-
- return 0;
-}
-
/**
* @brief Modify existing IPv4/IPv6 config on an interface.
*/
@@ -169,7 +132,8 @@ interface_ipv46_config_modify(const char *if_name, sr_val_t *old_val,
}
/**
- * @brief Callback to be called by any config change in subtrees "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address"
+ * @brief Callback to be called by any config change in subtrees
+ * "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address"
* or "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address".
*/
static int
@@ -178,6 +142,7 @@ ietf_interface_ipv46_address_change_cb(sr_session_ctx_t *session,
sr_notif_event_t event,
void *private_ctx)
{
+ UNUSED(private_ctx);
sr_change_iter_t *iter = NULL;
sr_change_oper_t op = SR_OP_CREATED;
sr_val_t *old_val = NULL;
@@ -207,13 +172,12 @@ ietf_interface_ipv46_address_change_cb(sr_session_ctx_t *session,
/* get changes iterator */
rc = sr_get_changes_iter(session, xpath, &iter);
if (SR_ERR_OK != rc) {
+ sr_free_change_iter(iter);
SRP_LOG_ERR("Unable to retrieve change iterator: %s", sr_strerror(rc));
return rc;
}
- /* iterate over all changes */
- while ((SR_ERR_OK == op_rc || event == SR_EV_ABORT) &&
- (SR_ERR_OK == (rc = sr_get_change_next(session, iter, &op, &old_val, &new_val)))) {
+ foreach_change(session, iter, op, old_val, new_val) {
SRP_LOG_DBG("A change detected in '%s', op=%d", new_val ? new_val->xpath : old_val->xpath, op);
if_name = strdup(sr_xpath_key_value(new_val ? new_val->xpath : old_val->xpath, "interface", "name", &xpath_ctx));
@@ -287,8 +251,9 @@ static int
ietf_interface_change_cb(sr_session_ctx_t *session, const char *xpath,
sr_notif_event_t event, void *private_ctx)
{
+ UNUSED(session); UNUSED(xpath); UNUSED(event); UNUSED(private_ctx);
+
SRP_LOG_INF("In %s", __FUNCTION__);
- SRP_LOG_DBG("'%s' modified, event=%d", xpath, event);
return SR_ERR_OK;
}
@@ -298,87 +263,80 @@ ietf_interface_change_cb(sr_session_ctx_t *session, const char *xpath,
*/
static int
ietf_interface_state_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt,
- __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) const char *original_xpath,
- __attribute__((unused)) void *private_ctx)
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx)
{
- sr_val_t *values_arr = NULL;
- int values_arr_size = 0, values_arr_cnt = 0;
- dump_all_ctx dctx;
- int nb_iface;
- vpp_interface_t* if_details;
- int rc = 0;
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ struct elt* stack;
+ sw_interface_dump_t *dump;
+ sr_val_t *val = NULL;
+ int vc = 5; //number of answer per interfaces
+ int cnt = 0; //value counter
+ int rc = SR_ERR_OK;
SRP_LOG_INF("In %s", __FUNCTION__);
- if (! sr_xpath_node_name_eq(xpath, "interface")) {
- /* statistics, ipv4 and ipv6 state data not supported */
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+ if (!sr_xpath_node_name_eq(xpath, "interface"))
+ goto nothing_todo; //no interface field specified
/* dump interfaces */
- nb_iface = interface_dump_all(&dctx);
- if (nb_iface <= 0) {
- SRP_LOG_ERR_MSG("Error by processing of a interface dump request.");
- free_sw_interface_dump_ctx(&dctx);
- return SR_ERR_INTERNAL;
- }
+ stack = interface_dump_all();
+ if (!stack)
+ goto nothing_todo; //no element returned
/* allocate array of values to be returned */
- values_arr_size = nb_iface * 5;
- rc = sr_new_values(values_arr_size, &values_arr);
- if (0 != rc) {
- free_sw_interface_dump_ctx(&dctx);
- return rc;
- }
-
- int i = 0;
- for (; i < nb_iface; i++) {
- if_details = dctx.intfcArray+i;
-
- /* currently the only supported interface types are propVirtual / ethernetCsmacd */
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/type", xpath, if_details->interface_name);
- sr_val_set_str_data(&values_arr[values_arr_cnt], SR_IDENTITYREF_T,
- strstr((char*)if_details->interface_name, "local0") ? "iana-if-type:propVirtual" : "iana-if-type:ethernetCsmacd");
- values_arr_cnt++;
-
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/admin-status", xpath, if_details->interface_name);
- sr_val_set_str_data(&values_arr[values_arr_cnt], SR_ENUM_T, if_details->admin_up_down ? "up" : "down");
- values_arr_cnt++;
-
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/oper-status", xpath, if_details->interface_name);
- sr_val_set_str_data(&values_arr[values_arr_cnt], SR_ENUM_T, if_details->link_up_down ? "up" : "down");
- values_arr_cnt++;
-
- if (if_details->l2_address_length > 0) {
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/phys-address", xpath, if_details->interface_name);
- sr_val_build_str_data(&values_arr[values_arr_cnt], SR_STRING_T, "%02x:%02x:%02x:%02x:%02x:%02x",
- if_details->l2_address[0], if_details->l2_address[1], if_details->l2_address[2],
- if_details->l2_address[3], if_details->l2_address[4], if_details->l2_address[5]);
- values_arr_cnt++;
+ SRP_LOG_DBG("number of interfaces: %d", stack->id+1);
+ rc = sr_new_values((stack->id + 1)* vc, &val);
+ if (0 != rc)
+ goto nothing_todo;
+
+ foreach_stack_elt(stack) {
+ dump = (sw_interface_dump_t *) data;
+
+ SRP_LOG_DBG("State of interface %s", dump->interface_name);
+ //TODO need support for type propvirtual
+ sr_val_build_xpath(&val[cnt], "%s[name='%s']/type", xpath, dump->interface_name);
+ sr_val_set_str_data(&val[cnt], SR_IDENTITYREF_T, "iana-if-type:ethernetCsmacd");
+ cnt++;
+
+ //Be careful, it needs if-mib feature to work !
+ sr_val_build_xpath(&val[cnt], "%s[name='%s']/admin-status", xpath, dump->interface_name);
+ sr_val_set_str_data(&val[cnt], SR_ENUM_T, dump->link_up_down ? "up" : "down");
+ cnt++;
+
+ sr_val_build_xpath(&val[cnt], "%s[name='%s']/oper-status", xpath, dump->interface_name);
+ sr_val_set_str_data(&val[cnt], SR_ENUM_T, dump->link_up_down ? "up" : "down");
+ cnt++;
+
+ sr_val_build_xpath(&val[cnt], "%s[name='%s']/phys-address", xpath, dump->interface_name);
+ if (dump->l2_address_length > 0) {
+ sr_val_build_str_data(&val[cnt], SR_STRING_T,
+ "%02x:%02x:%02x:%02x:%02x:%02x",
+ dump->l2_address[0], dump->l2_address[1],
+ dump->l2_address[2], dump->l2_address[3],
+ dump->l2_address[4], dump->l2_address[5]);
} else {
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/phys-address", xpath, if_details->interface_name);
- sr_val_build_str_data(&values_arr[values_arr_cnt], SR_STRING_T, "%02x:%02x:%02x:%02x:%02x:%02x", 0,0,0,0,0,0);
- values_arr_cnt++;
+ sr_val_build_str_data(&val[cnt], SR_STRING_T, "%02x:%02x:%02x:%02x:%02x:%02x", 0,0,0,0,0,0);
}
+ cnt++;
- sr_val_build_xpath(&values_arr[values_arr_cnt], "%s[name='%s']/speed", xpath, if_details->interface_name);
- values_arr[values_arr_cnt].type = SR_UINT64_T;
- values_arr[values_arr_cnt].data.uint64_val = if_details->link_speed;
- values_arr_cnt++;
- }
-
- SRP_LOG_DBG("Returning %zu state data elements for '%s'", values_arr, xpath);
+ sr_val_build_xpath(&val[cnt], "%s[name='%s']/speed", xpath, dump->interface_name);
+ val[cnt].type = SR_UINT64_T;
+ val[cnt].data.uint64_val = dump->link_speed;
+ cnt++;
- *values = values_arr;
- *values_cnt = values_arr_cnt;
+ free(dump);
+ }
- free_sw_interface_dump_ctx(&dctx);
+ *values = val;
+ *values_cnt = cnt;
return SR_ERR_OK;
+
+nothing_todo:
+ *values = NULL;
+ *values_cnt = 0;
+ return rc;
}
const xpath_t ietf_interfaces_xpaths[IETF_INTERFACES_SIZE] = {
diff --git a/src/plugins/ietf/ietf_interface.h b/src/plugins/ietf/ietf_interface.h
deleted file mode 100644
index 28a3783..0000000
--- a/src/plugins/ietf/ietf_interface.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2018 HUACHENTEL and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IETF_INTERFACE_H__
-#define __IETF_INTERFACE_H__
-
-#include "../sc_model.h"
-
-#define IETF_INTERFACES_SIZE 5
-extern const xpath_t ietf_interfaces_xpaths[IETF_INTERFACES_SIZE];
-
-#endif /* __IETF_INTERFACE_H__ */
-
diff --git a/src/plugins/ietf/ietf_nat.c b/src/plugins/ietf/ietf_nat.c
index 86c8570..9b2890e 100644
--- a/src/plugins/ietf/ietf_nat.c
+++ b/src/plugins/ietf/ietf_nat.c
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "ietf_nat.h"
-#include "sc_vpp_comm.h"
-#include "sc_vpp_interface.h"
-#include "sc_vpp_nat.h"
+#include <scvpp/comm.h>
+#include <scvpp/interface.h>
+#include <scvpp/nat.h>
+
+#include "../sc_model.h"
#include <assert.h>
#include <string.h>
@@ -30,17 +31,6 @@
#include "../sys_util.h"
-static int ietf_nat_mod_cb(
- __attribute__((unused)) sr_session_ctx_t *session,
- __attribute__((unused)) const char *module_name,
- __attribute__((unused)) sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
-{
- SRP_LOG_INF("Module subscribe: %s", module_name);
-
- return SR_ERR_OK;
-}
-
/**
* @brief Wrapper struct for VAPI address range payload.
*/
@@ -103,8 +93,7 @@ static int parse_instance_policy_external_ip_address_pool(
if (sr_xpath_node_name_eq(val->xpath, "pool-id")) {
SRP_LOG_WRN("%s not supported.", val->xpath);
} else if(sr_xpath_node_name_eq(val->xpath, "external-ip-pool")) {
- rc = get_address_from_prefix(tmp_str, val->data.string_val,
- VPP_IP4_ADDRESS_STRING_LEN, &prefix);
+ rc = prefix2address(tmp_str, val->data.string_val, &prefix);
if (0 != rc) {
SRP_LOG_ERR_MSG("Error translate");
return SR_ERR_INVAL_ARG;
@@ -136,8 +125,9 @@ static int parse_instance_policy_external_ip_address_pool(
// XPATH: /ietf-nat:nat/instances/instance[id='%s']/policy[id='%s']/external-ip-address-pool[pool-id='%s']/
static int instances_instance_policy_external_ip_address_pool_cb(
sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+ void *private_ctx)
{
+ UNUSED(private_ctx);
sr_error_t rc = SR_ERR_OK;
sr_change_iter_t *it = NULL;
sr_change_oper_t oper;
@@ -150,6 +140,8 @@ static int instances_instance_policy_external_ip_address_pool_cb(
ARG_CHECK2(SR_ERR_INVAL_ARG, ds, xpath);
+ SRP_LOG_INF("In %s", __FUNCTION__);
+
new_address_r.payload.vrf_id = ~0;
old_address_r.payload.vrf_id = ~0;
@@ -165,8 +157,7 @@ static int instances_instance_policy_external_ip_address_pool_cb(
return SR_ERR_OK;
}
- while (sr_get_change_next(ds, it, &oper,
- &old_val, &new_val) == SR_ERR_OK) {
+ foreach_change (ds, it, oper, old_val, new_val) {
SRP_LOG_DBG("A change detected in '%s', op=%d",
new_val ? new_val->xpath : old_val->xpath, oper);
@@ -345,8 +336,7 @@ static int parse_instance_mapping_table_mapping_entry(
return SR_ERR_INVAL_ARG;
}
- rc = get_address_from_prefix(tmp_str, val->data.string_val,
- VPP_IP4_PREFIX_STRING_LEN, NULL);
+ rc = prefix2address(tmp_str, val->data.string_val, NULL);
if (0 != rc) {
SRP_LOG_ERR_MSG("Error translate");
return SR_ERR_INVAL_ARG;
@@ -367,8 +357,7 @@ static int parse_instance_mapping_table_mapping_entry(
return SR_ERR_INVAL_ARG;
}
- rc = get_address_from_prefix(tmp_str, val->data.string_val,
- VPP_IP4_ADDRESS_STRING_LEN, NULL);
+ rc = prefix2address(tmp_str, val->data.string_val, NULL);
if (0 != rc) {
SRP_LOG_ERR_MSG("Error translate");
return SR_ERR_INVAL_ARG;
@@ -402,8 +391,9 @@ static int parse_instance_mapping_table_mapping_entry(
// XPATH: /ietf-nat:nat/instances/instance[id='%s']/mapping-table/mapping-entry[index='%s']/
static int instances_instance_mapping_table_mapping_entry_cb(
sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+ void *private_ctx)
{
+ UNUSED(private_ctx);
sr_error_t rc = SR_ERR_OK;
sr_change_iter_t *it = NULL;
sr_change_oper_t oper;
@@ -416,6 +406,8 @@ static int instances_instance_mapping_table_mapping_entry_cb(
ARG_CHECK2(SR_ERR_INVAL_ARG, ds, xpath);
+ SRP_LOG_INF("In %s", __FUNCTION__);
+
new_mapping.mtype = UNKNOWN;
old_mapping.mtype = UNKNOWN;
@@ -431,8 +423,7 @@ static int instances_instance_mapping_table_mapping_entry_cb(
return SR_ERR_OK;
}
- while (sr_get_change_next(ds, it, &oper,
- &old_val, &new_val) == SR_ERR_OK) {
+ foreach_change (ds, it, oper, old_val, new_val) {
SRP_LOG_DBG("A change detected in '%s', op=%d",
new_val ? new_val->xpath : old_val->xpath, oper);
@@ -503,15 +494,6 @@ error:
const xpath_t ietf_nat_xpaths[IETF_NAT_SIZE] = {
{
- .xpath = "ietf-nat",
- .method = MODULE,
- .datastore = SR_DS_RUNNING,
- .cb.mcb = ietf_nat_mod_cb,
- .private_ctx = NULL,
- .priority = 0,
- .opts = SR_SUBSCR_EV_ENABLED | SR_SUBSCR_APPLY_ONLY | SR_SUBSCR_CTX_REUSE
- },
- {
.xpath = "/ietf-nat:nat/instances/instance/policy/external-ip-address-pool",
.method = XPATH,
.datastore = SR_DS_RUNNING,
diff --git a/src/plugins/ietf/ietf_nat.h b/src/plugins/ietf/ietf_nat.h
deleted file mode 100644
index 7495209..0000000
--- a/src/plugins/ietf/ietf_nat.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2019 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 __IETF_NAT_H__
-#define __IETF_NAT_H__
-
-#include "../sc_model.h"
-
-#define IETF_NAT_SIZE 3
-extern const xpath_t ietf_nat_xpaths[IETF_NAT_SIZE];
-
-#endif
diff --git a/src/plugins/openconfig/openconfig_interfaces.c b/src/plugins/openconfig/openconfig_interfaces.c
index c72ad7f..7242c2b 100644
--- a/src/plugins/openconfig/openconfig_interfaces.c
+++ b/src/plugins/openconfig/openconfig_interfaces.c
@@ -17,119 +17,72 @@
#include <assert.h>
#include <string.h>
-#include "openconfig_interfaces.h"
-#include "../sys_util.h"
-
-#include "sc_vpp_comm.h"
-#include "sc_vpp_interface.h"
-#include "sc_vpp_ip.h"
+#include <scvpp/comm.h>
+#include <scvpp/interface.h>
+#include <scvpp/ip.h>
-#define XPATH_SIZE 2000
+#include "../sc_model.h"
+#include "../sys_util.h"
// XPATH: /openconfig-interfaces:interfaces/interface[name='%s']/config/
-int openconfig_interfaces_interfaces_interface_config_cb(
+static int openconfig_interfaces_interfaces_interface_config_cb(
sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+ void *private_ctx)
{
+ UNUSED(private_ctx);
sr_change_iter_t *it = NULL;
sr_change_oper_t oper;
- sr_val_t *old_val = NULL;
- sr_val_t *new_val = NULL;
+ sr_xpath_ctx_t state = {0};
+ sr_val_t *old = NULL;
+ sr_val_t *new = NULL;
char *tmp = NULL;
char interface_name[XPATH_SIZE] = {0};
int rc = 0;
- SRP_LOG_INF_MSG("In openconfig_interfaces_interfaces_interface_config_cb");
+ SRP_LOG_INF("In %s", __FUNCTION__);
+ SRP_LOG_INF("XPATH %s", xpath);
ARG_CHECK2(SR_ERR_INVAL_ARG, ds, xpath);
- // if we receive event SR_EV_APPLY - config has changed
-
- log_recv_event(event, "subtree_change_cb received");
- SRP_LOG_DBG("[SRP_LOG_DBG] xpath: %s", xpath);
-
- // apply configuration
- //
- //
- // in this type i guess we can call sr_get_item()
- // because we are subscribed to leaf we shouldn't
- // get more than one change in one callback
- // each chage represent change in a hierarchy of
- // xml document
- //
- if (event != SR_EV_APPLY) {
+ if (event == SR_EV_APPLY)
return SR_ERR_OK;
- }
-
- // first we get event VERIFY
- // then we get event APPLY
- // - we can return error from VERIFY event
- // - we can't return error from APPLY event
if (sr_get_changes_iter(ds, (char *)xpath, &it) != SR_ERR_OK) {
- // in example he calls even on fale
sr_free_change_iter(it);
return SR_ERR_OK;
}
- while (sr_get_change_next(ds, it, &oper,
- &old_val, &new_val) == SR_ERR_OK) {
+ foreach_change (ds, it, oper, old, new) {
- log_recv_oper(oper, "subtree_change_cb received");
+ SRP_LOG_DBG("xpath: %s", new->xpath);
- SRP_LOG_DBG("xpath: %s", new_val->xpath);
-
- sr_xpath_ctx_t state = {0};
-
- tmp = xpath_find_first_key(new_val->xpath, "name", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("interface_name NOT found.");
- continue;
+ tmp = sr_xpath_key_value(new->xpath, "interface", "name", &state);
+ if (!tmp) {
+ sr_set_error(ds, "XPATH interface name NOT found", new->xpath);
+ return SR_ERR_INVAL_ARG;
}
-
strncpy(interface_name, tmp, XPATH_SIZE);
sr_xpath_recover(&state);
switch (oper) {
case SR_OP_CREATED:
- if (sr_xpath_node_name_eq(new_val->xpath, "name")) {
- //TODO: LEAF: name, type: string
- } else if(sr_xpath_node_name_eq(new_val->xpath, "type")) {
- //TODO: LEAF: type, type: identityref
- } else if(sr_xpath_node_name_eq(new_val->xpath, "mtu")) {
- //TODO: LEAF: mtu, type: uint16
- } else if(sr_xpath_node_name_eq(new_val->xpath,
- "loopback-mode")) {
- //TODO: LEAF: loopback-mode, type: boolean
- } else if(sr_xpath_node_name_eq(new_val->xpath,
- "description")) {
- //TODO: LEAF: description, type: string
- } else if(sr_xpath_node_name_eq(new_val->xpath, "enabled")) {
- rc = interface_enable(interface_name,
- new_val->data.bool_val);
- } else if(sr_xpath_node_name_eq(new_val->xpath,
- "oc-vlan:tpid")) {
- //TODO: LEAF: oc-vlan:tpid, type: identityref
- }
- break;
-
case SR_OP_MODIFIED:
- if (sr_xpath_node_name_eq(new_val->xpath, "name")) {
+ if (sr_xpath_node_name_eq(new->xpath, "name")) {
//TODO: LEAF: name, type: string
- } else if(sr_xpath_node_name_eq(new_val->xpath, "type")) {
+ } else if(sr_xpath_node_name_eq(new->xpath, "type")) {
//TODO: LEAF: type, type: identityref
- } else if(sr_xpath_node_name_eq(new_val->xpath, "mtu")) {
+ } else if(sr_xpath_node_name_eq(new->xpath, "mtu")) {
//TODO: LEAF: mtu, type: uint16
- } else if(sr_xpath_node_name_eq(new_val->xpath,
+ } else if(sr_xpath_node_name_eq(new->xpath,
"loopback-mode")) {
//TODO: LEAF: loopback-mode, type: boolean
- } else if(sr_xpath_node_name_eq(new_val->xpath,
+ } else if(sr_xpath_node_name_eq(new->xpath,
"description")) {
//TODO: LEAF: description, type: string
- } else if(sr_xpath_node_name_eq(new_val->xpath, "enabled")) {
+ } else if(sr_xpath_node_name_eq(new->xpath, "enabled")) {
rc = interface_enable(interface_name,
- new_val->data.bool_val);
- } else if(sr_xpath_node_name_eq(new_val->xpath,
+ new->data.bool_val);
+ } else if(sr_xpath_node_name_eq(new->xpath,
"oc-vlan:tpid")) {
//TODO: LEAF: oc-vlan:tpid, type: identityref
}
@@ -139,21 +92,21 @@ int openconfig_interfaces_interfaces_interface_config_cb(
break;
case SR_OP_DELETED:
- if (sr_xpath_node_name_eq(old_val->xpath, "name")) {
+ if (sr_xpath_node_name_eq(old->xpath, "name")) {
//TODO: LEAF: name, type: string
- } else if(sr_xpath_node_name_eq(old_val->xpath, "type")) {
+ } else if(sr_xpath_node_name_eq(old->xpath, "type")) {
//TODO: LEAF: type, type: identityref
- } else if(sr_xpath_node_name_eq(old_val->xpath, "mtu")) {
+ } else if(sr_xpath_node_name_eq(old->xpath, "mtu")) {
//TODO: LEAF: mtu, type: uint16
- } else if(sr_xpath_node_name_eq(old_val->xpath,
+ } else if(sr_xpath_node_name_eq(old->xpath,
"loopback-mode")) {
//TODO: LEAF: loopback-mode, type: boolean
- } else if(sr_xpath_node_name_eq(old_val->xpath,
+ } else if(sr_xpath_node_name_eq(old->xpath,
"description")) {
//TODO: LEAF: description, type: string
- } else if(sr_xpath_node_name_eq(old_val->xpath, "enabled")) {
+ } else if(sr_xpath_node_name_eq(old->xpath, "enabled")) {
rc = interface_enable(interface_name, false);
- } else if(sr_xpath_node_name_eq(old_val->xpath,
+ } else if(sr_xpath_node_name_eq(old->xpath,
"oc-vlan:tpid")) {
//TODO: LEAF: oc-vlan:tpid, type: identityref
}
@@ -163,8 +116,8 @@ int openconfig_interfaces_interfaces_interface_config_cb(
if (0 != rc) {
sr_xpath_recover(&state);
- sr_free_val(old_val);
- sr_free_val(new_val);
+ sr_free_val(old);
+ sr_free_val(new);
sr_free_change_iter(it);
@@ -173,175 +126,190 @@ int openconfig_interfaces_interfaces_interface_config_cb(
sr_xpath_recover(&state);
- sr_free_val(old_val);
- sr_free_val(new_val);
+ sr_free_val(old);
+ sr_free_val(new);
}
sr_free_change_iter(it);
return SR_ERR_OK;
}
-// openconfig-interfaces
-int openconfig_interface_mod_cb(
- __attribute__((unused)) sr_session_ctx_t *session,
- __attribute__((unused)) const char *module_name,
- __attribute__((unused)) sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
-{
- SRP_LOG_INF_MSG("In openconfig_interface_mod_cb");
-
- return SR_ERR_OK;
-}
-
-typedef struct
+//XPATH : /openconfig-interfaces:interfaces/interface/state
+static int
+openconfig_interfaces_interfaces_interface_state_cb(
+ const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id, const char *original_xpath,
+ void *private_ctx)
{
- bool is_subif;
- u32 subinterface_index;
- sw_interface_details_query_t sw_interface_details_query;
- sysr_values_ctx_t sysr_values_ctx;
-} sys_sw_interface_dump_ctx;
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ sw_interface_dump_t reply = {0};
+ sr_val_t *vals = NULL;
+ sr_xpath_ctx_t state = {0};
+ char interface_name[VPP_INTFC_NAME_LEN] = {0};
+ char xpath_root[XPATH_SIZE];
+ int vc = 10;
+ char *tmp;
+ int rc;
-#define NOT_AVAL "NA"
+ SRP_LOG_INF("In %s", __FUNCTION__);
+ ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
-static int sw_interface_dump_cb_inner(
- vapi_payload_sw_interface_details * reply,
- sys_sw_interface_dump_ctx * dctx)
-{
- sr_val_t *vals = NULL;
- int rc = 0;
- int vc = 0;
+ tmp = sr_xpath_key_value((char*) xpath, "interface", "name", &state);
+ if (!tmp) {
+ SRP_LOG_ERR_MSG("XPATH interface name not found");
+ return SR_ERR_INVAL_ARG;
+ }
+ strncpy(interface_name, tmp, VPP_INTFC_NAME_LEN);
+ sr_xpath_recover(&state);
- ARG_CHECK2(SR_ERR_INVAL_ARG, reply, dctx);
+ snprintf(xpath_root, XPATH_SIZE,
+ "/openconfig-interfaces:interfaces/interface[name='%s']/state",
+ interface_name);
- vc = 10;
+ //dump interface interface_name
+ rc = interface_dump_iface(&reply, interface_name);
+ if (rc == -SCVPP_NOT_FOUND) {
+ SRP_LOG_ERR_MSG("interface not found");
+ return SR_ERR_NOT_FOUND;
+ }
- /* convenient functions such as this can be found in sysrepo/values.h */
rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
+ if (SR_ERR_OK != rc)
return rc;
- }
-
- const char* interface_name = (const char*)dctx->sw_interface_details_query.sw_interface_details.interface_name;
- sr_val_build_xpath(&vals[0], "%s/name", dctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[0], SR_STRING_T, interface_name);
+ sr_val_build_xpath(&vals[0], "%s/name", xpath_root);
+ sr_val_set_str_data(&vals[0], SR_STRING_T, (char *)reply.interface_name);
- sr_val_build_xpath(&vals[1], "%s/type", dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[1], "%s/type", xpath_root);
sr_val_set_str_data(&vals[1], SR_IDENTITYREF_T, "ianaift:ethernetCsmacd");
- sr_val_build_xpath(&vals[2], "%s/mtu", dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[2], "%s/mtu", xpath_root);
vals[2].type = SR_UINT16_T;
- vals[2].data.uint16_val = reply->link_mtu;
+ vals[2].data.uint16_val = reply.link_mtu;
- sr_val_build_xpath(&vals[3], "%s/loopback-mode",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[3], "%s/loopback-mode", xpath_root);
vals[3].type = SR_BOOL_T;
- vals[3].data.bool_val = (0 == strncmp(interface_name, "loop", 4)) ? 1 : 0;
+ if (strncmp((char*)reply.interface_name, "loop", 4) == 0)
+ vals[3].data.bool_val = 1;
+ else
+ vals[3].data.bool_val = 0;
- sr_val_build_xpath(&vals[4], "%s/description",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[4], "%s/description", xpath_root);
sr_val_set_str_data(&vals[4], SR_STRING_T, NOT_AVAL);
- sr_val_build_xpath(&vals[5], "%s/enabled",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[5], "%s/enabled", xpath_root);
vals[5].type = SR_BOOL_T;
- vals[5].data.bool_val = reply->admin_up_down;
+ vals[5].data.bool_val = reply.admin_up_down;
- sr_val_build_xpath(&vals[6], "%s/ifindex",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[6], "%s/ifindex", xpath_root);
vals[6].type = SR_UINT32_T;
- vals[6].data.uint32_val = reply->sw_if_index;
+ vals[6].data.uint32_val = reply.sw_if_index;
- sr_val_build_xpath(&vals[7], "%s/admin-status",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[7], "%s/admin-status", xpath_root);
sr_val_set_str_data(&vals[7], SR_ENUM_T,
- reply->admin_up_down ? "UP" : "DOWN");
+ reply.admin_up_down ? "UP" : "DOWN");
- sr_val_build_xpath(&vals[8], "%s/oper-status",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[8], "%s/oper-status", xpath_root);
sr_val_set_str_data(&vals[8], SR_ENUM_T,
- reply->link_up_down ? "UP" : "DOWN");
+ reply.link_up_down ? "UP" : "DOWN");
//TODO: Openconfig required this value
- // sr_val_build_xpath(&vals[9], "%s/last-change", dctx->sysr_values_ctx.xpath_root);
+ // sr_val_build_xpath(&vals[9], "%s/last-change", xpath_root);
// sr_val_set_str_data(&vals[9], YANG INPUT TYPE: oc-types:timeticks64);
- sr_val_build_xpath(&vals[9], "%s/logical",
- dctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[9], "%s/logical", xpath_root);
vals[9].type = SR_BOOL_T;
- vals[9].data.bool_val = true; //for now, we assume all are logical
+ vals[9].data.bool_val = true; //for now, we assume all are logical
- dctx->sysr_values_ctx.values = vals;
- dctx->sysr_values_ctx.values_cnt = vc;
+ *values = vals;
+ *values_cnt = vc;
return SR_ERR_OK;
}
-static int sw_subinterface_dump_cb_inner(
- vapi_payload_sw_interface_details *reply,
- sys_sw_interface_dump_ctx *dctx)
+//TODO: for some arcane reason, this doesn't work
+static int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_state_cb(
+ const char *xpath, sr_val_t **values, size_t *values_cnt,
+ uint64_t request_id, const char *original_xpath, void *private_ctx)
{
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ char xpath_root[XPATH_SIZE] = {0};
+ sr_xpath_ctx_t state = {0};
sr_val_t *vals = NULL;
- int rc = 0;
- int vc = 0, val_idx = 0;
+ char interface_name[VPP_INTFC_NAME_LEN] = {0};
+ char subinterface_index[XPATH_SIZE] = {0};
+ char address_ip[XPATH_SIZE] = {0};
+ u8 prefix_len;
+ char *tmp = NULL;
+ int rc, cnt = 0;
- ARG_CHECK2(SR_ERR_INVAL_ARG, reply, dctx);
+ ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
- vc = 6;
- /* convenient functions such as this can be found in sysrepo/values.h */
- rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
+ SRP_LOG_INF("In %s", __FUNCTION__);
+
+ /* Get XPATH parameters name, index and ip */
+
+ tmp = sr_xpath_key_value((char*)xpath, "interface", "name", &state);
+ if (!tmp) {
+ SRP_LOG_ERR_MSG("XPATH interface name not found");
+ return SR_ERR_INVAL_ARG;
}
+ strncpy(interface_name, tmp, VPP_INTFC_NAME_LEN);
+ sr_xpath_recover(&state);
- sr_val_build_xpath(&vals[val_idx], "%s/index",
- dctx->sysr_values_ctx.xpath_root);
- vals[val_idx].type = SR_UINT32_T;
- vals[val_idx++].data.uint32_val = dctx->subinterface_index;
+ tmp = sr_xpath_key_value((char*)xpath, "subinterface", "index", &state);
+ if (NULL == tmp) {
+ SRP_LOG_ERR_MSG("XPATH subinterface index not found.");
+ return SR_ERR_INVAL_ARG;
+ }
+ strncpy(subinterface_index, tmp, XPATH_SIZE);
+ sr_xpath_recover(&state);
- sr_val_build_xpath(&vals[val_idx], "%s/description",
- dctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[val_idx++], SR_STRING_T, NOT_AVAL);
+ tmp = sr_xpath_key_value((char*)xpath, "address", "ip", &state);
+ if (NULL == tmp) {
+ SRP_LOG_ERR_MSG("XPATH address ip not found.");
+ return SR_ERR_INVAL_ARG;
+ }
+ strncpy(address_ip, tmp, XPATH_SIZE);
+ sr_xpath_recover(&state);
- sr_val_build_xpath(&vals[val_idx], "%s/enabled",
- dctx->sysr_values_ctx.xpath_root);
- vals[val_idx].type = SR_BOOL_T;
- vals[val_idx++].data.bool_val = reply->admin_up_down;
+ snprintf(xpath_root, XPATH_SIZE, "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/openconfig-if-ip:ipv4/openconfig-if-ip:addresses/openconfig-if-ip:address[ip='%s']/openconfig-if-ip:state",
+ interface_name, subinterface_index, address_ip);
- //TODO: Openconfig required this value
- // sr_val_build_xpath(&vals[val_idx], "%s/name", dctx->sysr_values_ctx.xpath_root);
- // sr_val_set_str_data(&vals[val_idx++], SR_STRING_T, YANG INPUT TYPE: string);
+ rc = ipv46_address_dump(interface_name, address_ip, &prefix_len, false);
+ if (!rc) {
+ SRP_LOG_ERR_MSG("ipv46_address_dump failed");
+ return SR_ERR_INVAL_ARG;
+ }
- // sr_val_build_xpath(&vals[val_idx], "%s/ifindex", interface_name, subinterface_index);
- // vals[val_idx].type = SR_UINT32_T;
- // vals[val_idx++].data.uint32_val = YANG INPUT TYPE: uint32;
+ /* Build answer to state XPATH */
- sr_val_build_xpath(&vals[val_idx], "%s/admin-status",
- dctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[val_idx++], SR_ENUM_T,
- reply->admin_up_down ? "UP" : "DOWN");
+ rc = sr_new_values(3, &vals);
+ if (SR_ERR_OK != rc)
+ return rc;
- sr_val_build_xpath(&vals[val_idx], "%s/oper-status",
- dctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[val_idx++], SR_ENUM_T,
- reply->admin_up_down ? "UP" : "DOWN");
+ sr_val_build_xpath(&vals[cnt], "%s/openconfig-if-ip:ip", xpath_root);
+ sr_val_set_str_data(&vals[cnt], SR_STRING_T, address_ip);
+ cnt++;
- //TODO: Openconfig required this value
- // sr_val_build_xpath(&vals[val_idx], "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/state/last-change", interface_name, subinterface_index);
- // sr_val_set_str_data(&vals[val_idx++], YANG INPUT TYPE: oc-types:timeticks64);
+ sr_val_build_xpath(&vals[cnt], "%s/openconfig-if-ip:prefix-length", xpath_root);
+ vals[cnt].type = SR_UINT8_T;
+ vals[cnt].data.uint8_val = prefix_len;
+ cnt++;
- sr_val_build_xpath(&vals[val_idx], "%s/logical",
- dctx->sysr_values_ctx.xpath_root);
- vals[val_idx].type = SR_BOOL_T;
- vals[val_idx++].data.bool_val = true; //for now, we assume all are logical
+ sr_val_build_xpath(&vals[cnt], "%s/openconfig-if-ip:origin", xpath_root);
+ sr_val_set_str_data(&vals[cnt], SR_ENUM_T, "STATIC");
+ cnt++;
- dctx->sysr_values_ctx.values = vals;
- dctx->sysr_values_ctx.values_cnt = vc;
+ sr_xpath_recover(&state);
+ *values = vals;
+ *values_cnt = cnt;
return SR_ERR_OK;
}
+/* TODO move to common functions between all plugins */
static bool
is_subinterface(const char* subif_name, const char* base_name,
const u32 subif_index)
@@ -351,11 +319,10 @@ is_subinterface(const char* subif_name, const char* base_name,
const char* dot = strchr(subif_name, '.');
if (NULL == dot && 0 == subif_index)
- return true; //subif_index == 0 can pass as a "real" interface
+ return true; //subif_index == 0 can pass as a "real" interface
if (dot > subif_name && 0 == strncmp(subif_name, base_name,
- dot - subif_name))
- {
+ dot - subif_name)) {
char * eptr = NULL;
u32 si = strtoul(dot + 1, &eptr, 10);
@@ -366,289 +333,126 @@ is_subinterface(const char* subif_name, const char* base_name,
return false;
}
-static vapi_error_e
-sw_interface_dump_vapi_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
- vapi_error_e rv, bool is_last,
- vapi_payload_sw_interface_details * reply)
-{
- ARG_CHECK(VAPI_EINVAL, callback_ctx);
-
- if (is_last)
- {
- assert (NULL == reply);
- }
- else
- {
- assert (NULL != reply);
- sys_sw_interface_dump_ctx *dctx = callback_ctx;
-
- const char* const dctx_interface_name = (const char *)dctx->sw_interface_details_query.sw_interface_details.interface_name;
-
- SRP_LOG_DBG("interface_name: '%s', if_name: '%s'", reply->interface_name, dctx_interface_name);
-
- if (dctx->is_subif)
- {
- if (is_subinterface((const char*)reply->interface_name,
- dctx_interface_name, dctx->subinterface_index))
- sw_subinterface_dump_cb_inner(reply, dctx);
- }
- else
- {
- if (0 == strcmp(dctx_interface_name, (char *)reply->interface_name))
- {
- dctx->sw_interface_details_query.sw_interface_details = *reply;
- dctx->sw_interface_details_query.interface_found = true;
-
- sw_interface_dump_cb_inner(reply, dctx);
- }
- }
- }
-
- return VAPI_OK;
-}
-
-static vapi_error_e sysr_sw_interface_dump(sys_sw_interface_dump_ctx * dctx)
-{
- vapi_msg_sw_interface_dump *dump;
- vapi_error_e rv;
-
- ARG_CHECK(VAPI_EINVAL, dctx);
-
- dump = vapi_alloc_sw_interface_dump(g_vapi_ctx_instance);
-
- dump->payload.name_filter_valid = true;
- strcpy((char*)dump->payload.name_filter, (const char *)dctx->sw_interface_details_query.sw_interface_details.interface_name);
-
- VAPI_CALL(vapi_sw_interface_dump(g_vapi_ctx_instance, dump, sw_interface_dump_vapi_cb,
- dctx));
-
- if (VAPI_OK != rv) {
- SRP_LOG_DBG("vapi_sw_interface_dump error=%d", rv);
- }
-
- return rv;
-}
-
-int openconfig_interfaces_interfaces_interface_state_cb(
- const char *xpath, sr_val_t **values,
- size_t *values_cnt,
- __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) const char *original_xpath,
- __attribute__((unused)) void *private_ctx)
-{
- sr_xpath_ctx_t state = {0};
- char *tmp = NULL;
- char interface_name[XPATH_SIZE] = {0};
-
- SRP_LOG_INF_MSG("In openconfig_interfaces_interfaces_interface_state_cb");
-
- ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
-
- tmp = xpath_find_first_key(xpath, "name", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("Interface name not found in sysrepo database");
- return SR_ERR_INVAL_ARG;
- }
-
- strncpy(interface_name, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
-
- sys_sw_interface_dump_ctx dctx = {
- .is_subif = false
- };
- sw_interface_details_query_set_name(&dctx.sw_interface_details_query,
- interface_name);
-
- snprintf(dctx.sysr_values_ctx.xpath_root, XPATH_SIZE,
- "/openconfig-interfaces:interfaces/interface[name='%s']/state",
- interface_name);
-
- sysr_sw_interface_dump(&dctx);
-
- if (!dctx.sw_interface_details_query.interface_found) {
- SRP_LOG_ERR_MSG("interface not found");
- return SR_ERR_NOT_FOUND;
- }
-
- sr_xpath_recover(&state);
- *values = dctx.sysr_values_ctx.values;
- *values_cnt = dctx.sysr_values_ctx.values_cnt;
-
- return SR_ERR_OK;
-}
-
-int oc_dump_ip_helper(char *address_ip, u8 prefix_len,
- sysr_values_ctx_t *sysr_values_ctx)
-{
- sr_val_t *vals = NULL;
- int rc = 0;
- int vc = 0;
-
- ARG_CHECK2(SR_ERR_INVAL_ARG, address_ip, sysr_values_ctx);
-
- vc = 3;
- /* convenient functions such as this can be found in sysrepo/values.h */
- rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
-
- sr_val_build_xpath(&vals[0], "%s/openconfig-if-ip:ip",
- sysr_values_ctx->xpath_root);
- sr_val_set_str_data(&vals[0], SR_STRING_T, address_ip);
-
- sr_val_build_xpath(&vals[1], "%s/openconfig-if-ip:prefix-length",
- sysr_values_ctx->xpath_root);
- vals[1].type = SR_UINT8_T;
- vals[1].data.uint8_val = prefix_len;
-
- sr_val_build_xpath(&vals[2], "%s/openconfig-if-ip:origin",
- sysr_values_ctx->xpath_root);
- sr_val_set_str_data(&vals[2], SR_ENUM_T, "STATIC");
-
- sysr_values_ctx->values = vals;
- sysr_values_ctx->values_cnt = vc;
-
- return SR_ERR_OK;
-}
-
-//TODO: for some arcane reason, this doesn't work
-int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_state_cb(
+// openconfig-interfaces:interfaces/interface/subinterfaces/subinterface/state
+static int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_state_cb(
const char *xpath, sr_val_t **values, size_t *values_cnt,
- __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) const char *original_xpath,
- __attribute__((unused)) void *private_ctx)
+ uint64_t request_id, const char *original_xpath, void *private_ctx)
{
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ sw_interface_dump_t reply = {0};
+ char xpath_root[XPATH_SIZE];
sr_xpath_ctx_t state = {0};
- int rc;
char *tmp = NULL;
- char interface_name[XPATH_SIZE] = {0};
+ char interface_name[VPP_INTFC_NAME_LEN] = {0};
char subinterface_index[XPATH_SIZE] = {0};
- char address_ip[XPATH_SIZE] = {0};
- u8 prefix_len;
+ u32 sub_id;
+ sr_val_t *vals = NULL;
+ int vc = 6;
+ int val_idx = 0;
+ int rc;
ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
- SRP_LOG_INF_MSG("In oc-interfaces oc-ip");
+ SRP_LOG_INF("In %s", __FUNCTION__);
- tmp = xpath_find_first_key(xpath, "name", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("interface_name not found.");
+ tmp = sr_xpath_key_value((char*)xpath, "interface", "name", &state);
+ if (!tmp) {
+ SRP_LOG_ERR_MSG("XPATH interface name not found");
return SR_ERR_INVAL_ARG;
}
-
- strncpy(interface_name, tmp, XPATH_SIZE);
+ strncpy(interface_name, tmp, VPP_INTFC_NAME_LEN);
sr_xpath_recover(&state);
- tmp = xpath_find_first_key(xpath, "index", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("subinterface_index not found.");
+ tmp = sr_xpath_key_value((char*)xpath, "subinterface", "index", &state);
+ if (!tmp) {
+ SRP_LOG_ERR_MSG("subinterface index not found");
return SR_ERR_INVAL_ARG;
}
-
strncpy(subinterface_index, tmp, XPATH_SIZE);
sr_xpath_recover(&state);
- tmp = xpath_find_first_key(xpath, "ip", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("address_ip not found.");
- return SR_ERR_INVAL_ARG;
- }
-
- strncpy(address_ip, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
-
- sysr_values_ctx_t dctx = {0};
- snprintf(dctx.xpath_root, XPATH_SIZE, "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/openconfig-if-ip:ipv4/openconfig-if-ip:addresses/openconfig-if-ip:address[ip='%s']/openconfig-if-ip:state",
- interface_name, subinterface_index, address_ip);
+ snprintf(xpath_root, XPATH_SIZE,
+ "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/state",
+ interface_name, subinterface_index);
- rc = ipv46_address_dump(interface_name, address_ip, &prefix_len, false);
- if (!rc) {
- SRP_LOG_ERR_MSG("ipv46_address_dump failed");
- return SR_ERR_INVAL_ARG;
+ rc = interface_dump_iface(&reply, interface_name);
+ if (rc == -SCVPP_NOT_FOUND) {
+ SRP_LOG_ERR_MSG("interface not found");
+ return SR_ERR_NOT_FOUND;
}
- rc = oc_dump_ip_helper(address_ip, prefix_len, &dctx);
- if (!rc) {
- SRP_LOG_ERR_MSG("oc_dump_ip_helper failed");
- return rc;
+ /* Check that requested subinterface index matches reply subid */
+ sub_id = atoi(subinterface_index);
+ if (sub_id != reply.sub_id) {
+ SRP_LOG_ERR_MSG("subinterface index not found.");
+ return SR_ERR_NOT_FOUND;
}
- sr_xpath_recover(&state);
- *values = dctx.values;
- *values_cnt = dctx.values_cnt;
-
- return SR_ERR_OK;
-}
+ /* Check that interface is a sub interface */
+ if (!is_subinterface((char*)reply.interface_name, interface_name, sub_id)) {
+ SRP_LOG_ERR("%s not a subinterface", interface_name);
+ return SR_ERR_OPERATION_FAILED;
+ }
-// openconfig-interfaces:interfaces/interface/subinterfaces/subinterface/state
-int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_state_cb(
- const char *xpath, sr_val_t **values, size_t *values_cnt,
- __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) const char *original_xpath,
- __attribute__((unused)) void *private_ctx)
-{
- sr_xpath_ctx_t state = {0};
- char *tmp = NULL;
- char interface_name[XPATH_SIZE] = {0};
- char subinterface_index[XPATH_SIZE] = {0};
+ rc = sr_new_values(vc, &vals);
+ if (SR_ERR_OK != rc)
+ return rc;
- ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
+ sr_val_build_xpath(&vals[val_idx], "%s/index", xpath_root);
+ vals[val_idx].type = SR_UINT32_T;
+ vals[val_idx++].data.uint32_val = sub_id;
- tmp = xpath_find_first_key(xpath, "name", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("interface_name not found.");
- return SR_ERR_INVAL_ARG;
- }
+ sr_val_build_xpath(&vals[val_idx], "%s/description", xpath_root);
+ sr_val_set_str_data(&vals[val_idx++], SR_STRING_T, NOT_AVAL);
- strncpy(interface_name, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ sr_val_build_xpath(&vals[val_idx], "%s/enabled", xpath_root);
+ vals[val_idx].type = SR_BOOL_T;
+ vals[val_idx++].data.bool_val = reply.admin_up_down;
- tmp = xpath_find_first_key(xpath, "index", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("subinterface_index not found.");
- return SR_ERR_INVAL_ARG;
- }
+ //TODO: Openconfig required this value
+ // sr_val_build_xpath(&vals[val_idx], "%s/name", xpath_root);
+ // sr_val_set_str_data(&vals[val_idx++], SR_STRING_T, YANG INPUT TYPE: string);
- strncpy(subinterface_index, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ // sr_val_build_xpath(&vals[val_idx], "%s/ifindex", interface_name, sub_id);
+ // vals[val_idx].type = SR_UINT32_T;
+ // vals[val_idx++].data.uint32_val = YANG INPUT TYPE: uint32;
- sys_sw_interface_dump_ctx dctx =
- {
- .is_subif = true,
- .subinterface_index = atoi(subinterface_index)
- };
- sw_interface_details_query_set_name(&dctx.sw_interface_details_query,
- interface_name);
+ sr_val_build_xpath(&vals[val_idx], "%s/admin-status", xpath_root);
+ sr_val_set_str_data(&vals[val_idx++], SR_ENUM_T,
+ reply.admin_up_down ? "UP" : "DOWN");
- snprintf(dctx.sysr_values_ctx.xpath_root, XPATH_SIZE, "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/state",
- interface_name, subinterface_index);
+ sr_val_build_xpath(&vals[val_idx], "%s/oper-status", xpath_root);
+ sr_val_set_str_data(&vals[val_idx++], SR_ENUM_T, reply.admin_up_down ? "UP" : "DOWN");
- sysr_sw_interface_dump(&dctx);
+ //TODO: Openconfig required this value
+ // sr_val_build_xpath(&vals[val_idx], "/openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/state/last-change", interface_name, sub_id);
+ // sr_val_set_str_data(&vals[val_idx++], YANG INPUT TYPE: oc-types:timeticks64);
- if (!dctx.sw_interface_details_query.interface_found) {
- SRP_LOG_DBG_MSG("interface not found");
- return SR_ERR_NOT_FOUND;
- }
+ sr_val_build_xpath(&vals[val_idx], "%s/logical", xpath_root);
+ vals[val_idx].type = SR_BOOL_T;
+ vals[val_idx++].data.bool_val = true; //for now, we assume all are logical
sr_xpath_recover(&state);
- *values = dctx.sysr_values_ctx.values;
- *values_cnt = dctx.sysr_values_ctx.values_cnt;
+
+ *values = vals;
+ *values_cnt = vc;
return SR_ERR_OK;
}
// openconfig-interfaces:interfaces/interface[name='%s']/subinterfaces/subinterface[index='%s']/oc-ip:ipv4/oc-ip:addresses/oc-ip:address[ip='%s']/oc-ip:config/
-int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_config_cb(
+static int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_config_cb(
sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+ void *private_ctx)
{
+ UNUSED(private_ctx);
sr_change_iter_t *it = NULL;
sr_change_oper_t oper;
- sr_val_t *old_val = NULL;
- sr_val_t *new_val = NULL;
+ sr_xpath_ctx_t state = {0};
+ sr_val_t *old = NULL;
+ sr_val_t *new = NULL;
char *tmp = NULL;
- char interface_name[XPATH_SIZE] = {0};
+ char interface_name[VPP_INTFC_NAME_LEN] = {0};
char subinterface_index[XPATH_SIZE] = {0};
char address_ip[XPATH_SIZE] = {0};
char old_address_ip[XPATH_SIZE] = {0};
@@ -662,82 +466,69 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_
// if we receive event SR_EV_APPLY - config has changed
- log_recv_event(event, "subtree_change_cb received");
- SRP_LOG_DBG("[SRP_LOG_DBG] xpath: %s", xpath);
-
- if (event != SR_EV_APPLY) {
+ if (event == SR_EV_APPLY)
return SR_ERR_OK;
- }
if (sr_get_changes_iter(ds, (char *)xpath, &it) != SR_ERR_OK) {
- // in example he calls even on fale
sr_free_change_iter(it);
return SR_ERR_OK;
}
- while (sr_get_change_next(ds, it, &oper, &old_val, &new_val) == SR_ERR_OK) {
-
- log_recv_oper(oper, "subtree_change_cb received");
+ foreach_change (ds, it, oper, old, new) {
- SRP_LOG_DBG("xpath: %s", new_val->xpath);
+ SRP_LOG_DBG("xpath: %s", new->xpath);
- sr_xpath_ctx_t state = {0};
-
- tmp = xpath_find_first_key(new_val->xpath, "name", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("interface_name NOT found.");
- continue;
+ tmp = sr_xpath_key_value(new->xpath, "interface", "name", &state);
+ if (!tmp) {
+ sr_set_error(ds, "XPATH interface name NOT found", new->xpath);
+ return SR_ERR_INVAL_ARG;
}
-
- strncpy(interface_name, tmp, XPATH_SIZE);
+ strncpy(interface_name, tmp, VPP_INTFC_NAME_LEN);
sr_xpath_recover(&state);
- tmp = xpath_find_first_key(new_val->xpath, "index", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("subinterface_index NOT found.");
- continue;
+ tmp = sr_xpath_key_value(new->xpath, "subinterface", "index", &state);
+ if (!tmp) {
+ sr_set_error(ds, "XPATH subinterface index NOT found", new->xpath);
+ return SR_ERR_INVAL_ARG;
}
-
strncpy(subinterface_index, tmp, XPATH_SIZE);
sr_xpath_recover(&state);
switch (oper) {
case SR_OP_CREATED:
- if (sr_xpath_node_name_eq(new_val->xpath, "ip")) {
+ if (sr_xpath_node_name_eq(new->xpath, "ip")) {
ip_set = true;
- strncpy(address_ip, new_val->data.string_val, XPATH_SIZE);
- } else if (sr_xpath_node_name_eq(new_val->xpath,
+ strncpy(address_ip, new->data.string_val, XPATH_SIZE);
+ } else if (sr_xpath_node_name_eq(new->xpath,
"prefix-length")) {
prefix_len_set = true;
- prefix_len = new_val->data.uint8_val;
+ prefix_len = new->data.uint8_val;
}
- if (ip_set && prefix_len_set) {
- //add ipv4
+ if (ip_set && prefix_len_set) //add ipv4
rc = ipv46_config_add_remove(interface_name, address_ip,
prefix_len, false , true);
- }
break;
case SR_OP_MODIFIED:
- if (sr_xpath_node_name_eq(old_val->xpath, "ip")) {
+ if (sr_xpath_node_name_eq(old->xpath, "ip")) {
old_ip_set = true;
- strncpy(old_address_ip, old_val->data.string_val,
+ strncpy(old_address_ip, old->data.string_val,
XPATH_SIZE);
- } else if (sr_xpath_node_name_eq(old_val->xpath,
+ } else if (sr_xpath_node_name_eq(old->xpath,
" prefix-length")) {
old_prefix_len_set = true;
- old_prefix_len = old_val->data.uint8_val;
+ old_prefix_len = old->data.uint8_val;
}
- if (sr_xpath_node_name_eq(new_val->xpath, "ip")) {
+ if (sr_xpath_node_name_eq(new->xpath, "ip")) {
ip_set = true;
- strncpy(address_ip, new_val->data.string_val, XPATH_SIZE);
- } else if (sr_xpath_node_name_eq(new_val->xpath,
+ strncpy(address_ip, new->data.string_val, XPATH_SIZE);
+ } else if (sr_xpath_node_name_eq(new->xpath,
"prefix-length")) {
prefix_len_set = true;
- prefix_len = new_val->data.uint8_val;
+ prefix_len = new->data.uint8_val;
}
if (old_ip_set && old_prefix_len_set) {
@@ -760,14 +551,14 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_
break;
case SR_OP_DELETED:
- if (sr_xpath_node_name_eq(old_val->xpath, "ip")) {
+ if (sr_xpath_node_name_eq(old->xpath, "ip")) {
old_ip_set = true;
- strncpy(old_address_ip, old_val->data.string_val,
+ strncpy(old_address_ip, old->data.string_val,
XPATH_SIZE);
- } else if (sr_xpath_node_name_eq(old_val->xpath,
+ } else if (sr_xpath_node_name_eq(old->xpath,
"prefix-length")) {
old_prefix_len_set = true;
- old_prefix_len = old_val->data.uint8_val;
+ old_prefix_len = old->data.uint8_val;
}
if (old_ip_set && old_prefix_len_set) {
@@ -781,8 +572,8 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_
if (0 != rc) {
sr_xpath_recover(&state);
- sr_free_val(old_val);
- sr_free_val(new_val);
+ sr_free_val(old);
+ sr_free_val(new);
sr_free_change_iter(it);
@@ -791,8 +582,8 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_
sr_xpath_recover(&state);
- sr_free_val(old_val);
- sr_free_val(new_val);
+ sr_free_val(old);
+ sr_free_val(new);
}
sr_free_change_iter(it);
@@ -801,16 +592,6 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_
const xpath_t oc_interfaces_xpaths[OC_INTERFACES_SIZE] = {
{
- .xpath = "openconfig-interfaces",
- .method = MODULE,
- .datastore = SR_DS_RUNNING,
- .cb.mcb = openconfig_interface_mod_cb,
- .private_ctx = NULL,
- .priority = 0,
- //.opts = SR_SUBSCR_EV_ENABLED | SR_SUBSCR_APPLY_ONLY
- .opts = SR_SUBSCR_EV_ENABLED | SR_SUBSCR_APPLY_ONLY | SR_SUBSCR_CTX_REUSE
- },
- {
.xpath = "/openconfig-interfaces:interfaces/interface/config",
.method = XPATH,
.datastore = SR_DS_RUNNING,
diff --git a/src/plugins/openconfig/openconfig_interfaces.h b/src/plugins/openconfig/openconfig_interfaces.h
deleted file mode 100644
index 88d5fe0..0000000
--- a/src/plugins/openconfig/openconfig_interfaces.h
+++ /dev/null
@@ -1,26 +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 __OPENCONFIG_INTERFACES_H__
-#define __OPENCONFIG_INTERFACES_H__
-
-#include "../sc_model.h"
-
-#define OC_INTERFACES_SIZE 6
-extern const xpath_t oc_interfaces_xpaths[OC_INTERFACES_SIZE];
-
-#endif /* __OPENCONFIG_INTERFACES_H__ */
diff --git a/src/plugins/openconfig/openconfig_local_routing.c b/src/plugins/openconfig/openconfig_local_routing.c
index 5c63eaa..5d18b52 100644
--- a/src/plugins/openconfig/openconfig_local_routing.c
+++ b/src/plugins/openconfig/openconfig_local_routing.c
@@ -17,732 +17,494 @@
#include <assert.h>
#include <string.h>
-#include "openconfig_local_routing.h"
+#include <scvpp/comm.h>
+#include <scvpp/interface.h>
+#include <scvpp/ip.h>
+#include "../sc_model.h"
#include "../sys_util.h"
-#include "sc_vpp_comm.h"
-#include "sc_vpp_interface.h"
-#include "sc_vpp_ip.h"
+#define HOP_INDEX_SIZE 10 //number of digit in max 32 bit integer
-#define XPATH_SIZE 2000
-
-int openconfig_local_routing_mod_cb(
- __attribute__((unused)) sr_session_ctx_t* session,
- __attribute__((unused)) const char* module_name,
- __attribute__((unused)) sr_notif_event_t event,
- __attribute__((unused)) void* private_ctx)
+static inline int
+_set_route (const char *prefix, const char *nhop, bool is_add,
+ const char *iface)
{
- SRP_LOG_DBG("Local routing module subscribe: %s", module_name);
+ int table = 0; //FIB table ID
+ int mask;
+ int rc;
+
+ // Put prefix length in mask and prefix IP in prefix
+ mask = ip_prefix_split(prefix);
+ if (mask < 1) {
+ SRP_LOG_ERR("Prefix length can not be %d", mask);
+ return SR_ERR_INVAL_ARG;
+ }
+
+ rc = ipv46_config_add_del_route(prefix, mask, nhop, is_add, table, iface);
+ if (rc != SCVPP_OK) {
+ SRP_LOG_ERR("Add/delete route failed for %s %s", prefix, iface);
+ return SR_ERR_INVAL_ARG;
+ }
+
+ SRP_LOG_INF("Add/delete route Success for %s %s", prefix, iface);
return SR_ERR_OK;
}
-static int set_route(sr_session_ctx_t *sess, const char *index,
- const char *n_interface /*NULLABLE*/,
- const char *n_next_hop /*NULLABLE*/,
- const char *prefix, bool is_add)
-{
- int rc = SR_ERR_OK;
- sr_val_t *value = NULL;
- char xpath[XPATH_SIZE] = {0};
- const char *interface = NULL;
- const char *next_hop = NULL;
+#define STR(string) #string
- ARG_CHECK3(SR_ERR_INVAL_ARG, sess, index, prefix);
+#define ROOT "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/%s"
- if (NULL == n_interface) {
- snprintf(xpath, XPATH_SIZE,
- "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/interface-ref/config/interface", prefix, index);
+static inline char * _get_ds_elem(sr_session_ctx_t *sess, const char *prefix,
+ const char *index, const char *sub)
+{
+ char xpath[XPATH_SIZE] = {0};
+ sr_val_t *value = NULL;
+ int rc;
- rc = sr_get_item(sess, xpath, &value);
- if (SR_ERR_OK != rc) {
- SRP_LOG_DBG_MSG("Interface not set");
- return 0;
- }
+ snprintf(xpath, XPATH_SIZE, ROOT, prefix, index, sub);
- interface = value->data.string_val;
- } else {
- interface = n_interface;
+ rc = sr_get_item(sess, xpath, &value);
+ if (SR_ERR_OK != rc) {
+ SRP_LOG_DBG("XPATH %s not set", xpath);
+ return NULL;
}
- if (NULL == n_next_hop) {
- snprintf(xpath, XPATH_SIZE,
- "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/config/next-hop", prefix, index);
+ return value->data.string_val;
+}
- rc = sr_get_item(sess, xpath, &value);
- if (SR_ERR_OK != rc) {
- SRP_LOG_DBG_MSG("Next-hop not set");
- return 0;
- }
+/* @brief add/del route to FIB table 0.
+ * If you add/delete an entry to FIB, prefix is mandatory and next hop can be:
+ * - interface only
+ * - next hop IP
+ * - both interface and next hop IP
+ */
+static int set_route(sr_session_ctx_t *sess, const char *index,
+ const char *interface /* NULLABLE*/,
+ const char *next_hop /* NULLABLE*/,
+ const char *prefix, bool is_add)
+{
+ const char *iface = NULL;
+ const char *nhop = NULL;
- next_hop = value->data.string_val;
- } else {
- next_hop = n_next_hop;
- }
+ ARG_CHECK3(SR_ERR_INVAL_ARG, sess, index, prefix);
- int mask = ip_prefix_split(prefix);
- if (mask < 1) {
+ if (!interface && !next_hop)
return SR_ERR_INVAL_ARG;
- }
- rc = ipv46_config_add_del_route(prefix, mask, next_hop, is_add, 0,
- interface);
- if (!rc) {
- return SR_ERR_INVAL_ARG;
- }
+ if (!interface) //fetch interface in datastore, can return NULL
+ iface = _get_ds_elem(sess, prefix, index, "interface-ref/config/interface");
+ else //use interface provided
+ iface = interface;
+
+ if (!next_hop) //fetch next-hop in datastore , can return NULL
+ nhop = _get_ds_elem(sess, prefix, index, "config/next-hop");
+ else //use next hop IP provided
+ nhop = next_hop;
+
+ return _set_route(prefix, nhop, is_add, iface);
+}
+
+/* @brief Callback used to add prefix entry for XPATH:
+ * /openconfig-local-routing:local-routes/static-routes/static/config
+ */
+static int
+oc_prefix_config_cb(sr_session_ctx_t *ds, const char *xpath,
+ sr_notif_event_t event, void *private_ctx)
+{
+ UNUSED(ds); UNUSED(xpath); UNUSED(event); UNUSED(private_ctx);
+
+ SRP_LOG_INF("In %s", __FUNCTION__);
return SR_ERR_OK;
}
// XPATH: /openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/config/
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_config_cb(
- sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+static int oc_next_hop_config_cb(sr_session_ctx_t *ds, const char *xpath,
+ sr_notif_event_t event, void *private_ctx)
{
- sr_change_iter_t *it = NULL;
+ char prefix[VPP_IP4_PREFIX_STRING_LEN] = {0};
+ char next_hop[VPP_IP4_ADDRESS_STRING_LEN] = {0}; //IP of next router
+ char index[HOP_INDEX_SIZE]; //next hop index
+ bool index_set = false, next_hop_set = false;
+ sr_change_iter_t *it;
sr_change_oper_t oper;
- sr_val_t *old_val = NULL;
- sr_val_t *new_val = NULL;
+ sr_val_t *old, *new, *tmp;
+ sr_xpath_ctx_t state = {0};
int rc = SR_ERR_OK;
- char *tmp = NULL;
- char static_prefix[XPATH_SIZE] = {0};
- char next_hop_index[XPATH_SIZE] = {0};
- char next_hop[XPATH_SIZE] = {0};
- char old_next_hop_index[XPATH_SIZE] = {0};
- char old_next_hop[XPATH_SIZE] = {0};
- bool index_set = false, next_hop_set = false;
- bool old_index_set = false, old_next_hop_set = false;
+ UNUSED(private_ctx);
ARG_CHECK2(SR_ERR_INVAL_ARG, ds, xpath);
- // if we receive event SR_EV_APPLY - config has changed
+ SRP_LOG_INF("In %s", __FUNCTION__);
- log_recv_event(event, "subtree_change_cb received");
- SRP_LOG_DBG("[SRP_LOG_DBG] xpath: %s", xpath);
-
- if (event != SR_EV_APPLY) {
+ if (event == SR_EV_APPLY) //SR_EV_VERIFY already applied the changes
return SR_ERR_OK;
- }
- if (sr_get_changes_iter(ds, (char *)xpath, &it) != SR_ERR_OK) {
- // in example he calls even on fale
+ rc = sr_get_changes_iter(ds, (char *)xpath, &it);
+ if (rc != SR_ERR_OK) {
sr_free_change_iter(it);
- return SR_ERR_OK;
+ return rc;
}
- while (sr_get_change_next(ds, it, &oper,
- &old_val, &new_val) == SR_ERR_OK) {
-
- log_recv_oper(oper, "subtree_change_cb received");
-
- SRP_LOG_DBG("xpath: %s", new_val->xpath);
-
- sr_xpath_ctx_t state = {0};
-
- tmp = xpath_find_first_key(new_val->xpath, "prefix", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("static_prefix NOT found.");
- continue;
- }
+ foreach_change(ds, it, oper, old, new) {
- strncpy(static_prefix, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ rc = get_xpath_key(prefix, new->xpath, "static", "prefix",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
+ if (rc != 0)
+ goto error;
switch (oper) {
- case SR_OP_CREATED:
- if (sr_xpath_node_name_eq(new_val->xpath, "index")) {
- strncpy(next_hop_index, new_val->data.string_val,
- XPATH_SIZE);
- index_set = true;
- } else if(sr_xpath_node_name_eq(new_val->xpath, "next-hop")) {
- next_hop_set = true;
- strncpy(next_hop, new_val->data.string_val, XPATH_SIZE);
- } else if(sr_xpath_node_name_eq(new_val->xpath, "metric")) {
- //TODO: LEAF: metric, type: uint32
- } else if(sr_xpath_node_name_eq(new_val->xpath, "recurse")) {
- //TODO: LEAF: recurse, type: boolean
- }
-
- if (index_set && next_hop_set) {
- rc = set_route(ds, next_hop_index, NULL, next_hop,
- static_prefix, true);
- }
- break;
-
case SR_OP_MODIFIED:
- if (sr_xpath_node_name_eq(old_val->xpath, "index")) {
- strncpy(old_next_hop_index, old_val->data.string_val,
- XPATH_SIZE);
- old_index_set = true;
- } else if(sr_xpath_node_name_eq(old_val->xpath, "next-hop")) {
- old_next_hop_set = true;
- strncpy(old_next_hop, old_val->data.string_val, XPATH_SIZE);
- } else if(sr_xpath_node_name_eq(old_val->xpath, "metric")) {
- //TODO: LEAF: metric, type: uint32
- } else if(sr_xpath_node_name_eq(old_val->xpath, "recurse")) {
- //TODO: LEAF: recurse, type: boolean
- }
-
- if (sr_xpath_node_name_eq(new_val->xpath, "index")) {
- strncpy(next_hop_index, new_val->data.string_val,
- XPATH_SIZE);
- index_set = true;
- } else if(sr_xpath_node_name_eq(new_val->xpath, "next-hop")) {
- next_hop_set = true;
- strncpy(next_hop, new_val->data.string_val, XPATH_SIZE);
- } else if(sr_xpath_node_name_eq(new_val->xpath, "metric")) {
- //TODO: LEAF: metric, type: uint32
- } else if(sr_xpath_node_name_eq(new_val->xpath, "recurse")) {
- //TODO: LEAF: recurse, type: boolean
- }
-
- if (old_index_set && old_next_hop_set) {
- rc = set_route(ds, old_next_hop_index, NULL, old_next_hop,
- static_prefix, false);
- }
-
- if (index_set && next_hop_set) {
- rc = set_route(ds, next_hop_index, NULL, next_hop,
- static_prefix, true);
- }
- break;
-
- case SR_OP_MOVED:
+ case SR_OP_CREATED:
+ tmp = new;
break;
-
case SR_OP_DELETED:
- if (sr_xpath_node_name_eq(old_val->xpath, "index")) {
- strncpy(old_next_hop_index, old_val->data.string_val,
- XPATH_SIZE);
- old_index_set = true;
- } else if(sr_xpath_node_name_eq(old_val->xpath, "next-hop")) {
- old_next_hop_set = true;
- strncpy(old_next_hop, old_val->data.string_val, XPATH_SIZE);
- } else if(sr_xpath_node_name_eq(old_val->xpath, "metric")) {
- //TODO: LEAF: metric, type: uint32
- } else if(sr_xpath_node_name_eq(old_val->xpath, "recurse")) {
- //TODO: LEAF: recurse, type: boolean
- }
-
- if (old_index_set && old_next_hop_set) {
- rc = set_route(ds, old_next_hop_index, NULL, old_next_hop,
- static_prefix, false);
- }
+ tmp = old;
+ break;
+ default:
+ SRP_LOG_WRN_MSG("Operation not supported");
break;
}
- if (SR_ERR_OK != rc) {
- sr_xpath_recover(&state);
+ if (sr_xpath_node_name_eq(tmp->xpath, "config")) {
+ SRP_LOG_DBG("xpath: %s", tmp->xpath);
+ } else if (sr_xpath_node_name_eq(tmp->xpath, "index")) {
+ strncpy(index, tmp->data.string_val, HOP_INDEX_SIZE);
+ index_set = true;
+ } else if(sr_xpath_node_name_eq(tmp->xpath, "next-hop")) {
+ strncpy(next_hop, tmp->data.string_val, VPP_IP4_ADDRESS_STRING_LEN);
+ next_hop_set = true;
+ } else if(sr_xpath_node_name_eq(tmp->xpath, "recurse")) {
+ //SYSREPO BUG: Just catch it, sysrepo thinks it is mandatory...
+ } else { //metric, recurse
+ SRP_LOG_ERR("Unsupported field %s", tmp->xpath);
+ return SR_ERR_UNSUPPORTED;
+ }
- sr_free_val(old_val);
- sr_free_val(new_val);
+ if (index_set && next_hop_set) {
+ if (oper == SR_OP_CREATED) {
+ rc = set_route(ds, index, NULL, next_hop, prefix, true);
+ } else if (oper == SR_OP_MODIFIED) {
+ rc = set_route(ds, index, NULL, next_hop, prefix, false);
+ rc |= set_route(ds, index, NULL, next_hop, prefix, true);
+ } else if (oper == SR_OP_DELETED) {
+ rc = set_route(ds, index, NULL, next_hop, prefix, false);
+ }
- sr_free_change_iter(it);
- return SR_ERR_OPERATION_FAILED;
+ if (rc != 0) {
+ SRP_LOG_ERR_MSG("setting route failed");
+ goto error;
+ }
+ index_set = false; next_hop_set = false;
}
+ sr_free_val(old);
+ sr_free_val(new);
sr_xpath_recover(&state);
-
- sr_free_val(old_val);
- sr_free_val(new_val);
}
sr_free_change_iter(it);
- return SR_ERR_OK;
+ return rc;
+
+error:
+ sr_free_val(old);
+ sr_free_val(new);
+ sr_xpath_recover(&state);
+ sr_free_change_iter(it);
+ return rc;
}
// XPATH: /openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/interface-ref/config/
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_config_cb(
- sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event,
- __attribute__((unused)) void *private_ctx)
+static int
+oc_next_hop_interface_config_cb(sr_session_ctx_t *ds, const char *xpath,
+ sr_notif_event_t event, void *private_ctx)
{
+ char prefix[VPP_IP4_PREFIX_STRING_LEN] = {0};
+ char interface[VPP_INTFC_NAME_LEN] = {0};
+ char index[HOP_INDEX_SIZE] = {0};
sr_change_iter_t *it = NULL;
sr_change_oper_t oper;
- sr_val_t *old_val = NULL;
- sr_val_t *new_val = NULL;
- char *tmp = NULL;
- char static_prefix[XPATH_SIZE] = {0};
- char next_hop_index[XPATH_SIZE] = {0};
- char interface[XPATH_SIZE] = {0};
- char old_interface[XPATH_SIZE] = {0};
+ sr_val_t *old, *new, *tmp;
+ sr_xpath_ctx_t state = {0};
+ bool interface_set = false;
int rc = SR_ERR_OK;
+ UNUSED(private_ctx);
- // if we receive event SR_EV_APPLY - config has changed
-
- log_recv_event(event, "subtree_change_cb received");
- SRP_LOG_DBG("[SRP_LOG_DBG] xpath: %s", xpath);
+ SRP_LOG_INF("In %s", __FUNCTION__);
- if (event != SR_EV_APPLY) {
+ if (event == SR_EV_APPLY)
return SR_ERR_OK;
- }
- if (sr_get_changes_iter(ds, (char *)xpath, &it) != SR_ERR_OK) {
- // in example he calls even on fale
+ rc = sr_get_changes_iter(ds, (char *)xpath, &it);
+ if (rc != SR_ERR_OK) {
sr_free_change_iter(it);
- return SR_ERR_OK;
+ return rc;
}
- while (sr_get_change_next(ds, it, &oper,
- &old_val, &new_val) == SR_ERR_OK) {
+ foreach_change(ds, it, oper, old, new) {
- log_recv_oper(oper, "subtree_change_cb received");
+ SRP_LOG_DBG("xpath: %s", new->xpath);
- SRP_LOG_DBG("xpath: %s", new_val->xpath);
+ rc = get_xpath_key(prefix, new->xpath, "static", "prefix",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
- sr_xpath_ctx_t state = {0};
-
- tmp = xpath_find_first_key(new_val->xpath, "prefix", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("static_prefix NOT found.");
- continue;
- }
-
- strncpy(static_prefix, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
-
- tmp = xpath_find_first_key(new_val->xpath, "index", &state);
- if (NULL == tmp) {
- SRP_LOG_DBG_MSG("next-hop_index NOT found.");
- continue;
- }
-
- strncpy(next_hop_index, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ rc |= get_xpath_key(index, new->xpath, "next-hop", "index",
+ HOP_INDEX_SIZE, &state);
+ if (rc)
+ goto error;
switch (oper) {
- case SR_OP_CREATED:
- if (sr_xpath_node_name_eq(new_val->xpath, "interface")) {
- strncpy(interface, new_val->data.string_val, XPATH_SIZE);
- rc = set_route(ds, next_hop_index, interface, NULL,
- static_prefix, true);
- } else if (sr_xpath_node_name_eq(new_val->xpath,
- "subinterface")) {
- }
- break;
-
case SR_OP_MODIFIED:
- if (sr_xpath_node_name_eq(old_val->xpath, "interface")) {
- strncpy(old_interface, old_val->data.string_val,
- XPATH_SIZE);
- rc = set_route(ds, next_hop_index, old_interface, NULL,
- static_prefix, false);
- } else if (sr_xpath_node_name_eq(old_val->xpath,
- "subinterface")) {
- }
-
- if (sr_xpath_node_name_eq(new_val->xpath, "interface")) {
- strncpy(interface, new_val->data.string_val, XPATH_SIZE);
- rc = set_route(ds, next_hop_index, interface, NULL,
- static_prefix, true);
- } else if (sr_xpath_node_name_eq(new_val->xpath,
- "subinterface")) {
- }
- break;
-
- case SR_OP_MOVED:
+ case SR_OP_CREATED:
+ tmp = new;
break;
-
case SR_OP_DELETED:
- if (sr_xpath_node_name_eq(old_val->xpath, "interface")) {
- strncpy(old_interface, old_val->data.string_val,
- XPATH_SIZE);
- rc = set_route(ds, next_hop_index, old_interface, NULL,
- static_prefix, false);
- } else if (sr_xpath_node_name_eq(old_val->xpath,
- "subinterface")) {
- }
+ tmp = old;
+ break;
+ default:
+ SRP_LOG_WRN_MSG("Operation not supported");
break;
}
- if (SR_ERR_OK != rc) {
- sr_xpath_recover(&state);
+ if (sr_xpath_node_name_eq(tmp->xpath, "config")) {
+ SRP_LOG_DBG("xpath: %s", tmp->xpath);
+ } else if (sr_xpath_node_name_eq(tmp->xpath, "interface")) {
+ strncpy(interface, tmp->data.string_val, VPP_INTFC_NAME_LEN);
+ interface_set = true;
+ } else { //metric, recurse
+ SRP_LOG_ERR("Unsupported field %s", tmp->xpath);
+ return SR_ERR_UNSUPPORTED;
+ }
- sr_free_val(old_val);
- sr_free_val(new_val);
+ if (oper == SR_OP_CREATED && interface_set) {
+ rc = set_route(ds, index, interface, NULL, prefix, true);
+ interface_set = false;
+ } else if (oper == SR_OP_MODIFIED && interface_set) {
+ rc = set_route(ds, index, interface, NULL, prefix, false);
+ rc |= set_route(ds, index, interface, NULL, prefix, true);
+ interface_set = false;
+ } else if (oper == SR_OP_DELETED && interface_set) {
+ rc = set_route(ds, index, interface, NULL, prefix, false);
+ interface_set = false;
+ }
- sr_free_change_iter(it);
- return SR_ERR_OPERATION_FAILED;
+ if (rc != 0) {
+ SRP_LOG_ERR_MSG("setting route failed");
+ goto error;
}
+ sr_free_val(old);
+ sr_free_val(new);
sr_xpath_recover(&state);
-
- sr_free_val(old_val);
- sr_free_val(new_val);
}
sr_free_change_iter(it);
return SR_ERR_OK;
-}
-
-typedef struct
-{
- u8 length;
- u8 address[4];
-} address_prefix_t;
-
-typedef struct {
- char *next_hop_index;
- address_prefix_t address_prefix;
- const bool is_interface_ref;
- sw_interface_details_query_t sw_interface_details_query;
- sysr_values_ctx_t sysr_values_ctx;
-} sysr_ip_fib_details_ctx_t;
-
-static
-bool address_prefix_cmp(address_prefix_t* address_prefix,
- vapi_payload_ip_fib_details* reply)
-{
- ARG_CHECK2(false, address_prefix, reply);
-
- if (address_prefix->length == reply->address_length)
- {
- if (0 == memcmp(address_prefix->address, reply->address, sizeof(reply->address)))
- return true;
- }
-
- return false;
-}
-
-static
-bool address_prefix_init(address_prefix_t* address_prefix, char* str_prefix)
-{
- ARG_CHECK2(false, address_prefix, str_prefix);
-
- address_prefix->length = ip_prefix_split(str_prefix);
- if(address_prefix->length < 1)
- {
- SRP_LOG_ERR_MSG("not a valid prefix");
- return false;
- }
- return sc_aton(str_prefix, address_prefix->address,
- sizeof(address_prefix->address));
+error:
+ sr_free_val(old);
+ sr_free_val(new);
+ sr_xpath_recover(&state);
+ sr_free_change_iter(it);
+ return rc;
}
// XPATH: /openconfig-local-routing:local-routes/static-routes/static/state
-int openconfig_local_routing_local_routes_static_routes_static_state_vapi_cb(
- vapi_payload_ip_fib_details *reply,
- sysr_ip_fib_details_ctx_t *sysr_ip_fib_details_ctx)
+static int oc_prefix_state_cb(
+ const char *xpath, sr_val_t **values, size_t *values_cnt,
+ uint64_t request_id, const char *original_xpath, void *private_ctx)
{
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ char prefix[VPP_IP4_PREFIX_STRING_LEN] = {0};
+ sr_xpath_ctx_t state = {0};
sr_val_t *vals = NULL;
+ fib_dump_t *reply = NULL;
+ int vc = 1;
int rc = 0;
- int vc = 0;
- char address_prefix[INET_ADDRSTRLEN + 3] = {0};
- vc = 1;
- ARG_CHECK2(SR_ERR_INVAL_ARG, reply, sysr_ip_fib_details_ctx);
+ ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
- rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
+ SRP_LOG_INF("In %s", __FUNCTION__);
- //Filling the structure
- snprintf(address_prefix, sizeof(address_prefix), "%s/%u",
- sc_ntoa(reply->address), reply->address_length);
+ rc = get_xpath_key(prefix, (char *)xpath, "static", "prefix",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
+ if (rc != 0)
+ return SR_ERR_INVAL_ARG;
- sr_val_build_xpath(&vals[0], "%s/prefix",
- sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[0], SR_STRING_T, address_prefix);
+ rc = ipv4_fib_dump_prefix(prefix, &reply);
+ if (rc == -SCVPP_NOT_FOUND) {
+ SRP_LOG_ERR("Prefix %s not found in VPP FIB", prefix);
+ return SR_ERR_NOT_FOUND;
+ }
- sysr_ip_fib_details_ctx->sysr_values_ctx.values = vals;
- sysr_ip_fib_details_ctx->sysr_values_ctx.values_cnt = vc;
+ /* Allocation for number of elements dumped by ipv4_fib_dump_all */
+ rc = sr_new_values(vc, &vals);
+ if (SR_ERR_OK != rc)
+ return rc;
- return SR_ERR_OK;
-}
+ sr_val_build_xpath(&vals[0], "%s/prefix", xpath);
+ sr_val_set_str_data(&vals[0], SR_STRING_T, prefix);
-vapi_error_e
-ip_routing_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
- vapi_error_e rv, bool is_last,
- vapi_payload_ip_fib_details * reply)
-{
- if (is_last)
- {
- assert (NULL == reply);
- }
- else
- {
- sysr_ip_fib_details_ctx_t *dctx = callback_ctx;
- assert(dctx && reply);
+ sr_xpath_recover(&state);
- if (address_prefix_cmp(&dctx->address_prefix, reply))
- {
- openconfig_local_routing_local_routes_static_routes_static_state_vapi_cb(reply,
- dctx);
- }
- }
+ free(reply);
+ *values = vals;
+ *values_cnt = vc;
- return VAPI_OK;
+ return SR_ERR_OK;
}
-int openconfig_local_routing_local_routes_static_routes_static_state_cb(
- const char *xpath, sr_val_t **values, size_t *values_cnt,
- __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) const char *original_xpath,
- __attribute__((unused)) void *private_ctx)
+// XPATH /openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/state
+static int
+oc_next_hop_state_cb(const char *xpath, sr_val_t **values, size_t *values_cnt,
+ uint64_t request_id, const char *original_xpath,
+ void *private_ctx)
{
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ char prefix[VPP_IP4_PREFIX_STRING_LEN] = {0};
+ char index[HOP_INDEX_SIZE];
+ char next_hop[INET_ADDRSTRLEN] = {0};
+ fib_dump_t *reply = NULL;
sr_xpath_ctx_t state = {0};
- vapi_error_e rv = 0;
- char *tmp = NULL;
- char static_prefix[XPATH_SIZE] = {0};
- sysr_ip_fib_details_ctx_t dctx = {0};
+ sr_val_t *vals = NULL;
+ int vc = 3;
+ int rc = 0;
ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
- tmp = xpath_find_first_key(xpath, "prefix", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("static_prefix not found.");
- return SR_ERR_INVAL_ARG;
- }
+ SRP_LOG_INF("In %s", __FUNCTION__);
- strncpy(static_prefix, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ /* Get prefix and index key from XPATH */
+ rc = get_xpath_key(prefix, (char *)xpath, "static", "prefix",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
- //VPP callback
- snprintf(dctx.sysr_values_ctx.xpath_root, XPATH_SIZE, "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/state", static_prefix);
+ rc |= get_xpath_key(index, (char*)xpath, "next-hop", "index",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
- if (!address_prefix_init(&dctx.address_prefix, static_prefix))
- {
+ if (rc != 0)
return SR_ERR_INVAL_ARG;
- }
-
- vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx_instance);
-
- VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx_instance, mp, ip_routing_dump_cb, &dctx));
- if(VAPI_OK != rv)
- {
- SRP_LOG_ERR_MSG("VAPI call failed");
+ rc = ipv4_fib_dump_prefix(prefix, &reply);
+ if (rc != SCVPP_OK) {
+ SRP_LOG_ERR("Fail to dump prefix %s", prefix);
return SR_ERR_INVAL_ARG;
}
- sr_xpath_recover(&state);
- *values = dctx.sysr_values_ctx.values;
- *values_cnt = dctx.sysr_values_ctx.values_cnt;
-
- return SR_ERR_OK;
-}
-
-// // XPATH: /openconfig-local-routing:local-routes/static-routes/l/next-hops/next-hop/state
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_vapi_cb(
- vapi_type_fib_path *reply,
- sysr_ip_fib_details_ctx_t *sysr_ip_fib_details_ctx)
-{
- sr_val_t *vals = NULL;
- int rc = 0;
- int vc = 0;
- char next_hop[INET_ADDRSTRLEN] = {0};
-
- ARG_CHECK2(SR_ERR_INVAL_ARG, reply, sysr_ip_fib_details_ctx);
-
- vc = 3;
- /* convenient functions such as this can be found in sysrepo/values.h */
rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
+ if (SR_ERR_OK != rc)
return rc;
+
+ // check next hop index equals next hop id
+ if (strtoul(index, NULL, 0) != reply->path[0].next_hop_id) {
+ SRP_LOG_ERR("next hop index is %d for prefix %s",
+ reply->path[0].next_hop_id, prefix);
+ SRP_LOG_ERR("before %s, stroul is %d", index, strtoul(index, NULL, 0));
+ return SR_ERR_INVAL_ARG;
}
- sr_val_build_xpath(&vals[0], "%s/index",
- sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[0], SR_STRING_T,
- sysr_ip_fib_details_ctx->next_hop_index);
+ sr_val_build_xpath(&vals[0], "%s/index", xpath);
+ sr_val_set_str_data(&vals[0], SR_STRING_T, index);
- strncpy(next_hop, sc_ntoa(reply->next_hop), sizeof(next_hop));
- sr_val_build_xpath(&vals[1], "%s/next-hop", sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[1], SR_STRING_T, next_hop);
+ strncpy(next_hop, sc_ntoa(reply->path[0].next_hop), VPP_IP4_ADDRESS_LEN);
+ sr_val_build_xpath(&vals[1], "%s/next-hop", xpath);
+ sr_val_set_str_data(&vals[1], SR_STRING_T, (char *)reply->path[0].next_hop);
- sr_val_build_xpath(&vals[2], "%s/metric", sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root);
+ sr_val_build_xpath(&vals[2], "%s/metric", xpath);
vals[2].type = SR_UINT32_T;
- vals[2].data.uint32_val = reply->weight;
-
- // sr_val_build_xpath(&vals[3], "%s/recurse", sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root);
- // vals[3].type = SR_BOOL_T;
- // vals[3].data.bool_val = YANG INPUT TYPE: boolean;
+ vals[2].data.uint32_val = reply->path[0].weight;
- sysr_ip_fib_details_ctx->sysr_values_ctx.values = vals;
- sysr_ip_fib_details_ctx->sysr_values_ctx.values_cnt = vc;
+ free(reply);
+ sr_xpath_recover(&state);
+ *values = vals;
+ *values_cnt = vc;
return SR_ERR_OK;
}
-// // XPATH: /openconfig-local-routing:local-routes/static-routes/l/next-hops/next-hop/interface-ref/state
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_vapi_cb(
- sysr_ip_fib_details_ctx_t * dctx)
+// XPATH /openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/interface-ref/state
+static int
+oc_next_hop_interface_state_cb(const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx)
{
+ UNUSED(request_id); UNUSED(original_xpath); UNUSED(private_ctx);
+ sr_xpath_ctx_t state = {0};
+ char prefix[VPP_IP4_PREFIX_STRING_LEN] = {0};
+ char interface[VPP_INTFC_NAME_LEN] = {0};
+ char index[HOP_INDEX_SIZE]; //next hop index
+ fib_dump_t *reply = NULL;
sr_val_t *vals = NULL;
+ int vc = 1;
int rc = 0;
- int vc = 0;
-
- ARG_CHECK(SR_ERR_INVAL_ARG, dctx);
-
- vc = 2;
- /* convenient functions such as this can be found in sysrepo/values.h */
- rc = sr_new_values(vc, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
- sr_val_build_xpath(&vals[0], "%s/interface",
- dctx->sysr_values_ctx.xpath_root);
- sr_val_set_str_data(&vals[0], SR_STRING_T,
- (const char*)dctx->sw_interface_details_query.sw_interface_details.interface_name);
+ //ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
- sr_val_build_xpath(&vals[1], "%s/subinterface",
- dctx->sysr_values_ctx.xpath_root);
- vals[1].type = SR_UINT32_T;
- vals[1].data.uint32_val = 0;
+ SRP_LOG_INF("In %s", __FUNCTION__);
- dctx->sysr_values_ctx.values = vals;
- dctx->sysr_values_ctx.values_cnt = vc;
+ ///* Get prefix key from XPATH */
+ rc = get_xpath_key(prefix, (char*) xpath, "static", "prefix",
+ VPP_IP4_PREFIX_STRING_LEN, &state);
- return SR_ERR_OK;
-}
-
-vapi_error_e
-ip_routing_next_hop_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
- vapi_error_e rv, bool is_last,
- vapi_payload_ip_fib_details * reply)
-{
- ARG_CHECK(VAPI_EINVAL, callback_ctx);
-
- sysr_ip_fib_details_ctx_t *dctx = callback_ctx;
-
- if (is_last)
- {
- assert (NULL == reply);
- }
- else
- {
- assert (NULL != reply);
-
- if (reply->count > 0 && address_prefix_cmp(&dctx->address_prefix, reply))
- {
- if (dctx->is_interface_ref)
- {
- dctx->sw_interface_details_query.interface_found = true;
- dctx->sw_interface_details_query.sw_interface_details.sw_if_index = reply->path[0].sw_if_index;
- //sw_interface_dump will have to be called outside this VAPI
- }
- else
- {
- openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_vapi_cb(reply->path, dctx);
- }
- }
- }
-
- return VAPI_OK;
-}
-
-int next_hop_inner(
- bool is_interface_ref, const char *xpath, sr_val_t **values,
- size_t *values_cnt, __attribute__((unused)) uint64_t request_id,
- __attribute__((unused)) void *private_ctx)
-{
- sr_xpath_ctx_t state = {0};
- vapi_error_e rv;
- char *tmp = NULL;
- char static_prefix[XPATH_SIZE] = {0};
- char next_hop_index[XPATH_SIZE] = {0};
- sysr_ip_fib_details_ctx_t dctx = {.is_interface_ref = is_interface_ref};
-
- ARG_CHECK3(SR_ERR_INVAL_ARG, xpath, values, values_cnt);
+ rc |= get_xpath_key(index, (char *)xpath, "next-hop", "index",
+ HOP_INDEX_SIZE, &state);
- tmp = xpath_find_first_key(xpath, "prefix", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("static_prefix not found.");
+ if (rc != 0)
return SR_ERR_INVAL_ARG;
- }
- strncpy(static_prefix, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
- tmp = xpath_find_first_key(xpath, "index", &state);
- if (NULL == tmp) {
- SRP_LOG_ERR_MSG("index not found.");
+ rc = ipv4_fib_dump_prefix(prefix, &reply);
+ if (rc != SCVPP_OK) {
+ SRP_LOG_ERR("Fail to dump prefix %s", prefix);
return SR_ERR_INVAL_ARG;
}
- strncpy(next_hop_index, tmp, XPATH_SIZE);
- sr_xpath_recover(&state);
+ //TODO: check nhop?
- //VPP callback
- dctx.next_hop_index = next_hop_index;
- if (is_interface_ref) {
- snprintf(dctx.sysr_values_ctx.xpath_root, XPATH_SIZE,
- "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/interface-ref/state",
- static_prefix, next_hop_index);
- } else {
- snprintf(dctx.sysr_values_ctx.xpath_root, XPATH_SIZE,
- "/openconfig-local-routing:local-routes/static-routes/static[prefix='%s']/next-hops/next-hop[index='%s']/state",
- static_prefix, next_hop_index);
- }
+ rc = sr_new_values(vc, &vals);
+ if (SR_ERR_OK != rc)
+ return rc;
- if (!address_prefix_init(&dctx.address_prefix, static_prefix))
- {
+ // check next hop index equals next hop id
+ if (strtoul(index, NULL, 0) != reply->path[0].next_hop_id) {
+ SRP_LOG_ERR("next hop index is %d for prefix %s",
+ reply->path[0].next_hop_id, prefix);
+ SRP_LOG_ERR("before %s, stroul is %d", index, strtoul(index, NULL, 0));
return SR_ERR_INVAL_ARG;
}
- vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx_instance);
- VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx_instance, mp, ip_routing_next_hop_dump_cb, &dctx));
- if (VAPI_OK != rv)
- {
- SRP_LOG_ERR_MSG("VAPI call failed");
+ rc = get_interface_name(interface, reply->path[0].sw_if_index);
+ if (rc != SCVPP_OK) {
+ SRP_LOG_ERR("No interface name for id %d", reply->path[0].sw_if_index);
return SR_ERR_INVAL_ARG;
}
- if (is_interface_ref)
- {
- if (dctx.sw_interface_details_query.interface_found)
- {
- if (!get_interface_name(&dctx.sw_interface_details_query))
- {
- return SR_ERR_INVAL_ARG;
- }
- if (strlen((const char*)
- dctx.sw_interface_details_query.sw_interface_details.interface_name)) {
- openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_vapi_cb(&dctx);
- }
- }
- }
+ sr_val_build_xpath(&vals[0], "%s/interface", xpath);
+ sr_val_set_str_data(&vals[0], SR_STRING_T, interface);
+ free(reply);
sr_xpath_recover(&state);
- *values = dctx.sysr_values_ctx.values;
- *values_cnt = dctx.sysr_values_ctx.values_cnt;
+ *values = vals;
+ *values_cnt = vc;
return SR_ERR_OK;
}
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_cb(
- const char *xpath, sr_val_t **values, size_t *values_cnt,
- uint64_t request_id, const char *original_xpath, void *private_ctx)
-{
- return next_hop_inner(false, xpath, values, values_cnt, request_id,
- private_ctx);
-}
-
-int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_cb(
- const char *xpath, sr_val_t **values, size_t *values_cnt,
- uint64_t request_id, const char *original_xpath, void *private_ctx)
-{
- return next_hop_inner(true, xpath, values, values_cnt, request_id,
- private_ctx);
-}
-
const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE] = {
{
- .xpath = "openconfig-local-routing",
- .method = MODULE,
+ .xpath = "/openconfig-local-routing:local-routes/static-routes/static/config",
+ .method = XPATH,
.datastore = SR_DS_RUNNING,
- .cb.mcb = openconfig_local_routing_mod_cb,
+ .cb.scb = oc_prefix_config_cb,
.private_ctx = NULL,
.priority = 0,
- //.opts = SR_SUBSCR_EV_ENABLED | SR_SUBSCR_APPLY_ONLY
- .opts = SR_SUBSCR_EV_ENABLED | SR_SUBSCR_APPLY_ONLY | SR_SUBSCR_CTX_REUSE
+ //.opts = SR_SUBSCR_DEFAULT
+ .opts = SR_SUBSCR_CTX_REUSE
},
{
.xpath = "/openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/config",
.method = XPATH,
.datastore = SR_DS_RUNNING,
- .cb.scb = openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_config_cb,
+ .cb.scb = oc_next_hop_config_cb,
.private_ctx = NULL,
.priority = 0,
//.opts = SR_SUBSCR_DEFAULT
@@ -752,7 +514,7 @@ const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE] = {
.xpath = "/openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/interface-ref/config",
.method = XPATH,
.datastore = SR_DS_RUNNING,
- .cb.scb = openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_config_cb,
+ .cb.scb = oc_next_hop_interface_config_cb,
.private_ctx = NULL,
.priority = 0,
//.opts = SR_SUBSCR_DEFAULT
@@ -762,7 +524,7 @@ const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE] = {
.xpath = "/openconfig-local-routing:local-routes/static-routes/static/state",
.method = GETITEM,
.datastore = SR_DS_RUNNING,
- .cb.gcb = openconfig_local_routing_local_routes_static_routes_static_state_cb,
+ .cb.gcb = oc_prefix_state_cb,
.private_ctx = NULL,
.priority = 0,
.opts = SR_SUBSCR_CTX_REUSE
@@ -771,7 +533,7 @@ const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE] = {
.xpath = "/openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/state",
.method = GETITEM,
.datastore = SR_DS_RUNNING,
- .cb.gcb = openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_cb,
+ .cb.gcb = oc_next_hop_state_cb,
.private_ctx = NULL,
.priority = 0,
.opts = SR_SUBSCR_CTX_REUSE
@@ -780,7 +542,7 @@ const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE] = {
.xpath = "/openconfig-local-routing:local-routes/static-routes/static/next-hops/next-hop/interface-ref/state",
.method = GETITEM,
.datastore = SR_DS_RUNNING,
- .cb.gcb = openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_cb,
+ .cb.gcb = oc_next_hop_interface_state_cb,
.private_ctx = NULL,
.priority = 0,
.opts = SR_SUBSCR_CTX_REUSE
diff --git a/src/plugins/openconfig/openconfig_local_routing.h b/src/plugins/openconfig/openconfig_local_routing.h
deleted file mode 100644
index 13d2982..0000000
--- a/src/plugins/openconfig/openconfig_local_routing.h
+++ /dev/null
@@ -1,25 +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 __OPENCONFIG_LOCAL_ROUTING_H__
-#define __OPENCONFIG_LOCAL_ROUTING_H__
-
-#include "../sc_model.h"
-
-#define OC_LROUTING_SIZE 6
-extern const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE];
-
-#endif /* __OPENCONFIG_LOCAL_ROUTING_H__ */
diff --git a/src/plugins/sc_model.h b/src/plugins/sc_model.h
index ad4055b..a9392f9 100644
--- a/src/plugins/sc_model.h
+++ b/src/plugins/sc_model.h
@@ -29,7 +29,7 @@
#include <sysrepo/values.h>
#include <sysrepo/plugins.h>
-#include "sc_vpp_comm.h" //for ARG_CHECK only
+#include <scvpp/comm.h> //for ARG_CHECK only
typedef enum {
MODULE,
@@ -68,4 +68,18 @@ typedef struct {
int
model_register(plugin_main_t *plugin_main, const xpath_t *xpaths, size_t size);
+/* Declare registration */
+
+#define OC_INTERFACES_SIZE 5
+extern const xpath_t oc_interfaces_xpaths[OC_INTERFACES_SIZE];
+
+#define OC_LROUTING_SIZE 6
+extern const xpath_t oc_local_routing_xpaths[OC_LROUTING_SIZE];
+
+#define IETF_NAT_SIZE 2
+extern const xpath_t ietf_nat_xpaths[IETF_NAT_SIZE];
+
+#define IETF_INTERFACES_SIZE 5
+extern const xpath_t ietf_interfaces_xpaths[IETF_INTERFACES_SIZE];
+
#endif /* __SC_MODEL_H__ */
diff --git a/src/plugins/sc_plugins.c b/src/plugins/sc_plugins.c
index 87ea2d7..4dc6751 100644
--- a/src/plugins/sc_plugins.c
+++ b/src/plugins/sc_plugins.c
@@ -16,11 +16,6 @@
#include "sc_plugins.h"
#include "sc_model.h"
-#include "ietf/ietf_interface.h"
-#include "ietf/ietf_nat.h"
-#include "openconfig/openconfig_interfaces.h"
-#include "openconfig/openconfig_local_routing.h"
-
int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx)
{
plugin_main_t plugin_main;
diff --git a/src/plugins/sys_util.c b/src/plugins/sys_util.c
deleted file mode 100644
index a3ee0c9..0000000
--- a/src/plugins/sys_util.c
+++ /dev/null
@@ -1,170 +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 <sysrepo/plugins.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;
-}
-
-/**
- * @brief Get IPv4 host address from IPv4 prefix.
- *
- * @param[out] dst Host IPv4 address.
- * @param[in] src IPv4 Prefix.
- * @param[in] length dst buffer length.
- * @param[out] prefix Get Prefix length, optional value. Can be NULL.
- * @return -1 when failure, 0 on success.
- */
-int get_address_from_prefix(char *dst, const char *src, size_t length,
- uint8_t *prefix_length)
-{
- ARG_CHECK2(-1, src, dst);
-
- size_t size = 0;
- char *p = strchr(src, '/');
- if (NULL == p) {
- return -1;
- }
-
- size = p - src;
-
- // + 1, need size for \0
- if ((size + 1) > length) {
- return -1;
- }
-
- strncpy(dst, src, size);
-
- if (NULL != prefix_length) {
- *prefix_length = atoi(++p);
- }
-
- return 0;
-}
-
-/**
- * @brief Get IPv4 broadcast IP address form IPv4 network address.
- *
- * @param[out] broadcat Broadcast Ipv4 address.
- * @param[in] network Network IPv4 address.
- * @param[in] prefix Prefix number.
- * @return -1 when failure, 0 on success.
- */
-int get_network_broadcast(sc_ipv4_addr *broadcast, const sc_ipv4_addr *network,
- uint8_t prefix_length)
-{
- uint8_t mask = ~0;
- uint8_t tmp_p = prefix_length;
- int i;
-
- ARG_CHECK2(-1, network, broadcast);
-
- if (32 < prefix_length) {
- SRP_LOG_ERR_MSG("Prefix length to big.");
- return -1;
- }
-
- for (i = 0; i < 4 ; i++) {
- broadcast->address[i] = network->address[i] |
- (mask >> (tmp_p > 8 ? 8 : tmp_p));
- if (tmp_p >= 8) {
- tmp_p -= 8;
- } else {
- tmp_p = 0;
- }
- }
-
- return 0;
-}
-
-/**
- * @brief Get last IPv4 address from the IP range.
- *
- * @param[out] last_ip_address Last Ipv4 address.
- * @param[in] first_ip_address First IPv4 address.
- * @param[in] prefix Prefix number.
- * @return -1 when failure, 0 on success.
- */
-int get_last_ip_address(sc_ipv4_addr* last_ip_address,
- const sc_ipv4_addr* first_ip_address,
- uint8_t prefix_length)
-{
- return get_network_broadcast(last_ip_address, first_ip_address,
- prefix_length);
-}
diff --git a/src/plugins/sys_util.h b/src/plugins/sys_util.h
index d449712..692a012 100644
--- a/src/plugins/sys_util.h
+++ b/src/plugins/sys_util.h
@@ -19,20 +19,71 @@
#include <sysrepo.h>
#include <sysrepo/xpath.h>
+#include <sysrepo/plugins.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <string.h>
+
+#include <scvpp/comm.h>
+
+/* BEGIN sysrepo utils */
+
+#define foreach_change(ds, it, oper, old, new) \
+ while( (event != SR_EV_ABORT) && \
+ sr_get_change_next(ds, it, &oper, &old, &new) == SR_ERR_OK)
#define XPATH_SIZE 2000
+#define NOT_AVAL "NOT AVAILABLE"
+
+static inline int
+get_xpath_key(char *dst, char *xpath, char *node, char *key, int length,
+ sr_xpath_ctx_t *state) {
+ char *tmp;
+
+ tmp = sr_xpath_key_value(xpath, node, key, state);
+ if (!tmp) {
+ SRP_LOG_ERR("%s %s not found.", node, key);
+ return SR_ERR_INVAL_ARG;
+ }
+ strncpy(dst, tmp, length);
+ sr_xpath_recover(state);
+
+ return 0;
+}
+
+/* END of sysrepo utils */
typedef struct
{
- char xpath_root[XPATH_SIZE];
- sr_val_t * values;
- size_t values_cnt;
-} sysr_values_ctx_t;
+ uint8_t address[4];
+} sc_ipv4_addr;
-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);
+/**
+ * @brief Extract IP "AAA.BBB.CCC.DDD" from an IP prefix: "AAA.BBB.CCC.DDD/XX"
+ * @param prefix - IPv4 or IPv6 prefix:
+ * @return prefix length
+ */
+static inline 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;
+ uint8_t plen = strtoul(slash + 1, &eptr, 10);
+ if (*eptr || plen <= 0)
+ return -1;
+
+ //keep just the address part
+ *slash = '\0'; //replace '/' with 0
+
+ //return prefix length
+ return plen;
+}
/**
* @brief Get IPv4 host address from IPv4 prefix.
@@ -43,13 +94,61 @@ int ip_prefix_split(const char* ip_prefix);
* @param[out] prefix Get Prefix length, optional value. Can be NULL.
* @return -1 when failure, 0 on success.
*/
-int get_address_from_prefix(char* dst, const char* src, size_t length,
- uint8_t* prefix_length);
+static inline int
+prefix2address(char *dst, const char *src, uint8_t *prefix_length)
+{
+ if (!src || !dst)
+ return -1;
-typedef struct
+ char *p = strchr(src, '/');
+ if (!p)
+ return -1; // '/' not found
+
+ if ((p - src + 1) > VPP_IP4_ADDRESS_STRING_LEN) //+ 1 needed for \0
+ return -1;
+
+ strncpy(dst, src, VPP_IP4_ADDRESS_STRING_LEN);
+
+ if (!prefix_length)
+ *prefix_length = atoi(++p);
+
+ return 0;
+}
+
+/**
+ * @brief Helper function for converting netmask (ex: 255.255.255.0)
+ * to prefix length (ex: 24).
+ * @param netmask - string of netmask "AAA.BBB.CCC.DDD"
+ * @return prefix length
+ */
+static inline uint8_t netmask_to_prefix(const char *netmask)
{
- uint8_t address[4];
-} sc_ipv4_addr;
+ in_addr_t n = 0;
+ uint8_t i = 0;
+
+ inet_pton(AF_INET, netmask, &n);
+
+ while (n > 0) {
+ n = n >> 1;
+ i++;
+ }
+
+ return i;
+}
+
+/**
+ * @brief Convert prefix length to netmask
+ * @param prefix - prefix length (ex: 24)
+ * @return netmask - integer (ex: 111111111111111111111111100000000b )
+ */
+static inline uint32_t prefix2mask(int prefix)
+{
+ if (prefix) {
+ return htonl(~((1 << (32 - prefix)) - 1));
+ } else {
+ return htonl(0);
+ }
+}
/**
* @brief Get IPv4 broadcast IP address form IPv4 network address.
@@ -59,8 +158,32 @@ typedef struct
* @param[in] prefix Prefix number.
* @return -1 when failure, 0 on success.
*/
-int get_network_broadcast(sc_ipv4_addr *broadcast, const sc_ipv4_addr *network,
- uint8_t prefix_length);
+static inline int get_network_broadcast(sc_ipv4_addr *broadcast, const sc_ipv4_addr *network,
+ uint8_t prefix_length)
+{
+ uint8_t mask = ~0;
+ uint8_t tmp_p = prefix_length;
+ int i;
+
+ ARG_CHECK2(-1, network, broadcast);
+
+ if (32 < prefix_length) {
+ SRP_LOG_ERR_MSG("Prefix length to big.");
+ return -1;
+ }
+
+ for (i = 0; i < 4 ; i++) {
+ broadcast->address[i] = network->address[i] |
+ (mask >> (tmp_p > 8 ? 8 : tmp_p));
+ if (tmp_p >= 8) {
+ tmp_p -= 8;
+ } else {
+ tmp_p = 0;
+ }
+ }
+
+ return 0;
+}
/**
* @brief Get last IPv4 address from the IP range.
@@ -70,8 +193,12 @@ int get_network_broadcast(sc_ipv4_addr *broadcast, const sc_ipv4_addr *network,
* @param[in] prefix Prefix number.
* @return -1 when failure, 0 on success.
*/
-int get_last_ip_address(sc_ipv4_addr *last_ip_address,
- const sc_ipv4_addr *first_ip_address,
- uint8_t prefix_length);
+static inline int get_last_ip_address(sc_ipv4_addr* last_ip_address,
+ const sc_ipv4_addr* first_ip_address,
+ uint8_t prefix_length)
+{
+ return get_network_broadcast(last_ip_address, first_ip_address,
+ prefix_length);
+}
#endif /* __SYS_UTIL_H__ */
diff --git a/src/plugins/yang/ietf-interfaces.data.xml b/src/plugins/yang/ietf-interfaces.data.xml
deleted file mode 100644
index 3aae96e..0000000
--- a/src/plugins/yang/ietf-interfaces.data.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
- <interface>
- <name>GigabitEthernet0/8/0</name>
- <description>Ethernet 8</description>
- <type>ethernetCsmacd</type>
- <enabled>true</enabled>
- <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
- <address>
- <ip>192.168.2.100</ip>
- <prefix-length>24</prefix-length>
- </address>
- </ipv4>
- <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
- <address>
- <ip>2001:db8::10</ip>
- <prefix-length>32</prefix-length>
- </address>
- </ipv6>
- </interface>
-</interfaces>
-
diff --git a/src/plugins/yang/ietf/iana-if-type@2017-01-19.yang b/src/plugins/yang/ietf/iana-if-type@2017-01-19.yang
new file mode 100644
index 0000000..7bfee36
--- /dev/null
+++ b/src/plugins/yang/ietf/iana-if-type@2017-01-19.yang
@@ -0,0 +1,1619 @@
+module iana-if-type {
+ namespace "urn:ietf:params:xml:ns:yang:iana-if-type";
+ prefix ianaift;
+
+ import ietf-interfaces {
+ prefix if;
+ }
+
+ organization "IANA";
+ contact
+ " Internet Assigned Numbers Authority
+
+ Postal: ICANN
+ 12025 Waterfront Drive, Suite 300
+ Los Angeles, CA 90094-2536
+ United States
+
+ Tel: +1 310 301 5800
+ <mailto:iana&iana.org>";
+ description
+ "This YANG module defines YANG identities for IANA-registered
+ interface types.
+
+ This YANG module is maintained by IANA and reflects the
+ 'ifType definitions' registry.
+
+ The latest revision of this YANG module can be obtained from
+ the IANA web site.
+
+ Requests for new values should be made to IANA via
+ email (iana&iana.org).
+
+ Copyright (c) 2014 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ The initial version of this YANG module is part of RFC 7224;
+ see the RFC itself for full legal notices.";
+ reference
+ "IANA 'ifType definitions' registry.
+ <http://www.iana.org/assignments/smi-numbers>";
+
+ revision 2017-01-19 {
+ description
+ "Registered ifType 289.";
+ }
+
+ revision 2016-11-23 {
+ description
+ "Registered ifTypes 283-288.";
+ }
+
+ revision 2016-06-09 {
+ description
+ "Registered ifType 282.";
+ }
+ revision 2016-05-03 {
+ description
+ "Registered ifType 281.";
+ }
+ revision 2015-06-12 {
+ description
+ "Corrected formatting issue.";
+ }
+ revision 2014-09-24 {
+ description
+ "Registered ifType 280.";
+ }
+ revision 2014-09-19 {
+ description
+ "Registered ifType 279.";
+ }
+ revision 2014-07-03 {
+ description
+ "Registered ifTypes 277-278.";
+ }
+ revision 2014-05-19 {
+ description
+ "Updated the contact address.";
+ }
+ revision 2014-05-08 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 7224: IANA Interface Type YANG Module";
+ }
+
+ identity iana-interface-type {
+ base if:interface-type;
+ description
+ "This identity is used as a base for all interface types
+ defined in the 'ifType definitions' registry.";
+ }
+
+ identity other {
+ base iana-interface-type;
+ }
+ identity regular1822 {
+ base iana-interface-type;
+ }
+ identity hdh1822 {
+ base iana-interface-type;
+ }
+ identity ddnX25 {
+ base iana-interface-type;
+ }
+ identity rfc877x25 {
+ base iana-interface-type;
+ reference
+ "RFC 1382 - SNMP MIB Extension for the X.25 Packet Layer";
+ }
+ identity ethernetCsmacd {
+ base iana-interface-type;
+ description
+ "For all Ethernet-like interfaces, regardless of speed,
+ as per RFC 3635.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity iso88023Csmacd {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Deprecated via RFC 3635.
+ Use ethernetCsmacd(6) instead.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity iso88024TokenBus {
+ base iana-interface-type;
+ }
+ identity iso88025TokenRing {
+ base iana-interface-type;
+ }
+ identity iso88026Man {
+ base iana-interface-type;
+ }
+ identity starLan {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Deprecated via RFC 3635.
+ Use ethernetCsmacd(6) instead.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity proteon10Mbit {
+ base iana-interface-type;
+ }
+ identity proteon80Mbit {
+ base iana-interface-type;
+ }
+ identity hyperchannel {
+ base iana-interface-type;
+ }
+ identity fddi {
+ base iana-interface-type;
+ reference
+ "RFC 1512 - FDDI Management Information Base";
+ }
+ identity lapb {
+ base iana-interface-type;
+ reference
+ "RFC 1381 - SNMP MIB Extension for X.25 LAPB";
+ }
+ identity sdlc {
+ base iana-interface-type;
+ }
+ identity ds1 {
+ base iana-interface-type;
+ description
+ "DS1-MIB.";
+ reference
+ "RFC 4805 - Definitions of Managed Objects for the
+ DS1, J1, E1, DS2, and E2 Interface Types";
+ }
+ identity e1 {
+ base iana-interface-type;
+ status obsolete;
+ description
+ "Obsolete; see DS1-MIB.";
+ reference
+ "RFC 4805 - Definitions of Managed Objects for the
+ DS1, J1, E1, DS2, and E2 Interface Types";
+ }
+ identity basicISDN {
+ base iana-interface-type;
+ description
+ "No longer used. See also RFC 2127.";
+ }
+ identity primaryISDN {
+ base iana-interface-type;
+ description
+ "No longer used. See also RFC 2127.";
+ }
+ identity propPointToPointSerial {
+ base iana-interface-type;
+ description
+ "Proprietary serial.";
+ }
+ identity ppp {
+ base iana-interface-type;
+ }
+ identity softwareLoopback {
+ base iana-interface-type;
+ }
+ identity eon {
+ base iana-interface-type;
+ description
+ "CLNP over IP.";
+ }
+ identity ethernet3Mbit {
+ base iana-interface-type;
+ }
+ identity nsip {
+ base iana-interface-type;
+ description
+ "XNS over IP.";
+ }
+ identity slip {
+ base iana-interface-type;
+ description
+ "Generic SLIP.";
+ }
+ identity ultra {
+ base iana-interface-type;
+ description
+ "Ultra Technologies.";
+ }
+ identity ds3 {
+ base iana-interface-type;
+ description
+ "DS3-MIB.";
+ reference
+ "RFC 3896 - Definitions of Managed Objects for the
+ DS3/E3 Interface Type";
+ }
+ identity sip {
+ base iana-interface-type;
+ description
+ "SMDS, coffee.";
+ reference
+ "RFC 1694 - Definitions of Managed Objects for SMDS
+ Interfaces using SMIv2";
+ }
+ identity frameRelay {
+ base iana-interface-type;
+ description
+ "DTE only.";
+ reference
+ "RFC 2115 - Management Information Base for Frame Relay
+ DTEs Using SMIv2";
+ }
+ identity rs232 {
+ base iana-interface-type;
+ reference
+ "RFC 1659 - Definitions of Managed Objects for RS-232-like
+ Hardware Devices using SMIv2";
+ }
+ identity para {
+ base iana-interface-type;
+ description
+ "Parallel-port.";
+ reference
+ "RFC 1660 - Definitions of Managed Objects for
+ Parallel-printer-like Hardware Devices using
+ SMIv2";
+ }
+ identity arcnet {
+ base iana-interface-type;
+ description
+ "ARCnet.";
+ }
+ identity arcnetPlus {
+ base iana-interface-type;
+ description
+ "ARCnet Plus.";
+ }
+ identity atm {
+ base iana-interface-type;
+ description
+ "ATM cells.";
+ }
+ identity miox25 {
+ base iana-interface-type;
+ reference
+ "RFC 1461 - SNMP MIB extension for Multiprotocol
+ Interconnect over X.25";
+ }
+ identity sonet {
+ base iana-interface-type;
+ description
+ "SONET or SDH.";
+ }
+ identity x25ple {
+ base iana-interface-type;
+ reference
+ "RFC 2127 - ISDN Management Information Base using SMIv2";
+ }
+ identity iso88022llc {
+ base iana-interface-type;
+ }
+ identity localTalk {
+ base iana-interface-type;
+ }
+ identity smdsDxi {
+ base iana-interface-type;
+ }
+ identity frameRelayService {
+ base iana-interface-type;
+ description
+ "FRNETSERV-MIB.";
+ reference
+ "RFC 2954 - Definitions of Managed Objects for Frame
+ Relay Service";
+ }
+ identity v35 {
+ base iana-interface-type;
+ }
+ identity hssi {
+ base iana-interface-type;
+ }
+ identity hippi {
+ base iana-interface-type;
+ }
+ identity modem {
+ base iana-interface-type;
+ description
+ "Generic modem.";
+ }
+ identity aal5 {
+ base iana-interface-type;
+ description
+ "AAL5 over ATM.";
+ }
+ identity sonetPath {
+ base iana-interface-type;
+ }
+ identity sonetVT {
+ base iana-interface-type;
+ }
+ identity smdsIcip {
+ base iana-interface-type;
+ description
+ "SMDS InterCarrier Interface.";
+ }
+ identity propVirtual {
+ base iana-interface-type;
+ description
+ "Proprietary virtual/internal.";
+ reference
+ "RFC 2863 - The Interfaces Group MIB";
+ }
+ identity propMultiplexor {
+ base iana-interface-type;
+ description
+ "Proprietary multiplexing.";
+ reference
+ "RFC 2863 - The Interfaces Group MIB";
+ }
+ identity ieee80212 {
+ base iana-interface-type;
+ description
+ "100BaseVG.";
+ }
+ identity fibreChannel {
+ base iana-interface-type;
+ description
+ "Fibre Channel.";
+ }
+ identity hippiInterface {
+ base iana-interface-type;
+ description
+ "HIPPI interfaces.";
+ }
+ identity frameRelayInterconnect {
+ base iana-interface-type;
+ status obsolete;
+ description
+ "Obsolete; use either
+ frameRelay(32) or frameRelayService(44).";
+ }
+ identity aflane8023 {
+ base iana-interface-type;
+ description
+ "ATM Emulated LAN for 802.3.";
+ }
+ identity aflane8025 {
+ base iana-interface-type;
+ description
+ "ATM Emulated LAN for 802.5.";
+ }
+ identity cctEmul {
+ base iana-interface-type;
+ description
+ "ATM Emulated circuit.";
+ }
+ identity fastEther {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Obsoleted via RFC 3635.
+ ethernetCsmacd(6) should be used instead.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity isdn {
+ base iana-interface-type;
+ description
+ "ISDN and X.25.";
+ reference
+ "RFC 1356 - Multiprotocol Interconnect on X.25 and ISDN
+ in the Packet Mode";
+ }
+ identity v11 {
+ base iana-interface-type;
+ description
+ "CCITT V.11/X.21.";
+ }
+ identity v36 {
+ base iana-interface-type;
+ description
+ "CCITT V.36.";
+ }
+ identity g703at64k {
+ base iana-interface-type;
+ description
+ "CCITT G703 at 64Kbps.";
+ }
+ identity g703at2mb {
+ base iana-interface-type;
+ status obsolete;
+ description
+ "Obsolete; see DS1-MIB.";
+ }
+ identity qllc {
+ base iana-interface-type;
+ description
+ "SNA QLLC.";
+ }
+ identity fastEtherFX {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Obsoleted via RFC 3635.
+ ethernetCsmacd(6) should be used instead.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity channel {
+ base iana-interface-type;
+ description
+ "Channel.";
+ }
+ identity ieee80211 {
+ base iana-interface-type;
+ description
+ "Radio spread spectrum.";
+ }
+ identity ibm370parChan {
+ base iana-interface-type;
+ description
+ "IBM System 360/370 OEMI Channel.";
+ }
+ identity escon {
+ base iana-interface-type;
+ description
+ "IBM Enterprise Systems Connection.";
+ }
+ identity dlsw {
+ base iana-interface-type;
+ description
+ "Data Link Switching.";
+ }
+ identity isdns {
+ base iana-interface-type;
+ description
+ "ISDN S/T interface.";
+ }
+ identity isdnu {
+ base iana-interface-type;
+ description
+ "ISDN U interface.";
+ }
+ identity lapd {
+ base iana-interface-type;
+ description
+ "Link Access Protocol D.";
+ }
+ identity ipSwitch {
+ base iana-interface-type;
+ description
+ "IP Switching Objects.";
+ }
+ identity rsrb {
+ base iana-interface-type;
+ description
+ "Remote Source Route Bridging.";
+ }
+ identity atmLogical {
+ base iana-interface-type;
+ description
+ "ATM Logical Port.";
+ reference
+ "RFC 3606 - Definitions of Supplemental Managed Objects
+ for ATM Interface";
+ }
+ identity ds0 {
+ base iana-interface-type;
+ description
+ "Digital Signal Level 0.";
+ reference
+ "RFC 2494 - Definitions of Managed Objects for the DS0
+ and DS0 Bundle Interface Type";
+ }
+ identity ds0Bundle {
+ base iana-interface-type;
+ description
+ "Group of ds0s on the same ds1.";
+ reference
+ "RFC 2494 - Definitions of Managed Objects for the DS0
+ and DS0 Bundle Interface Type";
+ }
+ identity bsc {
+ base iana-interface-type;
+ description
+ "Bisynchronous Protocol.";
+ }
+ identity async {
+ base iana-interface-type;
+ description
+ "Asynchronous Protocol.";
+ }
+ identity cnr {
+ base iana-interface-type;
+ description
+ "Combat Net Radio.";
+ }
+ identity iso88025Dtr {
+ base iana-interface-type;
+ description
+ "ISO 802.5r DTR.";
+ }
+ identity eplrs {
+ base iana-interface-type;
+ description
+ "Ext Pos Loc Report Sys.";
+ }
+ identity arap {
+ base iana-interface-type;
+ description
+ "Appletalk Remote Access Protocol.";
+ }
+ identity propCnls {
+ base iana-interface-type;
+ description
+ "Proprietary Connectionless Protocol.";
+ }
+ identity hostPad {
+ base iana-interface-type;
+ description
+ "CCITT-ITU X.29 PAD Protocol.";
+ }
+ identity termPad {
+ base iana-interface-type;
+ description
+ "CCITT-ITU X.3 PAD Facility.";
+ }
+ identity frameRelayMPI {
+ base iana-interface-type;
+ description
+ "Multiproto Interconnect over FR.";
+ }
+ identity x213 {
+ base iana-interface-type;
+ description
+ "CCITT-ITU X213.";
+ }
+ identity adsl {
+ base iana-interface-type;
+ description
+ "Asymmetric Digital Subscriber Loop.";
+ }
+ identity radsl {
+ base iana-interface-type;
+ description
+ "Rate-Adapt. Digital Subscriber Loop.";
+ }
+ identity sdsl {
+ base iana-interface-type;
+ description
+ "Symmetric Digital Subscriber Loop.";
+ }
+ identity vdsl {
+ base iana-interface-type;
+ description
+ "Very H-Speed Digital Subscrib. Loop.";
+ }
+ identity iso88025CRFPInt {
+ base iana-interface-type;
+ description
+ "ISO 802.5 CRFP.";
+ }
+ identity myrinet {
+ base iana-interface-type;
+ description
+ "Myricom Myrinet.";
+ }
+ identity voiceEM {
+ base iana-interface-type;
+ description
+ "Voice recEive and transMit.";
+ }
+ identity voiceFXO {
+ base iana-interface-type;
+ description
+ "Voice Foreign Exchange Office.";
+ }
+ identity voiceFXS {
+ base iana-interface-type;
+ description
+ "Voice Foreign Exchange Station.";
+ }
+ identity voiceEncap {
+ base iana-interface-type;
+ description
+ "Voice encapsulation.";
+ }
+ identity voiceOverIp {
+ base iana-interface-type;
+ description
+ "Voice over IP encapsulation.";
+ }
+ identity atmDxi {
+ base iana-interface-type;
+ description
+ "ATM DXI.";
+ }
+ identity atmFuni {
+ base iana-interface-type;
+ description
+ "ATM FUNI.";
+ }
+ identity atmIma {
+ base iana-interface-type;
+ description
+ "ATM IMA.";
+ }
+ identity pppMultilinkBundle {
+ base iana-interface-type;
+ description
+ "PPP Multilink Bundle.";
+ }
+ identity ipOverCdlc {
+ base iana-interface-type;
+ description
+ "IBM ipOverCdlc.";
+ }
+ identity ipOverClaw {
+ base iana-interface-type;
+ description
+ "IBM Common Link Access to Workstn.";
+ }
+ identity stackToStack {
+ base iana-interface-type;
+ description
+ "IBM stackToStack.";
+ }
+ identity virtualIpAddress {
+ base iana-interface-type;
+ description
+ "IBM VIPA.";
+ }
+ identity mpc {
+ base iana-interface-type;
+ description
+ "IBM multi-protocol channel support.";
+ }
+ identity ipOverAtm {
+ base iana-interface-type;
+ description
+ "IBM ipOverAtm.";
+ reference
+ "RFC 2320 - Definitions of Managed Objects for Classical IP
+ and ARP Over ATM Using SMIv2 (IPOA-MIB)";
+ }
+ identity iso88025Fiber {
+ base iana-interface-type;
+ description
+ "ISO 802.5j Fiber Token Ring.";
+ }
+ identity tdlc {
+ base iana-interface-type;
+ description
+ "IBM twinaxial data link control.";
+ }
+ identity gigabitEthernet {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Obsoleted via RFC 3635.
+ ethernetCsmacd(6) should be used instead.";
+ reference
+ "RFC 3635 - Definitions of Managed Objects for the
+ Ethernet-like Interface Types";
+ }
+ identity hdlc {
+ base iana-interface-type;
+ description
+ "HDLC.";
+ }
+ identity lapf {
+ base iana-interface-type;
+ description
+ "LAP F.";
+ }
+ identity v37 {
+ base iana-interface-type;
+ description
+ "V.37.";
+ }
+ identity x25mlp {
+ base iana-interface-type;
+ description
+ "Multi-Link Protocol.";
+ }
+ identity x25huntGroup {
+ base iana-interface-type;
+ description
+ "X25 Hunt Group.";
+ }
+ identity transpHdlc {
+ base iana-interface-type;
+ description
+ "Transp HDLC.";
+ }
+ identity interleave {
+ base iana-interface-type;
+ description
+ "Interleave channel.";
+ }
+ identity fast {
+ base iana-interface-type;
+ description
+ "Fast channel.";
+ }
+ identity ip {
+ base iana-interface-type;
+ description
+ "IP (for APPN HPR in IP networks).";
+ }
+ identity docsCableMaclayer {
+ base iana-interface-type;
+ description
+ "CATV Mac Layer.";
+ }
+ identity docsCableDownstream {
+ base iana-interface-type;
+ description
+ "CATV Downstream interface.";
+ }
+ identity docsCableUpstream {
+ base iana-interface-type;
+ description
+ "CATV Upstream interface.";
+ }
+ identity a12MppSwitch {
+ base iana-interface-type;
+ description
+ "Avalon Parallel Processor.";
+ }
+ identity tunnel {
+ base iana-interface-type;
+ description
+ "Encapsulation interface.";
+ }
+ identity coffee {
+ base iana-interface-type;
+ description
+ "Coffee pot.";
+ reference
+ "RFC 2325 - Coffee MIB";
+ }
+ identity ces {
+ base iana-interface-type;
+ description
+ "Circuit Emulation Service.";
+ }
+ identity atmSubInterface {
+ base iana-interface-type;
+ description
+ "ATM Sub Interface.";
+ }
+ identity l2vlan {
+ base iana-interface-type;
+ description
+ "Layer 2 Virtual LAN using 802.1Q.";
+ }
+ identity l3ipvlan {
+ base iana-interface-type;
+ description
+ "Layer 3 Virtual LAN using IP.";
+ }
+ identity l3ipxvlan {
+ base iana-interface-type;
+ description
+ "Layer 3 Virtual LAN using IPX.";
+ }
+ identity digitalPowerline {
+ base iana-interface-type;
+ description
+ "IP over Power Lines.";
+ }
+ identity mediaMailOverIp {
+ base iana-interface-type;
+ description
+ "Multimedia Mail over IP.";
+ }
+ identity dtm {
+ base iana-interface-type;
+ description
+ "Dynamic synchronous Transfer Mode.";
+ }
+ identity dcn {
+ base iana-interface-type;
+ description
+ "Data Communications Network.";
+ }
+ identity ipForward {
+ base iana-interface-type;
+ description
+ "IP Forwarding Interface.";
+ }
+ identity msdsl {
+ base iana-interface-type;
+ description
+ "Multi-rate Symmetric DSL.";
+ }
+ identity ieee1394 {
+ base iana-interface-type;
+
+ description
+ "IEEE1394 High Performance Serial Bus.";
+ }
+ identity if-gsn {
+ base iana-interface-type;
+ description
+ "HIPPI-6400.";
+ }
+ identity dvbRccMacLayer {
+ base iana-interface-type;
+ description
+ "DVB-RCC MAC Layer.";
+ }
+ identity dvbRccDownstream {
+ base iana-interface-type;
+ description
+ "DVB-RCC Downstream Channel.";
+ }
+ identity dvbRccUpstream {
+ base iana-interface-type;
+ description
+ "DVB-RCC Upstream Channel.";
+ }
+ identity atmVirtual {
+ base iana-interface-type;
+ description
+ "ATM Virtual Interface.";
+ }
+ identity mplsTunnel {
+ base iana-interface-type;
+ description
+ "MPLS Tunnel Virtual Interface.";
+ }
+ identity srp {
+ base iana-interface-type;
+ description
+ "Spatial Reuse Protocol.";
+ }
+ identity voiceOverAtm {
+ base iana-interface-type;
+ description
+ "Voice over ATM.";
+ }
+ identity voiceOverFrameRelay {
+ base iana-interface-type;
+ description
+ "Voice Over Frame Relay.";
+ }
+ identity idsl {
+ base iana-interface-type;
+ description
+ "Digital Subscriber Loop over ISDN.";
+ }
+ identity compositeLink {
+ base iana-interface-type;
+ description
+ "Avici Composite Link Interface.";
+ }
+ identity ss7SigLink {
+ base iana-interface-type;
+ description
+ "SS7 Signaling Link.";
+ }
+ identity propWirelessP2P {
+ base iana-interface-type;
+ description
+ "Prop. P2P wireless interface.";
+ }
+ identity frForward {
+ base iana-interface-type;
+ description
+ "Frame Forward Interface.";
+ }
+ identity rfc1483 {
+ base iana-interface-type;
+ description
+ "Multiprotocol over ATM AAL5.";
+ reference
+ "RFC 1483 - Multiprotocol Encapsulation over ATM
+ Adaptation Layer 5";
+ }
+ identity usb {
+ base iana-interface-type;
+ description
+ "USB Interface.";
+ }
+ identity ieee8023adLag {
+ base iana-interface-type;
+ description
+ "IEEE 802.3ad Link Aggregate.";
+ }
+ identity bgppolicyaccounting {
+ base iana-interface-type;
+ description
+ "BGP Policy Accounting.";
+ }
+ identity frf16MfrBundle {
+ base iana-interface-type;
+ description
+ "FRF.16 Multilink Frame Relay.";
+ }
+ identity h323Gatekeeper {
+ base iana-interface-type;
+ description
+ "H323 Gatekeeper.";
+ }
+ identity h323Proxy {
+ base iana-interface-type;
+ description
+ "H323 Voice and Video Proxy.";
+ }
+ identity mpls {
+ base iana-interface-type;
+ description
+ "MPLS.";
+ }
+ identity mfSigLink {
+ base iana-interface-type;
+ description
+ "Multi-frequency signaling link.";
+ }
+ identity hdsl2 {
+ base iana-interface-type;
+ description
+ "High Bit-Rate DSL - 2nd generation.";
+ }
+ identity shdsl {
+ base iana-interface-type;
+ description
+ "Multirate HDSL2.";
+ }
+ identity ds1FDL {
+ base iana-interface-type;
+ description
+ "Facility Data Link (4Kbps) on a DS1.";
+ }
+ identity pos {
+ base iana-interface-type;
+ description
+ "Packet over SONET/SDH Interface.";
+ }
+ identity dvbAsiIn {
+ base iana-interface-type;
+ description
+ "DVB-ASI Input.";
+ }
+ identity dvbAsiOut {
+ base iana-interface-type;
+ description
+ "DVB-ASI Output.";
+ }
+ identity plc {
+ base iana-interface-type;
+ description
+ "Power Line Communications.";
+ }
+ identity nfas {
+ base iana-interface-type;
+ description
+ "Non-Facility Associated Signaling.";
+ }
+ identity tr008 {
+ base iana-interface-type;
+ description
+ "TR008.";
+ }
+ identity gr303RDT {
+ base iana-interface-type;
+ description
+ "Remote Digital Terminal.";
+ }
+ identity gr303IDT {
+ base iana-interface-type;
+ description
+ "Integrated Digital Terminal.";
+ }
+ identity isup {
+ base iana-interface-type;
+ description
+ "ISUP.";
+ }
+ identity propDocsWirelessMaclayer {
+ base iana-interface-type;
+ description
+ "Cisco proprietary Maclayer.";
+ }
+ identity propDocsWirelessDownstream {
+ base iana-interface-type;
+ description
+ "Cisco proprietary Downstream.";
+ }
+ identity propDocsWirelessUpstream {
+ base iana-interface-type;
+ description
+ "Cisco proprietary Upstream.";
+ }
+ identity hiperlan2 {
+ base iana-interface-type;
+ description
+ "HIPERLAN Type 2 Radio Interface.";
+ }
+ identity propBWAp2Mp {
+ base iana-interface-type;
+ description
+ "PropBroadbandWirelessAccesspt2Multipt (use of this value
+ for IEEE 802.16 WMAN interfaces as per IEEE Std 802.16f
+ is deprecated, and ieee80216WMAN(237) should be used
+ instead).";
+ }
+ identity sonetOverheadChannel {
+ base iana-interface-type;
+ description
+ "SONET Overhead Channel.";
+ }
+ identity digitalWrapperOverheadChannel {
+ base iana-interface-type;
+ description
+ "Digital Wrapper.";
+ }
+ identity aal2 {
+ base iana-interface-type;
+ description
+ "ATM adaptation layer 2.";
+ }
+ identity radioMAC {
+ base iana-interface-type;
+ description
+ "MAC layer over radio links.";
+ }
+ identity atmRadio {
+ base iana-interface-type;
+ description
+ "ATM over radio links.";
+ }
+ identity imt {
+ base iana-interface-type;
+ description
+ "Inter-Machine Trunks.";
+ }
+ identity mvl {
+ base iana-interface-type;
+ description
+ "Multiple Virtual Lines DSL.";
+ }
+ identity reachDSL {
+ base iana-interface-type;
+ description
+ "Long Reach DSL.";
+ }
+ identity frDlciEndPt {
+ base iana-interface-type;
+ description
+ "Frame Relay DLCI End Point.";
+ }
+ identity atmVciEndPt {
+ base iana-interface-type;
+ description
+ "ATM VCI End Point.";
+ }
+ identity opticalChannel {
+ base iana-interface-type;
+ description
+ "Optical Channel.";
+ }
+ identity opticalTransport {
+ base iana-interface-type;
+ description
+ "Optical Transport.";
+ }
+ identity propAtm {
+ base iana-interface-type;
+ description
+ "Proprietary ATM.";
+ }
+ identity voiceOverCable {
+ base iana-interface-type;
+ description
+ "Voice Over Cable Interface.";
+ }
+ identity infiniband {
+ base iana-interface-type;
+ description
+ "Infiniband.";
+ }
+ identity teLink {
+ base iana-interface-type;
+ description
+ "TE Link.";
+ }
+ identity q2931 {
+ base iana-interface-type;
+ description
+ "Q.2931.";
+ }
+ identity virtualTg {
+ base iana-interface-type;
+ description
+ "Virtual Trunk Group.";
+ }
+ identity sipTg {
+ base iana-interface-type;
+ description
+ "SIP Trunk Group.";
+ }
+ identity sipSig {
+ base iana-interface-type;
+ description
+ "SIP Signaling.";
+ }
+ identity docsCableUpstreamChannel {
+ base iana-interface-type;
+ description
+ "CATV Upstream Channel.";
+ }
+ identity econet {
+ base iana-interface-type;
+ description
+ "Acorn Econet.";
+ }
+ identity pon155 {
+ base iana-interface-type;
+ description
+ "FSAN 155Mb Symetrical PON interface.";
+ }
+ identity pon622 {
+ base iana-interface-type;
+ description
+ "FSAN 622Mb Symetrical PON interface.";
+ }
+ identity bridge {
+ base iana-interface-type;
+ description
+ "Transparent bridge interface.";
+ }
+ identity linegroup {
+ base iana-interface-type;
+ description
+ "Interface common to multiple lines.";
+ }
+ identity voiceEMFGD {
+ base iana-interface-type;
+ description
+ "Voice E&M Feature Group D.";
+ }
+ identity voiceFGDEANA {
+ base iana-interface-type;
+ description
+ "Voice FGD Exchange Access North American.";
+ }
+ identity voiceDID {
+ base iana-interface-type;
+ description
+ "Voice Direct Inward Dialing.";
+ }
+ identity mpegTransport {
+ base iana-interface-type;
+ description
+ "MPEG transport interface.";
+ }
+ identity sixToFour {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "6to4 interface (DEPRECATED).";
+ reference
+ "RFC 4087 - IP Tunnel MIB";
+ }
+ identity gtp {
+ base iana-interface-type;
+ description
+ "GTP (GPRS Tunneling Protocol).";
+ }
+ identity pdnEtherLoop1 {
+ base iana-interface-type;
+ description
+ "Paradyne EtherLoop 1.";
+ }
+ identity pdnEtherLoop2 {
+ base iana-interface-type;
+ description
+ "Paradyne EtherLoop 2.";
+ }
+ identity opticalChannelGroup {
+ base iana-interface-type;
+ description
+ "Optical Channel Group.";
+ }
+ identity homepna {
+ base iana-interface-type;
+ description
+ "HomePNA ITU-T G.989.";
+ }
+ identity gfp {
+ base iana-interface-type;
+ description
+ "Generic Framing Procedure (GFP).";
+ }
+ identity ciscoISLvlan {
+ base iana-interface-type;
+ description
+ "Layer 2 Virtual LAN using Cisco ISL.";
+ }
+ identity actelisMetaLOOP {
+ base iana-interface-type;
+ description
+ "Acteleis proprietary MetaLOOP High Speed Link.";
+ }
+ identity fcipLink {
+ base iana-interface-type;
+ description
+ "FCIP Link.";
+ }
+ identity rpr {
+ base iana-interface-type;
+ description
+ "Resilient Packet Ring Interface Type.";
+ }
+ identity qam {
+ base iana-interface-type;
+ description
+ "RF Qam Interface.";
+ }
+ identity lmp {
+ base iana-interface-type;
+ description
+ "Link Management Protocol.";
+ reference
+ "RFC 4327 - Link Management Protocol (LMP) Management
+ Information Base (MIB)";
+ }
+ identity cblVectaStar {
+ base iana-interface-type;
+ description
+ "Cambridge Broadband Networks Limited VectaStar.";
+ }
+ identity docsCableMCmtsDownstream {
+ base iana-interface-type;
+ description
+ "CATV Modular CMTS Downstream Interface.";
+ }
+ identity adsl2 {
+ base iana-interface-type;
+ status deprecated;
+ description
+ "Asymmetric Digital Subscriber Loop Version 2
+ (DEPRECATED/OBSOLETED - please use adsl2plus(238)
+ instead).";
+ reference
+ "RFC 4706 - Definitions of Managed Objects for Asymmetric
+ Digital Subscriber Line 2 (ADSL2)";
+ }
+ identity macSecControlledIF {
+ base iana-interface-type;
+ description
+ "MACSecControlled.";
+ }
+ identity macSecUncontrolledIF {
+ base iana-interface-type;
+ description
+ "MACSecUncontrolled.";
+ }
+ identity aviciOpticalEther {
+ base iana-interface-type;
+ description
+ "Avici Optical Ethernet Aggregate.";
+ }
+ identity atmbond {
+ base iana-interface-type;
+ description
+ "atmbond.";
+ }
+ identity voiceFGDOS {
+ base iana-interface-type;
+ description
+ "Voice FGD Operator Services.";
+ }
+ identity mocaVersion1 {
+ base iana-interface-type;
+ description
+ "MultiMedia over Coax Alliance (MoCA) Interface
+ as documented in information provided privately to IANA.";
+ }
+ identity ieee80216WMAN {
+ base iana-interface-type;
+ description
+ "IEEE 802.16 WMAN interface.";
+ }
+ identity adsl2plus {
+ base iana-interface-type;
+ description
+ "Asymmetric Digital Subscriber Loop Version 2 -
+ Version 2 Plus and all variants.";
+ }
+ identity dvbRcsMacLayer {
+ base iana-interface-type;
+ description
+ "DVB-RCS MAC Layer.";
+ reference
+ "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+ }
+ identity dvbTdm {
+ base iana-interface-type;
+ description
+ "DVB Satellite TDM.";
+ reference
+ "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+ }
+ identity dvbRcsTdma {
+ base iana-interface-type;
+ description
+ "DVB-RCS TDMA.";
+ reference
+ "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+ }
+ identity x86Laps {
+ base iana-interface-type;
+ description
+ "LAPS based on ITU-T X.86/Y.1323.";
+ }
+ identity wwanPP {
+ base iana-interface-type;
+ description
+ "3GPP WWAN.";
+ }
+ identity wwanPP2 {
+ base iana-interface-type;
+ description
+ "3GPP2 WWAN.";
+ }
+ identity voiceEBS {
+ base iana-interface-type;
+ description
+ "Voice P-phone EBS physical interface.";
+ }
+ identity ifPwType {
+ base iana-interface-type;
+ description
+ "Pseudowire interface type.";
+ reference
+ "RFC 5601 - Pseudowire (PW) Management Information Base (MIB)";
+ }
+ identity ilan {
+ base iana-interface-type;
+ description
+ "Internal LAN on a bridge per IEEE 802.1ap.";
+ }
+ identity pip {
+ base iana-interface-type;
+ description
+ "Provider Instance Port on a bridge per IEEE 802.1ah PBB.";
+ }
+ identity aluELP {
+ base iana-interface-type;
+ description
+ "Alcatel-Lucent Ethernet Link Protection.";
+ }
+ identity gpon {
+ base iana-interface-type;
+ description
+ "Gigabit-capable passive optical networks (G-PON) as per
+ ITU-T G.948.";
+ }
+ identity vdsl2 {
+ base iana-interface-type;
+ description
+ "Very high speed digital subscriber line Version 2
+ (as per ITU-T Recommendation G.993.2).";
+ reference
+ "RFC 5650 - Definitions of Managed Objects for Very High
+ Speed Digital Subscriber Line 2 (VDSL2)";
+ }
+ identity capwapDot11Profile {
+ base iana-interface-type;
+ description
+ "WLAN Profile Interface.";
+ reference
+ "RFC 5834 - Control and Provisioning of Wireless Access
+ Points (CAPWAP) Protocol Binding MIB for
+ IEEE 802.11";
+ }
+ identity capwapDot11Bss {
+ base iana-interface-type;
+ description
+ "WLAN BSS Interface.";
+ reference
+ "RFC 5834 - Control and Provisioning of Wireless Access
+ Points (CAPWAP) Protocol Binding MIB for
+ IEEE 802.11";
+ }
+ identity capwapWtpVirtualRadio {
+ base iana-interface-type;
+ description
+ "WTP Virtual Radio Interface.";
+ reference
+ "RFC 5833 - Control and Provisioning of Wireless Access
+ Points (CAPWAP) Protocol Base MIB";
+ }
+ identity bits {
+ base iana-interface-type;
+ description
+ "bitsport.";
+ }
+ identity docsCableUpstreamRfPort {
+ base iana-interface-type;
+ description
+ "DOCSIS CATV Upstream RF Port.";
+ }
+ identity cableDownstreamRfPort {
+ base iana-interface-type;
+ description
+ "CATV downstream RF Port.";
+ }
+ identity vmwareVirtualNic {
+ base iana-interface-type;
+ description
+ "VMware Virtual Network Interface.";
+ }
+ identity ieee802154 {
+ base iana-interface-type;
+ description
+ "IEEE 802.15.4 WPAN interface.";
+ reference
+ "IEEE 802.15.4-2006";
+ }
+ identity otnOdu {
+ base iana-interface-type;
+ description
+ "OTN Optical Data Unit.";
+ }
+ identity otnOtu {
+ base iana-interface-type;
+ description
+ "OTN Optical channel Transport Unit.";
+ }
+ identity ifVfiType {
+ base iana-interface-type;
+ description
+ "VPLS Forwarding Instance Interface Type.";
+ }
+ identity g9981 {
+ base iana-interface-type;
+ description
+ "G.998.1 bonded interface.";
+ }
+ identity g9982 {
+ base iana-interface-type;
+ description
+ "G.998.2 bonded interface.";
+ }
+ identity g9983 {
+ base iana-interface-type;
+ description
+ "G.998.3 bonded interface.";
+ }
+
+ identity aluEpon {
+ base iana-interface-type;
+ description
+ "Ethernet Passive Optical Networks (E-PON).";
+ }
+ identity aluEponOnu {
+ base iana-interface-type;
+ description
+ "EPON Optical Network Unit.";
+ }
+ identity aluEponPhysicalUni {
+ base iana-interface-type;
+ description
+ "EPON physical User to Network interface.";
+ }
+ identity aluEponLogicalLink {
+ base iana-interface-type;
+ description
+ "The emulation of a point-to-point link over the EPON
+ layer.";
+ }
+ identity aluGponOnu {
+ base iana-interface-type;
+ description
+ "GPON Optical Network Unit.";
+ reference
+ "ITU-T G.984.2";
+ }
+ identity aluGponPhysicalUni {
+ base iana-interface-type;
+ description
+ "GPON physical User to Network interface.";
+ reference
+ "ITU-T G.984.2";
+ }
+ identity vmwareNicTeam {
+ base iana-interface-type;
+ description
+ "VMware NIC Team.";
+ }
+ identity docsOfdmDownstream {
+ base iana-interface-type;
+ description
+ "CATV Downstream OFDM interface.";
+ }
+ identity docsOfdmaUpstream {
+ base iana-interface-type;
+ description
+ "CATV Upstream OFDMA interface.";
+ }
+ identity gfast {
+ base iana-interface-type;
+ description
+ "G.fast port.";
+ reference
+ "ITU-T G.9701";
+ }
+ identity sdci {
+ base iana-interface-type;
+ description
+ "SDCI (IO-Link).";
+ reference
+ "IEC 61131-9 Edition 1.0 2013-09";
+ }
+ identity xboxWireless {
+ base iana-interface-type;
+ description
+ "Xbox wireless.";
+ }
+ identity fastdsl {
+ base iana-interface-type;
+ description
+ "FastDSL.";
+ reference
+ "BBF TR-355";
+ }
+ identity docsCableScte55d1FwdOob {
+ base iana-interface-type;
+ description
+ "Cable SCTE 55-1 OOB Forward Channel.";
+ }
+ identity docsCableScte55d1RetOob {
+ base iana-interface-type;
+ description
+ "Cable SCTE 55-1 OOB Return Channel.";
+ }
+ identity docsCableScte55d2DsOob {
+ base iana-interface-type;
+ description
+ "Cable SCTE 55-2 OOB Downstream Channel.";
+ }
+ identity docsCableScte55d2UsOob {
+ base iana-interface-type;
+ description
+ "Cable SCTE 55-2 OOB Upstream Channel.";
+ }
+ identity docsCableNdf {
+ base iana-interface-type;
+ description
+ "Cable Narrowband Digital Forward.";
+ }
+ identity docsCableNdr {
+ base iana-interface-type;
+ description
+ "Cable Narrowband Digital Return.";
+ }
+ identity ptm {
+ base iana-interface-type;
+ description
+ "Packet Transfer Mode.";
+ }
+}
diff --git a/src/plugins/yang/ietf/ietf-interfaces@2014-05-08.yang b/src/plugins/yang/ietf/ietf-interfaces@2014-05-08.yang
deleted file mode 100644
index a0eb30e..0000000
--- a/src/plugins/yang/ietf/ietf-interfaces@2014-05-08.yang
+++ /dev/null
@@ -1,707 +0,0 @@
-module ietf-interfaces {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-interfaces";
-
- prefix if;
-
- import ietf-yang-types {
- prefix yang;
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: Thomas Nadeau
- <mailto:tnadeau@lucidvision.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Martin Bjorklund
- <mailto:mbj@tail-f.com>";
-
- description
- "This module contains a collection of YANG definitions for
- managing network interfaces.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 7223; see
- the RFC itself for full legal notices.";
-
- revision "2014-05-08" {
- description "Initial revision.";
- reference
- "RFC 7223: A YANG Data Model for Interface Management";
-
- }
-
-
- typedef interface-ref {
- type leafref {
- path "/if:interfaces/if:interface/if:name";
- }
- description
- "This type is used by data models that need to reference
- configured interfaces.";
- }
-
- typedef interface-state-ref {
- type leafref {
- path "/if:interfaces-state/if:interface/if:name";
- }
- description
- "This type is used by data models that need to reference
- the operationally present interfaces.";
- }
-
- identity interface-type {
- description
- "Base identity from which specific interface types are
- derived.";
- }
-
- feature arbitrary-names {
- description
- "This feature indicates that the device allows user-controlled
- interfaces to be named arbitrarily.";
- }
-
- feature pre-provisioning {
- description
- "This feature indicates that the device supports
- pre-provisioning of interface configuration, i.e., it is
- possible to configure an interface whose physical interface
- hardware is not present on the device.";
- }
-
- feature if-mib {
- description
- "This feature indicates that the device implements
- the IF-MIB.";
- reference
- "RFC 2863: The Interfaces Group MIB";
-
- }
-
- container interfaces {
- description
- "Interface configuration parameters.";
- list interface {
- key "name";
- description
- "The list of configured interfaces on the device.
-
- The operational state of an interface is available in the
- /interfaces-state/interface list. If the configuration of a
- system-controlled interface cannot be used by the system
- (e.g., the interface hardware present does not match the
- interface type), then the configuration is not applied to
- the system-controlled interface shown in the
- /interfaces-state/interface list. If the configuration
- of a user-controlled interface cannot be used by the system,
- the configured interface is not instantiated in the
- /interfaces-state/interface list.";
- leaf name {
- type string;
- description
- "The name of the interface.
-
- A device MAY restrict the allowed values for this leaf,
- possibly depending on the type of the interface.
- For system-controlled interfaces, this leaf is the
- device-specific name of the interface. The 'config false'
- list /interfaces-state/interface contains the currently
- existing interfaces on the device.
-
- If a client tries to create configuration for a
- system-controlled interface that is not present in the
- /interfaces-state/interface list, the server MAY reject
- the request if the implementation does not support
- pre-provisioning of interfaces or if the name refers to
- an interface that can never exist in the system. A
- NETCONF server MUST reply with an rpc-error with the
- error-tag 'invalid-value' in this case.
-
- If the device supports pre-provisioning of interface
- configuration, the 'pre-provisioning' feature is
- advertised.
-
- If the device allows arbitrarily named user-controlled
- interfaces, the 'arbitrary-names' feature is advertised.
-
- When a configured user-controlled interface is created by
- the system, it is instantiated with the same name in the
- /interface-state/interface list.";
- }
-
- leaf description {
- type string;
- description
- "A textual description of the interface.
-
- A server implementation MAY map this leaf to the ifAlias
- MIB object. Such an implementation needs to use some
- mechanism to handle the differences in size and characters
- allowed between this leaf and ifAlias. The definition of
- such a mechanism is outside the scope of this document.
-
- Since ifAlias is defined to be stored in non-volatile
- storage, the MIB implementation MUST map ifAlias to the
- value of 'description' in the persistently stored
- datastore.
-
- Specifically, if the device supports ':startup', when
- ifAlias is read the device MUST return the value of
- 'description' in the 'startup' datastore, and when it is
- written, it MUST be written to the 'running' and 'startup'
- datastores. Note that it is up to the implementation to
-
- decide whether to modify this single leaf in 'startup' or
- perform an implicit copy-config from 'running' to
- 'startup'.
-
- If the device does not support ':startup', ifAlias MUST
- be mapped to the 'description' leaf in the 'running'
- datastore.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifAlias";
-
- }
-
- leaf type {
- type identityref {
- base interface-type;
- }
- mandatory true;
- description
- "The type of the interface.
-
- When an interface entry is created, a server MAY
- initialize the type leaf with a valid value, e.g., if it
- is possible to derive the type from the name of the
- interface.
-
- If a client tries to set the type of an interface to a
- value that can never be used by the system, e.g., if the
- type is not supported or if the type does not match the
- name of the interface, the server MUST reject the request.
- A NETCONF server MUST reply with an rpc-error with the
- error-tag 'invalid-value' in this case.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifType";
-
- }
-
- leaf enabled {
- type boolean;
- default "true";
- description
- "This leaf contains the configured, desired state of the
- interface.
-
- Systems that implement the IF-MIB use the value of this
- leaf in the 'running' datastore to set
- IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
- has been initialized, as described in RFC 2863.
-
-
-
- Changes in this leaf in the 'running' datastore are
- reflected in ifAdminStatus, but if ifAdminStatus is
- changed over SNMP, this leaf is not affected.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
-
- }
-
- leaf link-up-down-trap-enable {
- if-feature if-mib;
- type enumeration {
- enum "enabled" {
- value 1;
- }
- enum "disabled" {
- value 2;
- }
- }
- description
- "Controls whether linkUp/linkDown SNMP notifications
- should be generated for this interface.
-
- If this node is not configured, the value 'enabled' is
- operationally used by the server for interfaces that do
- not operate on top of any other interface (i.e., there are
- no 'lower-layer-if' entries), and 'disabled' otherwise.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifLinkUpDownTrapEnable";
-
- }
- } // list interface
- } // container interfaces
-
- container interfaces-state {
- config false;
- description
- "Data nodes for the operational state of interfaces.";
- list interface {
- key "name";
- description
- "The list of interfaces on the device.
-
- System-controlled interfaces created by the system are
- always present in this list, whether they are configured or
- not.";
- leaf name {
- type string;
- description
- "The name of the interface.
-
- A server implementation MAY map this leaf to the ifName
- MIB object. Such an implementation needs to use some
- mechanism to handle the differences in size and characters
- allowed between this leaf and ifName. The definition of
- such a mechanism is outside the scope of this document.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifName";
-
- }
-
- leaf type {
- type identityref {
- base interface-type;
- }
- mandatory true;
- description
- "The type of the interface.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifType";
-
- }
-
- leaf admin-status {
- if-feature if-mib;
- type enumeration {
- enum "up" {
- value 1;
- description
- "Ready to pass packets.";
- }
- enum "down" {
- value 2;
- description
- "Not ready to pass packets and not in some test mode.";
- }
- enum "testing" {
- value 3;
- description
- "In some test mode.";
- }
- }
- mandatory true;
- description
- "The desired state of the interface.
-
- This leaf has the same read semantics as ifAdminStatus.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
-
- }
-
- leaf oper-status {
- type enumeration {
- enum "up" {
- value 1;
- description
- "Ready to pass packets.";
- }
- enum "down" {
- value 2;
- description
- "The interface does not pass any packets.";
- }
- enum "testing" {
- value 3;
- description
- "In some test mode. No operational packets can
- be passed.";
- }
- enum "unknown" {
- value 4;
- description
- "Status cannot be determined for some reason.";
- }
- enum "dormant" {
- value 5;
- description
- "Waiting for some external event.";
- }
- enum "not-present" {
- value 6;
- description
- "Some component (typically hardware) is missing.";
- }
- enum "lower-layer-down" {
- value 7;
- description
- "Down due to state of lower-layer interface(s).";
- }
- }
- mandatory true;
- description
- "The current operational state of the interface.
-
- This leaf has the same semantics as ifOperStatus.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifOperStatus";
-
- }
-
- leaf last-change {
- type yang:date-and-time;
- description
- "The time the interface entered its current operational
- state. If the current state was entered prior to the
- last re-initialization of the local network management
- subsystem, then this node is not present.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifLastChange";
-
- }
-
- leaf if-index {
- if-feature if-mib;
- type int32 {
- range "1..2147483647";
- }
- mandatory true;
- description
- "The ifIndex value for the ifEntry represented by this
- interface.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifIndex";
-
- }
-
- leaf phys-address {
- type yang:phys-address;
- description
- "The interface's address at its protocol sub-layer. For
- example, for an 802.x interface, this object normally
- contains a Media Access Control (MAC) address. The
- interface's media-specific modules must define the bit
-
-
- and byte ordering and the format of the value of this
- object. For interfaces that do not have such an address
- (e.g., a serial line), this node is not present.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifPhysAddress";
-
- }
-
- leaf-list higher-layer-if {
- type interface-state-ref;
- description
- "A list of references to interfaces layered on top of this
- interface.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifStackTable";
-
- }
-
- leaf-list lower-layer-if {
- type interface-state-ref;
- description
- "A list of references to interfaces layered underneath this
- interface.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifStackTable";
-
- }
-
- leaf speed {
- type yang:gauge64;
- units "bits/second";
- description
- "An estimate of the interface's current bandwidth in bits
- per second. For interfaces that do not vary in
- bandwidth or for those where no accurate estimation can
- be made, this node should contain the nominal bandwidth.
- For interfaces that have no concept of bandwidth, this
- node is not present.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifSpeed, ifHighSpeed";
-
- }
-
- container statistics {
- description
- "A collection of interface-related statistics objects.";
- leaf discontinuity-time {
- type yang:date-and-time;
- mandatory true;
- description
- "The time on the most recent occasion at which any one or
- more of this interface's counters suffered a
- discontinuity. If no such discontinuities have occurred
- since the last re-initialization of the local management
- subsystem, then this node contains the time the local
- management subsystem re-initialized itself.";
- }
-
- leaf in-octets {
- type yang:counter64;
- description
- "The total number of octets received on the interface,
- including framing characters.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
-
- }
-
- leaf in-unicast-pkts {
- type yang:counter64;
- description
- "The number of packets, delivered by this sub-layer to a
- higher (sub-)layer, that were not addressed to a
- multicast or broadcast address at this sub-layer.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
-
- }
-
- leaf in-broadcast-pkts {
- type yang:counter64;
- description
- "The number of packets, delivered by this sub-layer to a
- higher (sub-)layer, that were addressed to a broadcast
- address at this sub-layer.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifHCInBroadcastPkts";
-
- }
-
- leaf in-multicast-pkts {
- type yang:counter64;
- description
- "The number of packets, delivered by this sub-layer to a
- higher (sub-)layer, that were addressed to a multicast
- address at this sub-layer. For a MAC-layer protocol,
- this includes both Group and Functional addresses.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifHCInMulticastPkts";
-
- }
-
- leaf in-discards {
- type yang:counter32;
- description
- "The number of inbound packets that were chosen to be
- discarded even though no errors had been detected to
- prevent their being deliverable to a higher-layer
- protocol. One possible reason for discarding such a
- packet could be to free up buffer space.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifInDiscards";
-
- }
-
- leaf in-errors {
- type yang:counter32;
- description
- "For packet-oriented interfaces, the number of inbound
- packets that contained errors preventing them from being
- deliverable to a higher-layer protocol. For character-
- oriented or fixed-length interfaces, the number of
- inbound transmission units that contained errors
- preventing them from being deliverable to a higher-layer
- protocol.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifInErrors";
-
- }
-
- leaf in-unknown-protos {
- type yang:counter32;
- description
- "For packet-oriented interfaces, the number of packets
- received via the interface that were discarded because
- of an unknown or unsupported protocol. For
- character-oriented or fixed-length interfaces that
- support protocol multiplexing, the number of
- transmission units received via the interface that were
- discarded because of an unknown or unsupported protocol.
- For any interface that does not support protocol
- multiplexing, this counter is not present.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
-
- }
-
- leaf out-octets {
- type yang:counter64;
- description
- "The total number of octets transmitted out of the
- interface, including framing characters.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
-
- }
-
- leaf out-unicast-pkts {
- type yang:counter64;
- description
- "The total number of packets that higher-level protocols
- requested be transmitted, and that were not addressed
- to a multicast or broadcast address at this sub-layer,
- including those that were discarded or not sent.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
-
- }
-
- leaf out-broadcast-pkts {
- type yang:counter64;
- description
- "The total number of packets that higher-level protocols
- requested be transmitted, and that were addressed to a
- broadcast address at this sub-layer, including those
- that were discarded or not sent.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifHCOutBroadcastPkts";
-
- }
-
- leaf out-multicast-pkts {
- type yang:counter64;
- description
- "The total number of packets that higher-level protocols
- requested be transmitted, and that were addressed to a
- multicast address at this sub-layer, including those
- that were discarded or not sent. For a MAC-layer
- protocol, this includes both Group and Functional
- addresses.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB -
- ifHCOutMulticastPkts";
-
- }
-
- leaf out-discards {
- type yang:counter32;
- description
- "The number of outbound packets that were chosen to be
- discarded even though no errors had been detected to
- prevent their being transmitted. One possible reason
- for discarding such a packet could be to free up buffer
- space.
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifOutDiscards";
-
- }
-
- leaf out-errors {
- type yang:counter32;
- description
- "For packet-oriented interfaces, the number of outbound
- packets that could not be transmitted because of errors.
- For character-oriented or fixed-length interfaces, the
- number of outbound transmission units that could not be
- transmitted because of errors.
-
-
-
-
- Discontinuities in the value of this counter can occur
- at re-initialization of the management system, and at
- other times as indicated by the value of
- 'discontinuity-time'.";
- reference
- "RFC 2863: The Interfaces Group MIB - ifOutErrors";
-
- }
- } // container statistics
- } // list interface
- } // container interfaces-state
- } // module ietf-interfaces
diff --git a/src/plugins/yang/ietf/ietf-interfaces.yang b/src/plugins/yang/ietf/ietf-interfaces@2018-02-20.yang
index f66c205..f66c205 100644
--- a/src/plugins/yang/ietf/ietf-interfaces.yang
+++ b/src/plugins/yang/ietf/ietf-interfaces@2018-02-20.yang
diff --git a/src/plugins/yang/openconfig/openconfig-extensions.yang b/src/plugins/yang/openconfig/openconfig-extensions@2017-04-11.yang
index f39ecf6..f39ecf6 100644
--- a/src/plugins/yang/openconfig/openconfig-extensions.yang
+++ b/src/plugins/yang/openconfig/openconfig-extensions@2017-04-11.yang
diff --git a/src/plugins/yang/openconfig/openconfig-if-aggregate.yang b/src/plugins/yang/openconfig/openconfig-if-aggregate@2018-03-23.yang
index 5aa80bb..5aa80bb 100644
--- a/src/plugins/yang/openconfig/openconfig-if-aggregate.yang
+++ b/src/plugins/yang/openconfig/openconfig-if-aggregate@2018-03-23.yang
diff --git a/src/plugins/yang/openconfig/openconfig-if-ethernet.yang b/src/plugins/yang/openconfig/openconfig-if-ethernet@2018-09-04.yang
index cd6b526..cd6b526 100644
--- a/src/plugins/yang/openconfig/openconfig-if-ethernet.yang
+++ b/src/plugins/yang/openconfig/openconfig-if-ethernet@2018-09-04.yang
diff --git a/src/plugins/yang/openconfig/openconfig-if-ip.yang b/src/plugins/yang/openconfig/openconfig-if-ip@2018-01-05.yang
index a20e21c..a20e21c 100644
--- a/src/plugins/yang/openconfig/openconfig-if-ip.yang
+++ b/src/plugins/yang/openconfig/openconfig-if-ip@2018-01-05.yang
diff --git a/src/plugins/yang/openconfig/openconfig-if-types.yang b/src/plugins/yang/openconfig/openconfig-if-types@2018-01-05.yang
index 3743878..3743878 100644
--- a/src/plugins/yang/openconfig/openconfig-if-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-if-types@2018-01-05.yang
diff --git a/src/plugins/yang/openconfig/openconfig-inet-types.yang b/src/plugins/yang/openconfig/openconfig-inet-types@2017-08-24.yang
index fbb872f..fbb872f 100644
--- a/src/plugins/yang/openconfig/openconfig-inet-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-inet-types@2017-08-24.yang
diff --git a/src/plugins/yang/openconfig/openconfig-interfaces.yang b/src/plugins/yang/openconfig/openconfig-interfaces@2018-08-07.yang
index d11e0b2..d11e0b2 100644
--- a/src/plugins/yang/openconfig/openconfig-interfaces.yang
+++ b/src/plugins/yang/openconfig/openconfig-interfaces@2018-08-07.yang
diff --git a/src/plugins/yang/openconfig/openconfig-local-routing.yang b/src/plugins/yang/openconfig/openconfig-local-routing@2017-05-15.yang
index 5184fe7..5184fe7 100644
--- a/src/plugins/yang/openconfig/openconfig-local-routing.yang
+++ b/src/plugins/yang/openconfig/openconfig-local-routing@2017-05-15.yang
diff --git a/src/plugins/yang/openconfig/openconfig-policy-types.yang b/src/plugins/yang/openconfig/openconfig-policy-types@2018-06-05.yang
index ef47f33..ef47f33 100644
--- a/src/plugins/yang/openconfig/openconfig-policy-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-policy-types@2018-06-05.yang
diff --git a/src/plugins/yang/openconfig/openconfig-types.yang b/src/plugins/yang/openconfig/openconfig-types@2018-05-05.yang
index 01713b3..01713b3 100644
--- a/src/plugins/yang/openconfig/openconfig-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-types@2018-05-05.yang
diff --git a/src/plugins/yang/openconfig/openconfig-vlan-types.yang b/src/plugins/yang/openconfig/openconfig-vlan-types@2018-02-14.yang
index 6d9ab55..6d9ab55 100644
--- a/src/plugins/yang/openconfig/openconfig-vlan-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-vlan-types@2018-02-14.yang
diff --git a/src/plugins/yang/openconfig/openconfig-vlan.yang b/src/plugins/yang/openconfig/openconfig-vlan@2018-06-05.yang
index 97348c0..97348c0 100644
--- a/src/plugins/yang/openconfig/openconfig-vlan.yang
+++ b/src/plugins/yang/openconfig/openconfig-vlan@2018-06-05.yang
diff --git a/src/plugins/yang/openconfig/openconfig-yang-types.yang b/src/plugins/yang/openconfig/openconfig-yang-types@2018-04-24.yang
index b3b2c16..b3b2c16 100644
--- a/src/plugins/yang/openconfig/openconfig-yang-types.yang
+++ b/src/plugins/yang/openconfig/openconfig-yang-types@2018-04-24.yang