summaryrefslogtreecommitdiffstats
path: root/utils/sysrepo-plugins/hicn-light
diff options
context:
space:
mode:
Diffstat (limited to 'utils/sysrepo-plugins/hicn-light')
-rw-r--r--utils/sysrepo-plugins/hicn-light/CMakeLists.txt60
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/CMakeLists.txt60
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c121
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h25
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c31
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h78
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c33
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h44
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/tlock.c21
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/tlock.h31
-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-light/plugin/yang/startup.xml11
13 files changed, 1134 insertions, 0 deletions
diff --git a/utils/sysrepo-plugins/hicn-light/CMakeLists.txt b/utils/sysrepo-plugins/hicn-light/CMakeLists.txt
new file mode 100644
index 000000000..eea06592d
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/CMakeLists.txt
@@ -0,0 +1,60 @@
+#
+# 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.
+#
+
+# set compiler options
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99")
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2")
+set(CMAKE_C_FLAGS_DEBUG "-g -O0")
+set (CMAKE_INSTALL_LIBDIR "/usr/lib")
+
+cmake_minimum_required(VERSION 2.8)
+project(sysrepo-light-plugins)
+
+# Cmake find modules
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
+
+find_package(PkgConfig)
+find_package(HicnLight)
+find_package(Sysrepo)
+
+#pkg_check_modules(SYSREPO libsysrepo)
+
+# get sysrepo plugins directory from pkgconfig
+if (NOT SR_PLUGINS_DIR)
+ if (PKG_CONFIG_FOUND)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--variable=SR_PLUGINS_DIR" "libsysrepo" OUTPUT_VARIABLE SR_PLUGINS_DIR)
+ string(STRIP ${SR_PLUGINS_DIR} SR_PLUGINS_DIR)
+ endif()
+endif()
+if (NOT SR_PLUGINS_DIR)
+ message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SR_PLUGINS_DIR manually.")
+endif()
+
+# plugins sources
+set(PLUGINS_SOURCES
+ plugin/model/hicn_model.c
+ plugin/model/tlock.c
+ plugin/hicn_light_comm.c
+ plugin/hicn_light.c
+)
+
+# build the source code into shared library
+add_library(hicnlight SHARED ${PLUGINS_SOURCES})
+target_include_directories(hicnlight PUBLIC ${HICNLIGHT_INCLUDE_DIRS})
+target_link_libraries(hicnlight ${SYSREPO_LIBRARIES} ${HICNLIGHT_LIBRARIES})
+
+# install the plugin into plugins dir
+install(TARGETS hicnlight DESTINATION ${SR_PLUGINS_DIR} COMPONENT hicn_sysrepo_plugin)
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/CMakeLists.txt b/utils/sysrepo-plugins/hicn-light/plugin/CMakeLists.txt
new file mode 100644
index 000000000..e1d3dd39a
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/CMakeLists.txt
@@ -0,0 +1,60 @@
+#
+# 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.
+#
+
+# set compiler options
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99")
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2")
+set(CMAKE_C_FLAGS_DEBUG "-g -O0")
+set (CMAKE_INSTALL_LIBDIR "/usr/lib")
+
+cmake_minimum_required(VERSION 2.8)
+project(sysrepo-light-plugins)
+
+# Cmake find modules
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
+
+find_package(PkgConfig)
+find_package(HicnLight)
+find_package(Sysrepo)
+
+#pkg_check_modules(SYSREPO libsysrepo)
+
+# get sysrepo plugins directory from pkgconfig
+if (NOT SR_PLUGINS_DIR)
+ if (PKG_CONFIG_FOUND)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--variable=SR_PLUGINS_DIR" "libsysrepo" OUTPUT_VARIABLE SR_PLUGINS_DIR)
+ string(STRIP ${SR_PLUGINS_DIR} SR_PLUGINS_DIR)
+ endif()
+endif()
+if (NOT SR_PLUGINS_DIR)
+ message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SR_PLUGINS_DIR manually.")
+endif()
+
+# plugins sources
+set(PLUGINS_SOURCES
+ model/hicn_model.c
+ model/tlock.c
+ hicn_light_comm.c
+ hicn_light.c
+)
+
+# build the source code into shared library
+add_library(hicnlight SHARED ${PLUGINS_SOURCES})
+target_include_directories(hicnlight PUBLIC ${HICNLIGHT_INCLUDE_DIRS})
+target_link_libraries(hicnlight ${SYSREPO_LIBRARIES} ${HICNLIGHT_LIBRARIES})
+
+# install the plugin into plugins dir
+install(TARGETS hicnlight DESTINATION ${SR_PLUGINS_DIR} COMPONENT hicn_sysrepo_plugin) \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
new file mode 100644
index 000000000..e5b1bf56d
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+#include <inttypes.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "hicn_light.h"
+#include "model/hicn_model.h"
+
+
+
+sr_subscription_ctx_t *subscription = NULL;
+volatile int exit_application = 0;
+
+int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx) {
+ HICN_INVOKE_BEGIN
+ sr_subscription_ctx_t *subscription = NULL;
+ int rc = SR_ERR_OK;
+ rc = hicn_connect_light();
+ if (SR_ERR_OK != rc) {
+ HICN_LOG_ERR("hicn light connect error , with return %d.", rc);
+ return SR_ERR_INTERNAL;
+ }
+
+ // HICN subscribe
+ hicn_subscribe_events(session, &subscription);
+
+
+ /* set subscription as our private context */
+ *private_ctx = subscription;
+ HICN_INVOKE_END;
+ return SR_ERR_OK;
+}
+
+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.");
+ hicn_disconnect_light();
+ HICN_LOG_DBG_MSG("hicn light disconnect ok.");
+ HICN_INVOKE_END;
+}
+
+static void sigint_handler(int signum) { exit_application = 1; }
+int subscribe_all_module_events(sr_session_ctx_t *session) {
+ sr_plugin_init_cb(session, (void **)&subscription);
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ sr_conn_ctx_t *connection = NULL;
+ sr_session_ctx_t *session = NULL;
+ int rc = SR_ERR_OK;
+
+ /* connect to hicn light */
+ rc = hicn_connect_light();
+ if (-1 == rc) {
+ fprintf(stderr, "hicn light connect error");
+ return -1;
+ }
+
+ /* connect to sysrepo */
+ rc = sr_connect("cpe_application", SR_CONN_DEFAULT, &connection);
+ if (SR_ERR_OK != rc) {
+ fprintf(stderr, "Error by sr_connect: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ /* start session */
+ rc = sr_session_start(connection, SR_DS_STARTUP, SR_SESS_DEFAULT, &session);
+ if (SR_ERR_OK != rc) {
+ fprintf(stderr, "Error by sr_session_start: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ /* subscribe all module events */
+ rc = subscribe_all_module_events(session);
+ if (SR_ERR_OK != rc) {
+ fprintf(stderr, "Error by subscribe module events: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ /* loop until ctrl-c is pressed / SIGINT is received */
+ signal(SIGINT, sigint_handler);
+ signal(SIGPIPE, SIG_IGN);
+
+ while (!exit_application) {
+ sleep(2);
+ }
+
+ printf("Application exit requested, exiting.\n");
+
+cleanup:
+ if (NULL != subscription) {
+ sr_unsubscribe(session, subscription);
+ }
+ if (NULL != session) {
+ sr_session_stop(session);
+ }
+ if (NULL != connection) {
+ sr_disconnect(connection);
+ }
+ hicn_disconnect_light();
+ return rc;
+} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h
new file mode 100644
index 000000000..16f65e5c4
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h
@@ -0,0 +1,25 @@
+/*
+ * 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 __HICN_LIGHT_H__
+#define __HICN_LIGHT_H__
+
+#include "hicn_light_comm.h"
+
+// functions that sysrepo-plugin need
+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);
+
+#endif //__HICN_LIGHT_H__ \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
new file mode 100644
index 000000000..a1b4d7ad2
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+#include "hicn_light_comm.h"
+
+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() {
+ hc_sock_free(hsocket);
+ return 0;
+} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
new file mode 100644
index 000000000..d424ebf3a
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
@@ -0,0 +1,78 @@
+/*
+ * 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 __HICN_LIGHT_COMMM_H__
+#define __HICN_LIGHT_COMMM_H__
+#include <sysrepo.h>
+#include <sysrepo/plugins.h>
+#include <sysrepo/values.h>
+
+
+#include <hicn/api/api.h>
+
+#ifndef HICN_THIS_FUNC
+#ifdef __FUNCTION__
+#define HICN_THIS_FUNC __FUNCTION__
+#else
+#define HICN_THIS_FUNC __func__
+#endif
+#endif
+
+#ifndef _NOLOG
+#define HICN_LOG_DBG SRP_LOG_DBG
+#define HICN_LOG_ERR SRP_LOG_ERR
+#define HICN_LOG_DBG_MSG SRP_LOG_DBG_MSG
+#define HICN_LOG_ERR_MSG SRP_LOG_ERR_MSG
+#else
+#define HICN_LOG_DBG // printf
+#define HICN_LOG_DBG // SRP_LOG_DBG
+#define HICN_LOG_ERR // SRP_LOG_ERR
+#define HICN_LOG_DBG_MSG // SRP_LOG_DBG_MSG
+#define HICN_LOG_ERR_MSG // SRP_LOG_ERR_MSG
+#endif
+
+//Here it is the definition
+
+#define HICN_INVOKE_BEGIN HICN_LOG_DBG("inovke %s bein.", HICN_THIS_FUNC);
+#define HICN_INVOKE_END \
+ HICN_LOG_DBG("inovke %s end,with return OK.", HICN_THIS_FUNC);
+#define HICN_INVOKE_ENDX(...) \
+ HICN_LOG_DBG("inovke %s end,with %s.", HICN_THIS_FUNC, ##__VA_ARGS__)
+
+#define ARG_CHECK(retval, arg) \
+ do { \
+ if (NULL == (arg)) { \
+ HICN_LOG_ERR_MSG(#arg ":NULL pointer passed."); \
+ return (retval); \
+ } \
+ } while (0)
+
+
+
+#define ARG_CHECK2(retval, arg1, arg2) \
+ ARG_CHECK(retval, arg1); \
+ ARG_CHECK(retval, arg2)
+
+#define ARG_CHECK5(retval, arg1, arg2, arg3, arg4, arg5) \
+ ARG_CHECK(retval, arg1); \
+ ARG_CHECK(retval, arg2); \
+ ARG_CHECK(retval, arg3); \
+ ARG_CHECK(retval, arg4); \
+ ARG_CHECK(retval, arg5)
+
+int hicn_connect_light();
+int hicn_disconnect_light();
+extern hc_sock_t * hsocket;
+#endif //__HICN_LIGHT_COMMM_H__
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
new file mode 100644
index 000000000..0c34325d6
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+#include <stdio.h>
+#include <malloc.h>
+#include <sysrepo/xpath.h>
+
+/* Hicn headers */
+
+#include "hicn_model.h"
+#include "tlock.h"
+#include "../hicn_light.h"
+
+
+
+int hicn_subscribe_events(sr_session_ctx_t *session,
+ sr_subscription_ctx_t **subscription) {
+
+ SRP_LOG_INF_MSG("hicn light plugin initialized successfully.");
+ return SR_ERR_OK;
+
+} \ 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
new file mode 100644
index 000000000..59befe68c
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h
@@ -0,0 +1,44 @@
+/*
+ * 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_light_comm.h"
+
+
+#define MEM_ALIGN 4096
+
+// 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
+// better to initialize the lock by 0
+#define NLOCKS 5
+#define LOCK_INIT 0
+
+
+enum locks_name {lstate, lstrategy, lstrategies, lroute, lface_ip_params};
+
+#define NSTATE_LEAVES 15
+#define NSTRATEGY_LEAVES 1
+#define NSTRATEGIES_LEAVES 2
+#define NROUTE_LEAVES 2
+#define NFACE_IP_PARAMS_LEAVES 3
+
+
+
+int hicn_subscribe_events(sr_session_ctx_t *session,
+ sr_subscription_ctx_t **subscription);
+
+#endif /* __IETF_HICN_H__ */ \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.c b/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.c
new file mode 100644
index 000000000..2f7b11efa
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.c
@@ -0,0 +1,21 @@
+#include"tlock.h"
+
+
+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 );
+//En[Lock_Number]=init;
+//De[Lock_Number]=init;
+}
+
+void Ticket_Lock(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 ){
+De[Lock_Number]++;
+}
diff --git a/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.h b/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.h
new file mode 100644
index 000000000..36698115a
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.h
@@ -0,0 +1,31 @@
+/*
+ * 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 __TLOCK_H__
+#define __TLOCK_H__
+
+
+// limit on the number of locks: it shoud be matched with the number of hicn-state leaves
+#define MAX_LOCK_SIZE 5
+
+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 );
+
+#endif /* __IETF_HICN_H__ */ \ No newline at end of file
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
new file mode 100644
index 000000000..c5d24e4f6
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/yang/controler_rpcs_instances.xml
@@ -0,0 +1,73 @@
+<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
new file mode 100644
index 000000000..928e5cdc6
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/yang/model/hicn.yang
@@ -0,0 +1,546 @@
+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-light/plugin/yang/startup.xml b/utils/sysrepo-plugins/hicn-light/plugin/yang/startup.xml
new file mode 100644
index 000000000..f88e13ea2
--- /dev/null
+++ b/utils/sysrepo-plugins/hicn-light/plugin/yang/startup.xml
@@ -0,0 +1,11 @@
+<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