From 6b7f4c3f9d9d26a5aa71be8f5976956aff387e8f Mon Sep 17 00:00:00 2001 From: masoud Date: Thu, 31 Oct 2019 18:07:18 +0100 Subject: [HICN-357] sysrepo plugin update Signed-off-by: masoud Change-Id: Idabe9d3a3b03139ad3cdb20c8c822e6dd7d4c553 --- ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake | 6 +++--- .../hicn-light/plugin/hicn_light_comm.h | 2 +- .../hicn-light/plugin/model/hicn_model.c | 23 ++++++++++------------ .../hicn-plugin/plugin/ietf/ietf_interface.c | 2 +- .../hicn-plugin/plugin/model/hicn_model.c | 16 ++------------- scripts/build-sysrepo.sh | 10 +++++----- 6 files changed, 22 insertions(+), 37 deletions(-) diff --git a/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake b/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake index bce3265fa..7883b09dd 100644 --- a/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake +++ b/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake @@ -18,15 +18,15 @@ set(HICNLIGHT_SEARCH_PATH_LIST /usr ) -find_path(HICNLIGHT_INCLUDE_DIR hicn/api/api.h +find_path(HICNLIGHT_INCLUDE_DIR hicn/ctrl/api.h HINTS ${HICNLIGHT_SEARCH_PATH_LIST} PATH_SUFFIXES include DOC "Find the hicn plugin includes" ) -find_library(HICNLIGHT_LIBRARY NAMES libhicn-light-ctrl.so +find_library(HICNLIGHT_LIBRARY NAMES libhicnctrl.so HINTS ${HICNLIGHT_SEARCH_PATH_LIST} - PATH_SUFFIXES lib + PATH_SUFFIXES lib/x86_64-linux-gnu/ DOC "Find the hicn light lib" ) diff --git a/ctrl/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h b/ctrl/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h index adb7737aa..100023564 100644 --- a/ctrl/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h +++ b/ctrl/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h @@ -20,7 +20,7 @@ #include -#include +#include #ifndef HICN_THIS_FUNC #ifdef __FUNCTION__ diff --git a/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c b/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c index 7cfb8363a..6f8ece08c 100644 --- a/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c +++ b/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c @@ -33,24 +33,22 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, 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; + face.face.family=AF_INET; + face.face.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; + face.face.family=AF_INET6; + face.face.local_addr.v6.as_in6addr = *dst; }else{ SRP_LOG_DBG_MSG("Invalid local IP address"); @@ -62,16 +60,16 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, 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; + face.face.family=AF_INET; + face.face.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; + face.face.family=AF_INET6; + face.face.remote_addr.v6.as_in6addr = *dst; }else{ SRP_LOG_DBG_MSG("Invalid local IP address"); @@ -80,11 +78,10 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, // 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.face.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; @@ -203,4 +200,4 @@ error: sr_plugin_cleanup_cb(session, hsocket); return rc; -} \ No newline at end of file +} diff --git a/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c b/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c index f02605895..0498527cb 100644 --- a/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c +++ b/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c @@ -302,7 +302,7 @@ static i32 ietf_interface_name2index(const char *name, u32* if_index) dump = vapi_alloc_sw_interface_dump(g_vapi_ctx_instance); dump->payload.name_filter_valid = true; - memcpy(dump->payload.name_filter, name, sizeof(dump->payload.name_filter)); + memcpy(&dump->payload.name_filter, name, sizeof(dump->payload.name_filter)); while (VAPI_EAGAIN == (rv = vapi_sw_interface_dump(g_vapi_ctx_instance, dump, ietf_sw_interface_dump_cb, &dctx))) ; diff --git a/ctrl/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c b/ctrl/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c index b49839c53..b40293705 100644 --- a/ctrl/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c +++ b/ctrl/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c @@ -28,7 +28,7 @@ /* Hicn headers */ #include -#include +#include #include "../hicn_plugin.h" #include "../hicn_vpp_comm.h" #include "hicn_model.h" @@ -484,18 +484,6 @@ static int hicn_node_params_set_cb(sr_session_ctx_t *session, const char *xpath, 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", @@ -1452,4 +1440,4 @@ error: 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/scripts/build-sysrepo.sh b/scripts/build-sysrepo.sh index 7d83cac14..205fcc6bd 100644 --- a/scripts/build-sysrepo.sh +++ b/scripts/build-sysrepo.sh @@ -25,12 +25,12 @@ PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio VPP_GIT_REPO="https://git.fd.io/vpp" VPP_BRANCH="stable/1908" -VPP_VERSION_DEB="19.08-release" -VPP_VERSION_RPM="19.08-release.x86_64" +VPP_VERSION_DEB="19.08.1-release" +VPP_VERSION_RPM="19.08.1-release.x86_64" BUILD_TOOLS_UBUNTU="build-essential doxygen" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="hicn-light hicn-plugin libvppinfra=${VPP_VERSION_DEB} libvppinfra-dev=${VPP_VERSION_DEB} vpp=${VPP_VERSION_DEB} vpp-dev=${VPP_VERSION_DEB} vpp-plugin-core=${VPP_VERSION_DEB}" +DEPS_UBUNTU="hicn-light libhicn-dev libhicnctrl libhicnctrl-dev hicn-plugin hicn-plugin-dev libvppinfra=${VPP_VERSION_DEB} libvppinfra-dev=${VPP_VERSION_DEB} vpp=${VPP_VERSION_DEB} vpp-dev=${VPP_VERSION_DEB} vpp-plugin-core=${VPP_VERSION_DEB}" # BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} vpp-lib-${VPP_VERSION_RPM} libparc-devel asio-devel centos-release-scl devtoolset-7" @@ -122,8 +122,8 @@ build_package() { mkdir -p build && pushd build rm -rf * -# cp ${SCRIPT_PATH}/../cmake/Modules/Packager.cmake ${SCRIPT_PATH}/../utils/sysrepo-plugin/cmake/ - cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/../utils/sysrepo-plugins/ \ +# cp ${SCRIPT_PATH}/../cmake/Modules/Packager.cmake ${SCRIPT_PATH}/../ctrl/sysrepo-plugin/cmake/ + cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/../ctrl/sysrepo-plugins/ \ -DSR_PLUGINS_DIR=/usr/lib/x86_64-linux-gnu/sysrepo/plugins make package -- cgit 1.2.3-korg