aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorMasoud Hemmatpour <mhemmatp@cisco.com>2019-04-04 13:34:04 +0200
committerMauro Sardara <msardara@cisco.com>2019-05-03 08:54:29 +0000
commite9a02cb3a565daab16e295c551dff80501f94974 (patch)
tree891701aac1b440c4e74c31f485dad667bfab3924 /utils
parent305e7617be61d21ebd0dee043588c469bc28ad3b (diff)
[HICN-153] vapi definition warning
Change-Id: I50f381540e171fe2808d4e56cc24ba6d66e8a2ab Signed-off-by: Masoud Hemmatpour <mhemmatp@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/sysrepo-plugins/README.md11
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c1
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c2
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h3
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c175
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h2
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/yang/controler_rpcs_instances.xml73
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/yang/model/hicn.yang546
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c6
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h19
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h2
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c2120
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h157
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c6
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h6
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/yang/startup.xml11
-rw-r--r--utils/sysrepo-plugins/yang/hicn/hicn.yang (renamed from utils/sysrepo-plugins/hicn-plugin/plugin/yang/model/hicn.yang)101
-rw-r--r--utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml (renamed from utils/sysrepo-plugins/hicn-plugin/plugin/yang/controler_rpcs_instances.xml)4
-rw-r--r--utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml (renamed from utils/sysrepo-plugins/hicn-light/plugin/yang/startup.xml)0
-rw-r--r--utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang1704
-rw-r--r--utils/sysrepo-plugins/yang/ietf/ietf-interfaces.yang1123
-rw-r--r--utils/sysrepo-plugins/yang/ietf/ietf-ip@2014-06-16.yang742
-rw-r--r--utils/sysrepo-plugins/yang/ietf/ietf-yang-types@2013-07-15.yang474
23 files changed, 5560 insertions, 1728 deletions
diff --git a/utils/sysrepo-plugins/README.md b/utils/sysrepo-plugins/README.md
index ca40dcb5f..3f0ed2e34 100644
--- a/utils/sysrepo-plugins/README.md
+++ b/utils/sysrepo-plugins/README.md
@@ -1,6 +1,6 @@
# Sysrepo plugin for hicn-plugin (2019)
-These plugins serve as a data management agent. they provide yang models via NETCONF to allow the management of hicn-light and hicn-plugin which runs in VPP instance from out-of-box.
+These plugins serve as a data management agent. They provide yang models via NETCONF to allow the management of hicn-light, and hicn-plugin which runs in VPP instance from out-of-box.
## Software Requirement
@@ -25,8 +25,7 @@ else
sysrepoctl --install --yang=path_to_hicn_yang_model
fi
-hicn.yang can be found under plugin/yang/model/. It consists of two container nodes: hicn-conf and hicn-state. One is used to hold the
-configuration data (i.e., hicn-conf) and one for providing the state data (i.e., hicn-state). The hicn-conf has one node, params, which contains the hICN configuration parameters. Controler can configure these parameters through the edit-config RPC call. This node can be used to enable and to initialize the hicn-plugin in VPP instance. Hicn-state container is used to provide the state data to the controler. It consists of state, strategy, strategies, route, and face-ip-params nodes with the coresponding leaves. In hicn model variety of RPCs are provided to allow controler to communicate with hicn-plugin as well as update the state data in hicn-state. Here you can find the schematic view of the described hicn model:
+hicn.yang can be found in the yang-model. It consists of two container nodes: hicn-conf and hicn-state. One is used to hold the configuration data (i.e., hicn-conf) and one for providing the state data (i.e., hicn-state). The hicn-conf has one node, params, which contains the hICN configuration parameters. Controler can configure these parameters through the edit-config RPC call. This node can be used to enable and to initialize the hicn-plugin in VPP instance. Hicn-state container is used to provide the state data to the controler. It consists of state, strategy, strategies, route, and face-ip-params nodes with the coresponding leaves. In hicn model variety of RPCs are provided to allow controler to communicate with hicn-plugin as well as update the state data in hicn-state. Here you can find the schematic view of the described hicn model:
module: hicn
@@ -82,7 +81,7 @@ sysrepocfg -d startup -i path_to_startup_xml -f xml hicn
fi
-startup.xml is placed under plugin/yang/. Here you can find the content:
+startup.xml is placed in the yang-model. Here you can find the content:
<hicn-conf xmlns="urn:sysrepo:hicn">
<params>
@@ -168,7 +167,7 @@ As can be seen, it contains the leaves of the params in hicn-conf node which is
+---w swif? uint32
-In order to run different RPCs from controler you can use the examples in the controler_rpcs_instances.xml under plugin/yang/. Here you can find the content:
+In order to run different RPCs from controler you can use the examples in the controler_rpcs_instances.xml in the yang-model. Here you can find the content:
<node-params-get xmlns="urn:sysrepo:hicn"/>
@@ -327,4 +326,4 @@ At this point, we are able to connect to the remote device.
## Release note
-The current version is compatible with the 19.01 VPP stable and sysrepo 0.7.7. \ No newline at end of file
+The current version is compatible with the 19.01 VPP stable and sysrepo 0.7.7.
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
index e5b1bf56d..ae436a8ad 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
@@ -48,7 +48,6 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx) {
void sr_plugin_cleanup_cb(sr_session_ctx_t *session, void *private_ctx) {
HICN_INVOKE_BEGIN;
-
/* subscription was set as our private context */
sr_unsubscribe(session, private_ctx);
HICN_LOG_DBG_MSG("hicn light unload plugin ok.");
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
index a1b4d7ad2..6c4f938ce 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
@@ -17,12 +17,14 @@
hc_sock_t * hsocket;
int hicn_connect_light() {
+
hsocket = hc_sock_create();
if (!hsocket)
HICN_LOG_ERR_MSG("Error creating socket\n");
if (hc_sock_connect(hsocket) < 0)
HICN_LOG_ERR_MSG("Error connecting to the forwarder\n");
return 0;
+
}
int hicn_disconnect_light() {
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
index d424ebf3a..adb7737aa 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
@@ -72,6 +72,9 @@
ARG_CHECK(retval, arg4); \
ARG_CHECK(retval, arg5)
+
+#define MEM_ALIGN 4096
+
int hicn_connect_light();
int hicn_disconnect_light();
extern hc_sock_t * hsocket;
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
index 0c34325d6..7cfb8363a 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
@@ -21,13 +21,186 @@
#include "hicn_model.h"
#include "tlock.h"
#include "../hicn_light.h"
+#include "../hicn_light_comm.h"
+
+
+
+/**
+ * @brief API to add hicn face ip in hicn-light.
+ */
+static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input,
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
+
+ SRP_LOG_DBG_MSG("hicn face ip add received successfully");
+
+ hc_face_t face;
+
+ if(strcmp(input[0].data.string_val,"-1")){
+
+ struct sockaddr_in sa;
+ // store this IP address in sa:
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ face.face.hicn.family=AF_INET;
+ face.face.hicn.local_addr.v4.as_inaddr=sa.sin_addr;
+
+
+ }else if(strcmp(input[1].data.string_val,"-1")){
+
+ struct in6_addr *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ face.face.hicn.family=AF_INET6;
+ face.face.hicn.local_addr.v6.as_in6addr = *dst;
+
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
+
+ if(strcmp(input[2].data.string_val,"-1")){
+
+ struct sockaddr_in sa;
+ // store this IP address in sa:
+ inet_pton(AF_INET, input[2].data.string_val, &(sa.sin_addr));
+ face.face.hicn.family=AF_INET;
+ face.face.hicn.remote_addr.v4.as_inaddr=sa.sin_addr;
+
+
+ }else if(strcmp(input[3].data.string_val,"-1")){
+
+ struct in6_addr *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[3].data.string_val, dst);
+ face.face.hicn.family=AF_INET6;
+ face.face.hicn.remote_addr.v6.as_in6addr = *dst;
+
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
+
+
+ // strncpy(face.face.hicn.netdevice.name,"ens39"); // Can we work only with Idx number ?
+ face.face.hicn.netdevice.index = input[4].data.uint32_val; // This is the idx number of interface
+
+
+ face.id=0;//can be empty
+ face.face.tags=0;//can be empty
+ strcpy(face.name,"hicn_face");
+ face.face.type=1;
+
+ int rc;
+ rc = hc_face_create(hsocket, &face);
+ if (rc > 0) {
+ SRP_LOG_DBG_MSG("Face added successfully");
+ return SR_ERR_OK;
+ }
+
+ SRP_LOG_DBG_MSG("Operation Failed");
+ return SR_ERR_OPERATION_FAILED;
+}
+
+/**
+ * @brief API to del hicn face ip in vpp.
+ */
+static int hicn_face_ip_del_cb(const char *xpath, const sr_val_t *input,
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
+
+ SRP_LOG_DBG_MSG("hicn face ip del received successfully");
+ face_t * face=NULL;
+
+ // msg->payload.faceid = input[0].data.uint16_val;
+ //lookup(face);
+ face_free(face);
+
+ // if(!resp->payload.retval){
+ // SRP_LOG_DBG_MSG("Successfully Done");
+ // return SR_ERR_OK;
+ // }
+
+ SRP_LOG_DBG_MSG("Operation Failed");
+ return SR_ERR_OPERATION_FAILED;
+
+}
+
+
+/**
+ * @brief API to del hicn face ip in vpp.
+ */
+static int hicn_route_add_cb(const char *xpath, const sr_val_t *input,
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
+
+/*
+
+ SRP_LOG_DBG_MSG("hicn route add received successfully");
+
+ hc_route_t * route;
+
+ if(strcmp(input[0].data.string_val,"-1")){
+
+ struct sockaddr_in sa;
+ // store this IP address in sa:
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ route.family=AF_INET;
+ route.face.hicn.local_addr.v4.as_inaddr=sa.sin_addr;
+
+
+ }else if(strcmp(input[1].data.string_val,"-1")){
+
+ struct in6_addr *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ face.face.hicn.family=AF_INET6;
+ face.face.hicn.local_addr.v6.as_in6addr = *dst;
+
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
+
+
+hc_route_create(hsocket, route);
+*/
+ return SR_ERR_OK;
+}
int hicn_subscribe_events(sr_session_ctx_t *session,
sr_subscription_ctx_t **subscription) {
- SRP_LOG_INF_MSG("hicn light plugin initialized successfully.");
+
+ int rc;
+ rc = sr_rpc_subscribe(session, "/hicn:face-ip-add", hicn_face_ip_add_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription stat-get\n");
+ goto error;
+ }
+
+
+ rc = sr_rpc_subscribe(session, "/hicn:face-ip-del", hicn_face_ip_del_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription face-ip-del\n");
+ goto error;
+ }
+
+
+ rc = sr_rpc_subscribe(session, "/hicn:route-nhops-add",
+ hicn_route_add_cb, session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc!= SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription route-nhops-add\n");
+ goto error;
+ }
+
+
+ SRP_LOG_INF_MSG("hicn light initialized successfully.");
return SR_ERR_OK;
+error:
+ SRP_LOG_ERR_MSG("Error by initialization of the hicn plugin.");
+ sr_plugin_cleanup_cb(session, hsocket);
+ return rc;
+
} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h
index 59befe68c..e6e857bff 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h
@@ -36,8 +36,6 @@ enum locks_name {lstate, lstrategy, lstrategies, lroute, lface_ip_params};
#define NROUTE_LEAVES 2
#define NFACE_IP_PARAMS_LEAVES 3
-
-
int hicn_subscribe_events(sr_session_ctx_t *session,
sr_subscription_ctx_t **subscription);
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/yang/controler_rpcs_instances.xml b/utils/sysrepo-plugins/hicn-light/plugin/yang/controler_rpcs_instances.xml
deleted file mode 100644
index c5d24e4f6..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/yang/controler_rpcs_instances.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<node-params-get xmlns="urn:sysrepo:hicn"/>
-
-<node-stat-get xmlns="urn:sysrepo:hicn"/>
-
-<strategy-get xmlns="urn:sysrepo:hicn">
- <strategy_id>0</strategy_id>
-</strategy-get>
-
-<strategies-get xmlns="urn:sysrepo:hicn"/>
-
-
-<route-get xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
-</route-get>
-
-<route-del xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
-</route-del>
-
-<route-nhops-add xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
- <face_ids0>40</face_ids0>
- <face_ids1>50</face_ids1>
- <face_ids2>60</face_ids2>
- <face_ids3>70</face_ids3>
- <face_ids4>80</face_ids4>
- <face_ids5>90</face_ids5>
- <face_ids6>100</face_ids6>
- <n_faces>110</n_faces>
-</route-nhops-add>
-
-<route-nhops-del xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
- <faceid>40</faceid>
-</route-nhops-del>
-
-
-<face-ip-params-get xmlns="urn:sysrepo:hicn">
- <faceid>10</faceid>
-</face-ip-params-get>
-
-<face-ip-add xmlns="urn:sysrepo:hicn">
- <nh_addr0>10</nh_addr0>
- <nh_addr1>20</nh_addr1>
- <swif>30</swif>
-</face-ip-add>
-
-<face-ip-del xmlns="urn:sysrepo:hicn">
- <faceid>0</faceid>
-</face-ip-del>
-
-<punting-add xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
- <swif>40</swif>
-</punting-add>
-
-
-<punting-del xmlns="urn:sysrepo:hicn">
- <prefix0>10</prefix0>
- <prefix1>20</prefix1>
- <len>30</len>
- <swif>40</swif>
-</punting-del>
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/yang/model/hicn.yang b/utils/sysrepo-plugins/hicn-light/plugin/yang/model/hicn.yang
deleted file mode 100644
index 928e5cdc6..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/yang/model/hicn.yang
+++ /dev/null
@@ -1,546 +0,0 @@
-module hicn {
- namespace "urn:sysrepo:hicn";
- prefix hcn;
-
- revision 2019-02-06 {
- description "Initial revision.";
- }
-
-/* new data types and grouping definition to forward the remote request toward hicn controler--to-->hicn */
-
- typedef float {
- type decimal64 {
- fraction-digits 2;
- }
- }
-
-
- grouping params {
-
- leaf enable_disable {
- description "Enable / disable ICN forwarder in forwarder.";
- type boolean;
- default false;
- }
-
- leaf pit_max_size {
- description "PIT maximum size, otherwise -1 to assign default value.";
- type int32;
- default -1;
- }
-
- leaf cs_max_size {
- description "CS maximum size, otherwise -1 to assign default value.";
- type int32;
- default -1;
- }
-
- leaf cs_reserved_app {
- description "Portion of CS reserved to application, otherwise -1 to assign default value.";
- type int32;
- default -1;
- }
-
- leaf pit_dflt_lifetime_sec {
- description "Default PIT entry lifetime, otherwise -1 to assign default value.";
- type float;
- default -1;
- }
-
- leaf pit_max_lifetime_sec {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value.";
- type float;
- default -1;
- }
-
- leaf pit_min_lifetime_sec {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type float;
- default -1;
- }
-}
-
- grouping face_ip_add {
-
- leaf nh_addr0 {
- description "IP local address.";
- type uint64;
- }
-
- leaf nh_addr1 {
- description "IP local address.";
- type uint64;
- }
-
- leaf swif {
- description "IPv4 local port number.";
- type uint32;
- }
- }
-
- grouping route_nhops_add {
-
- leaf prefix0 {
- description "Prefix0 to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix1 to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-
- leaf face_ids0 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids1 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids2 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids3 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids4 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids5 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf face_ids6 {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint32;
- }
-
- leaf n_faces {
- description "Number of face to add.";
- type uint8;
- }
- }
-
-
- grouping route_nhops_del {
-
- leaf prefix0 {
- description "Prefix0 to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix1 to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-
- leaf faceid {
- description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint16;
- }
-
- }
-
-
- grouping route_add {
-
- leaf prefix0 {
- description "Prefix0 to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix1 to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
- }
-
-
- grouping route_del {
-
- leaf prefix0 {
- description "Prefix0 to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix1 to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
- }
-
-
- grouping route_get {
-
-
- leaf prefix0 {
- description "Prefix0 to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix1 to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
- }
-
- grouping punting_add {
-
- leaf prefix0 {
- description "Prefix to be added to the FIB.";
- type uint64;
- }
-
- leaf prefix1 {
- description "Prefix to be added to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-
- leaf swif {
- description "Interface id.";
- type uint32;
- }
- }
-
- grouping register_prod_app {
-
- leaf-list prefix {
- description "Prefix to be matched to the FIB.";
- type uint64;
- }
-
- leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-
- leaf swif {
- description "Interface id.";
- type uint32;
- }
-
- leaf cs_reserved {
- description "CS memory reserved -- in number of packets.";
- type uint32;
- }
-
- }
-
-/* new data types and grouping definition to backward the remote response hicn--to-->controler */
-
-
- grouping states-reply {
-
- leaf pkts_processed {
- description "ICN packets processed.";
- type uint64;
- }
-
- leaf pkts_interest_count {
- description "PIT maximum size, otherwise -1 to assign default value.";
- type uint64;
- }
-
- leaf pkts_data_count {
- description "CS maximum size, otherwise -1 to assign default value.";
- type uint64;
- }
-
- leaf pkts_from_cache_count {
- description "Portion of CS reserved to application, otherwise -1 to assign default value.";
- type uint64;
- }
-
- leaf pkts_no_pit_count {
- description "Default PIT entry lifetime, otherwise -1 to assign default value.";
- type uint64;
- }
-
- leaf pit_expired_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value.";
- type uint64;
- }
-
- leaf cs_expired_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf cs_lru_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf pkts_drop_no_buf {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf interests_aggregated {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf interests_retx {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf interests_hash_collision {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf pit_entries_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf cs_entries_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
- leaf cs_entries_ntw_count {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint64;
- }
-
-}
-
-
-
- grouping strategy-reply {
-
- leaf description {
- description "Enable / disable ICN forwarder in forwarder.";
- type uint8;
- }
- }
-
- grouping route-reply {
-
- leaf faceids {
- description "Enable / disable ICN forwarder in forwarder.";
- type uint16;
-
- }
-
- leaf strategy_id {
- description "compile-time plugin features.";
- type uint32;
- }
- }
-
- grouping strategies-reply {
- leaf n_strategies {
- description "Enable / disable ICN forwarder in forwarder.";
- type uint8;
- }
- leaf strategy_id {
- description "Enable / disable ICN forwarder in forwarder.";
- type uint32;
- }
-
- }
-
- grouping face-ip-params-reply {
-
- leaf nh_addr {
- description "Enable / disable ICN forwarder in forwarder.";
- type uint64;
- }
-
- leaf swif {
- description "compile-time plugin features.";
- type uint32;
- }
-
- leaf flags {
- description "compile-time plugin features.";
- type uint32;
- }
-
- }
-
-
-/* Hicn configuration */
-
- container hicn-conf {
- config true;
- description "config data container for the hicn-forwarder.";
-
- container params{
- uses params;
- }
- }
-
-
-/* Hicn operational data */
-
- container hicn-state {
- config false;
- description "operational data container for the hicn.";
-
- container states{
- uses states-reply;
- }
- container strategy{
- uses strategy-reply;
- }
- container route{
- uses route-reply;
- }
- container strategies{
- uses strategies-reply;
- }
- container face-ip-params{
- uses face-ip-params-reply;
- }
-
- }
-
-/* RPC Definitions */
-
-
- rpc node-params-set {
- description "Operation to set hicn params in forwarder.";
- input {
- uses params;
- }
- }
-
- rpc node-params-get {
- description "Operation to get hicn parameter in forwarder.";
- }
-
-
- rpc node-stat-get {
- description "Operation to get hicn status in forwarder.";
- }
-
-
- rpc strategy-get {
- description "Operation to get hicn strategy.";
- input {
- leaf strategy_id {
- description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
- type uint32;
- }
- }
- }
-
- rpc strategies-get {
- description "Operation to get hicn strategies.";
- }
-
- rpc route-get {
- description "Operation to get hicn route.";
- input {
- uses route_get;
- }
- }
-
- rpc route-del {
- description "Operation to del hicn route.";
- input {
- uses route_del;
- }
- }
-
- rpc route-nhops-add {
- description "Operation to add hicn route nhops.";
- input {
- uses route_nhops_add;
- }
- }
-
- rpc route-nhops-del {
- description "Operation to add hicn face ip punt.";
- input {
- uses route_nhops_del;
- }
- }
-
- rpc face-ip-params-get {
- description "Operation to del hicn route.";
- input {
- leaf faceid {
- description "Face to be retrieved .";
- type uint16;
- }
- }
- }
-
- rpc face-ip-add {
- description "Operation to add hicn face ip.";
- input {
- uses face_ip_add;
- }
- }
-
- rpc face-ip-del {
- description "Operation to del hicn face ip.";
- input {
- leaf faceid {
- description "Face to be deleted .";
- type uint16;
- }
- }
- }
-
- rpc punting-add {
- description "Operation to add hicn punt.";
- input {
- uses punting_add;
- }
- }
-
- rpc punting-del {
- description "Operation to del hicn punt.";
- input {
- uses punting_add; /* It uses the same payload as the add*/
- }
- }
-
-} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c
index 2add127f2..f044c5b1b 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include "hicn_vpp_comm.h"
+#include <vapi/vapi.h>
@@ -21,7 +22,10 @@
#define MAX_OUTSTANDING_REQUESTS 4
#define RESPONSE_QUEUE_SIZE 2
vapi_ctx_t g_vapi_ctx_instance=NULL;
-DEFINE_VAPI_MSG_IDS_HICN_API_JSON;
+
+// Use VAPI macros to define symbols
+
+
int hicn_connect_vpp() {
HICN_INVOKE_BEGIN;
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h
index aff8e2ea1..fd71dbaf2 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h
@@ -41,9 +41,7 @@
#define HICN_LOG_ERR_MSG // SRP_LOG_ERR_MSG
#endif
-//DEFINE_VAPI_MSG_IDS_VPE_API_JSON
-DEFINE_VAPI_MSG_IDS_HICN_API_JSON;
// ctx vpp connect
extern vapi_ctx_t g_vapi_ctx_instance;
@@ -72,13 +70,13 @@ extern vapi_ctx_t g_vapi_ctx_instance;
ARG_CHECK(retval, arg1); \
ARG_CHECK(retval, arg2)
-#define ARG_CHECK5(retval, arg1, arg2, arg3, arg4, arg5) \
+#define ARG_CHECK6(retval, arg1, arg2, arg3, arg4, arg5, arg6) \
ARG_CHECK(retval, arg1); \
ARG_CHECK(retval, arg2); \
ARG_CHECK(retval, arg3); \
ARG_CHECK(retval, arg4); \
- ARG_CHECK(retval, arg5)
-
+ ARG_CHECK(retval, arg5); \
+ ARG_CHECK(retval, arg6)
/**
@@ -113,6 +111,17 @@ extern vapi_ctx_t g_vapi_ctx_instance;
} while (0);
+// define the error list
+typedef enum {
+ HICN_OK = 0, /* Success */
+ HICN_EINVAL, /* Invalid value encountered */
+ HICN_EAGAIN, /* Operation would block */
+ HICN_ENOTSUP, /* Operation not supported */
+ HICN_ENOMEM, /* Out of memory */
+ HICN_NOT_FOUND, /* Required element can not be found */
+} hicn_error_e;
+
+
int hicn_connect_vpp();
int hicn_disconnect_vpp();
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h b/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h
index dec789853..0f6c7f8b4 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h
@@ -16,8 +16,6 @@
#ifndef __IETF_INTERFACE_H__
#define __IETF_INTERFACE_H__
-//#include "../sc_model.h"
-
int ietf_subscribe_events(sr_session_ctx_t *session,
sr_subscription_ctx_t **subscription);
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c b/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c
index 340d403fb..b49839c53 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c
@@ -1,21 +1,30 @@
/*
- * Copyright (c) 2019 Cisco 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.
- */
+* Copyright (c) 2019 Cisco 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.
+*/
+
+#define _GNU_SOURCE
+
#include <stdio.h>
#include <malloc.h>
#include <sysrepo/xpath.h>
#include <inttypes.h>
+#include <unistd.h>
+#include <pthread.h>
+
+
+
+#include <sched.h>
/* Hicn headers */
#include <vapi/hicn.api.vapi.h>
@@ -26,7 +35,8 @@
#include "tlock.h"
-//vapi_ctx_t g_vapi_ctx_instance=NULL;
+DEFINE_VAPI_MSG_IDS_HICN_API_JSON
+
// Shared local variables between state and RPCs
@@ -35,1289 +45,1411 @@ volatile hicn_strategy_t * hicn_strategy = NULL;
volatile hicn_strategies_t * hicn_strategies =NULL;
volatile hicn_route_t * hicn_route = NULL;
volatile hicn_face_ip_params_t * hicn_face_ip_params = NULL;
+volatile hicn_faces_t * hicn_faces = NULL;
+//volatile hicn_face_stat_t * hicn_face_stat=NULL;
+struct hicn_faces_s * current = NULL;
+//volatile hicn_state_face_t * hicn_state_face=NULL;
+
static int init_buffer(void){
- hicn_state = memalign(MEM_ALIGN, sizeof(hicn_state_t) );
- memset((hicn_state_t *)hicn_state, 0 , sizeof(hicn_state_t) );
- hicn_strategy = memalign(MEM_ALIGN, sizeof(hicn_strategy_t) );
- memset((hicn_strategy_t *) hicn_strategy, 0 , sizeof(hicn_strategy_t) );
- hicn_strategies = memalign(MEM_ALIGN, sizeof(hicn_strategies_t) );
- memset((hicn_strategies_t *) hicn_strategies, 0 , sizeof(hicn_strategies_t) );
- hicn_route = memalign(MEM_ALIGN, sizeof(hicn_route_t) );
- memset((hicn_route_t *) hicn_route, 0 , sizeof(hicn_route_t) );
- hicn_face_ip_params = memalign(MEM_ALIGN, sizeof(hicn_face_ip_params_t) );
- memset((hicn_face_ip_params_t *) hicn_face_ip_params, 0 , sizeof(hicn_face_ip_params_t) );
- int retval=-1;
- ARG_CHECK5(retval, hicn_state, hicn_strategy, hicn_strategies, hicn_route, hicn_face_ip_params);
- retval=0;
- return retval;
+ hicn_state = memalign(MEM_ALIGN, sizeof(hicn_state_t) );
+ memset((hicn_state_t *)hicn_state, 0 , sizeof(hicn_state_t) );
+
+ hicn_strategy = memalign(MEM_ALIGN, sizeof(hicn_strategy_t) );
+ memset((hicn_strategy_t *) hicn_strategy, 0 , sizeof(hicn_strategy_t) );
+
+ hicn_strategies = memalign(MEM_ALIGN, sizeof(hicn_strategies_t) );
+ memset((hicn_strategies_t *) hicn_strategies, 0 , sizeof(hicn_strategies_t) );
+
+ hicn_route = memalign(MEM_ALIGN, sizeof(hicn_route_t) );
+ memset((hicn_route_t *) hicn_route, 0 , sizeof(hicn_route_t) );
+
+ hicn_faces = memalign(MEM_ALIGN, sizeof(hicn_faces_t) );
+ hicn_faces->next=memalign(MEM_ALIGN, sizeof(struct hicn_faces_s));
+ current=hicn_faces->next;
+
+// hicn_state_face = memalign(MEM_ALIGN, sizeof(hicn_state_face_t) );
+// memset((hicn_state_face_t *) hicn_state_face, 0, sizeof(hicn_state_face_t));
+
+ int retval=-1;
+ ARG_CHECK6(retval, hicn_state, hicn_strategy, hicn_strategies, hicn_route, current, hicn_faces);
+ hicn_faces->nface=0;
+ retval=0;
+
+ return retval;
}
- static inline void state_update(sr_val_t * vals ){
- sr_val_set_xpath(&vals[0], "/hicn:hicn-state/states/pkts_processed");
- vals[0].type = SR_UINT64_T;
- vals[0].data.uint64_val = hicn_state->pkts_processed;
- sr_val_set_xpath(&vals[1], "/hicn:hicn-state/states/pkts_interest_count");
- vals[1].type = SR_UINT64_T;
- vals[1].data.uint64_val = hicn_state->pkts_interest_count;
+static int init_face_pool(struct hicn_faces_s * head){
+
+ ARG_CHECK(HICN_EINVAL, head);
+ for(int i=0; i<MAX_FACE_POOL; i++){
+ head->next=memalign(MEM_ALIGN, sizeof(struct hicn_faces_s));
+ head=head->next;
+ SRP_LOG_DBG_MSG("Allocated\n");
+ }
+ head->next=NULL;
+ return HICN_OK;
- sr_val_set_xpath(&vals[2], "/hicn:hicn-state/states/pkts_data_count");
- vals[2].type = SR_UINT64_T;
- vals[2].data.uint64_val = hicn_state->pkts_data_count;
+}
- sr_val_set_xpath(&vals[3], "/hicn:hicn-state/states/pkts_from_cache_count");
- vals[3].type = SR_UINT64_T;
- vals[3].data.uint64_val = hicn_state->pkts_from_cache_count;
+static inline void state_cache(vapi_msg_hicn_api_node_stats_get_reply * resp){
+ hicn_state->pkts_processed = resp->payload.pkts_processed;
+ hicn_state->pkts_interest_count = resp->payload.pkts_interest_count;
+ hicn_state->pkts_data_count = resp->payload.pkts_data_count;
+ hicn_state->pkts_from_cache_count = resp->payload.pkts_from_cache_count;
+ hicn_state->pkts_no_pit_count = resp->payload.pkts_no_pit_count;
+ hicn_state->pit_expired_count = resp->payload.pit_expired_count;
+ hicn_state->cs_expired_count = resp->payload.cs_expired_count;
+ hicn_state->cs_lru_count = resp->payload.cs_lru_count;
+ hicn_state->pkts_drop_no_buf = resp->payload.pkts_drop_no_buf;
+ hicn_state->interests_aggregated = resp->payload.interests_aggregated;
+ hicn_state->interests_retx = resp->payload.interests_retx;
+ hicn_state->pit_entries_count = resp->payload.pit_entries_count;
+ hicn_state->cs_entries_count = resp->payload.cs_entries_count;
+ hicn_state->cs_entries_ntw_count = resp->payload.cs_entries_ntw_count;
+ SRP_LOG_DBG_MSG("state cached");
+}
- sr_val_set_xpath(&vals[4], "/hicn:hicn-state/states/pkts_no_pit_count");
- vals[4].type = SR_UINT64_T;
- vals[4].data.uint64_val = hicn_state->pkts_no_pit_count;
- sr_val_set_xpath(&vals[5], "/hicn:hicn-state/states/pit_expired_count");
- vals[5].type = SR_UINT64_T;
- vals[5].data.uint64_val = hicn_state->pit_expired_count;
+static inline void state_update(sr_val_t * vals ){
+ sr_val_set_xpath(&vals[0], "/hicn:hicn-state/states/pkts_processed");
+ vals[0].type = SR_UINT64_T;
+ vals[0].data.uint64_val = hicn_state->pkts_processed;
- sr_val_set_xpath(&vals[6], "/hicn:hicn-state/states/cs_expired_count");
- vals[6].type = SR_UINT64_T;
- vals[6].data.uint64_val = hicn_state->cs_expired_count;
+ sr_val_set_xpath(&vals[1], "/hicn:hicn-state/states/pkts_interest_count");
+ vals[1].type = SR_UINT64_T;
+ vals[1].data.uint64_val = hicn_state->pkts_interest_count;
- sr_val_set_xpath(&vals[7], "/hicn:hicn-state/states/cs_lru_count");
- vals[7].type = SR_UINT64_T;
- vals[7].data.uint64_val = hicn_state->cs_lru_count;
+ sr_val_set_xpath(&vals[2], "/hicn:hicn-state/states/pkts_data_count");
+ vals[2].type = SR_UINT64_T;
+ vals[2].data.uint64_val = hicn_state->pkts_data_count;
- sr_val_set_xpath(&vals[8], "/hicn:hicn-state/states/pkts_drop_no_buf");
- vals[8].type = SR_UINT64_T;
- vals[8].data.uint64_val = hicn_state->pkts_drop_no_buf;
+ sr_val_set_xpath(&vals[3], "/hicn:hicn-state/states/pkts_from_cache_count");
+ vals[3].type = SR_UINT64_T;
+ vals[3].data.uint64_val = hicn_state->pkts_from_cache_count;
- sr_val_set_xpath(&vals[9], "/hicn:hicn-state/states/interests_aggregated");
- vals[9].type = SR_UINT64_T;
- vals[9].data.uint64_val = hicn_state->interests_aggregated;
+ sr_val_set_xpath(&vals[4], "/hicn:hicn-state/states/pkts_no_pit_count");
+ vals[4].type = SR_UINT64_T;
+ vals[4].data.uint64_val = hicn_state->pkts_no_pit_count;
- sr_val_set_xpath(&vals[10], "/hicn:hicn-state/states/interests_retx");
- vals[10].type = SR_UINT64_T;
- vals[10].data.uint64_val = hicn_state->interests_retx;
+ sr_val_set_xpath(&vals[5], "/hicn:hicn-state/states/pit_expired_count");
+ vals[5].type = SR_UINT64_T;
+ vals[5].data.uint64_val = hicn_state->pit_expired_count;
- sr_val_set_xpath(&vals[11],
- "/hicn:hicn-state/states/interests_hash_collision");
- vals[11].type = SR_UINT64_T;
- vals[11].data.uint64_val = hicn_state->interests_hash_collision;
+ sr_val_set_xpath(&vals[6], "/hicn:hicn-state/states/cs_expired_count");
+ vals[6].type = SR_UINT64_T;
+ vals[6].data.uint64_val = hicn_state->cs_expired_count;
- sr_val_set_xpath(&vals[12], "/hicn:hicn-state/states/pit_entries_count");
- vals[12].type = SR_UINT64_T;
- vals[12].data.uint64_val = hicn_state->pit_entries_count;
+ sr_val_set_xpath(&vals[7], "/hicn:hicn-state/states/cs_lru_count");
+ vals[7].type = SR_UINT64_T;
+ vals[7].data.uint64_val = hicn_state->cs_lru_count;
- sr_val_set_xpath(&vals[13], "/hicn:hicn-state/states/cs_entries_count");
- vals[13].type = SR_UINT64_T;
- vals[13].data.uint64_val = hicn_state->cs_entries_count;
+ sr_val_set_xpath(&vals[8], "/hicn:hicn-state/states/pkts_drop_no_buf");
+ vals[8].type = SR_UINT64_T;
+ vals[8].data.uint64_val = hicn_state->pkts_drop_no_buf;
- sr_val_set_xpath(&vals[14], "/hicn:hicn-state/states/cs_entries_ntw_count");
- vals[14].type = SR_UINT64_T;
- vals[14].data.uint64_val = hicn_state->cs_entries_ntw_count;
-}
+ sr_val_set_xpath(&vals[9], "/hicn:hicn-state/states/interests_aggregated");
+ vals[9].type = SR_UINT64_T;
+ vals[9].data.uint64_val = hicn_state->interests_aggregated;
+ sr_val_set_xpath(&vals[10], "/hicn:hicn-state/states/interests_retx");
+ vals[10].type = SR_UINT64_T;
+ vals[10].data.uint64_val = hicn_state->interests_retx;
-static inline void strategy_update(sr_val_t * vals ){
- sr_val_set_xpath(&vals[0], "/hicn:hicn-state/strategy/description");
- vals[0].type = SR_UINT8_T;
- vals[0].data.uint8_val = hicn_strategy->description[0];
-}
+ sr_val_set_xpath(&vals[11],
+ "/hicn:hicn-state/states/interests_hash_collision");
+ vals[11].type = SR_UINT64_T;
+ vals[11].data.uint64_val = hicn_state->interests_hash_collision;
-static inline void strategies_update(sr_val_t * vals ){
- sr_val_set_xpath(&vals[0], "/hicn:hicn-state/strategies/n_strategies");
- vals[0].type = SR_UINT8_T;
- vals[0].data.uint8_val = hicn_strategies->n_strategies;
+ sr_val_set_xpath(&vals[12], "/hicn:hicn-state/states/pit_entries_count");
+ vals[12].type = SR_UINT64_T;
+ vals[12].data.uint64_val = hicn_state->pit_entries_count;
- sr_val_set_xpath(&vals[1], "/hicn:hicn-state/strategies/strategy_id");
- vals[1].type = SR_UINT32_T;
- vals[1].data.uint32_val = hicn_strategies->strategy_id[0];
+ sr_val_set_xpath(&vals[13], "/hicn:hicn-state/states/cs_entries_count");
+ vals[13].type = SR_UINT64_T;
+ vals[13].data.uint64_val = hicn_state->cs_entries_count;
+ sr_val_set_xpath(&vals[14], "/hicn:hicn-state/states/cs_entries_ntw_count");
+ vals[14].type = SR_UINT64_T;
+ vals[14].data.uint64_val = hicn_state->cs_entries_ntw_count;
}
-static inline void route_update(sr_val_t * vals ){
- sr_val_set_xpath(&vals[0], "/hicn:hicn-state/route/faceids");
- vals[0].type = SR_UINT16_T;
- vals[0].data.uint16_val = hicn_route->faceids[0];
+static inline void strategies_update(sr_val_t * vals ){
+ sr_val_set_xpath(&vals[0], "/hicn:hicn-state/strategies/n_strategies");
+ vals[0].type = SR_UINT8_T;
+ vals[0].data.uint8_val = hicn_strategies->n_strategies;
- sr_val_set_xpath(&vals[1], "/hicn:hicn-state/route/strategy_id");
- vals[1].type = SR_UINT32_T;
- vals[1].data.uint32_val = hicn_route->strategy_id;
+ sr_val_set_xpath(&vals[1], "/hicn:hicn-state/strategies/strategy_id");
+ vals[1].type = SR_UINT32_T;
+ vals[1].data.uint32_val = hicn_strategies->strategy_id[0];
}
-static inline void face_ip_params_update(sr_val_t * vals ){
- sr_val_set_xpath(&vals[0], "/hicn:hicn-state/face-ip-params/nh_addr");
- vals[0].type = SR_UINT64_T;
- vals[0].data.uint64_val = hicn_face_ip_params->nh_addr[0];
-
- sr_val_set_xpath(&vals[1], "/hicn:hicn-state/face-ip-params/swif");
- vals[1].type = SR_UINT32_T;
- vals[1].data.uint32_val = hicn_face_ip_params->swif;
+static inline void route_update(sr_val_t * vals ){
+ sr_val_set_xpath(&vals[0], "/hicn:hicn-state/routes/faceids");
+ vals[0].type = SR_UINT16_T;
+ vals[0].data.uint32_val = hicn_route->faceids[0];
- sr_val_set_xpath(&vals[2], "/hicn:hicn-state/face-ip-params/flags");
- vals[2].type = SR_UINT32_T;
- vals[2].data.uint32_val = hicn_face_ip_params->flags;
+ sr_val_set_xpath(&vals[1], "/hicn:hicn-state/routes/strategy_id");
+ vals[1].type = SR_UINT32_T;
+ vals[1].data.uint32_val = hicn_route->strategy_id;
}
+static inline int faces_update(sr_val_t * vals, uint32_t nleaves){
-static int hicn_state_states_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt, uint64_t request_id,
- const char *original_xpath, void *private_ctx) {
- sr_val_t *vals;
- int rc;
- enum locks_name state;
- state=lstate;
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
-
- if (!sr_xpath_node_name_eq(xpath, "states")) {
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+ struct hicn_faces_s * temp = hicn_faces->next;
+ int face =0;
- rc = sr_new_values(NSTATE_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
+ for(int count=0; count<nleaves; count++){
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- Ticket_Lock(state);
- state_update(vals);
- Ticket_Unlock(state);
- *values = vals;
- *values_cnt = NSTATE_LEAVES;
-/*
- pthread_t state_tid;
- rc = pthread_create((pthread_t *)&state_tid, NULL, state_thread, NULL);
- if (rc != 0) {
- SRP_LOG_DBG_MSG("Error making hicn state thread");
- return SR_ERR_OPERATION_FAILED;
- }
-*/
- return SR_ERR_OK;
-}
+ // This part must be removed once the faceid is provided by the dump msg
+ vapi_msg_hicn_api_face_ip_params_get *msg;
+ vapi_msg_hicn_api_face_ip_params_get_reply *resp;
+ msg = vapi_alloc_hicn_api_face_ip_params_get(g_vapi_ctx_instance);
+ msg->payload.faceid = temp->face.faceid;
+ vapi_msg_hicn_api_face_ip_params_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_face_ip_params_get_reply_ntoh(resp);
+ if(!resp->payload.retval){
+ SRP_LOG_DBG("faceid(%d)-->intfc(%d)", temp->face.faceid, resp->payload.swif);
+ temp->face.intfc= resp->payload.swif;
+ }
-static int hicn_state_strategy_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt, uint64_t request_id,
- const char *original_xpath, void *private_ctx) {
- sr_val_t *vals;
- int rc;
- enum locks_name strategy;
- strategy=lstrategy;
-
- if (!sr_xpath_node_name_eq(xpath, "strategy")) {
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/intfc", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT32_T;
+ vals[face].data.uint32_val = temp->face.intfc;
- rc = sr_new_values(NSTRATEGY_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- Ticket_Lock(strategy);
- strategy_update(vals);
- Ticket_Unlock(strategy);
+ face++;
- *values = vals;
- *values_cnt = NSTRATEGY_LEAVES;
- return SR_ERR_OK;
- }
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/irx_packets", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.irx_packets;
-static int hicn_state_strategies_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt, uint64_t request_id,
- const char *original_xpath, void *private_ctx) {
- sr_val_t *vals;
- int rc;
- enum locks_name strategies;
- strategies=lstrategies;
+ face++;
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/irx_bytes", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.irx_bytes;
+ face++;
- if (! sr_xpath_node_name_eq(xpath, "strategies")) {
- SRP_LOG_DBG_MSG("Requesting state is not for strategies");
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/itx_packets", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.itx_packets;
+ face++;
- rc = sr_new_values(NSTRATEGIES_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/itx_bytes", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.itx_bytes;
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- Ticket_Lock(strategies);
- strategies_update(vals);
- Ticket_Unlock(strategies);
+ face++;
- *values = vals;
- *values_cnt = NSTRATEGIES_LEAVES;
- return SR_ERR_OK;
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/drx_packets", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.drx_packets;
- }
+ face++;
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/drx_bytes", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.drx_bytes;
-static int hicn_state_route_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt, uint64_t request_id,
- const char *original_xpath, void *private_ctx) {
- sr_val_t *vals;
- int rc;
- enum locks_name route;
- route=lroute;
-
-
- if (! sr_xpath_node_name_eq(xpath, "route")) {
- SRP_LOG_DBG_MSG("Requesting state is not for route");
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+ face++;
- rc = sr_new_values(NROUTE_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/dtx_packets", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.dtx_packets;
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- Ticket_Lock(route);
- route_update(vals);
- Ticket_Unlock(route);
+ face++;
- *values = vals;
- *values_cnt = NROUTE_LEAVES;
- return SR_ERR_OK;
+ sr_val_build_xpath(&vals[face], "%s[faceid='%d']/dtx_bytes", "/hicn:hicn-state/faces/face",
+ temp->face.faceid);
+ vals[face].type = SR_UINT64_T;
+ vals[face].data.uint64_val = temp->face.dtx_bytes;
- }
+ face++;
+ SRP_LOG_DBG(" **********************face is: %d-%d-%d ****************\n",temp->face.dtx_bytes,temp->face.drx_bytes,temp->face.faceid);
- static int hicn_state_face_ip_params_cb(const char *xpath, sr_val_t **values,
- size_t *values_cnt, uint64_t request_id,
- const char *original_xpath, void *private_ctx) {
- sr_val_t *vals;
- int rc;
- enum locks_name face_ip_params;
- face_ip_params=lface_ip_params;
+ printf("%" PRId64 "\n", temp->face.drx_bytes);
+ temp=temp->next;
+ }
+ SRP_LOG_DBG_MSG("Faces state updated \n");
+ return SR_ERR_OK;
+}
- if (! sr_xpath_node_name_eq(xpath, "face-ip-params")) {
- SRP_LOG_DBG_MSG("Requesting state is not for face-ip-params");
- *values = NULL;
- *values_cnt = 0;
- return SR_ERR_OK;
- }
+static int hicn_state_states_cb(const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx) {
+ sr_val_t *vals;
+ int rc;
+ enum locks_name state;
+ state=lstate;
+ SRP_LOG_DBG("Requesting state data for '%s'", xpath);
+
+ if (!sr_xpath_node_name_eq(xpath, "states")) {
+ *values = NULL;
+ *values_cnt = 0;
+ return SR_ERR_OK;
+ }
+
+ rc = sr_new_values(NSTATE_LEAVES, &vals);
+ if (SR_ERR_OK != rc) {
+ return rc;
+ }
+
+ SRP_LOG_DBG("Requesting state data for '%s'", xpath);
+ tlock(state);
+ state_update(vals);
+ tunlock(state);
+
+ *values = vals;
+ *values_cnt = NSTATE_LEAVES;
+
+ return SR_ERR_OK;
+}
- rc = sr_new_values(NFACE_IP_PARAMS_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
+static int hicn_state_strategies_cb(const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx) {
+ sr_val_t *vals;
+ int rc;
+ enum locks_name strategies;
+ strategies=lstrategies;
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- Ticket_Lock(face_ip_params);
- face_ip_params_update(vals);
- Ticket_Unlock(face_ip_params);
- *values = vals;
- *values_cnt = NFACE_IP_PARAMS_LEAVES;
- return SR_ERR_OK;
- }
+ if (! sr_xpath_node_name_eq(xpath, "strategies")) {
+ SRP_LOG_DBG_MSG("Requesting state is not for strategies");
+ *values = NULL;
+ *values_cnt = 0;
+ return SR_ERR_OK;
+ }
-static int params_send(vapi_msg_hicn_api_node_params_set *msg,
- vapi_msg_hicn_api_node_params_set_reply *resp) {
- vapi_msg_hicn_api_node_params_set_hton(msg);
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
- HICN_VPP_VAPI_RECV;
- SRP_LOG_DBG_MSG("state data are updated successfully");
- return SR_ERR_OK;
-}
+ rc = sr_new_values(NSTRATEGIES_LEAVES, &vals);
+ if (SR_ERR_OK != rc) {
+ return rc;
+ }
-/**
- * @brief Callback to be called by any config change of "/hicn:/" leaf.
- */
-static int hicn_node_params_set_cb(sr_session_ctx_t *session, const char *xpath,
- sr_notif_event_t event, void *private_ctx) {
- sr_change_iter_t *iter = NULL;
- sr_change_oper_t op = SR_OP_CREATED;
- sr_val_t *old_val = NULL;
- sr_val_t *new_val = NULL;
- sr_xpath_ctx_t xpath_ctx = {
- 0,
- };
- int rc = SR_ERR_OK, op_rc = SR_ERR_OK;
- // no-op for apply, we only care about SR_EV_ENABLED, SR_EV_VERIFY,
- // SR_EV_ABORT
- if (SR_EV_APPLY == event) {
- return SR_ERR_OK;
- }
+ SRP_LOG_DBG("Requesting state data for '%s'", xpath);
+ tlock(strategies);
+ strategies_update(vals);
+ tunlock(strategies);
- // get changes iterator
- rc = sr_get_changes_iter(session, xpath, &iter);
- if (SR_ERR_OK != rc) {
- SRP_LOG_ERR("Unable to retrieve change iterator: %s", sr_strerror(rc));
- return rc;
- }
+ *values = vals;
+ *values_cnt = NSTRATEGIES_LEAVES;
+ return SR_ERR_OK;
- vapi_msg_hicn_api_node_params_set *msg;
- vapi_msg_hicn_api_node_params_set_reply *resp = NULL;
- msg = vapi_alloc_hicn_api_node_params_set(g_vapi_ctx_instance);
- // 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)))) {
- if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/enable_disable")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.bool_val);
- msg->payload.enable_disable = new_val->data.bool_val;
- } else if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/pit_max_size")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.int32_val);
- msg->payload.pit_max_size = new_val->data.int32_val;
- } else if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/cs_max_size")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.int32_val);
- msg->payload.cs_max_size = new_val->data.int32_val;
- } else if (!strcmp(new_val->xpath,
- "/hicn:hicn-conf/params/cs_reserved_app")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.int32_val);
- msg->payload.cs_reserved_app = new_val->data.int32_val;
- } else if (!strcmp(new_val->xpath,
- "/hicn:hicn-conf/params/pit_dflt_lifetime_sec")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.decimal64_val);
- msg->payload.pit_dflt_lifetime_sec = new_val->data.decimal64_val;
- } else if (!strcmp(new_val->xpath,
- "/hicn:hicn-conf/params/pit_min_lifetime_sec")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.decimal64_val);
- msg->payload.pit_min_lifetime_sec = new_val->data.decimal64_val;
- } else if (!strcmp(new_val->xpath,
- "/hicn:hicn-conf/params/pit_max_lifetime_sec")) {
- SRP_LOG_DBG("A change detected in '%s', op=%d",
- new_val ? new_val->xpath : old_val->xpath,
- new_val->data.decimal64_val);
- msg->payload.pit_max_lifetime_sec = new_val->data.decimal64_val;
- }
-
- switch (op) {
- case SR_OP_CREATED:
- case SR_OP_MODIFIED:
- op_rc = SR_ERR_OK; // OK
- break;
- case SR_OP_DELETED:
- op_rc = SR_ERR_OPERATION_FAILED; // ERROR
- break;
- default:
- break;
- }
- sr_xpath_recover(&xpath_ctx);
- if (SR_ERR_INVAL_ARG == op_rc) {
- sr_set_error(session, "You are not allowed to change the schema.",
- new_val ? new_val->xpath : old_val->xpath);
- }
- sr_free_val(old_val);
- sr_free_val(new_val);
- }
+ }
- params_send(msg, resp);
- sr_free_change_iter(iter);
- SRP_LOG_DBG_MSG("Configuration applied successfully");
- return SR_ERR_OK;
+static int hicn_state_route_cb(const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx) {
+ sr_val_t *vals;
+ int rc;
+ enum locks_name route;
+ route=lroute;
+
+
+ if (! sr_xpath_node_name_eq(xpath, "routes")) {
+ SRP_LOG_DBG_MSG("Requesting state is not for routes");
+ *values = NULL;
+ *values_cnt = 0;
+ return SR_ERR_OK;
+ }
+
+ rc = sr_new_values(NROUTE_LEAVES, &vals);
+ if (SR_ERR_OK != rc) {
+ return rc;
+ }
+
+ SRP_LOG_DBG("Requesting state data for '%s'", xpath);
+ tlock(route);
+ route_update(vals);
+ tunlock(route);
+
+ *values = vals;
+ *values_cnt = NROUTE_LEAVES;
+ return SR_ERR_OK;
+
+ }
+
+
+ static int hicn_state_faces_cb(const char *xpath, sr_val_t **values,
+ size_t *values_cnt, uint64_t request_id,
+ const char *original_xpath, void *private_ctx) {
+ sr_val_t *vals;
+ int rc;
+ enum locks_name faces;
+ faces=lfaces;
+ uint32_t NFACES_NODES = hicn_faces->nface * FACES_CHILDREN;
+
+ if (! sr_xpath_node_name_eq(xpath, "faces")) {
+ SRP_LOG_DBG_MSG("Requesting state is not for faces");
+ *values = NULL;
+ *values_cnt = 0;
+ return SR_ERR_OK;
+ }
+
+ // We should only consider the number of leaves not the head of list(faceid)
+ rc = sr_new_values(NFACES_NODES, &vals);
+ if (SR_ERR_OK != rc) {
+ return rc;
+ }
+
+ SRP_LOG_DBG("Requesting state data for '%s'", xpath);
+
+ tlock(faces);
+ SRP_LOG_DBG("**********NFACES-LEAVES '%d' *********", NFACES_NODES);
+ faces_update(vals, NFACES_NODES/FACES_CHILDREN);
+ tunlock(faces);
+ //hicn_faces->nface=0;
+ *values = vals;
+ *values_cnt = NFACES_NODES;
+ return SR_ERR_OK;
+
+ }
+
+/**
+* @brief Callback to be called by any config change of "/hicn:/" leaf.
+*/
+static int hicn_node_params_set_cb(sr_session_ctx_t *session, const char *xpath,
+ sr_notif_event_t event, void *private_ctx) {
+ sr_change_iter_t *iter = NULL;
+ sr_change_oper_t op = SR_OP_CREATED;
+ sr_val_t *old_val = NULL;
+ sr_val_t *new_val = NULL;
+ sr_xpath_ctx_t xpath_ctx = {
+ 0,
+ };
+ int rc = SR_ERR_OK, op_rc = SR_ERR_OK;
+ // no-op for apply, we only care about SR_EV_ENABLED, SR_EV_VERIFY,
+ // SR_EV_ABORT
+ if (SR_EV_APPLY == event) {
+ return SR_ERR_OK;
+ }
+
+ // get changes iterator
+ rc = sr_get_changes_iter(session, xpath, &iter);
+ if (SR_ERR_OK != rc) {
+ SRP_LOG_ERR("Unable to retrieve change iterator: %s", sr_strerror(rc));
+ return rc;
+ }
+
+ vapi_msg_hicn_api_node_params_set *msg;
+ vapi_msg_hicn_api_node_params_set_reply *resp = NULL;
+ msg = vapi_alloc_hicn_api_node_params_set(g_vapi_ctx_instance);
+ SRP_LOG_DBG("H:recv msgid [%d]\n", msg->header._vl_msg_id); \
+
+ // 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)))) {
+ if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/enable_disable")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.bool_val);
+ msg->payload.enable_disable = new_val->data.bool_val;
+ } else if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/pit_max_size")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.int32_val);
+ msg->payload.pit_max_size = new_val->data.int32_val;
+ } else if (!strcmp(new_val->xpath, "/hicn:hicn-conf/params/cs_max_size")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.int32_val);
+ msg->payload.cs_max_size = new_val->data.int32_val;
+ } else if (!strcmp(new_val->xpath,
+ "/hicn:hicn-conf/params/cs_reserved_app")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.int32_val);
+ msg->payload.cs_reserved_app = new_val->data.int32_val;
+ } else if (!strcmp(new_val->xpath,
+ "/hicn:hicn-conf/params/pit_dflt_lifetime_sec")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.decimal64_val);
+ msg->payload.pit_dflt_lifetime_sec = new_val->data.decimal64_val;
+ } else if (!strcmp(new_val->xpath,
+ "/hicn:hicn-conf/params/pit_min_lifetime_sec")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.decimal64_val);
+ msg->payload.pit_min_lifetime_sec = new_val->data.decimal64_val;
+ } else if (!strcmp(new_val->xpath,
+ "/hicn:hicn-conf/params/pit_max_lifetime_sec")) {
+ SRP_LOG_DBG("A change detected in '%s', op=%d",
+ new_val ? new_val->xpath : old_val->xpath,
+ new_val->data.decimal64_val);
+ msg->payload.pit_max_lifetime_sec = new_val->data.decimal64_val;
+ }
+
+ switch (op) {
+ case SR_OP_CREATED:
+ case SR_OP_MODIFIED:
+ op_rc = SR_ERR_OK; // OK
+ break;
+ case SR_OP_DELETED:
+ op_rc = SR_ERR_OPERATION_FAILED; // ERROR
+ break;
+ default:
+ break;
+ }
+ sr_xpath_recover(&xpath_ctx);
+ if (SR_ERR_INVAL_ARG == op_rc) {
+ sr_set_error(session, "You are not allowed to change the schema.",
+ new_val ? new_val->xpath : old_val->xpath);
+ }
+ sr_free_val(old_val);
+ sr_free_val(new_val);
+ }
+
+ vapi_msg_hicn_api_node_params_set_hton(msg);
+
+ params_send(msg, resp);
+
+ vapi_msg_hicn_api_node_params_set_reply_ntoh(resp);
+
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ sr_free_change_iter(iter);
+ return SR_ERR_OK;
+ }
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get hicn param in vpp.
- */
+* @brief API to get hicn param in vpp.
+*/
static int hicn_node_params_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn node parameter received successfully");
- vapi_msg_hicn_api_node_params_get *msg;
- vapi_msg_hicn_api_node_params_get_reply *resp;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- msg = vapi_alloc_hicn_api_node_params_get(g_vapi_ctx_instance);
- vapi_msg_hicn_api_node_params_get_hton(msg);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ SRP_LOG_DBG_MSG("hicn node parameter received successfully");
+ vapi_msg_hicn_api_node_params_get *msg;
+ vapi_msg_hicn_api_node_params_get_reply *resp;
+ msg = vapi_alloc_hicn_api_node_params_get(g_vapi_ctx_instance);
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
- HICN_VPP_VAPI_RECV;
- vapi_msg_hicn_api_node_params_get_reply_ntoh(resp);
+ vapi_msg_hicn_api_node_params_get_hton(msg);
+ params_send(msg, resp);
+ vapi_msg_hicn_api_node_params_get_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- SRP_LOG_DBG("Pit Max entries: %d",resp->payload.pit_max_size);
- return SR_ERR_OK;
- }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get hicn stat in vpp.
- */
+* @brief API to get hicn stat in vpp.
+*/
static int hicn_node_stat_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- SRP_LOG_DBG_MSG("hicn status received successfully");
- vapi_msg_hicn_api_node_stats_get *msg;
- vapi_msg_hicn_api_node_stats_get_reply *resp;
- enum locks_name state;
- state=lstate;
+ SRP_LOG_DBG_MSG("hicn status received successfully");
+ vapi_msg_hicn_api_node_stats_get *msg;
+ vapi_msg_hicn_api_node_stats_get_reply *resp;
+ enum locks_name state;
+ state=lstate;
+ msg = vapi_alloc_hicn_api_node_stats_get(g_vapi_ctx_instance);
- //vapi_msg_id_hicn_api_node_stats_get=103;
- msg = vapi_alloc_hicn_api_node_stats_get(g_vapi_ctx_instance);
- vapi_msg_hicn_api_node_stats_get_hton(msg);
+ vapi_msg_hicn_api_node_stats_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_node_stats_get_reply_ntoh(resp);
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ if(resp->payload.retval){
+ SRP_LOG_DBG_MSG("Error updating state");
+ return SR_ERR_OPERATION_FAILED;
+ }
+ tlock(state);
- HICN_VPP_VAPI_RECV;
- vapi_msg_hicn_api_node_stats_get_reply_ntoh(resp);
+ state_cache(resp);
- if(resp->payload.retval){
- SRP_LOG_DBG_MSG("Error updating state");
- return SR_ERR_OPERATION_FAILED;
- }
- Ticket_Lock(state);
- // hicn_state = (hicn_state_t *) resp->payload;
- hicn_state->pkts_processed = resp->payload.pkts_processed;
- hicn_state->pkts_interest_count = resp->payload.pkts_interest_count;
- hicn_state->pkts_data_count = resp->payload.pkts_data_count;
- hicn_state->pkts_from_cache_count = resp->payload.pkts_from_cache_count;
- hicn_state->pkts_no_pit_count = resp->payload.pkts_no_pit_count;
- hicn_state->pit_expired_count = resp->payload.pit_expired_count;
- hicn_state->cs_expired_count = resp->payload.cs_expired_count;
- hicn_state->cs_lru_count = resp->payload.cs_lru_count;
- hicn_state->pkts_drop_no_buf = resp->payload.pkts_drop_no_buf;
- hicn_state->interests_aggregated = resp->payload.interests_aggregated;
- hicn_state->interests_retx = resp->payload.interests_retx;
- // hicn_state->interests_hash_collision = resp->payload.interests_hash_collision;
- hicn_state->pit_entries_count = resp->payload.pit_entries_count;
- hicn_state->cs_entries_count = resp->payload.cs_entries_count;
- hicn_state->cs_entries_ntw_count = resp->payload.cs_entries_ntw_count;
- Ticket_Unlock(state);
-
- return SR_ERR_OK;
+ tunlock(state);
+ return SR_ERR_OK;
}
/**
- * @brief API to get hicn strategy in vpp.
- */
+* @brief API to get hicn strategy in vpp.
+*/
static int hicn_strategy_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn strategy receive successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_strategy_get *msg;
- vapi_msg_hicn_api_strategy_get_reply *resp;
-
- msg = vapi_alloc_hicn_api_strategy_get(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
-
- msg->payload.strategy_id = input[0].data.uint32_val;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- vapi_msg_hicn_api_strategy_get_hton(msg);
+ SRP_LOG_DBG_MSG("hicn strategy receive successfully");
+ vapi_msg_hicn_api_strategy_get *msg;
+ vapi_msg_hicn_api_strategy_get_reply *resp;
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg = vapi_alloc_hicn_api_strategy_get(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- HICN_VPP_VAPI_RECV;
+ msg->payload.strategy_id = input[0].data.uint32_val;
- vapi_msg_hicn_api_strategy_get_reply_ntoh(resp);
+ vapi_msg_hicn_api_strategy_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_strategy_get_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get hicn strategies in vpp.
- */
+* @brief API to get hicn strategies in vpp.
+*/
static int hicn_strategies_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn strategies received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_strategies_get *msg;
- vapi_msg_hicn_api_strategies_get_reply *resp;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- msg = vapi_alloc_hicn_api_strategies_get(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- vapi_msg_hicn_api_strategies_get_hton(msg);
+ SRP_LOG_DBG_MSG("hicn strategies received successfully");
+ vapi_msg_hicn_api_strategies_get *msg;
+ vapi_msg_hicn_api_strategies_get_reply *resp;
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg = vapi_alloc_hicn_api_strategies_get(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- HICN_VPP_VAPI_RECV;
- vapi_msg_hicn_api_strategies_get_reply_ntoh(resp);
+ vapi_msg_hicn_api_strategies_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_strategies_get_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get hicn route in vpp.
- */
+* @brief API to get hicn route in vpp.
+*/
static int hicn_route_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- SRP_LOG_DBG_MSG("hicn route receive successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_route_get *msg;
- vapi_msg_hicn_api_route_get_reply *resp;
-
- msg = vapi_alloc_hicn_api_route_get(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ SRP_LOG_DBG_MSG("hicn route receive successfully");
+ vapi_msg_hicn_api_route_get *msg;
+ vapi_msg_hicn_api_route_get_reply *resp;
+ msg = vapi_alloc_hicn_api_route_get(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- if(strcmp(input[0].data.string_val,"-1")){
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
+ if(strcmp(input[0].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B32);
- }else if(strcmp(input[1].data.string_val,"-1")){
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
+ }else if(strcmp(input[1].data.string_val,"-1")){
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- msg->payload.len = input[2].data.uint8_val;
- vapi_msg_hicn_api_route_get_hton(msg);
+ msg->payload.len = input[2].data.uint8_val;
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ vapi_msg_hicn_api_route_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_route_get_reply_ntoh(resp);
- HICN_VPP_VAPI_RECV;
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- vapi_msg_hicn_api_route_get_reply_ntoh(resp);
-
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
-
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to add hicn route nhops in vpp.
- */
+* @brief API to add hicn route nhops in vpp.
+*/
static int hicn_route_nhops_add_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn route nhops add received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_route_nhops_add *msg;
- vapi_msg_hicn_api_route_nhops_add_reply *resp;
-
- msg = vapi_alloc_hicn_api_route_nhops_add(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- vapi_msg_hicn_api_route_nhops_add_hton(msg);
-
-
-
- if(strcmp(input[0].data.string_val,"-1")){
-
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
-
-
- }else if(strcmp(input[1].data.string_val,"-1")){
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
+ SRP_LOG_DBG_MSG("hicn route nhops add received successfully");
+ vapi_msg_hicn_api_route_nhops_add *msg;
+ vapi_msg_hicn_api_route_nhops_add_reply *resp;
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg = vapi_alloc_hicn_api_route_nhops_add(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ if(strcmp(input[0].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,4);
+ }else if(strcmp(input[1].data.string_val,"-1")){
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.face_ids[0] = input[3].data.uint32_val;
- msg->payload.face_ids[1] = input[4].data.uint32_val;
- msg->payload.face_ids[2] = input[5].data.uint32_val;
- msg->payload.face_ids[3] = input[6].data.uint32_val;
- msg->payload.face_ids[4] = input[7].data.uint32_val;
- msg->payload.face_ids[5] = input[8].data.uint32_val;
- msg->payload.face_ids[6] = input[9].data.uint32_val;
- msg->payload.n_faces = input[10].data.uint8_val;
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)){
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- HICN_VPP_VAPI_RECV;
+ msg->payload.len = input[2].data.uint8_val;
+ msg->payload.face_ids[0] = input[3].data.uint32_val;
+ msg->payload.face_ids[1] = input[4].data.uint32_val;
+ msg->payload.face_ids[2] = input[5].data.uint32_val;
+ msg->payload.face_ids[3] = input[6].data.uint32_val;
+ msg->payload.face_ids[4] = input[7].data.uint32_val;
+ msg->payload.face_ids[5] = input[8].data.uint32_val;
+ msg->payload.face_ids[6] = input[9].data.uint32_val;
+ msg->payload.n_faces = input[10].data.uint8_val;
- vapi_msg_hicn_api_route_nhops_add_reply_ntoh(resp);
+ vapi_msg_hicn_api_route_nhops_add_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_route_nhops_add_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to del hicn route in vpp.
- */
+* @brief API to del hicn route in vpp.
+*/
static int hicn_route_del_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- SRP_LOG_DBG_MSG("hicn route del received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_route_del *msg;
- vapi_msg_hicn_api_route_del_reply *resp;
+ SRP_LOG_DBG_MSG("hicn route del received successfully");
+ vapi_msg_hicn_api_route_del *msg;
+ vapi_msg_hicn_api_route_del_reply *resp;
- msg = vapi_alloc_hicn_api_route_del(g_vapi_ctx_instance);
+ msg = vapi_alloc_hicn_api_route_del(g_vapi_ctx_instance);
- if(strcmp(input[0].data.string_val,"-1")){
+ if(strcmp(input[0].data.string_val,"-1")){
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B32);
- }else if(strcmp(input[1].data.string_val,"-1")){
-
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
-
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
-
+ }else if(strcmp(input[1].data.string_val,"-1")){
- msg->payload.len = input[2].data.uint8_val;
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
- vapi_msg_hicn_api_route_del_hton(msg);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
- HICN_VPP_VAPI_RECV;
+ msg->payload.len = input[2].data.uint8_val;
- vapi_msg_hicn_api_route_del_reply_ntoh(resp);
+ vapi_msg_hicn_api_route_del_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_route_del_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get face ip params in hicn in vpp.
- */
+* @brief API to get face ip params in hicn in vpp.
+*/
static int hicn_face_ip_params_get_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn face ip params get received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_face_ip_params_get *msg;
- vapi_msg_hicn_api_face_ip_params_get_reply *resp;
-
- msg = vapi_alloc_hicn_api_face_ip_params_get(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
-
- msg->payload.faceid = input[0].data.uint16_val;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- vapi_msg_hicn_api_face_ip_params_get_hton(msg);
+ SRP_LOG_DBG_MSG("hicn face ip params get received successfully");
+ vapi_msg_hicn_api_face_ip_params_get *msg;
+ vapi_msg_hicn_api_face_ip_params_get_reply *resp;
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg = vapi_alloc_hicn_api_face_ip_params_get(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- HICN_VPP_VAPI_RECV;
+ msg->payload.faceid = input[0].data.uint32_val;
- vapi_msg_hicn_api_face_ip_params_get_reply_ntoh(resp);
+ vapi_msg_hicn_api_face_ip_params_get_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_face_ip_params_get_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG("faceid(%d)-->intfc(%d)",input[0].data.uint32_val, resp->payload.swif);
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to get face ip params in hicn in vpp.
- */
+* @brief API to get face ip params in hicn in vpp.
+*/
static int hicn_punting_add_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn punting add received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_punting_add *msg;
- vapi_msg_hicn_api_punting_add_reply *resp;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- msg = vapi_alloc_hicn_api_punting_add(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
-
-
- if(strcmp(input[0].data.string_val,"-1")){
-
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
+ SRP_LOG_DBG_MSG("hicn punting add received successfully");
+ // allocate memory msg and resp
+ vapi_msg_hicn_api_punting_add *msg;
+ vapi_msg_hicn_api_punting_add_reply *resp;
+ msg = vapi_alloc_hicn_api_punting_add(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- }else if(strcmp(input[1].data.string_val,"-1")){
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp =(unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
+ if(strcmp(input[0].data.string_val,"-1")){
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ struct sockaddr_in sa;
+ // store this IP address in sa:
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B32);
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.swif = input[3].data.uint32_val;
+ }else if(strcmp(input[1].data.string_val,"-1")){
- vapi_msg_hicn_api_punting_add_hton(msg);
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp =(unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg->payload.len = input[2].data.uint8_val;
+ msg->payload.swif = input[3].data.uint32_val;
- HICN_VPP_VAPI_RECV;
- vapi_msg_hicn_api_punting_add_reply_ntoh(resp);
+ vapi_msg_hicn_api_punting_add_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_punting_add_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to del hicn route nhops in vpp.
- */
+* @brief API to del hicn route nhops in vpp.
+*/
static int hicn_route_nhops_del_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn route nhop del received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_route_nhop_del *msg;
- vapi_msg_hicn_api_route_nhop_del_reply *resp;
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- msg = vapi_alloc_hicn_api_route_nhop_del(g_vapi_ctx_instance);
- vapi_msg_hicn_api_route_nhop_del_hton(msg);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ SRP_LOG_DBG_MSG("hicn route nhop del received successfully");
+ // allocate memory msg and resp
+ vapi_msg_hicn_api_route_nhop_del *msg;
+ vapi_msg_hicn_api_route_nhop_del_reply *resp;
+ msg = vapi_alloc_hicn_api_route_nhop_del(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- if(strcmp(input[0].data.string_val,"-1")){
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
+ if(strcmp(input[0].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ // store this IP address in sa:
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B32);
- }else if(strcmp(input[1].data.string_val,"-1")){
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
+ }else if(strcmp(input[1].data.string_val,"-1")){
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.faceid = input[3].data.uint16_val;
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg->payload.len = input[2].data.uint8_val;
+ msg->payload.faceid = input[3].data.uint32_val;
- HICN_VPP_VAPI_RECV;
+ vapi_msg_hicn_api_route_nhop_del_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_route_nhop_del_reply_ntoh(resp);
- vapi_msg_hicn_api_route_nhop_del_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to del hicn punting in vpp.
- */
+* @brief API to del hicn punting in vpp.
+*/
static int hicn_punting_del_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- SRP_LOG_DBG_MSG("hicn punting del received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_punting_del *msg;
- vapi_msg_hicn_api_punting_del_reply *resp;
+ SRP_LOG_DBG_MSG("hicn punting del received successfully");
+ // allocate memory msg and resp
+ vapi_msg_hicn_api_punting_del *msg;
+ vapi_msg_hicn_api_punting_del_reply *resp;
- msg = vapi_alloc_hicn_api_punting_del(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
-
-
- if(strcmp(input[0].data.string_val,"-1")){
-
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.prefix[0],temp,4);
-
-
- }else if(strcmp(input[1].data.string_val,"-1")){
-
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.prefix[0],temp,8);
- memcpy(&msg->payload.prefix[1],temp+8,8);
-
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg = vapi_alloc_hicn_api_punting_del(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ if(strcmp(input[0].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B32);
+ }else if(strcmp(input[1].data.string_val,"-1")){
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.prefix[0],tmp,B64);
+ memcpy(&msg->payload.prefix[1],tmp+B64,B64);
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.swif = input[3].data.uint32_val;
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- vapi_msg_hicn_api_punting_del_hton(msg);
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg->payload.len = input[2].data.uint8_val;
+ msg->payload.swif = input[3].data.uint32_val;
- HICN_VPP_VAPI_RECV;
+ vapi_msg_hicn_api_punting_del_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_punting_del_reply_ntoh(resp);
- vapi_msg_hicn_api_punting_del_reply_ntoh(resp);
-
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to del hicn face ip in vpp.
- */
+* @brief API to del hicn face ip in vpp.
+*/
static int hicn_face_ip_del_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn face ip del received successfully");
- // allocate memory msg and resp
- vapi_msg_hicn_api_face_ip_del *msg;
- vapi_msg_hicn_api_face_ip_del_reply *resp;
-
- msg = vapi_alloc_hicn_api_face_ip_del(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- msg->payload.faceid = input[0].data.uint16_val;
-
- vapi_msg_hicn_api_face_ip_del_hton(msg);
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ SRP_LOG_DBG_MSG("hicn face ip del received successfully");
+ // allocate memory msg and resp
+ vapi_msg_hicn_api_face_ip_del *msg;
+ vapi_msg_hicn_api_face_ip_del_reply *resp;
- HICN_VPP_VAPI_RECV;
+ msg = vapi_alloc_hicn_api_face_ip_del(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ msg->payload.faceid = input[0].data.uint32_val;
- vapi_msg_hicn_api_face_ip_del_reply_ntoh(resp);
+ vapi_msg_hicn_api_face_ip_del_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_face_ip_del_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG_MSG("Successfully Done");
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
/**
- * @brief API to del hicn face ip in vpp.
- */
+* @brief API to del hicn face ip in vpp.
+*/
static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input,
- const size_t input_cnt, sr_val_t **output,
- size_t *output_cnt, void *private_ctx) {
-
- SRP_LOG_DBG_MSG("hicn face ip add received successfully");
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
- // allocate memory msg and resp
- vapi_msg_hicn_api_face_ip_add *msg;
- vapi_msg_hicn_api_face_ip_add_reply *resp;
-
- msg = vapi_alloc_hicn_api_face_ip_add(g_vapi_ctx_instance);
- SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
- if(strcmp(input[0].data.string_val,"-1")){
+ SRP_LOG_DBG_MSG("hicn face ip add received successfully");
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *) &sa.sin_addr.s_addr;
- memcpy(&msg->payload.local_addr[0],temp,4);
- }else if(strcmp(input[1].data.string_val,"-1")){
+ vapi_msg_hicn_api_face_ip_add *msg;
+ vapi_msg_hicn_api_face_ip_add_reply *resp;
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[1].data.string_val, dst);
- unsigned char * temp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.local_addr[0],temp,8);
- memcpy(&msg->payload.local_addr[1],temp+8,8);
+ msg = vapi_alloc_hicn_api_face_ip_add(g_vapi_ctx_instance);
+ SRP_LOG_DBG("msg id:%d",msg->header._vl_msg_id);
+ if(strcmp(input[0].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[0].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *) &sa.sin_addr.s_addr;
+ memcpy(&msg->payload.local_addr[0],tmp,B32);
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ }else if(strcmp(input[1].data.string_val,"-1")){
- if(strcmp(input[2].data.string_val,"-1")){
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[1].data.string_val, dst);
+ unsigned char * tmp = (unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.local_addr[0],tmp,B64);
+ memcpy(&msg->payload.local_addr[1],tmp+B64,B64);
- struct sockaddr_in sa;
- // store this IP address in sa:
- inet_pton(AF_INET, input[2].data.string_val, &(sa.sin_addr));
- unsigned char * temp = (unsigned char *)&sa.sin_addr.s_addr;
- memcpy(&msg->payload.remote_addr[0],temp,4);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
+ if(strcmp(input[2].data.string_val,"-1")){
- }else if(strcmp(input[3].data.string_val,"-1")){
+ struct sockaddr_in sa;
+ inet_pton(AF_INET, input[2].data.string_val, &(sa.sin_addr));
+ unsigned char * tmp = (unsigned char *)&sa.sin_addr.s_addr;
+ memcpy(&msg->payload.remote_addr[0],tmp,B32);
- void *dst = malloc(sizeof(struct in6_addr));
- inet_pton(AF_INET6, input[3].data.string_val, dst);
- unsigned char * temp =(unsigned char *) ((struct in6_addr *)dst)->s6_addr;
- memcpy(&msg->payload.remote_addr[0],temp,8);
- memcpy(&msg->payload.remote_addr[1],temp+8,8);
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
+ }else if(strcmp(input[3].data.string_val,"-1")){
- msg->payload.swif = input[4].data.uint32_val; // This is the idx number of interface
+ void *dst = malloc(sizeof(struct in6_addr));
+ inet_pton(AF_INET6, input[3].data.string_val, dst);
+ unsigned char * tmp =(unsigned char *) ((struct in6_addr *)dst)->s6_addr;
+ memcpy(&msg->payload.remote_addr[0],tmp,B64);
+ memcpy(&msg->payload.remote_addr[1],tmp+B64,B64);
- vapi_msg_hicn_api_face_ip_add_hton(msg);
+ }else{
+ SRP_LOG_DBG_MSG("Invalid local IP address");
+ return SR_ERR_OPERATION_FAILED;
+ }
- if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
- SRP_LOG_DBG_MSG("Sending msg to VPP failed");
- return SR_ERR_OPERATION_FAILED;
- }
+ msg->payload.swif = input[4].data.uint32_val; // This is the idx number of interface
- HICN_VPP_VAPI_RECV;
- vapi_msg_hicn_api_face_ip_add_reply_ntoh(resp);
+ vapi_msg_hicn_api_face_ip_add_hton(msg);
+ params_send(msg,resp);
+ vapi_msg_hicn_api_face_ip_add_reply_ntoh(resp);
- if(!resp->payload.retval){
- SRP_LOG_DBG("Successfully Done return faceid: %d",resp->payload.faceid);
- return SR_ERR_OK;
- }
+ if(!resp->payload.retval){
+ SRP_LOG_DBG_MSG("Successfully done");
+ return SR_ERR_OK;
+ }
- SRP_LOG_DBG_MSG("Operation Failed");
- return SR_ERR_OPERATION_FAILED;
+ SRP_LOG_DBG_MSG("Operation failed");
+ return SR_ERR_OPERATION_FAILED;
}
-/**
- * @brief Helper function for subscribing all hicn APIs.
- */
-int hicn_subscribe_events(sr_session_ctx_t *session,
- sr_subscription_ctx_t **subscription) {
- int rc = SR_ERR_OK;
- SRP_LOG_DBG_MSG("Subscriging hicn.");
-
-
- //Initializing the locks
- for (int i=0; i<NLOCKS; i++)
- Ticket_init(i,LOCK_INIT);
-
- //Initializing the buffer
- rc=init_buffer();
- if(rc!= SR_ERR_OK){
- SRP_LOG_DBG_MSG("Problem in initializing the buffers\n"); goto error;
- }
-
+static vapi_error_e
+hicn_api_face_stats_dump_cb(struct vapi_ctx_s *ctx, void *callback_ctx,
+ vapi_error_e rv, bool is_last,
+ vapi_payload_hicn_api_face_stats_details *reply)
+{
- // node state subscriptions
-
- rc = sr_rpc_subscribe(session, "/hicn:node-params-get", hicn_node_params_get_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription stat-get\n");
- goto error;
- }
-
+ static int counter = 0;
+/*
+ UNUSED(ctx); UNUSED(rv); UNUSED(is_last);
+ //struct elt **stackp;
+ ARG_CHECK2(VAPI_EINVAL, callback_ctx, reply);
+ stackp = (struct elt**) callback_ctx;
+ SRP_LOG_DBG("reply: %d:%d:%d", reply->faceid,reply->dtx_packets,reply->irx_packets);
+
+ vapi_payload_hicn_api_face_stats_details *passed;
+ ARG_CHECK2(VAPI_EINVAL, callback_ctx, reply);
+ passed = (vapi_payload_hicn_api_face_stats_details *) callback_ctx;
+ *passed = *reply;
+ SRP_LOG_DBG("reply %d", reply->faceid);*/
+
+ tlock(lfaces);
+ if (reply!=NULL){
+
+ current->face.faceid = reply->faceid;
+ current->face.intfc = 1;
+ current->face.irx_packets = reply->irx_packets;
+ current->face.irx_bytes = reply->irx_bytes;
+ current->face.itx_packets = reply->itx_packets;
+ current->face.itx_bytes = reply->itx_bytes;
+ current->face.drx_packets = reply->drx_packets;
+ current->face.drx_bytes = reply->drx_bytes;
+ current->face.dtx_packets = reply->dtx_packets;
+ current->face.dtx_bytes = reply->dtx_bytes;
+ //hicn_faces->nface++; // Increment the number of faces
+ counter++;
+ current = current->next;
+ //current->next = memalign(MEM_ALIGN, sizeof(hicn_faces_t));
+ SRP_LOG_DBG_MSG("---------Face------- \n");
+ SRP_LOG_DBG("reply %d", reply->faceid);
+ SRP_LOG_DBG("reply %d", reply->drx_bytes);
+ SRP_LOG_DBG("reply %d", reply->dtx_bytes);
+
+ }else
+ {
+ hicn_faces->nface=counter;
+ counter=0;
+ current=hicn_faces->next;
+ }
+ tunlock(lfaces);
+ return SR_ERR_OK;
+}
- // node state subscriptions
+/**
+* @brief API to del hicn face state details in vpp.
+*/
- rc = sr_rpc_subscribe(session, "/hicn:node-stat-get", hicn_node_stat_get_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription stat-get\n");
- goto error;
- }
+static int hicn_face_stats_details_cb(const char *xpath, const sr_val_t *input,
+ const size_t input_cnt, sr_val_t **output,
+ size_t *output_cnt, void *private_ctx) {
+ //struct elt* stack=NULL ;
+ SRP_LOG_DBG_MSG("hicn face state details received successfully");
+ vapi_payload_hicn_api_face_stats_details resp={0};
+ vapi_msg_hicn_api_face_stats_dump *msg;
+ msg = vapi_alloc_hicn_api_face_stats_dump(g_vapi_ctx_instance);
+ vapi_hicn_api_face_stats_dump(g_vapi_ctx_instance, msg, hicn_api_face_stats_dump_cb, &resp);
+ return SR_ERR_OK;
+}
- // strategies subscriptions
- rc = sr_rpc_subscribe(session, "/hicn:strategy-get", hicn_strategy_get_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription strategy-get\n");
- goto error;
- }
+/**
+* @brief Thread to update the state
+*/
+static void *state_thread(void *arg) {
- rc = sr_rpc_subscribe(session, "/hicn:strategies-get",
- hicn_strategies_get_cb, session, SR_SUBSCR_CTX_REUSE, subscription); if (rc
- != SR_ERR_OK) { SRP_LOG_DBG_MSG("Problem in subscription strategies-get\n"); goto error;
- }
+ // mapping can be retrieved by cpuinfo
+ int map = 0;
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(map, &cpuset);
- // route subscriptions
+ // pin the thread to a core
+ if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset))
+ {
+ SRP_LOG_DBG_MSG("Thread pining failed\n");
+ exit(1);
+ }
- rc = sr_rpc_subscribe(session, "/hicn:route-get", hicn_route_get_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription route-get\n");
- goto error;
- }
+ vapi_msg_hicn_api_node_stats_get *msg=NULL;
+ vapi_msg_hicn_api_node_stats_get_reply *resp=NULL;
+ enum locks_name state;
+ state=lstate;
- rc = sr_rpc_subscribe(session, "/hicn:route-del", hicn_route_del_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription route-del\n");
- goto error;
- }
+ while(true){
+ msg = vapi_alloc_hicn_api_node_stats_get(g_vapi_ctx_instance);
+ vapi_msg_hicn_api_node_stats_get_hton(msg);
- // route nhops subscriptions
+ if (VAPI_OK != vapi_send(g_vapi_ctx_instance, msg)) {
+ SRP_LOG_DBG_MSG("Sending msg to VPP failed");
+ // Here I should think about a recovery method
+ return NULL;
+ }
- rc = sr_rpc_subscribe(session, "/hicn:route-nhops-add",
- hicn_route_nhops_add_cb, session, SR_SUBSCR_CTX_REUSE, subscription); if (rc
- != SR_ERR_OK) { SRP_LOG_DBG_MSG("Problem in subscription route-get\n"); goto error;
- }
+ HICN_VPP_VAPI_RECV;
- rc = sr_rpc_subscribe(session, "/hicn:route-nhops-del",
- hicn_route_nhops_del_cb, session, SR_SUBSCR_CTX_REUSE, subscription); if (rc
- != SR_ERR_OK) { SRP_LOG_DBG_MSG("Problem in subscription route-nhops-del\n"); goto
- error;
- }
+ vapi_msg_hicn_api_node_stats_get_reply_ntoh(resp);
+ if(resp->payload.retval){
+ SRP_LOG_DBG_MSG("Error updating state");
+ // Here I should think about a recovery method
+ return NULL;
+ }
- // face ip subscriptions
+ //vapi_payload_hicn_api_face_stats_details resp_dump={0};
+ vapi_msg_hicn_api_face_stats_dump *msg;
+ msg = vapi_alloc_hicn_api_face_stats_dump(g_vapi_ctx_instance);
+ vapi_hicn_api_face_stats_dump(g_vapi_ctx_instance, msg, hicn_api_face_stats_dump_cb, current);
- rc = sr_rpc_subscribe(session, "/hicn:face-ip-params-get",
- hicn_face_ip_params_get_cb, session, SR_SUBSCR_CTX_REUSE, subscription); if
- (rc != SR_ERR_OK) { SRP_LOG_DBG_MSG("Problem in subscription face-ip-params-get\n");
- goto error;
- }
+ tlock(state);
+ state_cache(resp);
+ SRP_LOG_DBG_MSG("state updated");
+ tunlock(state);
+ sleep(1);
+ }
+ return NULL;
+}
- rc = sr_rpc_subscribe(session, "/hicn:face-ip-add", hicn_face_ip_add_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription face-ip-add\n");
- goto error;
- }
+/**
+* @brief helper function for subscribing all hicn APIs.
+*/
+int hicn_subscribe_events(sr_session_ctx_t *session,
+ sr_subscription_ctx_t **subscription) {
+ int rc = SR_ERR_OK;
+ SRP_LOG_DBG_MSG("Subscriging hicn.");
- rc = sr_rpc_subscribe(session, "/hicn:face-ip-del", hicn_face_ip_del_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription face-ip-del\n");
- goto error;
- }
+ pthread_t state_tid;
+ rc = pthread_create((pthread_t *)&state_tid, NULL, state_thread, NULL);
+ if (rc != 0) {
+ SRP_LOG_DBG_MSG("Error making hicn state thread");
+ return SR_ERR_OPERATION_FAILED;
+ }
+ SRP_LOG_DBG_MSG("State thread created successfully.");
- // punting subscriptions
+ //Initializing the locks
+ for (int i=0; i<NLOCKS; i++)
+ ticket_init(i,LOCK_INIT);
- rc = sr_rpc_subscribe(session, "/hicn:punting-add", hicn_punting_add_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription punting-add\n");
- goto error;
- }
+ //Initializing the buffer
+ rc=init_buffer();
+ if(rc!= SR_ERR_OK){
+ SRP_LOG_DBG_MSG("Problem in initializing the buffers\n");
+ goto error;
+ }
- rc = sr_rpc_subscribe(session, "/hicn:punting-del", hicn_punting_del_cb,
- session, SR_SUBSCR_CTX_REUSE, subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription punting-del\n");
- goto error;
- }
+ SRP_LOG_DBG_MSG("buffer initialized successfully.");
- rc = sr_subtree_change_subscribe(
- session, "/hicn:hicn-conf", hicn_node_params_set_cb, g_vapi_ctx_instance,
- 100, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
- if (SR_ERR_OK != rc) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-conf\n");
- goto error;
- }
- // subscribe as hicn state data provider
- rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/states",
- hicn_state_states_cb, NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/states\n");
- goto error;
- }
+ rc=init_face_pool(current);
+ if(rc!= SR_ERR_OK){
+ SRP_LOG_DBG_MSG("Problem in initializing the face pool\n");
+ goto error;
+ }
- rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/strategy",
- hicn_state_strategy_cb, NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/strategy\n");
- goto error;
- }
+ SRP_LOG_DBG_MSG("face pool created successfully.");
+ // node state subscriptions
- rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/strategies",
- hicn_state_strategies_cb, NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/strategies\n");
- goto error;
- }
+ rc = sr_rpc_subscribe(session, "/hicn:node-params-get", hicn_node_params_get_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription node-params-get\n");
+ goto error;
+ }
- rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/route",
- hicn_state_route_cb, NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/route\n");
- goto error;
- }
+ // node state subscriptions
+ rc = sr_rpc_subscribe(session, "/hicn:node-stat-get", hicn_node_stat_get_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription stat-get\n");
+ goto error;
+ }
- rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/face-ip-params",
- hicn_state_face_ip_params_cb, NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/face-ip-params\n");
- goto error;
- }
+ // strategies subscriptions
+ rc = sr_rpc_subscribe(session, "/hicn:strategy-get", hicn_strategy_get_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription strategy-get\n");
+ goto error;
+ }
- SRP_LOG_INF_MSG("hicn plugin initialized successfully.");
- return SR_ERR_OK;
+ rc = sr_rpc_subscribe(session, "/hicn:strategies-get",
+ hicn_strategies_get_cb, session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc!= SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription strategies-get\n");
+ goto error;
+ }
+
+ // route subscriptions
+
+ rc = sr_rpc_subscribe(session, "/hicn:route-get", hicn_route_get_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription route-get\n");
+ goto error;
+ }
+
+ rc = sr_rpc_subscribe(session, "/hicn:route-del", hicn_route_del_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription route-del\n");
+ goto error;
+ }
+
+
+ // route nhops subscriptions
+
+ rc = sr_rpc_subscribe(session, "/hicn:route-nhops-add",
+ hicn_route_nhops_add_cb, session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc!= SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription route-nhops-add\n");
+ goto error;
+ }
+
+ rc = sr_rpc_subscribe(session, "/hicn:route-nhops-del",
+ hicn_route_nhops_del_cb, session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc!= SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription route-nhops-del\n");
+ goto error;
+ }
+
+
+ // face ip subscriptions
+
+ rc = sr_rpc_subscribe(session, "/hicn:face-ip-params-get",
+ hicn_face_ip_params_get_cb, session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription face-ip-params-get\n");
+ goto error;
+ }
+
+
+ rc = sr_rpc_subscribe(session, "/hicn:face-ip-add", hicn_face_ip_add_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription face-ip-add\n");
+ goto error;
+ }
+
+ rc = sr_rpc_subscribe(session, "/hicn:face-ip-del", hicn_face_ip_del_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription face-ip-del\n");
+ goto error;
+ }
+
+ // punting subscriptions
+
+ rc = sr_rpc_subscribe(session, "/hicn:punting-add", hicn_punting_add_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription punting-add\n");
+ goto error;
+ }
+
+ rc = sr_rpc_subscribe(session, "/hicn:punting-del", hicn_punting_del_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription punting-del\n");
+ goto error;
+ }
+
+
+ rc = sr_rpc_subscribe(session, "/hicn:face-stats-details", hicn_face_stats_details_cb,
+ session, SR_SUBSCR_CTX_REUSE, subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription face-stats-details\n");
+ goto error;
+ }
+
+ // subscripe for edit-config
+ rc = sr_subtree_change_subscribe(
+ session, "/hicn:hicn-conf", hicn_node_params_set_cb, g_vapi_ctx_instance,
+ 0, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
+ if (SR_ERR_OK != rc) {
+ SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-conf\n");
+ goto error;
+ }
+
+ // subscribe as hicn state data provider
+ rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/states",
+ hicn_state_states_cb, NULL, SR_SUBSCR_CTX_REUSE,
+ subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/states\n");
+ goto error;
+ }
+
+ rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/strategies",
+ hicn_state_strategies_cb, NULL, SR_SUBSCR_CTX_REUSE,
+ subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/strategies\n");
+ goto error;
+ }
+
+
+ rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/routes",
+ hicn_state_route_cb, NULL, SR_SUBSCR_CTX_REUSE,
+ subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/routes\n");
+ goto error;
+ }
+
+
+ rc = sr_dp_get_items_subscribe(session, "/hicn:hicn-state/faces",
+ hicn_state_faces_cb, NULL, SR_SUBSCR_CTX_REUSE,
+ subscription);
+ if (rc != SR_ERR_OK) {
+ SRP_LOG_DBG_MSG("Problem in subscription /hicn:hicn-state/faces\n");
+ goto error;
+ }
+
+
+ SRP_LOG_INF_MSG("hicn plugin initialized successfully.");
+ return SR_ERR_OK;
error:
- SRP_LOG_ERR_MSG("Error by initialization of the hicn plugin.");
- sr_plugin_cleanup_cb(session, &g_vapi_ctx_instance);
- return rc;
+ SRP_LOG_ERR_MSG("Error by initialization of the hicn plugin.");
+ sr_plugin_cleanup_cb(session, &g_vapi_ctx_instance);
+ return rc;
} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h b/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h
index 1f5acabc5..6cb5d2710 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h
@@ -1,25 +1,26 @@
/*
- * Copyright (c) 2019 Cisco 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.
- */
+* Copyright (c) 2019 Cisco 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_HICN_H__
#define __IETF_HICN_H__
#include "../hicn_vpp_comm.h"
-
#define MEM_ALIGN 4096
+#define B32 4
+#define B64 8
// Number of locks is equal to number of nodes in hicn-state
// It is a coarse grain approach later can be changed to fine grained
@@ -28,63 +29,127 @@
#define LOCK_INIT 0
-enum locks_name {lstate, lstrategy, lstrategies, lroute, lface_ip_params};
+enum locks_name {lstate, lstrategy, lstrategies, lroute, lfaces};
#define NSTATE_LEAVES 15
#define NSTRATEGY_LEAVES 1
#define NSTRATEGIES_LEAVES 2
#define NROUTE_LEAVES 2
-#define NFACE_IP_PARAMS_LEAVES 3
+#define MAX_FACE_POOL 100
+#define FACES_CHILDREN 9 /*this is the number of children of each leave*/
+
+#define params_send( msg , resp ) \
+{ \
+ if (VAPI_OK != vapi_send(g_vapi_ctx_instance, (msg))) { \
+ SRP_LOG_DBG_MSG("Sending msg to VPP failed"); \
+ return SR_ERR_OPERATION_FAILED; \
+ } \
+ HICN_VPP_VAPI_RECV; \
+};
typedef struct __attribute__ ((__packed__)) {
- uint64_t pkts_processed;
- uint64_t pkts_interest_count;
- uint64_t pkts_data_count;
- uint64_t pkts_from_cache_count;
- uint64_t pkts_no_pit_count;
- uint64_t pit_expired_count;
- uint64_t cs_expired_count;
- uint64_t cs_lru_count;
- uint64_t pkts_drop_no_buf;
- uint64_t interests_aggregated;
- uint64_t interests_retx;
- uint64_t interests_hash_collision;
- uint64_t pit_entries_count;
- uint64_t cs_entries_count;
- uint64_t cs_entries_ntw_count;
- int32_t retval;
+
+ int32_t retval;
+ uint64_t pkts_processed;
+ uint64_t pkts_interest_count;
+ uint64_t pkts_data_count;
+ uint64_t pkts_from_cache_count;
+ uint64_t pkts_no_pit_count;
+ uint64_t pit_expired_count;
+ uint64_t cs_expired_count;
+ uint64_t cs_lru_count;
+ uint64_t pkts_drop_no_buf;
+ uint64_t interests_aggregated;
+ uint64_t interests_retx;
+ uint64_t interests_hash_collision;
+ uint64_t pit_entries_count;
+ uint64_t cs_entries_count;
+ uint64_t cs_entries_ntw_count;
} hicn_state_t;
typedef struct __attribute__ ((__packed__)) {
- uint8_t description[200];
- int32_t retval;
+ uint8_t description[200];
+ int32_t retval;
} hicn_strategy_t;
typedef struct __attribute__ ((__packed__)) {
- uint8_t n_strategies;
- uint32_t strategy_id[256];
- int32_t retval;
+ uint8_t n_strategies;
+ uint32_t strategy_id[256];
+ int32_t retval;
} hicn_strategies_t;
typedef struct __attribute__ ((__packed__)) {
- uint16_t faceids[1000];
- uint32_t strategy_id;
- int32_t retval;
+ uint32_t faceids[1000];
+ uint32_t strategy_id;
+ int32_t retval;
} hicn_route_t;
typedef struct __attribute__ ((__packed__)) {
- uint64_t nh_addr[2];
- uint32_t swif;
- uint32_t flags;
- int32_t retval;
+ uint64_t nh_addr[2];
+ uint32_t swif;
+ uint32_t flags;
+ int32_t retval;
} hicn_face_ip_params_t;
+typedef struct __attribute__ ((__packed__)) {
+ uint32_t faceid;
+ uint32_t intfc;
+ uint64_t irx_packets;
+ uint64_t irx_bytes;
+ uint64_t itx_packets;
+ uint64_t itx_bytes;
+ uint64_t drx_packets;
+ uint64_t drx_bytes;
+ uint64_t dtx_packets;
+ uint64_t dtx_bytes;
+} hicn_face_inf_t;
+
+
+struct hicn_faces_s{
+ hicn_face_inf_t face;
+ struct hicn_faces_s * next;
+};
+
+typedef struct __attribute__ ((__packed__)) {
+ uint32_t nface;
+ struct hicn_faces_s * next;
+} hicn_faces_t;
+
+// typedef struct __attribute__ ((__packed__)) {
+// int32_t retval;
+// uint32_t faceid;
+// uint64_t irx_packets;
+// uint64_t irx_bytes;
+// uint64_t itx_packets;
+// uint64_t itx_bytes;
+// uint64_t drx_packets;
+// uint64_t drx_bytes;
+// uint64_t dtx_packets;
+// uint64_t dtx_bytes;
+// } hicn_face_stat_t;
+
+// typedef struct __attribute__ ((__packed__)) {
+
+// int32_t retval;
+// uint32_t faceid;
+// uint64_t irx_packets;
+// uint64_t irx_bytes;
+// uint64_t itx_packets;
+// uint64_t itx_bytes;
+// uint64_t drx_packets;
+// uint64_t drx_bytes;
+// uint64_t dtx_packets;
+// uint64_t dtx_bytes;
+
+// } hicn_state_face_t;
+
+
int hicn_subscribe_events(sr_session_ctx_t *session,
- sr_subscription_ctx_t **subscription);
+ sr_subscription_ctx_t **subscription);
-#endif /* __IETF_HICN_H__ */ \ No newline at end of file
+#endif /* __IETF_HICN_H__ */
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c b/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c
index d870adf75..d27ae6492 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c
@@ -1,7 +1,7 @@
#include"tlock.h"
-void Ticket_init ( int Lock_Number , long int init ){
+void ticket_init ( int Lock_Number , long int init ){
//__atomic_store( &En[Lock_Number] , &init , __ATOMIC_SEQ_CST );
//__atomic_store( &De[Lock_Number] , &init , __ATOMIC_SEQ_CST );
@@ -9,13 +9,13 @@ En[Lock_Number]=init;
De[Lock_Number]=init;
}
-void Ticket_Lock(int Lock_Number ){
+void tlock(int Lock_Number ){
int my_ticket = __sync_fetch_and_add(&En[Lock_Number] , 1 );
while ( my_ticket != De[ Lock_Number ] ) {};
}
-void Ticket_Unlock(int Lock_Number ){
+void tunlock(int Lock_Number ){
De[Lock_Number]++;
}
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h b/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h
index 36698115a..8cdfc8b5b 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h
+++ b/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h
@@ -24,8 +24,8 @@
volatile long int En[MAX_LOCK_SIZE] , De[MAX_LOCK_SIZE] ; // For Ticket Algorithm
-void Ticket_init ( int Lock_Number , long int init );
-void Ticket_Lock(int Lock_Number );
-void Ticket_Unlock(int Lock_Number );
+void ticket_init ( int Lock_Number , long int init );
+void tlock(int Lock_Number );
+void tunlock(int Lock_Number );
#endif /* __IETF_HICN_H__ */ \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/startup.xml b/utils/sysrepo-plugins/hicn-plugin/plugin/yang/startup.xml
deleted file mode 100644
index f88e13ea2..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/startup.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<hicn-conf xmlns="urn:sysrepo:hicn">
-<params>
- <enable_disable>false</enable_disable>
- <pit_max_size>-1</pit_max_size>
- <cs_max_size>-1</cs_max_size>
- <cs_reserved_app>-1</cs_reserved_app>
- <pit_dflt_lifetime_sec>-1</pit_dflt_lifetime_sec>
- <pit_max_lifetime_sec>-1</pit_max_lifetime_sec>
- <pit_min_lifetime_sec>-1</pit_min_lifetime_sec>
-</params>
-</hicn-conf> \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/model/hicn.yang b/utils/sysrepo-plugins/yang/hicn/hicn.yang
index eddf31c98..e5bdca420 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/model/hicn.yang
+++ b/utils/sysrepo-plugins/yang/hicn/hicn.yang
@@ -2,7 +2,7 @@ module hicn {
namespace "urn:sysrepo:hicn";
prefix hcn;
-revision 2019-02-06 {
+revision 2019-04-25 {
description "Initial revision.";
}
@@ -166,7 +166,7 @@ leaf len {
leaf faceid {
description "A Face ID to the next hop forwarder for the specified prefix.";
- type uint16;
+ type uint32;
}
}
@@ -338,7 +338,62 @@ grouping states-reply {
}
+grouping face-stats-reply {
+ list face{
+ key faceid;
+ leaf faceid {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint32;
+ }
+
+ leaf intfc {
+ description "This is the idx number of the faceid.";
+ type uint32;
+ }
+
+ leaf irx_packets {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+ leaf irx_bytes {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+ leaf itx_packets {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+ leaf itx_bytes {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+
+ leaf drx_packets {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+ leaf drx_bytes {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+ leaf dtx_packets {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+
+
+ leaf dtx_bytes {
+ description "Upper bound on PIT entry lifetime, otherwise -1 to assign default value .";
+ type uint64;
+ }
+ }
+}
grouping strategy-reply {
@@ -352,7 +407,7 @@ grouping route-reply {
leaf faceids {
description "Enable / disable ICN forwarder in VPP.";
- type uint16;
+ type uint32;
}
@@ -374,32 +429,10 @@ grouping strategies-reply {
}
-grouping face-ip-params-reply {
-
- leaf nh_addr {
- description "Enable / disable ICN forwarder in VPP.";
- type uint64;
- }
-
- leaf swif {
- description "compile-time plugin features.";
- type uint32;
- }
-
- leaf flags {
- description "compile-time plugin features.";
- type uint32;
- }
-
-}
-
-
/* Hicn configuration */
container hicn-conf {
- config true;
description "config data container for the hicn-vpp.";
-
container params{
uses params;
}
@@ -415,17 +448,14 @@ container hicn-state {
container states{
uses states-reply;
}
- container strategy{
- uses strategy-reply;
- }
- container route{
+ container routes{
uses route-reply;
}
container strategies{
uses strategies-reply;
}
- container face-ip-params{
- uses face-ip-params-reply;
+ container faces{
+ uses face-stats-reply;
}
}
@@ -497,7 +527,7 @@ rpc face-ip-params-get {
input {
leaf faceid {
description "Face to be retrieved .";
- type uint16;
+ type uint32;
}
}
}
@@ -514,7 +544,7 @@ rpc face-ip-del {
input {
leaf faceid {
description "Face to be deleted .";
- type uint16;
+ type uint32;
}
}
}
@@ -533,4 +563,9 @@ rpc punting-del {
}
}
+rpc face-stats-details {
+ description "Operation to take stat per face.";
}
+
+
+} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/controler_rpcs_instances.xml b/utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml
index f497f0193..db79fd4ef 100644
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/yang/controler_rpcs_instances.xml
+++ b/utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml
@@ -73,4 +73,6 @@
<ip6>-1</ip6>
<len>24</len>
<swif>0</swif>
-</punting-del> \ No newline at end of file
+</punting-del>
+
+<face-stats-details xmlns="urn:sysrepo:hicn"/>
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/yang/startup.xml b/utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml
index f88e13ea2..f88e13ea2 100644
--- a/utils/sysrepo-plugins/hicn-light/plugin/yang/startup.xml
+++ b/utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml
diff --git a/utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang b/utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang
new file mode 100644
index 000000000..4138ba46e
--- /dev/null
+++ b/utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang
@@ -0,0 +1,1704 @@
+module iana-if-type {
+
+ yang-version 1;
+
+ 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
+ 4676 Admiralty Way, Suite 330
+ Marina del Rey, CA 90292
+
+ Tel: +1 310 823 9358
+ <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 "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.";
+ }
+ } // module iana-if-type
diff --git a/utils/sysrepo-plugins/yang/ietf/ietf-interfaces.yang b/utils/sysrepo-plugins/yang/ietf/ietf-interfaces.yang
new file mode 100644
index 000000000..f66c205ce
--- /dev/null
+++ b/utils/sysrepo-plugins/yang/ietf/ietf-interfaces.yang
@@ -0,0 +1,1123 @@
+module ietf-interfaces {
+ yang-version 1.1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
+ prefix if;
+
+ import ietf-yang-types {
+ prefix yang;
+ }
+
+ organization
+ "IETF NETMOD (Network Modeling) Working Group";
+
+ contact
+ "WG Web: <https://datatracker.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ Editor: Martin Bjorklund
+ <mailto:mbj@tail-f.com>";
+
+ description
+ "This module contains a collection of YANG definitions for
+ managing network interfaces.
+
+ Copyright (c) 2018 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
+ (https://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 8343; see
+ the RFC itself for full legal notices.";
+
+ revision 2018-02-20 {
+ description
+ "Updated to support NMDA.";
+ reference
+ "RFC 8343: A YANG Data Model for Interface Management";
+ }
+
+ revision 2014-05-08 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 7223: A YANG Data Model for Interface Management";
+ }
+
+ /*
+ * Typedefs
+ */
+
+ typedef interface-ref {
+ type leafref {
+ path "/if:interfaces/if:interface/if:name";
+ }
+ description
+ "This type is used by data models that need to reference
+ interfaces.";
+ }
+
+ /*
+ * Identities
+ */
+
+ identity interface-type {
+ description
+ "Base identity from which specific interface types are
+ derived.";
+ }
+
+ /*
+ * Features
+ */
+
+ 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";
+ }
+
+ /*
+ * Data nodes
+ */
+
+ container interfaces {
+ description
+ "Interface parameters.";
+
+ list interface {
+ key "name";
+
+ description
+ "The list of interfaces on the device.
+
+ The status of an interface is available in this list in the
+ operational state. 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 operational
+ state. If the configuration of a user-controlled interface
+ cannot be used by the system, the configured interface is
+ not instantiated in the operational state.
+
+ System-controlled interfaces created by the system are
+ always present in this list in the operational state,
+ whether or not they are configured.";
+
+ 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.
+
+ If a client tries to create configuration for a
+ system-controlled interface that is not present in the
+ operational state, 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 Network Configuration
+ Protocol (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
+ operational state.
+
+ 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 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
+ configuration.";
+ 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 intended configuration 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 intended configuration are
+ reflected in ifAdminStatus.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
+ }
+
+ leaf link-up-down-trap-enable {
+ if-feature if-mib;
+ type enumeration {
+ enum enabled {
+ value 1;
+ description
+ "The device will generate linkUp/linkDown SNMP
+ notifications for this interface.";
+ }
+ enum disabled {
+ value 2;
+ description
+ "The device will not generate linkUp/linkDown SNMP
+ notifications for this interface.";
+ }
+ }
+ 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";
+ }
+
+ 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.";
+ }
+ }
+ config false;
+ 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).";
+ }
+ }
+ config false;
+ 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;
+ config false;
+ 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";
+ }
+ config false;
+ 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;
+ config false;
+ 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-ref;
+ config false;
+ 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-ref;
+ config false;
+
+ 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";
+ config false;
+ 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 {
+ config false;
+ 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";
+ }
+ }
+
+ }
+ }
+
+ /*
+ * Legacy typedefs
+ */
+
+ typedef interface-state-ref {
+ type leafref {
+ path "/if:interfaces-state/if:interface/if:name";
+ }
+ status deprecated;
+ description
+ "This type is used by data models that need to reference
+ the operationally present interfaces.";
+ }
+
+ /*
+ * Legacy operational state data nodes
+ */
+
+ container interfaces-state {
+ config false;
+ status deprecated;
+ description
+ "Data nodes for the operational state of interfaces.";
+
+ list interface {
+ key "name";
+ status deprecated;
+
+ description
+ "The list of interfaces on the device.
+
+ System-controlled interfaces created by the system are
+ always present in this list, whether or not they are
+ configured.";
+
+ leaf name {
+ type string;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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";
+ status deprecated;
+ 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 {
+ status deprecated;
+ description
+ "A collection of interface-related statistics objects.";
+
+ leaf discontinuity-time {
+ type yang:date-and-time;
+ mandatory true;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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;
+ status deprecated;
+ 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";
+ }
+ }
+ }
+ }
+}
diff --git a/utils/sysrepo-plugins/yang/ietf/ietf-ip@2014-06-16.yang b/utils/sysrepo-plugins/yang/ietf/ietf-ip@2014-06-16.yang
new file mode 100644
index 000000000..79606cc07
--- /dev/null
+++ b/utils/sysrepo-plugins/yang/ietf/ietf-ip@2014-06-16.yang
@@ -0,0 +1,742 @@
+module ietf-ip {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-ip";
+
+ prefix ip;
+
+ import ietf-interfaces {
+ prefix if;
+ }
+ import ietf-inet-types {
+ prefix inet;
+ }
+ 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
+ configuring IP implementations.
+
+ 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 7277; see
+ the RFC itself for full legal notices.";
+
+ revision "2014-06-16" {
+ description "Initial revision.";
+ reference
+ "RFC 7277: A YANG Data Model for IP Management";
+
+ }
+
+
+ feature ipv4-non-contiguous-netmasks {
+ description
+ "Indicates support for configuring non-contiguous
+ subnet masks.";
+ }
+
+ feature ipv6-privacy-autoconf {
+ description
+ "Indicates support for Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6.";
+ reference
+ "RFC 4941: Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6";
+
+ }
+
+ typedef ip-address-origin {
+ type enumeration {
+ enum "other" {
+ value 0;
+ description
+ "None of the following.";
+ }
+ enum "static" {
+ value 1;
+ description
+ "Indicates that the address has been statically
+ configured - for example, using NETCONF or a Command Line
+ Interface.";
+ }
+ enum "dhcp" {
+ value 2;
+ description
+ "Indicates an address that has been assigned to this
+ system by a DHCP server.";
+ }
+ enum "link-layer" {
+ value 3;
+ description
+ "Indicates an address created by IPv6 stateless
+ autoconfiguration that embeds a link-layer address in its
+ interface identifier.";
+ }
+ enum "random" {
+ value 4;
+ description
+ "Indicates an address chosen by the system at
+
+ random, e.g., an IPv4 address within 169.254/16, an
+ RFC 4941 temporary address, or an RFC 7217 semantically
+ opaque address.";
+ reference
+ "RFC 4941: Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6
+ RFC 7217: A Method for Generating Semantically Opaque
+ Interface Identifiers with IPv6 Stateless
+ Address Autoconfiguration (SLAAC)";
+
+ }
+ }
+ description
+ "The origin of an address.";
+ }
+
+ typedef neighbor-origin {
+ type enumeration {
+ enum "other" {
+ value 0;
+ description
+ "None of the following.";
+ }
+ enum "static" {
+ value 1;
+ description
+ "Indicates that the mapping has been statically
+ configured - for example, using NETCONF or a Command Line
+ Interface.";
+ }
+ enum "dynamic" {
+ value 2;
+ description
+ "Indicates that the mapping has been dynamically resolved
+ using, e.g., IPv4 ARP or the IPv6 Neighbor Discovery
+ protocol.";
+ }
+ }
+ description
+ "The origin of a neighbor entry.";
+ }
+
+ augment /if:interfaces/if:interface {
+ description
+ "Parameters for configuring IP on interfaces.
+
+ If an interface is not capable of running IP, the server
+ must not allow the client to configure these parameters.";
+ container ipv4 {
+ presence
+ "Enables IPv4 unless the 'enabled' leaf
+ (which defaults to 'true') is set to 'false'";
+ description
+ "Parameters for the IPv4 address family.";
+ leaf enabled {
+ type boolean;
+ default 'true';
+ description
+ "Controls whether IPv4 is enabled or disabled on this
+ interface. When IPv4 is enabled, this interface is
+ connected to an IPv4 stack, and the interface can send
+ and receive IPv4 packets.";
+ }
+
+ leaf forwarding {
+ type boolean;
+ default 'false';
+ description
+ "Controls IPv4 packet forwarding of datagrams received by,
+ but not addressed to, this interface. IPv4 routers
+ forward datagrams. IPv4 hosts do not (except those
+ source-routed via the host).";
+ }
+
+ leaf mtu {
+ type uint16 {
+ range "68..max";
+ }
+ units "octets";
+ description
+ "The size, in octets, of the largest IPv4 packet that the
+ interface will send and receive.
+
+ The server may restrict the allowed values for this leaf,
+ depending on the interface's type.
+
+ If this leaf is not configured, the operationally used MTU
+ depends on the interface's type.";
+ reference
+ "RFC 791: Internet Protocol";
+
+ }
+
+ list address {
+ key "ip";
+ description
+ "The list of configured IPv4 addresses on the interface.";
+ leaf ip {
+ type inet:ipv4-address-no-zone;
+ description
+ "The IPv4 address on the interface.";
+ }
+
+ choice subnet {
+ mandatory true;
+ description
+ "The subnet can be specified as a prefix-length, or,
+ if the server supports non-contiguous netmasks, as
+ a netmask.";
+ leaf prefix-length {
+ type uint8 {
+ range "0..32";
+ }
+ description
+ "The length of the subnet prefix.";
+ }
+ leaf netmask {
+ if-feature ipv4-non-contiguous-netmasks;
+ type yang:dotted-quad;
+ description
+ "The subnet specified as a netmask.";
+ }
+ } // choice subnet
+ } // list address
+
+ list neighbor {
+ key "ip";
+ description
+ "A list of mappings from IPv4 addresses to
+ link-layer addresses.
+
+ Entries in this list are used as static entries in the
+ ARP Cache.";
+ reference
+ "RFC 826: An Ethernet Address Resolution Protocol";
+
+ leaf ip {
+ type inet:ipv4-address-no-zone;
+ description
+ "The IPv4 address of the neighbor node.";
+ }
+
+ leaf link-layer-address {
+ type yang:phys-address;
+ mandatory true;
+ description
+ "The link-layer address of the neighbor node.";
+ }
+ } // list neighbor
+ } // container ipv4
+
+ container ipv6 {
+ presence
+ "Enables IPv6 unless the 'enabled' leaf
+ (which defaults to 'true') is set to 'false'";
+ description
+ "Parameters for the IPv6 address family.";
+ leaf enabled {
+ type boolean;
+ default 'true';
+ description
+ "Controls whether IPv6 is enabled or disabled on this
+ interface. When IPv6 is enabled, this interface is
+ connected to an IPv6 stack, and the interface can send
+ and receive IPv6 packets.";
+ }
+
+ leaf forwarding {
+ type boolean;
+ default 'false';
+ description
+ "Controls IPv6 packet forwarding of datagrams received by,
+ but not addressed to, this interface. IPv6 routers
+ forward datagrams. IPv6 hosts do not (except those
+ source-routed via the host).";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+ Section 6.2.1, IsRouter";
+
+ }
+
+ leaf mtu {
+ type uint32 {
+ range "1280..max";
+ }
+ units "octets";
+ description
+ "The size, in octets, of the largest IPv6 packet that the
+ interface will send and receive.
+
+ The server may restrict the allowed values for this leaf,
+ depending on the interface's type.
+
+ If this leaf is not configured, the operationally used MTU
+ depends on the interface's type.";
+ reference
+ "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+ Section 5";
+
+ }
+
+ list address {
+ key "ip";
+ description
+ "The list of configured IPv6 addresses on the interface.";
+ leaf ip {
+ type inet:ipv6-address-no-zone;
+ description
+ "The IPv6 address on the interface.";
+ }
+
+ leaf prefix-length {
+ type uint8 {
+ range "0..128";
+ }
+ mandatory true;
+ description
+ "The length of the subnet prefix.";
+ }
+ } // list address
+
+ list neighbor {
+ key "ip";
+ description
+ "A list of mappings from IPv6 addresses to
+ link-layer addresses.
+
+ Entries in this list are used as static entries in the
+ Neighbor Cache.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
+
+ leaf ip {
+ type inet:ipv6-address-no-zone;
+ description
+ "The IPv6 address of the neighbor node.";
+ }
+
+ leaf link-layer-address {
+ type yang:phys-address;
+ mandatory true;
+ description
+ "The link-layer address of the neighbor node.";
+ }
+ } // list neighbor
+
+ leaf dup-addr-detect-transmits {
+ type uint32;
+ default '1';
+ description
+ "The number of consecutive Neighbor Solicitation messages
+ sent while performing Duplicate Address Detection on a
+ tentative address. A value of zero indicates that
+ Duplicate Address Detection is not performed on
+ tentative addresses. A value of one indicates a single
+ transmission with no follow-up retransmissions.";
+ reference
+ "RFC 4862: IPv6 Stateless Address Autoconfiguration";
+
+ }
+
+ container autoconf {
+ description
+ "Parameters to control the autoconfiguration of IPv6
+ addresses, as described in RFC 4862.";
+ reference
+ "RFC 4862: IPv6 Stateless Address Autoconfiguration";
+
+ leaf create-global-addresses {
+ type boolean;
+ default 'true';
+ description
+ "If enabled, the host creates global addresses as
+ described in RFC 4862.";
+ reference
+ "RFC 4862: IPv6 Stateless Address Autoconfiguration
+ Section 5.5";
+
+ }
+
+ leaf create-temporary-addresses {
+ if-feature ipv6-privacy-autoconf;
+ type boolean;
+ default 'false';
+ description
+ "If enabled, the host creates temporary addresses as
+ described in RFC 4941.";
+ reference
+ "RFC 4941: Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6";
+
+ }
+
+ leaf temporary-valid-lifetime {
+ if-feature ipv6-privacy-autoconf;
+ type uint32;
+ units "seconds";
+ default '604800';
+ description
+ "The time period during which the temporary address
+ is valid.";
+ reference
+ "RFC 4941: Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6
+ - TEMP_VALID_LIFETIME";
+
+ }
+
+ leaf temporary-preferred-lifetime {
+ if-feature ipv6-privacy-autoconf;
+ type uint32;
+ units "seconds";
+ default '86400';
+ description
+ "The time period during which the temporary address is
+ preferred.";
+ reference
+ "RFC 4941: Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6
+ - TEMP_PREFERRED_LIFETIME";
+
+ }
+ } // container autoconf
+ } // container ipv6
+ }
+
+ augment /if:interfaces-state/if:interface {
+ description
+ "Data nodes for the operational state of IP on interfaces.";
+ container ipv4 {
+ presence
+ "Present if IPv4 is enabled on this interface";
+ config false;
+ description
+ "Interface-specific parameters for the IPv4 address family.";
+ leaf forwarding {
+ type boolean;
+ description
+ "Indicates whether IPv4 packet forwarding is enabled or
+ disabled on this interface.";
+ }
+
+ leaf mtu {
+ type uint16 {
+ range "68..max";
+ }
+ units "octets";
+ description
+ "The size, in octets, of the largest IPv4 packet that the
+ interface will send and receive.";
+ reference
+ "RFC 791: Internet Protocol";
+
+ }
+
+ list address {
+ key "ip";
+ description
+ "The list of IPv4 addresses on the interface.";
+ leaf ip {
+ type inet:ipv4-address-no-zone;
+ description
+ "The IPv4 address on the interface.";
+ }
+
+ choice subnet {
+ description
+ "The subnet can be specified as a prefix-length, or,
+ if the server supports non-contiguous netmasks, as
+ a netmask.";
+ leaf prefix-length {
+ type uint8 {
+ range "0..32";
+ }
+ description
+ "The length of the subnet prefix.";
+ }
+ leaf netmask {
+ if-feature ipv4-non-contiguous-netmasks;
+ type yang:dotted-quad;
+ description
+ "The subnet specified as a netmask.";
+ }
+ } // choice subnet
+
+ leaf origin {
+ type ip-address-origin;
+ description
+ "The origin of this address.";
+ }
+ } // list address
+
+ list neighbor {
+ key "ip";
+ description
+ "A list of mappings from IPv4 addresses to
+ link-layer addresses.
+
+ This list represents the ARP Cache.";
+ reference
+ "RFC 826: An Ethernet Address Resolution Protocol";
+
+ leaf ip {
+ type inet:ipv4-address-no-zone;
+ description
+ "The IPv4 address of the neighbor node.";
+ }
+
+ leaf link-layer-address {
+ type yang:phys-address;
+ description
+ "The link-layer address of the neighbor node.";
+ }
+
+ leaf origin {
+ type neighbor-origin;
+ description
+ "The origin of this neighbor entry.";
+ }
+ } // list neighbor
+ } // container ipv4
+
+ container ipv6 {
+ presence
+ "Present if IPv6 is enabled on this interface";
+ config false;
+ description
+ "Parameters for the IPv6 address family.";
+ leaf forwarding {
+ type boolean;
+ default 'false';
+ description
+ "Indicates whether IPv6 packet forwarding is enabled or
+ disabled on this interface.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+ Section 6.2.1, IsRouter";
+
+ }
+
+ leaf mtu {
+ type uint32 {
+ range "1280..max";
+ }
+ units "octets";
+ description
+ "The size, in octets, of the largest IPv6 packet that the
+ interface will send and receive.";
+ reference
+ "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+ Section 5";
+
+ }
+
+ list address {
+ key "ip";
+ description
+ "The list of IPv6 addresses on the interface.";
+ leaf ip {
+ type inet:ipv6-address-no-zone;
+ description
+ "The IPv6 address on the interface.";
+ }
+
+ leaf prefix-length {
+ type uint8 {
+ range "0..128";
+ }
+ mandatory true;
+ description
+ "The length of the subnet prefix.";
+ }
+
+ leaf origin {
+ type ip-address-origin;
+ description
+ "The origin of this address.";
+ }
+
+ leaf status {
+ type enumeration {
+ enum "preferred" {
+ value 0;
+ description
+ "This is a valid address that can appear as the
+ destination or source address of a packet.";
+ }
+ enum "deprecated" {
+ value 1;
+ description
+ "This is a valid but deprecated address that should
+ no longer be used as a source address in new
+ communications, but packets addressed to such an
+ address are processed as expected.";
+ }
+ enum "invalid" {
+ value 2;
+ description
+ "This isn't a valid address, and it shouldn't appear
+ as the destination or source address of a packet.";
+ }
+ enum "inaccessible" {
+ value 3;
+ description
+ "The address is not accessible because the interface
+ to which this address is assigned is not
+ operational.";
+ }
+ enum "unknown" {
+ value 4;
+ description
+ "The status cannot be determined for some reason.";
+ }
+ enum "tentative" {
+ value 5;
+ description
+ "The uniqueness of the address on the link is being
+ verified. Addresses in this state should not be
+ used for general communication and should only be
+ used to determine the uniqueness of the address.";
+ }
+ enum "duplicate" {
+ value 6;
+ description
+ "The address has been determined to be non-unique on
+ the link and so must not be used.";
+ }
+ enum "optimistic" {
+ value 7;
+ description
+ "The address is available for use, subject to
+ restrictions, while its uniqueness on a link is
+ being verified.";
+ }
+ }
+ description
+ "The status of an address. Most of the states correspond
+ to states from the IPv6 Stateless Address
+ Autoconfiguration protocol.";
+ reference
+ "RFC 4293: Management Information Base for the
+ Internet Protocol (IP)
+ - IpAddressStatusTC
+ RFC 4862: IPv6 Stateless Address Autoconfiguration";
+
+ }
+ } // list address
+
+ list neighbor {
+ key "ip";
+ description
+ "A list of mappings from IPv6 addresses to
+ link-layer addresses.
+
+ This list represents the Neighbor Cache.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
+
+ leaf ip {
+ type inet:ipv6-address-no-zone;
+ description
+ "The IPv6 address of the neighbor node.";
+ }
+
+ leaf link-layer-address {
+ type yang:phys-address;
+ description
+ "The link-layer address of the neighbor node.";
+ }
+
+ leaf origin {
+ type neighbor-origin;
+ description
+ "The origin of this neighbor entry.";
+ }
+
+ leaf is-router {
+ type empty;
+ description
+ "Indicates that the neighbor node acts as a router.";
+ }
+
+ leaf state {
+ type enumeration {
+ enum "incomplete" {
+ value 0;
+ description
+ "Address resolution is in progress, and the link-layer
+ address of the neighbor has not yet been
+ determined.";
+ }
+ enum "reachable" {
+ value 1;
+ description
+ "Roughly speaking, the neighbor is known to have been
+ reachable recently (within tens of seconds ago).";
+ }
+ enum "stale" {
+ value 2;
+ description
+ "The neighbor is no longer known to be reachable, but
+ until traffic is sent to the neighbor no attempt
+ should be made to verify its reachability.";
+ }
+ enum "delay" {
+ value 3;
+ description
+ "The neighbor is no longer known to be reachable, and
+ traffic has recently been sent to the neighbor.
+ Rather than probe the neighbor immediately, however,
+ delay sending probes for a short while in order to
+ give upper-layer protocols a chance to provide
+ reachability confirmation.";
+ }
+ enum "probe" {
+ value 4;
+ description
+ "The neighbor is no longer known to be reachable, and
+ unicast Neighbor Solicitation probes are being sent
+ to verify reachability.";
+ }
+ }
+ description
+ "The Neighbor Unreachability Detection state of this
+ entry.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+ Section 7.3.2";
+
+ }
+ } // list neighbor
+ } // container ipv6
+ }
+ } // module ietf-ip
diff --git a/utils/sysrepo-plugins/yang/ietf/ietf-yang-types@2013-07-15.yang b/utils/sysrepo-plugins/yang/ietf/ietf-yang-types@2013-07-15.yang
new file mode 100644
index 000000000..ee58fa3ab
--- /dev/null
+++ b/utils/sysrepo-plugins/yang/ietf/ietf-yang-types@2013-07-15.yang
@@ -0,0 +1,474 @@
+module ietf-yang-types {
+
+ namespace "urn:ietf:params:xml:ns:yang: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: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module contains a collection of generally useful derived
+ YANG data types.
+
+ Copyright (c) 2013 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 6991; see
+ the RFC itself for full legal notices.";
+
+ revision 2013-07-15 {
+ description
+ "This revision adds the following new data types:
+ - yang-identifier
+ - hex-string
+ - uuid
+ - dotted-quad";
+ reference
+ "RFC 6991: Common YANG Data Types";
+ }
+
+ revision 2010-09-24 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 6021: Common YANG Data Types";
+ }
+
+ /*** collection of counter and gauge types ***/
+
+ typedef counter32 {
+ type uint32;
+ description
+ "The counter32 type represents a non-negative integer
+ that monotonically increases until it reaches a
+ maximum value of 2^32-1 (4294967295 decimal), when it
+ wraps around and starts increasing again from zero.
+
+ Counters have no defined 'initial' value, and thus, a
+ single value of a counter has (in general) no information
+ content. Discontinuities in the monotonically increasing
+ value normally occur at re-initialization of the
+ management system, and at other times as specified in the
+ description of a schema node using this type. If such
+ other times can occur, for example, the creation of
+ a schema node of type counter32 at times other than
+ re-initialization, then a corresponding schema node
+ should be defined, with an appropriate type, to indicate
+ the last discontinuity.
+
+ The counter32 type should not be used for configuration
+ schema nodes. A default statement SHOULD NOT be used in
+ combination with the type counter32.
+
+ In the value set and its semantics, this type is equivalent
+ to the Counter32 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+ }
+
+ typedef zero-based-counter32 {
+ type yang:counter32;
+ default "0";
+ description
+ "The zero-based-counter32 type represents a counter32
+ that has the defined 'initial' value zero.
+
+ A schema node of this type will be set to zero (0) on creation
+ and will thereafter increase monotonically until it reaches
+ a maximum value of 2^32-1 (4294967295 decimal), when it
+ wraps around and starts increasing again from zero.
+
+ Provided that an application discovers a new schema node
+ of this type within the minimum time to wrap, it can use the
+ 'initial' value as a delta. It is important for a management
+ station to be aware of this minimum time and the actual time
+ between polls, and to discard data if the actual time is too
+ long or there is no defined minimum time.
+
+ In the value set and its semantics, this type is equivalent
+ to the ZeroBasedCounter32 textual convention of the SMIv2.";
+ reference
+ "RFC 4502: Remote Network Monitoring Management Information
+ Base Version 2";
+ }
+
+ typedef counter64 {
+ type uint64;
+ description
+ "The counter64 type represents a non-negative integer
+ that monotonically increases until it reaches a
+ maximum value of 2^64-1 (18446744073709551615 decimal),
+ when it wraps around and starts increasing again from zero.
+
+ Counters have no defined 'initial' value, and thus, a
+ single value of a counter has (in general) no information
+ content. Discontinuities in the monotonically increasing
+ value normally occur at re-initialization of the
+ management system, and at other times as specified in the
+ description of a schema node using this type. If such
+ other times can occur, for example, the creation of
+ a schema node of type counter64 at times other than
+ re-initialization, then a corresponding schema node
+ should be defined, with an appropriate type, to indicate
+ the last discontinuity.
+
+ The counter64 type should not be used for configuration
+ schema nodes. A default statement SHOULD NOT be used in
+ combination with the type counter64.
+
+ In the value set and its semantics, this type is equivalent
+ to the Counter64 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+ }
+
+ typedef zero-based-counter64 {
+ type yang:counter64;
+ default "0";
+ description
+ "The zero-based-counter64 type represents a counter64 that
+ has the defined 'initial' value zero.
+
+ A schema node of this type will be set to zero (0) on creation
+ and will thereafter increase monotonically until it reaches
+ a maximum value of 2^64-1 (18446744073709551615 decimal),
+ when it wraps around and starts increasing again from zero.
+
+ Provided that an application discovers a new schema node
+ of this type within the minimum time to wrap, it can use the
+ 'initial' value as a delta. It is important for a management
+ station to be aware of this minimum time and the actual time
+ between polls, and to discard data if the actual time is too
+ long or there is no defined minimum time.
+
+ In the value set and its semantics, this type is equivalent
+ to the ZeroBasedCounter64 textual convention of the SMIv2.";
+ reference
+ "RFC 2856: Textual Conventions for Additional High Capacity
+ Data Types";
+ }
+
+ typedef gauge32 {
+ type uint32;
+ description
+ "The gauge32 type represents a non-negative integer, which
+ may increase or decrease, but shall never exceed a maximum
+ value, nor fall below a minimum value. The maximum value
+ cannot be greater than 2^32-1 (4294967295 decimal), and
+ the minimum value cannot be smaller than 0. The value of
+ a gauge32 has its maximum value whenever the information
+ being modeled is greater than or equal to its maximum
+ value, and has its minimum value whenever the information
+ being modeled is smaller than or equal to its minimum value.
+ If the information being modeled subsequently decreases
+ below (increases above) the maximum (minimum) value, the
+ gauge32 also decreases (increases).
+
+ In the value set and its semantics, this type is equivalent
+ to the Gauge32 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+ }
+
+ typedef gauge64 {
+ type uint64;
+ description
+ "The gauge64 type represents a non-negative integer, which
+ may increase or decrease, but shall never exceed a maximum
+ value, nor fall below a minimum value. The maximum value
+ cannot be greater than 2^64-1 (18446744073709551615), and
+ the minimum value cannot be smaller than 0. The value of
+ a gauge64 has its maximum value whenever the information
+ being modeled is greater than or equal to its maximum
+ value, and has its minimum value whenever the information
+ being modeled is smaller than or equal to its minimum value.
+ If the information being modeled subsequently decreases
+ below (increases above) the maximum (minimum) value, the
+ gauge64 also decreases (increases).
+
+ In the value set and its semantics, this type is equivalent
+ to the CounterBasedGauge64 SMIv2 textual convention defined
+ in RFC 2856";
+ reference
+ "RFC 2856: Textual Conventions for Additional High Capacity
+ Data Types";
+ }
+
+ /*** collection of identifier-related types ***/
+
+ typedef object-identifier {
+ type string {
+ pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
+ + '(\.(0|([1-9]\d*)))*';
+ }
+ description
+ "The object-identifier type represents administratively
+ assigned names in a registration-hierarchical-name tree.
+
+ Values of this type are denoted as a sequence of numerical
+ non-negative sub-identifier values. Each sub-identifier
+ value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
+ are separated by single dots and without any intermediate
+ whitespace.
+
+ The ASN.1 standard restricts the value space of the first
+ sub-identifier to 0, 1, or 2. Furthermore, the value space
+ of the second sub-identifier is restricted to the range
+ 0 to 39 if the first sub-identifier is 0 or 1. Finally,
+ the ASN.1 standard requires that an object identifier
+ has always at least two sub-identifiers. The pattern
+ captures these restrictions.
+
+ Although the number of sub-identifiers is not limited,
+ module designers should realize that there may be
+ implementations that stick with the SMIv2 limit of 128
+ sub-identifiers.
+
+ This type is a superset of the SMIv2 OBJECT IDENTIFIER type
+ since it is not restricted to 128 sub-identifiers. Hence,
+ this type SHOULD NOT be used to represent the SMIv2 OBJECT
+ IDENTIFIER type; the object-identifier-128 type SHOULD be
+ used instead.";
+ reference
+ "ISO9834-1: Information technology -- Open Systems
+ Interconnection -- Procedures for the operation of OSI
+ Registration Authorities: General procedures and top
+ arcs of the ASN.1 Object Identifier tree";
+ }
+
+ typedef object-identifier-128 {
+ type object-identifier {
+ pattern '\d*(\.\d*){1,127}';
+ }
+ description
+ "This type represents object-identifiers restricted to 128
+ sub-identifiers.
+
+ In the value set and its semantics, this type is equivalent
+ to the OBJECT IDENTIFIER type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+ }
+
+ typedef yang-identifier {
+ type string {
+ length "1..max";
+ pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
+ pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
+ }
+ description
+ "A YANG identifier string as defined by the 'identifier'
+ rule in Section 12 of RFC 6020. An identifier must
+ start with an alphabetic character or an underscore
+ followed by an arbitrary sequence of alphabetic or
+ numeric characters, underscores, hyphens, or dots.
+
+ A YANG identifier MUST NOT start with any possible
+ combination of the lowercase or uppercase character
+ sequence 'xml'.";
+ reference
+ "RFC 6020: YANG - A Data Modeling Language for the Network
+ Configuration Protocol (NETCONF)";
+ }
+
+ /*** collection of types related to date and time***/
+
+ typedef date-and-time {
+ type string {
+ pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
+ + '(Z|[\+\-]\d{2}:\d{2})';
+ }
+ description
+ "The date-and-time type is a profile of the ISO 8601
+ standard for representation of dates and times using the
+ Gregorian calendar. The profile is defined by the
+ date-time production in Section 5.6 of RFC 3339.
+
+ The date-and-time type is compatible with the dateTime XML
+ schema type with the following notable exceptions:
+
+ (a) The date-and-time type does not allow negative years.
+
+ (b) The date-and-time time-offset -00:00 indicates an unknown
+ time zone (see RFC 3339) while -00:00 and +00:00 and Z
+ all represent the same time zone in dateTime.
+
+ (c) The canonical format (see below) of data-and-time values
+ differs from the canonical format used by the dateTime XML
+ schema type, which requires all times to be in UTC using
+ the time-offset 'Z'.
+
+ This type is not equivalent to the DateAndTime textual
+ convention of the SMIv2 since RFC 3339 uses a different
+ separator between full-date and full-time and provides
+ higher resolution of time-secfrac.
+
+ The canonical format for date-and-time values with a known time
+ zone uses a numeric time zone offset that is calculated using
+ the device's configured known offset to UTC time. A change of
+ the device's offset to UTC time will cause date-and-time values
+ to change accordingly. Such changes might happen periodically
+ in case a server follows automatically daylight saving time
+ (DST) time zone offset changes. The canonical format for
+ date-and-time values with an unknown time zone (usually
+ referring to the notion of local time) uses the time-offset
+ -00:00.";
+ reference
+ "RFC 3339: Date and Time on the Internet: Timestamps
+ RFC 2579: Textual Conventions for SMIv2
+ XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
+ }
+
+ typedef timeticks {
+ type uint32;
+ description
+ "The timeticks type represents a non-negative integer that
+ represents the time, modulo 2^32 (4294967296 decimal), in
+ hundredths of a second between two epochs. When a schema
+ node is defined that uses this type, the description of
+ the schema node identifies both of the reference epochs.
+
+ In the value set and its semantics, this type is equivalent
+ to the TimeTicks type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+ }
+
+ typedef timestamp {
+ type yang:timeticks;
+ description
+ "The timestamp type represents the value of an associated
+ timeticks schema node at which a specific occurrence
+ happened. The specific occurrence must be defined in the
+ description of any schema node defined using this type. When
+ the specific occurrence occurred prior to the last time the
+ associated timeticks attribute was zero, then the timestamp
+ value is zero. Note that this requires all timestamp values
+ to be reset to zero when the value of the associated timeticks
+ attribute reaches 497+ days and wraps around to zero.
+
+ The associated timeticks schema node must be specified
+ in the description of any schema node using this type.
+
+ In the value set and its semantics, this type is equivalent
+ to the TimeStamp textual convention of the SMIv2.";
+ reference
+ "RFC 2579: Textual Conventions for SMIv2";
+ }
+
+ /*** collection of generic address types ***/
+
+ typedef phys-address {
+ type string {
+ pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+ }
+
+ description
+ "Represents media- or physical-level addresses represented
+ as a sequence octets, each octet represented by two hexadecimal
+ numbers. Octets are separated by colons. The canonical
+ representation uses lowercase characters.
+
+ In the value set and its semantics, this type is equivalent
+ to the PhysAddress textual convention of the SMIv2.";
+ reference
+ "RFC 2579: Textual Conventions for SMIv2";
+ }
+
+ typedef mac-address {
+ type string {
+ pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
+ }
+ description
+ "The mac-address type represents an IEEE 802 MAC address.
+ The canonical representation uses lowercase characters.
+
+ In the value set and its semantics, this type is equivalent
+ to the MacAddress textual convention of the SMIv2.";
+ reference
+ "IEEE 802: IEEE Standard for Local and Metropolitan Area
+ Networks: Overview and Architecture
+ RFC 2579: Textual Conventions for SMIv2";
+ }
+
+ /*** collection of XML-specific types ***/
+
+ typedef xpath1.0 {
+ type string;
+ description
+ "This type represents an XPATH 1.0 expression.
+
+ When a schema node is defined that uses this type, the
+ description of the schema node MUST specify the XPath
+ context in which the XPath expression is evaluated.";
+ reference
+ "XPATH: XML Path Language (XPath) Version 1.0";
+ }
+
+ /*** collection of string types ***/
+
+ typedef hex-string {
+ type string {
+ pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+ }
+ description
+ "A hexadecimal string with octets represented as hex digits
+ separated by colons. The canonical representation uses
+ lowercase characters.";
+ }
+
+ typedef uuid {
+ type string {
+ pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
+ + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
+ }
+ description
+ "A Universally Unique IDentifier in the string representation
+ defined in RFC 4122. The canonical representation uses
+ lowercase characters.
+
+ The following is an example of a UUID in string representation:
+ f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+ ";
+ reference
+ "RFC 4122: A Universally Unique IDentifier (UUID) URN
+ Namespace";
+ }
+
+ typedef dotted-quad {
+ type string {
+ pattern
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
+ }
+ description
+ "An unsigned 32-bit number expressed in the dotted-quad
+ notation, i.e., four octets written as decimal numbers
+ and separated with the '.' (full stop) character.";
+ }
+}