aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/CMakeLists.txt2
-rw-r--r--utils/extras/CMakeLists.txt104
-rw-r--r--utils/extras/README.md49
-rw-r--r--utils/extras/cmake/Modules/Packaging.cmake31
-rw-r--r--utils/extras/devices/rtnetlink/mapper.c270
-rw-r--r--utils/extras/devices/rtnetlink/mapper.h35
-rw-r--r--utils/extras/devices/rtnetlink/netns.c787
-rw-r--r--utils/extras/devices/rtnetlink/netns.h145
-rw-r--r--utils/extras/devices/rtnetlink/rtnl.c604
-rw-r--r--utils/extras/devices/rtnetlink/rtnl.h60
-rw-r--r--utils/extras/devices/rtnetlink/test.c203
-rw-r--r--utils/extras/rtinject/tap_inject.c380
-rw-r--r--utils/extras/rtinject/tap_inject.h108
-rw-r--r--utils/extras/rtinject/tap_inject_netlink.c285
-rw-r--r--utils/extras/rtinject/tap_inject_node.c374
-rw-r--r--utils/extras/rtinject/tap_inject_tap.c170
-rw-r--r--utils/sysrepo-plugins/CMakeLists.txt40
-rw-r--r--utils/sysrepo-plugins/README.md329
-rw-r--r--utils/sysrepo-plugins/cmake/FindHicnLight.cmake39
-rw-r--r--utils/sysrepo-plugins/cmake/FindHicnPlugin.cmake39
-rw-r--r--utils/sysrepo-plugins/cmake/FindSysrepo.cmake46
-rw-r--r--utils/sysrepo-plugins/cmake/FindVPP.cmake178
-rw-r--r--utils/sysrepo-plugins/cmake/Packager.cmake149
-rw-r--r--utils/sysrepo-plugins/cmake/Packaging.cmake31
-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.c120
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h25
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c33
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h81
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c206
-rw-r--r--utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h42
-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-plugin/CMakeLists.txt65
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c123
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.h25
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c57
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h128
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c597
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h23
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c1455
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h155
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c21
-rw-r--r--utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h31
-rw-r--r--utils/sysrepo-plugins/yang/hicn/hicn.yang571
-rw-r--r--utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml78
-rw-r--r--utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml11
-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
52 files changed, 1 insertions, 12519 deletions
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index ad81427e7..5fc071734 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -23,7 +23,7 @@ set(CMAKE_MODULE_PATH
)
if (NOT CMAKE_BUILD_TYPE)
- message(STATUS "No build type selected, default to Release")
+ message(STATUS "${PROJECT_NAME}: No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif ()
diff --git a/utils/extras/CMakeLists.txt b/utils/extras/CMakeLists.txt
deleted file mode 100644
index d92ac4a68..000000000
--- a/utils/extras/CMakeLists.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright (c) 2017-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.
-
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-project(extra-plugin)
-
-include(GNUInstallDirs)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
- "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules/"
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/"
-)
-
-set (CMAKE_CXX_STANDARD 11)
-set (CMAKE_C_STANDARD 11)
-
-# Check for memfd_create syscall
-include(CheckSymbolExists)
-CHECK_SYMBOL_EXISTS ( "__NR_memfd_create" "sys/syscall.h" HAVE_MEMFD_CREATE )
-if ( HAVE_MEMFD_CREATE )
- add_definitions ( -DHAVE_MEMFD_CREATE )
-endif()
-
-if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
- set(HICN_EXTRA_PLUGIN extra-plugin)
-endif()
-
-include (Packaging)
-
-# Dependencies
-
-find_package(Vpp REQUIRED)
-
-include_directories(${VPP_INCLUDE_DIR})
-
-set(HICN_EXTRA_PLUGIN_SOURCE_FILES
- rtinject/tap_inject.c
- rtinject/tap_inject_netlink.c
- rtinject/tap_inject_node.c
- rtinject/tap_inject_tap.c
- devices/rtnetlink/mapper.c
- devices/rtnetlink/netns.c
- devices/rtnetlink/rtnl.c
-)
-
-set(HICN_EXTRA_PLUGIN_HEADER_FILES
- devices/rtnetlink/mapper.h
- devices/rtnetlink/netns.h
- devices/rtnetlink/rtnl.h
-)
-
-if (NOT VPP_HOME)
- set(VPP_HOME /usr)
-endif()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE "Release")
-endif (NOT CMAKE_BUILD_TYPE)
-
-SET(EXTRA_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} CACHE STRING "extra_install_prefix")
-
-if (CMAKE_BUILD_TYPE STREQUAL "Release")
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -march=native -O3 -g")
-elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -march=native -O0 -g")
- add_definitions(-DCLIB_DEBUG -fPIC -fstack-protector-all)
-endif()
-
-include_directories(SYSTEM)
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DEXTRA_VPP_PLUGIN=1")
-add_library(hicn_extra_plugin SHARED
- ${HICN_EXTRA_PLUGIN_SOURCE_FILES})
-
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins)
-
-set(VPP_INSTALL_PLUGIN ${EXTRA_INSTALL_PREFIX}/vpp_plugins)
-
-set_target_properties(hicn_extra_plugin
- PROPERTIES
- LINKER_LANGUAGE C
- INSTALL_RPATH ${VPP_INSTALL_PLUGIN}
- PREFIX ""
- LIBRARY_OUTPUT_NAME "hicn_router")
-
-install(DIRECTORY
- DESTINATION ${VPP_INSTALL_PLUGIN}
- COMPONENT ${HICN_EXTRA_PLUGIN})
-
-install(TARGETS hicn_extra_plugin
- DESTINATION
- ${VPP_INSTALL_PLUGIN}
- COMPONENT ${HICN_EXTRA_PLUGIN})
diff --git a/utils/extras/README.md b/utils/extras/README.md
deleted file mode 100644
index 40363ef18..000000000
--- a/utils/extras/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Configure VPP and FRRouting for OSPF6
-This document describes how to configure the VPP with hicn_router plugin and FRR to enable the OSPF protocol. The VPP and FRR
-are configured in a docker file.
-
-## DPDK configuration on host machine:
-
-- Install and configure dpdk
- - make install T=x86_64-native-linux-gcc && cd x86_64-native-linux-gcc && sudo make install
- - modprobe uio
- - modprobe uio_pci_generic
- - dpdk-devbind --status
- - the PCIe number of the desired device can be observed ("xxx")
- - sudo dpdk-devbind -b uio_pci_generic "xxx"
-## VPP configuration:
-
-- Run and configure the VPP (hICN router plugin is required to be installed in VPP)
- - set int state TenGigabitEtherneta/0/0 up
- - set int ip address TenGigabitEtherneta/0/0 a001::1/24
- - create loopback interface
- - set interface state loop0 up
- - set interface ip address loop0 b001::1/128
- - enable tap-inject # This creates the taps by router plugin
- - show tap-inject # This shows the created taps
- - ip mroute add ff02::/64 via local Forward # ff02:: is multicast ip address
- - ip mroute add ff02::/64 via TenGigabitEtherneta/0/0 Accept
- - ip mroute add ff02::/64 via loop0 Accept
-
-- Setup the tap interface
- - ip addr add a001::1/24 dev vpp0
- - ip addr add b001::1/128 dev vpp1
- - ip link set dev vpp0 up
- - ip link set dev vpp1 up
-
-## FRR configuration:
-
-- Run and configure FRRouting (ospf)
- - /usr/lib/frr/frrinit.sh start &
- - vtysh
- - configure terminal
- - router ospf6
- - area 0.0.0.0 range a001::1/24
- - area 0.0.0.0 range b001::1/128
- - interface vpp0 area 0.0.0.0
- - interface vpp1 area 0.0.0.0
- - end
- - wr
- - add "no ipv6 nd suppress-ra" to the first configurtion part of the /etc/frr/frr.conf
-After the following configuration, the traffic over tap interface can be observered through "tcpdump- i vpp1".
-The neighborhood and route can be seen by the "show ipv6 ospf6 neighbor/route".
diff --git a/utils/extras/cmake/Modules/Packaging.cmake b/utils/extras/cmake/Modules/Packaging.cmake
deleted file mode 100644
index 69f63971f..000000000
--- a/utils/extras/cmake/Modules/Packaging.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2017-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.
-
-######################
-# Packages section
-######################
-
-set(${HICN_EXTRA_PLUGIN}_DESCRIPTION
- "A extra plugin to VPP."
- CACHE STRING "Description for deb/rpm package."
-)
-
-set(${HICN_EXTRA_PLUGIN}_DEB_DEPENDENCIES
- "vpp (>= stable_version-release), vpp (<< next_version-release), vpp-plugin-core (>= stable_version-release), vpp-plugin-core (<< next_version-release)"
- CACHE STRING "Dependencies for deb/rpm package."
-)
-
-set(${HICN_EXTRA_PLUGIN}_RPM_DEPENDENCIES
- "vpp >= stable_version-release, vpp < next_version-release, vpp-plugins >= stable_version-release, vpp-plugins < next_version-release"
- CACHE STRING "Dependencies for deb/rpm package."
-)
diff --git a/utils/extras/devices/rtnetlink/mapper.c b/utils/extras/devices/rtnetlink/mapper.c
deleted file mode 100644
index ed4fa5634..000000000
--- a/utils/extras/devices/rtnetlink/mapper.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2016-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 <vnet/ip/ip.h>
-#include <vnet/ip/lookup.h>
-#include <vnet/fib/fib.h>
-
-#include "netns.h"
-#include "mapper.h"
-
-typedef struct {
- int linux_ifindex;
- u32 sw_if_index;
-} mapper_map_t;
-
-typedef struct {
- char nsname[RTNL_NETNS_NAMELEN + 1];
- mapper_map_t *mappings;
- u32 netns_handle; //Used to receive notifications
- u32 v4fib_index; //One fib index for the namespace
- u32 v6fib_index;
-} mapper_ns_t;
-
-typedef struct {
- mapper_ns_t *namespaces;
-} mapper_main_t;
-
-static mapper_main_t mapper_main;
-
-mapper_map_t *mapper_get_by_ifindex(mapper_ns_t *ns, int ifindex)
-{
- mapper_map_t *map;
- pool_foreach(map, ns->mappings, {
- if (ifindex == map->linux_ifindex)
- return map;
- });
- return NULL;
-}
-
-int mapper_add_del_route(mapper_ns_t *ns, ns_route_t *route, int del)
-{
- mapper_main_t *mm = &mapper_main;
- clib_warning("NS %d %s %U", ns - mm->namespaces, del?"del":"add", format_ns_route, route);
-
- mapper_map_t *map = mapper_get_by_ifindex(ns, route->oif);
- if (!map)
- return 0;
-
- if (route->rtm.rtm_family == AF_INET6) {
-
- //Filter-out multicast
- if (route->rtm.rtm_dst_len >= 8 && route->dst[0] == 0xff)
- return 0;
-
- fib_prefix_t prefix;
- ip46_address_t nh;
-
- memset (&prefix, 0, sizeof (prefix));
- prefix.fp_len = route->rtm.rtm_dst_len;
- prefix.fp_proto = FIB_PROTOCOL_IP6;
- clib_memcpy (&prefix.fp_addr.ip6, route->dst, sizeof (prefix.fp_addr.ip6));
-
- memset (&nh, 0, sizeof (nh));
- clib_memcpy (&nh.ip6, route->gateway, sizeof (nh.ip6));
-
- fib_table_entry_path_add (ns->v6fib_index, &prefix, FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE, prefix.fp_proto,
- &nh, map->sw_if_index, ns->v6fib_index,
- 0 /* weight */,
- (fib_mpls_label_t *) MPLS_LABEL_INVALID,
- FIB_ROUTE_PATH_FLAG_NONE);
- } else {
- fib_prefix_t prefix;
- ip46_address_t nh;
-
- memset (&prefix, 0, sizeof (prefix));
- prefix.fp_len = route->rtm.rtm_dst_len;
- prefix.fp_proto = FIB_PROTOCOL_IP4;
- clib_memcpy (&prefix.fp_addr.ip4, route->dst, sizeof (prefix.fp_addr.ip4));
-
- memset (&nh, 0, sizeof (nh));
- clib_memcpy (&nh.ip4, route->gateway, sizeof (nh.ip4));
-
- fib_table_entry_path_add (ns->v4fib_index, &prefix, FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE, prefix.fp_proto,
- &nh, map->sw_if_index, ns->v4fib_index,
- 0 /* weight */,
- (fib_mpls_label_t *) MPLS_LABEL_INVALID,
- FIB_ROUTE_PATH_FLAG_NONE);
- }
-
- return 0;
-}
-
-static void
-mapper_netns_notify_cb(void *obj, netns_type_t type,
- u32 flags, uword opaque)
-{
- mapper_main_t *mm = &mapper_main;
- mapper_ns_t *ns = &mm->namespaces[(u32) opaque];
- ASSERT(!pool_is_free_index(mm->namespaces, (u32) opaque));
- if (type != NETNS_TYPE_ROUTE)
- return; //For now...
-
- ns_route_t *route = obj;
- if (flags & NETNS_F_DEL) {
- mapper_add_del_route(ns, route, 1);
- } else if (flags & NETNS_F_ADD) {
- mapper_add_del_route(ns, route, 0);
- }
-}
-
-void
-mapper_delmap(mapper_ns_t*ns, mapper_map_t *map)
-{
- ns_route_t *route;
- netns_t *netns = netns_getns(ns->netns_handle);
- pool_foreach(route, netns->routes, {
- if (route->oif == map->linux_ifindex)
- mapper_add_del_route(ns, route, 1);
- });
- pool_put(ns->mappings, map);
-}
-
-mapper_map_t *
-mapper_getmap(mapper_ns_t*ns, u32 sw_if_index,
- int linux_ifindex, int create)
-{
- mapper_map_t *map;
- pool_foreach(map, ns->mappings, {
- if (linux_ifindex == map->linux_ifindex) {
- if (sw_if_index != map->sw_if_index)
- return NULL; //Cannot have multiple mapping with the same ifindex
- else
- return map;
- }
- });
-
- if (!create)
- return NULL;
-
- pool_get(ns->mappings, map);
- map->linux_ifindex = linux_ifindex;
- map->sw_if_index = sw_if_index;
- ip6_main.fib_index_by_sw_if_index[sw_if_index] = ns->v6fib_index;
- ip4_main.fib_index_by_sw_if_index[sw_if_index] = ns->v4fib_index;
-
- //Load available routes
- ns_route_t *route;
- netns_t *netns = netns_getns(ns->netns_handle);
- pool_foreach(route, netns->routes, {
- if (route->oif == map->linux_ifindex)
- mapper_add_del_route(ns, route, 0);
- });
- return map;
-}
-
-u32
-mapper_get_ns(char *nsname)
-{
- mapper_main_t *mm = &mapper_main;
- mapper_ns_t *ns;
- pool_foreach(ns, mm->namespaces, {
- if (!strcmp(nsname, ns->nsname))
- return ns - mm->namespaces;
- });
- return ~0;
-}
-
-int
-mapper_add_del(u32 nsindex, int linux_ifindex,
- u32 sw_if_index, int del)
-{
- mapper_main_t *mm = &mapper_main;
- //ip6_main_t *im6 = &ip6_main;
- mapper_ns_t *ns = &mm->namespaces[nsindex];
- mapper_map_t *map;
- //vnet_sw_interface_t *iface = vnet_get_sw_interface(vnet_get_main(), sw_if_index);
-
- if (pool_is_free(mm->namespaces, ns))
- return -1;
-
- /*if (!del) {
- if ((iface->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) &&
- im6->fib_index_by_sw_if_index[sw_if_index] != ~0) {
- //A custom fib index will be used...
- clib_warning("Cannot add interface with a custom fib index (current is %d)",
- im6->fib_index_by_sw_if_index[sw_if_index]);
- return -1;
- }
- }*/
-
- if (!(map = mapper_getmap(ns, sw_if_index, linux_ifindex, !del)))
- return -1;
-
- if (del)
- mapper_delmap(ns, map);
-
- return 0;
-}
-
-int
-mapper_add_ns(char *nsname, u32 v4fib_index, u32 v6fib_index, u32 *nsindex)
-{
- mapper_main_t *mm = &mapper_main;
- mapper_ns_t *ns;
- if (mapper_get_ns(nsname) != ~0)
- return -1; //Already exists
-
- pool_get(mm->namespaces, ns);
- strcpy(ns->nsname, nsname);
- ns->v4fib_index = v4fib_index;
- ns->v6fib_index = v6fib_index;
- ns->mappings = 0;
-
- netns_sub_t sub;
- sub.notify = mapper_netns_notify_cb;
- sub.opaque = (uword)(ns - mm->namespaces);
- if ((ns->netns_handle = netns_open(ns->nsname, &sub)) == ~0) {
- pool_put(mm->namespaces, ns);
- return -1;
- }
- *nsindex = ns - mm->namespaces;
- return 0;
-}
-
-int
-mapper_del_ns(u32 nsindex)
-{
- mapper_main_t *mm = &mapper_main;
- mapper_ns_t *ns = &mm->namespaces[nsindex];
- if (pool_is_free(mm->namespaces, ns))
- return -1;
-
- //Remove all existing mappings
- int i, *indexes = 0;
- pool_foreach_index(i, ns->mappings, {
- vec_add1(indexes, i);
- });
- vec_foreach_index(i, indexes) {
- mapper_delmap(ns, &ns->mappings[indexes[i]]);
- }
- vec_free(indexes);
-
- netns_close(ns->netns_handle);
- pool_put(mm->namespaces, ns);
- return 0;
-}
-
-clib_error_t *
-mapper_init (vlib_main_t * vm)
-{
- mapper_main_t *mm = &mapper_main;
- mm->namespaces = 0;
- return 0;
-}
-
-VLIB_INIT_FUNCTION (mapper_init);
diff --git a/utils/extras/devices/rtnetlink/mapper.h b/utils/extras/devices/rtnetlink/mapper.h
deleted file mode 100644
index 32e95d48f..000000000
--- a/utils/extras/devices/rtnetlink/mapper.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016-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 MAPPER_H_
-#define MAPPER_H_
-
-#include "netns.h"
-
-/*
- * Automatically map linux network routes to VPP.
- * Each namespace is associated with an individual fib.
- *
- * One linux interface can only be mapped to a single VPP
- * interface, but one VPP interface can be mapped to
- * multiple linux interfaces.
- * A mapped VPP interface must not have any configured fib.
- */
-
-int mapper_add_ns(char *nsname, u32 v4fib_index, u32 v6fib_index, u32 *nsindex);
-int mapper_del_ns(u32 nsindex);
-int mapper_add_del(u32 nsindex, int linux_ifindex, u32 sw_if_index, int del);
-
-#endif /* MAPPER_H_ */
diff --git a/utils/extras/devices/rtnetlink/netns.c b/utils/extras/devices/rtnetlink/netns.c
deleted file mode 100644
index 19adb469a..000000000
--- a/utils/extras/devices/rtnetlink/netns.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * Copyright (c) 2016-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 <vlib/vlib.h>
-#include <vlib/unix/unix.h>
-#include <vnet/ethernet/ethernet.h>
-#include <vnet/ip/ip4_packet.h>
-#include <vnet/ip/ip6_packet.h>
-#include <vnet/ip/format.h>
-#include <stddef.h>
-
-#include "netns.h"
-
-/* Enable some RTA values debug */
-//#define RTNL_CHECK
-
-#define is_nonzero(x) \
- ({ \
- u8 __is_zero_zero[sizeof(x)] = {}; \
- memcmp(__is_zero_zero, &x, sizeof(x)); \
- })
-
-typedef struct {
- u8 type; //Attribute identifier
- u8 unique; //Part of the values uniquely identifying an entry
- u16 offset; //Offset where stored in struct
- u16 size; //Length of the attribute
-} rtnl_mapping_t;
-
-#define ns_foreach_ifla \
- _(IFLA_ADDRESS, hwaddr) \
- _(IFLA_BROADCAST, broadcast) \
- _(IFLA_IFNAME, ifname) \
- _(IFLA_MASTER, master) \
- _(IFLA_MTU, mtu) \
- _(IFLA_QDISC, qdisc)
-
-static rtnl_mapping_t ns_ifmap[] = {
-#define _(t, e) \
- { \
- .type = t, \
- .offset = offsetof(ns_link_t, e), \
- .size = sizeof(((ns_link_t*)0)->e) \
- },
- ns_foreach_ifla
-#undef _
- { .type = 0 }
-};
-
-u8 *format_ns_link (u8 *s, va_list *args)
-{
- ns_link_t *l = va_arg(*args, ns_link_t *);
- s = format(s, "%s index %u", l->ifname, l->ifi.ifi_index);
- return s;
-}
-
-#define ns_foreach_rta \
- _(RTA_DST, dst, 1) \
- _(RTA_SRC, src, 1) \
- _(RTA_GATEWAY, gateway, 1) \
- _(RTA_IIF, iif, 1) \
- _(RTA_OIF, oif, 1) \
- _(RTA_PREFSRC, prefsrc, 0) \
- _(RTA_TABLE, table, 0) \
- _(RTA_PRIORITY, priority, 0) \
- _(RTA_CACHEINFO, cacheinfo, 0) \
- _(RTA_ENCAP, encap, 1)
-
-static rtnl_mapping_t ns_routemap[] = {
-#define _(t, e, u) \
- { \
- .type = t, .unique = u, \
- .offset = offsetof(ns_route_t, e), \
- .size = sizeof(((ns_route_t*)0)->e) \
- },
- ns_foreach_rta
-#undef _
- { .type = 0 }
-};
-
-u8 *format_ns_route (u8 *s, va_list *args)
-{
- ns_route_t *r = va_arg(*args, ns_route_t *);
- void *format_ip = r->rtm.rtm_family == AF_INET ? format_ip4_address : format_ip6_address;
- s = format(s, "%U/%d", format_ip, r->dst, r->rtm.rtm_dst_len);
- if (r->rtm.rtm_src_len)
- s = format(s, " from %U/%d", format_ip, r->src, r->rtm.rtm_src_len);
- if (is_nonzero(r->gateway))
- s = format(s, " via %U", format_ip, r->gateway);
- if (r->iif)
- s = format(s, " iif %d", r->iif);
- if (r->oif)
- s = format(s, " oif %d", r->oif);
- if (is_nonzero(r->prefsrc))
- s = format(s, " src %U", format_ip, r->prefsrc);
- if (r->table)
- s = format(s, " table %d", r->table);
- if (r->priority)
- s = format(s, " priority %u", r->priority);
- return s;
-}
-
-#define ns_foreach_ifaddr \
- _(IFA_ADDRESS, addr, 1) \
- _(IFA_LOCAL, local, 1) \
- _(IFA_LABEL, label, 0) \
- _(IFA_BROADCAST, broadcast, 0) \
- _(IFA_ANYCAST, anycast, 0) \
- _(IFA_CACHEINFO, cacheinfo, 0)
-
-static rtnl_mapping_t ns_addrmap[] = {
-#define _(t, e, u) \
- { \
- .type = t, .unique = u, \
- .offset = offsetof(ns_addr_t, e), \
- .size = sizeof(((ns_addr_t*)0)->e) \
- },
- ns_foreach_ifaddr
-#undef _
- { .type = 0 }
-};
-
-u8 *format_ns_addr (u8 *s, va_list *args)
-{
- ns_addr_t *a = va_arg(*args, ns_addr_t *);
- void *format_ip = a->ifaddr.ifa_family == AF_INET ? format_ip4_address : format_ip6_address;
- s = format(s, "%U/%d", format_ip, a->addr, a->ifaddr.ifa_prefixlen);
- if (is_nonzero(a->label))
- s = format(s, " dev %s", a->label);
- if (is_nonzero(a->broadcast))
- s = format(s, " broadcast %U", format_ip, a->broadcast);
- if (is_nonzero(a->anycast))
- s = format(s, " anycast %U", format_ip, a->anycast);
- if (is_nonzero(a->local))
- s = format(s, " local %U", format_ip, a->local);
- return s;
-}
-
-#ifndef NDA_RTA
-#define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
-#define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
-#endif
-
-#define ns_foreach_neigh \
- _(NDA_DST, dst, 1) \
- _(NDA_LLADDR, lladdr, 0) \
- _(NDA_PROBES, probes, 0) \
- _(NDA_CACHEINFO, cacheinfo, 0)
-
-static rtnl_mapping_t ns_neighmap[] = {
-#define _(t, e, u) \
- { \
- .type = t, .unique = u, \
- .offset = offsetof(ns_neigh_t, e), \
- .size = sizeof(((ns_neigh_t*)0)->e) \
- },
- ns_foreach_neigh
-#undef _
- { .type = 0 }
-};
-
-u8 *format_ns_neigh (u8 *s, va_list *args)
-{
- ns_neigh_t *n = va_arg(*args, ns_neigh_t *);
- void *format_ip = n->nd.ndm_family == AF_INET ? format_ip4_address : format_ip6_address;
- s = format(s, "%U", format_ip, n->dst);
- if (is_nonzero(n->lladdr))
- s = format(s, " lladdr %U", format_ethernet_address, n->lladdr);
- if (n->probes)
- s = format(s, " probes %d", n->probes);
- return s;
-}
-
-typedef struct {
- void (*notify)(void *obj, netns_type_t type, u32 flags, uword opaque);
- uword opaque;
- u32 netns_index;
-} netns_handle_t;
-
-typedef struct {
- netns_t netns;
- u32 rtnl_handle;
- u32 subscriber_count;
-} netns_p;
-
-typedef struct {
- netns_p *netnss;
- netns_handle_t *handles;
-} netns_main_t;
-
-netns_main_t netns_main;
-
-static int
-rtnl_parse_rtattr(struct rtattr *db[], size_t max,
- struct rtattr *rta, size_t len) {
- for(; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
- if (rta->rta_type <= max)
- db[rta->rta_type] = rta;
-#ifdef RTNL_CHECK
- else
- clib_warning("RTA type too high: %d", rta->rta_type);
-#endif
- }
-
- if(len) {
- clib_warning("rattr lenght mistmatch %d %d len",
- (int) len, (int) rta->rta_len);
- return -1;
- }
- return 0;
-}
-
-/*
- * Debug function to display when
- * we receive an RTA that I forgot in
- * the mapping table (there are so many of them).
- */
-#ifdef RTNL_CHECK
-static void
-rtnl_entry_check(struct rtattr *rtas[],
- size_t rta_len,
- rtnl_mapping_t map[],
- char *logstr)
-{
- int i;
- for (i=0; i<rta_len; i++) {
- if (!rtas[i])
- continue;
-
- rtnl_mapping_t *m = map;
- for (m = map; m->type; m++) {
- if (m->type == rtas[i]->rta_type)
- break;
- }
- if (!m->type)
- clib_warning("Unknown RTA type %d (%s)", rtas[i]->rta_type, logstr);
- }
-}
-#endif
-
-/*
- * Check if the provided entry matches the parsed and unique rtas
- */
-static int
-rtnl_entry_match(void *entry,
- struct rtattr *rtas[],
- rtnl_mapping_t map[])
-{
- u8 zero[1024] = {};
- for ( ;map->type != 0; map++) {
- struct rtattr *rta = rtas[map->type];
- size_t rta_len = rta?RTA_PAYLOAD(rta):0;
- if (!map->unique)
- continue;
-
- if (rta && RTA_PAYLOAD(rta) > map->size) {
- clib_warning("rta (type=%d len=%d) too long (max %d)",
- rta->rta_type, rta->rta_len, map->size);
- return -1;
- }
-
- if ((rta && memcmp(RTA_DATA(rta), entry + map->offset, rta_len)) ||
- memcmp(entry + map->offset + rta_len, zero, map->size - rta_len)) {
- return 0;
- }
- }
- return 1;
-}
-
-static int
-rtnl_entry_set(void *entry,
- struct rtattr *rtas[],
- rtnl_mapping_t map[],
- int init)
-{
- for (; map->type != 0; map++) {
-
- struct rtattr *rta = rtas[map->type];
-
- if(map->type == RTA_ENCAP && rta) {
- /*Data of RTA_ENCAP is a pointer to rta attributes for MPLS*/
- rta = (struct rtattr*)RTA_DATA(rta);
- if (RTA_PAYLOAD(rta) > map->size) {
- clib_warning("rta (type=%d len=%d) too long (max %d)", rta->rta_type, rta->rta_len, map->size);
- return -1;
- }
- memcpy(entry + map->offset, RTA_DATA(rta), map->size);
- memset(entry + map->offset + map->size, 0, 0);
- } else if (rta) {
- if (RTA_PAYLOAD(rta) > map->size) {
- clib_warning("rta (type=%d len=%d) too long (max %d)", rta->rta_type, rta->rta_len, map->size);
- return -1;
- }
- memcpy(entry + map->offset, RTA_DATA(rta), RTA_PAYLOAD(rta));
- memset(entry + map->offset + RTA_PAYLOAD(rta), 0, map->size - RTA_PAYLOAD(rta));
- } else if (init) {
- memset(entry + map->offset, 0, map->size);
- }
- }
- return 0;
-}
-
-void
-netns_notify(netns_p *ns, void *obj, netns_type_t type, u32 flags)
-{
- netns_main_t *nm = &netns_main;
- netns_handle_t *h;
- pool_foreach(h, nm->handles, {
- if (h->netns_index == (ns - nm->netnss) && h->notify)
- h->notify(obj, type, flags, h->opaque);
- });
-}
-
-static_always_inline int
-mask_match(void *a, void *b, void *mask, size_t len)
-{
- u8 *va = (u8 *) a;
- u8 *vb = (u8 *) b;
- u8 *vm = (u8 *) mask;
- while (len--) {
- if ((va[len] ^ vb[len]) & vm[len])
- return 0;
- }
- return 1;
-}
-
-static ns_link_t *
-ns_get_link(netns_p *ns, struct ifinfomsg *ifi, struct rtattr *rtas[])
-{
- ns_link_t *link;
- pool_foreach(link, ns->netns.links, {
- if(ifi->ifi_index == link->ifi.ifi_index)
- return link;
- });
- return NULL;
-}
-
-static int
-ns_rcv_link(netns_p *ns, struct nlmsghdr *hdr)
-{
- ns_link_t *link;
- struct ifinfomsg *ifi;
- struct rtattr *rtas[IFLA_MAX + 1] = {};
- size_t datalen = hdr->nlmsg_len - NLMSG_ALIGN(sizeof(*hdr));
-
- if(datalen < sizeof(*ifi))
- return -1;
-
- ifi = NLMSG_DATA(hdr);
- if((datalen > NLMSG_ALIGN(sizeof(*ifi))) &&
- rtnl_parse_rtattr(rtas, IFLA_MAX, IFLA_RTA(ifi),
- IFLA_PAYLOAD(hdr))) {
- return -1;
- }
-#ifdef RTNL_CHECK
- rtnl_entry_check(rtas, IFLA_MAX + 1, ns_ifmap, "link");
-#endif
-
- link = ns_get_link(ns, ifi, rtas);
-
- if (hdr->nlmsg_type == RTM_DELLINK) {
- if (!link)
- return -1;
- pool_put(ns->netns.links, link);
- netns_notify(ns, link, NETNS_TYPE_LINK, NETNS_F_DEL);
- return 0;
- }
-
- if (!link) {
- pool_get(ns->netns.links, link);
- rtnl_entry_set(link, rtas, ns_ifmap, 1);
- } else {
- rtnl_entry_set(link, rtas, ns_ifmap, 0);
- }
-
- link->ifi = *ifi;
- link->last_updated = vlib_time_now(vlib_get_main());
- netns_notify(ns, link, NETNS_TYPE_LINK, NETNS_F_ADD);
- return 0;
-}
-
-static ns_route_t *
-ns_get_route(netns_p *ns, struct rtmsg *rtm, struct rtattr *rtas[])
-{
- ns_route_t *route;
-
- //This describes the values which uniquely identify a route
- struct rtmsg msg = {
- .rtm_family = 0xff,
- .rtm_dst_len = 0xff,
- .rtm_src_len = 0xff,
- .rtm_table = 0xff,
- .rtm_protocol = 0xff,
- .rtm_type = 0xff
- };
-
- pool_foreach(route, ns->netns.routes, {
- if(mask_match(&route->rtm, rtm, &msg, sizeof(struct rtmsg)) &&
- rtnl_entry_match(route, rtas, ns_routemap))
- return route;
- });
- return NULL;
-}
-
-static int
-ns_rcv_route(netns_p *ns, struct nlmsghdr *hdr)
-{
- ns_route_t *route;
- struct rtmsg *rtm;
- struct rtattr *rtas[RTA_MAX + 1] = {};
- size_t datalen = hdr->nlmsg_len - NLMSG_ALIGN(sizeof(*hdr));
-
- if(datalen < sizeof(*rtm))
- return -1;
-
- rtm = NLMSG_DATA(hdr);
- if((datalen > NLMSG_ALIGN(sizeof(*rtm))) &&
- rtnl_parse_rtattr(rtas, RTA_MAX, RTM_RTA(rtm),
- RTM_PAYLOAD(hdr))) {
- return -1;
- }
-#ifdef RTNL_CHECK
- rtnl_entry_check(rtas, RTA_MAX + 1, ns_routemap, "route");
-#endif
- route = ns_get_route(ns, rtm, rtas);
-
- if (hdr->nlmsg_type == RTM_DELROUTE) {
- if (!route)
- return -1;
- pool_put(ns->netns.routes, route);
- netns_notify(ns, route, NETNS_TYPE_ROUTE, NETNS_F_DEL);
- return 0;
- }
-
- if (!route) {
- pool_get(ns->netns.routes, route);
- memset(route, 0, sizeof(*route));
- rtnl_entry_set(route, rtas, ns_routemap, 1);
- } else {
- rtnl_entry_set(route, rtas, ns_routemap, 0);
- }
-
- route->rtm = *rtm;
- route->last_updated = vlib_time_now(vlib_get_main());
- netns_notify(ns, route, NETNS_TYPE_ROUTE, NETNS_F_ADD);
- return 0;
-}
-
-static ns_addr_t *
-ns_get_addr(netns_p *ns, struct ifaddrmsg *ifaddr, struct rtattr *rtas[])
-{
- ns_addr_t *addr;
-
- //This describes the values which uniquely identify a route
- struct ifaddrmsg msg = {
- .ifa_family = 0xff,
- .ifa_prefixlen = 0xff,
- };
-
- pool_foreach(addr, ns->netns.addresses, {
- if(mask_match(&addr->ifaddr, ifaddr, &msg, sizeof(struct ifaddrmsg)) &&
- rtnl_entry_match(addr, rtas, ns_addrmap))
- return addr;
- });
- return NULL;
-}
-
-static int
-ns_rcv_addr(netns_p *ns, struct nlmsghdr *hdr)
-{
- ns_addr_t *addr;
- struct ifaddrmsg *ifaddr;
- struct rtattr *rtas[IFA_MAX + 1] = {};
- size_t datalen = hdr->nlmsg_len - NLMSG_ALIGN(sizeof(*hdr));
-
- if(datalen < sizeof(*ifaddr))
- return -1;
-
- ifaddr = NLMSG_DATA(hdr);
- if((datalen > NLMSG_ALIGN(sizeof(*ifaddr))) &&
- rtnl_parse_rtattr(rtas, IFA_MAX, IFA_RTA(ifaddr),
- IFA_PAYLOAD(hdr))) {
- return -1;
- }
-#ifdef RTNL_CHECK
- rtnl_entry_check(rtas, IFA_MAX + 1, ns_addrmap, "addr");
-#endif
- addr = ns_get_addr(ns, ifaddr, rtas);
-
- if (hdr->nlmsg_type == RTM_DELADDR) {
- if (!addr)
- return -1;
- pool_put(ns->netns.addresses, addr);
- netns_notify(ns, addr, NETNS_TYPE_ADDR, NETNS_F_DEL);
- return 0;
- }
-
- if (!addr) {
- pool_get(ns->netns.addresses, addr);
- memset(addr, 0, sizeof(*addr));
- rtnl_entry_set(addr, rtas, ns_addrmap, 1);
- } else {
- rtnl_entry_set(addr, rtas, ns_addrmap, 0);
- }
-
- addr->ifaddr = *ifaddr;
- addr->last_updated = vlib_time_now(vlib_get_main());
- netns_notify(ns, addr, NETNS_TYPE_ADDR, NETNS_F_ADD);
- return 0;
-}
-
-static ns_neigh_t *
-ns_get_neigh(netns_p *ns, struct ndmsg *nd, struct rtattr *rtas[])
-{
- ns_neigh_t *neigh;
-
- //This describes the values which uniquely identify a route
- struct ndmsg msg = {
- .ndm_family = 0xff,
- .ndm_ifindex = 0xff,
- };
-
- pool_foreach(neigh, ns->netns.neighbors, {
- if(mask_match(&neigh->nd, nd, &msg, sizeof(&msg)) &&
- rtnl_entry_match(neigh, rtas, ns_neighmap))
- return neigh;
- });
- return NULL;
-}
-
-static int
-ns_rcv_neigh(netns_p *ns, struct nlmsghdr *hdr)
-{
- ns_neigh_t *neigh;
- struct ndmsg *nd;
- struct rtattr *rtas[NDA_MAX + 1] = {};
- size_t datalen = hdr->nlmsg_len - NLMSG_ALIGN(sizeof(*hdr));
-
- if(datalen < sizeof(*nd))
- return -1;
-
- nd = NLMSG_DATA(hdr);
- if((datalen > NLMSG_ALIGN(sizeof(*nd))) &&
- rtnl_parse_rtattr(rtas, NDA_MAX, NDA_RTA(nd),
- NDA_PAYLOAD(hdr))) {
- return -1;
- }
-#ifdef RTNL_CHECK
- rtnl_entry_check(rtas, NDA_MAX + 1, ns_neighmap, "nd");
-#endif
- neigh = ns_get_neigh(ns, nd, rtas);
-
- if (hdr->nlmsg_type == RTM_DELNEIGH) {
- if (!neigh)
- return -1;
- pool_put(ns->netns.neighbors, neigh);
- netns_notify(ns, neigh, NETNS_TYPE_NEIGH, NETNS_F_DEL);
- return 0;
- }
-
- if (!neigh) {
- pool_get(ns->netns.neighbors, neigh);
- memset(neigh, 0, sizeof(*neigh));
- rtnl_entry_set(neigh, rtas, ns_neighmap, 1);
- } else {
- rtnl_entry_set(neigh, rtas, ns_neighmap, 0);
- }
-
- neigh->nd = *nd;
- neigh->last_updated = vlib_time_now(vlib_get_main());
- netns_notify(ns, neigh, NETNS_TYPE_NEIGH, NETNS_F_ADD);
- return 0;
-}
-
-#define ns_object_foreach \
- _(neighbors, NETNS_TYPE_NEIGH) \
- _(routes, NETNS_TYPE_ROUTE) \
- _(addresses, NETNS_TYPE_ADDR) \
- _(links, NETNS_TYPE_LINK)
-
-static void
-ns_recv_error(rtnl_error_t err, uword o)
-{
- //An error was received. Reset everything.
- netns_p *ns = &netns_main.netnss[o];
- u32 *indexes = 0;
- u32 *i = 0;
-
-#define _(pool, type) \
- pool_foreach_index(*i, ns->netns.pool, { \
- vec_add1(indexes, *i); \
- }) \
- vec_foreach(i, indexes) { \
- pool_put_index(ns->netns.pool, *i); \
- netns_notify(ns, &ns->netns.pool[*i], type, NETNS_F_DEL); \
- } \
- vec_reset_length(indexes);
-
- ns_object_foreach
-
-#undef _
- vec_free(indexes);
-}
-
-static void
-ns_recv_rtnl(struct nlmsghdr *hdr, uword o)
-{
- netns_p *ns = &netns_main.netnss[o];
- switch (hdr->nlmsg_type) {
- case RTM_NEWROUTE:
- case RTM_DELROUTE:
- ns_rcv_route(ns, hdr);
- break;
- case RTM_NEWLINK:
- case RTM_DELLINK:
- ns_rcv_link(ns, hdr);
- break;
- case RTM_NEWADDR:
- case RTM_DELADDR:
- ns_rcv_addr(ns, hdr);
- break;
- case RTM_NEWNEIGH:
- case RTM_DELNEIGH:
- ns_rcv_neigh(ns, hdr);
- break;
- default:
- clib_warning("unknown rtnl type %d", hdr->nlmsg_type);
- break;
- }
-}
-
-static void
-netns_destroy(netns_p *ns)
-{
- netns_main_t *nm = &netns_main;
- rtnl_stream_close(ns->rtnl_handle);
- pool_put(nm->netnss, ns);
- pool_free(ns->netns.links);
- pool_free(ns->netns.addresses);
- pool_free(ns->netns.routes);
- pool_free(ns->netns.neighbors);
-}
-
-static netns_p *
-netns_get(char *name)
-{
- netns_main_t *nm = &netns_main;
- netns_p *ns;
- pool_foreach(ns, nm->netnss, {
- if (!strcmp(name, ns->netns.name))
- return ns;
- });
-
- if (strlen(name) > RTNL_NETNS_NAMELEN)
- return NULL;
-
- pool_get(nm->netnss, ns);
- rtnl_stream_t s = {
- .recv_message = ns_recv_rtnl,
- .error = ns_recv_error,
- .opaque = (uword)(ns - nm->netnss),
- };
- strcpy(s.name, name);
-
- u32 handle;
- if ((handle = rtnl_stream_open(&s)) == ~0) {
- pool_put(nm->netnss, ns);
- return NULL;
- }
-
- strcpy(ns->netns.name, name);
- ns->netns.addresses = 0;
- ns->netns.links = 0;
- ns->netns.neighbors = 0;
- ns->netns.routes = 0;
- ns->subscriber_count = 0;
- ns->rtnl_handle = handle;
- return ns;
-}
-
-u32 netns_open(char *name, netns_sub_t *sub)
-{
- netns_main_t *nm = &netns_main;
- netns_p *ns;
- netns_handle_t *p;
- if (!(ns = netns_get(name)))
- return ~0;
-
- pool_get(nm->handles, p);
- p->netns_index = ns - nm->netnss;
- p->notify = sub->notify;
- p->opaque = sub->opaque;
- ns->subscriber_count++;
- return p - nm->handles;
-}
-
-netns_t *netns_getns(u32 handle)
-{
- netns_main_t *nm = &netns_main;
- netns_handle_t *h = pool_elt_at_index(nm->handles, handle);
- netns_p *ns = pool_elt_at_index(nm->netnss, h->netns_index);
- return &ns->netns;
-}
-
-void netns_close(u32 handle)
-{
- netns_main_t *nm = &netns_main;
- netns_handle_t *h = pool_elt_at_index(nm->handles, handle);
- netns_p *ns = pool_elt_at_index(nm->netnss, h->netns_index);
- pool_put(h, nm->handles);
- ns->subscriber_count--;
- if (!ns->subscriber_count)
- netns_destroy(ns);
-}
-
-void netns_callme(u32 handle, char del)
-{
- netns_main_t *nm = &netns_main;
- netns_handle_t *h = pool_elt_at_index(nm->handles, handle);
- netns_p *ns = pool_elt_at_index(nm->netnss, h->netns_index);
- u32 i = 0;
- if (!h->notify)
- return;
-
-#define _(pool, type) \
- pool_foreach_index(i, ns->netns.pool, { \
- h->notify(&ns->netns.pool[i], type, \
- del?NETNS_F_DEL:NETNS_F_ADD, h->opaque); \
- });
-
- ns_object_foreach
-#undef _
-
- }
-
-u8 *format_ns_object(u8 *s, va_list *args)
-{
- netns_type_t t = va_arg(*args, netns_type_t);
- void *o = va_arg(*args, void *);
- switch (t) {
- case NETNS_TYPE_ADDR:
- return format(s, "addr %U", format_ns_addr, o);
- case NETNS_TYPE_ROUTE:
- return format(s, "route %U", format_ns_route, o);
- case NETNS_TYPE_LINK:
- return format(s, "link %U", format_ns_link, o);
- case NETNS_TYPE_NEIGH:
- return format(s, "neigh %U", format_ns_neigh, o);
- }
- return s;
-}
-
-u8 *format_ns_flags(u8 *s, va_list *args)
-{
- u32 flags = va_arg(*args, u32);
- if (flags & NETNS_F_ADD)
- s = format(s, "add");
- else if (flags & NETNS_F_DEL)
- s = format(s, "del");
- else
- s = format(s, "mod");
- return s;
-}
-
-clib_error_t *
-netns_init (vlib_main_t * vm)
-{
- netns_main_t *nm = &netns_main;
- nm->netnss = 0;
- nm->handles = 0;
- return 0;
-}
-
-VLIB_INIT_FUNCTION (netns_init);
diff --git a/utils/extras/devices/rtnetlink/netns.h b/utils/extras/devices/rtnetlink/netns.h
deleted file mode 100644
index 53effe5ce..000000000
--- a/utils/extras/devices/rtnetlink/netns.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2016-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 NETNS_H_
-#define NETNS_H_
-
-#include <vlib/vlib.h>
-
-#include <sys/socket.h>
-#include <linux/rtnetlink.h>
-#include <linux/netlink.h>
-#include <net/if.h>
-
-#include "rtnl.h"
-
-/*include it for 'struct mpls_label'*/
-#include <linux/mpls.h>
-/*so far depth is fixed, looking into ways to be dynamic*/
-#define MPLS_STACK_DEPTH 7
-
-typedef struct {
- struct ifinfomsg ifi;
- u8 hwaddr[IFHWADDRLEN];
- u8 broadcast[IFHWADDRLEN];
- u8 ifname[IFNAMSIZ];
- u32 mtu;
- u32 master;
- u8 qdisc[IFNAMSIZ];
- struct rtnl_link_stats stats; //This struct is big and only comes as a response to a request
- f64 last_updated;
-} ns_link_t;
-
-typedef struct {
- struct rtmsg rtm;
- u8 dst[16];
- u8 src[16];
- u8 via[16];
- u8 prefsrc[16];
- u32 iif;
- u32 oif;
- u32 table;
- u8 gateway[16];
- u32 priority;
- struct rta_cacheinfo cacheinfo;
- struct mpls_label encap[MPLS_STACK_DEPTH];
- f64 last_updated;
-} ns_route_t;
-
-typedef struct {
- struct ifaddrmsg ifaddr;
- u8 addr[16];
- u8 local[16];
- u8 label[IFNAMSIZ];
- u8 broadcast[16];
- u8 anycast[16];
- struct ifa_cacheinfo cacheinfo;
- f64 last_updated;
-} ns_addr_t;
-
-typedef struct {
- struct ndmsg nd;
- u8 dst[16];
- u8 lladdr[IFHWADDRLEN];
- u32 probes;
- struct nda_cacheinfo cacheinfo;
- f64 last_updated;
-} ns_neigh_t;
-
-typedef struct {
- char name[RTNL_NETNS_NAMELEN + 1];
- ns_link_t *links;
- ns_route_t *routes;
- ns_addr_t *addresses;
- ns_neigh_t *neighbors;
-} netns_t;
-
-
-typedef enum {
- NETNS_TYPE_LINK,
- NETNS_TYPE_ROUTE,
- NETNS_TYPE_ADDR,
- NETNS_TYPE_NEIGH,
-} netns_type_t;
-
-//Flags used in notification functions call
-#define NETNS_F_ADD 0x01
-#define NETNS_F_DEL 0x02
-
-typedef struct {
- void (*notify)(void *obj, netns_type_t type, u32 flags, uword opaque);
- uword opaque;
-} netns_sub_t;
-
-/*
- * Subscribe for events related to the given namespace.
- * When another subscriber already uses the namespace,
- * this call will not trigger updates for already
- * existing routes (This is to protect against
- * synch. Vs asynch. issues).
- */
-u32 netns_open(char *name, netns_sub_t *sub);
-
-/*
- * Retrieves the namespace structure associated with a
- * given namespace handler.
- */
-netns_t *netns_getns(u32 handle);
-
-/*
- * Terminates a subscriber session.
- */
-void netns_close(u32 handle);
-
-/*
- * Calls the callback associated with the handle
- * for all existing objects with the flags
- * set to (del?NETNS_F_DEL:NETNS_F_ADD).
- */
-void netns_callme(u32 handle, char del);
-
-/*
- * netns struct format functions.
- * Taking the struct as single argument.
- */
-u8 *format_ns_neigh(u8 *s, va_list *args);
-u8 *format_ns_addr(u8 *s, va_list *args);
-u8 *format_ns_route(u8 *s, va_list *args);
-u8 *format_ns_link(u8 *s, va_list *args);
-
-u8 *format_ns_object(u8 *s, va_list *args);
-u8 *format_ns_flags(u8 *s, va_list *args);
-
-#endif
diff --git a/utils/extras/devices/rtnetlink/rtnl.c b/utils/extras/devices/rtnetlink/rtnl.c
deleted file mode 100644
index ed3db9e72..000000000
--- a/utils/extras/devices/rtnetlink/rtnl.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * Copyright (c) 2016-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 <sched.h>
-
-#include <vlib/vlib.h>
-#include <vlib/unix/unix.h>
-#include <vppinfra/error.h>
-
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <float.h>
-#include <fcntl.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <string.h>
-
-#include "netns.h"
-#include "rtnl.h"
-
-#undef DBL_MAX
-#define DBL_MAX 1000000000.0
-
-typedef enum {
- RTNL_E_OPEN,
- RTNL_E_CLOSE,
- RTNL_E_READ,
-} rtnl_event_t;
-
-typedef enum {
- RTNL_S_INIT,
- RTNL_S_SYNC,
- RTNL_S_READY,
-} rtnl_state_t;
-
-typedef enum {
- RTNL_SS_OPENING,
- RTNL_SS_LINK,
- RTNL_SS_ADDR,
- RTNL_SS_ROUTE4,
- RTNL_SS_ROUTE6,
- RTNL_SS_NEIGH,
-} rtnl_sync_state_t;
-
-typedef struct {
- rtnl_stream_t stream;
- rtnl_state_t state;
- rtnl_sync_state_t sync_state;
- int ns_fd;
- int rtnl_socket;
- u32 unix_index;
- u32 rtnl_seq;
- f64 timeout;
-} rtnl_ns_t;
-
-typedef struct {
- f64 now;
- rtnl_ns_t *streams;
-} rtnl_main_t;
-
-static rtnl_main_t rtnl_main;
-static vlib_node_registration_t rtnl_process_node;
-
-#define RTNL_BUFFSIZ 16384
-#define RTNL_DUMP_TIMEOUT 1
-
-static inline u32 grpmask(u32 g)
-{
- ASSERT (g <= 31);
- if (g) {
- return 1 << (g - 1);
- } else
- return 0;
-}
-
-
-u8 *format_rtnl_nsname2path(u8 *s, va_list *args)
-{
- char *nsname = va_arg(*args, char *);
- if (!nsname || !strlen(nsname)) {
- return format(s, "/proc/self/ns/net");
- } else if (strpbrk(nsname, "/") != NULL) {
- return format(s, "%s", nsname);
- } else {
- return format(s, "/var/run/netns/%s", nsname);
- }
-}
-
-static_always_inline void
-rtnl_schedule_timeout(rtnl_ns_t *ns, f64 when)
-{
- ns->timeout = when;
-}
-
-static_always_inline void
-rtnl_cancel_timeout(rtnl_ns_t *ns)
-{
- ns->timeout = DBL_MAX;
-}
-
-static clib_error_t *rtnl_read_cb(struct clib_file * f)
-{
- rtnl_main_t *rm = &rtnl_main;
- vlib_main_t *vm = vlib_get_main();
- rtnl_ns_t *ns = &rm->streams[f->private_data];
- vlib_process_signal_event(vm, rtnl_process_node.index, RTNL_E_READ, (uword)(ns - rm->streams));
- return 0;
-}
-
-int rtnl_dump_request(rtnl_ns_t *ns, int type, void *req, size_t len)
-{
- struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
- struct nlmsghdr nlh = {
- .nlmsg_len = NLMSG_LENGTH(len),
- .nlmsg_type = type,
- .nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST,
- .nlmsg_pid = 0,
- .nlmsg_seq = ++ns->rtnl_seq,
- };
- struct iovec iov[2] = {
- { .iov_base = &nlh, .iov_len = sizeof(nlh) },
- { .iov_base = req, .iov_len = len }
- };
- struct msghdr msg = {
- .msg_name = &nladdr,
- .msg_namelen = sizeof(nladdr),
- .msg_iov = iov,
- .msg_iovlen = 2,
- };
- if(sendmsg(ns->rtnl_socket, &msg, 0) < 0) {
- clib_warning("sendmsg error: %s", strerror(errno));
- return -1;
- }
- return 0;
-}
-
-static void rtnl_socket_close(rtnl_ns_t *ns)
-{
- clib_file_del(&file_main, &file_main.file_pool[ns->unix_index]);
- close(ns->rtnl_socket);
-}
-
-struct rtnl_thread_exec {
- int fd;
- void *(*fn)(void *);
- void *arg;
- void **ret;
-};
-
-static void *rtnl_exec_in_thread_fn(void *p)
-{
- struct rtnl_thread_exec *ex = (struct rtnl_thread_exec *) p;
- if (setns(ex->fd, 0))
- return (void *) ((uword) (-errno));
-
- *ex->ret = ex->fn(ex->arg);
- return NULL;
-}
-
-static int rtnl_exec_in_namespace_byfd(int fd, void *(*fn)(void *), void *arg, void **ret)
-{
- pthread_t thread;
- void *thread_ret;
- struct rtnl_thread_exec ex = {
- .fd = fd,
- .fn = fn,
- .arg = arg,
- .ret = ret
- };
- if(pthread_create(&thread, NULL, rtnl_exec_in_thread_fn, &ex))
- return -errno;
-
- if(pthread_join(thread, &thread_ret))
- return -errno;
-
- if (thread_ret)
- return (int) ((uword)thread_ret);
-
- return 0;
-}
-
-int rtnl_exec_in_namespace(u32 stream_index, void *(*fn)(void *), void *arg, void **ret)
-{
- rtnl_main_t *rm = &rtnl_main;
- if (pool_is_free_index(rm->streams, stream_index))
- return -EBADR;
-
- rtnl_ns_t *ns = pool_elt_at_index(rm->streams, stream_index);
- return rtnl_exec_in_namespace_byfd(ns->ns_fd, fn, arg, ret);
-}
-
-int rtnl_exec_in_namespace_by_name(char *nsname, void *(*fn)(void *), void *arg, void **ret)
-{
- int fd;
- u8 *s = format((u8 *)0, "%U", format_rtnl_nsname2path, nsname);
-
- if ((fd = open((char *)s, O_RDONLY)) < 0) {
- vec_free(s);
- return -errno;
- }
-
- int r = rtnl_exec_in_namespace_byfd(fd, fn, arg, ret);
- vec_free(s);
- close(fd);
- return r;
-}
-
-/* this function is run by the second thread */
-static void *rtnl_thread_fn(void *p)
-{
- rtnl_ns_t *ns = (rtnl_ns_t *) p;
- if (setns(ns->ns_fd, 0)) {
- clib_warning("setns(%d, %d) error %d", ns->ns_fd, CLONE_NEWNET, errno);
- return (void *) -1;
- }
-
- if ((ns->rtnl_socket = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) == -1) {
- clib_warning("Cannot open socket");
- return (void *) -2;
- }
-
- return NULL;
-}
-
-static int rtnl_socket_open(rtnl_ns_t *ns)
-{
- rtnl_main_t *rm = &rtnl_main;
- pthread_t thread;
- void *thread_ret;
- if(pthread_create(&thread, NULL, rtnl_thread_fn, ns)) {
- clib_warning("Can't create opening thread");
- return -1;
- }
-
- if(pthread_join(thread, &thread_ret)) {
- clib_warning("Can't join opening thread");
- return -2;
- }
-
- if (thread_ret) {
- clib_warning("Could not open netlink socket");
- return -3;
- }
-
- struct sockaddr_nl addr = {
- .nl_family = AF_NETLINK,
- .nl_pad = 0,
- .nl_pid = 0,
- /*add mpls message group*/
- .nl_groups = grpmask(RTNLGRP_LINK)| grpmask(RTNLGRP_IPV6_IFADDR) |
- grpmask(RTNLGRP_IPV4_IFADDR) | grpmask(RTNLGRP_IPV4_ROUTE) |
- grpmask(RTNLGRP_IPV6_ROUTE) | grpmask(RTNLGRP_NEIGH) |
- grpmask(RTNLGRP_NOTIFY) /* | grpmask(RTNLGRP_MPLS_ROUTE)*/,
- };
-
- if (bind(ns->rtnl_socket, (struct sockaddr*) &addr, sizeof(addr))) {
- close(ns->rtnl_socket);
- return -3;
- }
-
- clib_file_t template = {0};
- template.read_function = rtnl_read_cb;
- template.file_descriptor = ns->rtnl_socket;
- template.private_data = (uword) (ns - rm->streams);
- ns->unix_index = clib_file_add (&file_main, &template);
- return 0;
-}
-
-static int
-rtnl_rcv_error(rtnl_ns_t *ns, struct nlmsghdr *hdr, int *error)
-{
- struct nlmsgerr *err = NLMSG_DATA(hdr);
- size_t datalen = hdr->nlmsg_len - NLMSG_ALIGN(sizeof(*hdr));
- if(datalen < sizeof(*err))
- return -1;
-
- *error = err->error;
- return 0;
-}
-
-static void
-rtnl_sync_reset(rtnl_ns_t *ns)
-{
- if (ns->sync_state == RTNL_SS_OPENING)
- return;
-
- rtnl_socket_close(ns);
- ns->sync_state = RTNL_SS_OPENING;
-}
-
-static void
-rtnl_sync_done(rtnl_ns_t *ns)
-{
- rtnl_main_t *rm = &rtnl_main;
- struct ifaddrmsg addrmsg;
- struct rtmsg rtmsg;
- struct ndmsg ndmsg;
- switch (ns->sync_state) {
- case RTNL_SS_OPENING:
- //Cannot happen here
- break;
- case RTNL_SS_LINK:
- memset(&addrmsg, 0, sizeof(addrmsg));
- addrmsg.ifa_family = AF_UNSPEC;
- if(rtnl_dump_request(ns, RTM_GETADDR, &addrmsg, sizeof(addrmsg))) {
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now + 1);
- return;
- }
- rtnl_schedule_timeout(ns, rm->now + RTNL_DUMP_TIMEOUT);
- ns->sync_state = RTNL_SS_ADDR;
- break;
- case RTNL_SS_ADDR:
- case RTNL_SS_ROUTE4:
- memset(&rtmsg, 0, sizeof(rtmsg));
- rtmsg.rtm_family = (ns->sync_state == RTNL_SS_ADDR)?AF_INET:AF_INET6;
- rtmsg.rtm_table = RT_TABLE_UNSPEC;
- if(rtnl_dump_request(ns, RTM_GETROUTE, &rtmsg, sizeof(rtmsg))) {
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now + 1);
- return;
- }
- rtnl_schedule_timeout(ns, rm->now + RTNL_DUMP_TIMEOUT);
- ns->sync_state = (ns->sync_state == RTNL_SS_ADDR)?RTNL_SS_ROUTE4:RTNL_SS_ROUTE6;
- break;
- case RTNL_SS_ROUTE6:
- memset(&ndmsg, 0, sizeof(ndmsg));
- ndmsg.ndm_family = AF_UNSPEC;
- if(rtnl_dump_request(ns, RTM_GETNEIGH, &ndmsg, sizeof(ndmsg))) {
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now + 1);
- return;
- }
- rtnl_schedule_timeout(ns, rm->now + RTNL_DUMP_TIMEOUT);
- ns->sync_state = RTNL_SS_NEIGH;
- break;
- case RTNL_SS_NEIGH:
- ns->state = RTNL_S_READY;
- ns->sync_state = 0;
- rtnl_cancel_timeout(ns);
- break;
- }
-}
-
-static void
-rtnl_sync_timeout(rtnl_ns_t *ns)
-{
- rtnl_main_t *rm = &rtnl_main;
- struct ifinfomsg imsg = {};
- switch (ns->sync_state) {
- case RTNL_SS_OPENING:
- if (rtnl_socket_open(ns)) {
- rtnl_schedule_timeout(ns, rm->now + 10);
- return;
- }
- imsg.ifi_family = AF_UNSPEC;
- if (rtnl_dump_request(ns, RTM_GETLINK, &imsg, sizeof(imsg))) {
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now + 10);
- }
- ns->sync_state = RTNL_SS_LINK;
- rtnl_schedule_timeout(ns, rm->now + 2);
- break;
- case RTNL_SS_LINK:
- case RTNL_SS_ADDR:
- case RTNL_SS_ROUTE4:
- case RTNL_SS_ROUTE6:
- case RTNL_SS_NEIGH:
- //Timeout happened while synchronizing
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now + 1);
- break;
- }
-}
-
-static int
-rtnl_ns_recv(rtnl_ns_t *ns, struct nlmsghdr *hdr)
-{
- rtnl_main_t *rm = &rtnl_main;
- int ret, error = 0;
-
- if (ns->state == RTNL_S_SYNC &&
- ((hdr->nlmsg_flags & RTM_F_NOTIFY) ||
- (hdr->nlmsg_seq != (ns->rtnl_seq)))) {
- clib_warning("Received notification while in sync. Restart synchronization.");
- rtnl_sync_reset(ns);
- rtnl_schedule_timeout(ns, rm->now);
- }
-
- switch (hdr->nlmsg_type) {
- case NLMSG_DONE:
- rtnl_sync_done(ns);
- break;
- case NLMSG_ERROR:
- if((ret = rtnl_rcv_error(ns, hdr, &error)))
- return ret;
- break;
- case RTM_NEWROUTE:
- case RTM_DELROUTE:
- case RTM_NEWLINK:
- case RTM_DELLINK:
- case RTM_NEWADDR:
- case RTM_DELADDR:
- case RTM_NEWNEIGH:
- case RTM_DELNEIGH:
- if (ns->stream.recv_message)
- ns->stream.recv_message(hdr, ns->stream.opaque);
- break;
- default:
- clib_warning("Unknown rtnetlink type %d", hdr->nlmsg_type);
- break;
- }
- return 0;
-}
-
-static void
-rtnl_process_open(rtnl_ns_t *ns)
-{
- rtnl_main_t *rm = &rtnl_main;
- if (ns->state != RTNL_S_INIT)
- return;
-
- ns->state = RTNL_S_SYNC;
- ns->sync_state = RTNL_SS_OPENING;
- rtnl_schedule_timeout(ns, rm->now);
-}
-
-static void
-rtnl_process_close(rtnl_ns_t *ns)
-{
- rtnl_main_t *rm = &rtnl_main;
- if (ns->state == RTNL_S_INIT)
- return;
-
- rtnl_socket_close(ns);
- close(ns->ns_fd);
- pool_put(rm->streams, ns);
-}
-
-static int
-rtnl_process_read(rtnl_ns_t *ns)
-{
- uint8_t buff[RTNL_BUFFSIZ];
- ssize_t len;
- struct nlmsghdr *hdr;
- while(1) {
- if((len = recv(ns->rtnl_socket, buff, RTNL_BUFFSIZ, MSG_DONTWAIT)) < 0) {
- if(errno != EAGAIN) {
- clib_warning("rtnetlink recv error (%d) [%s]: %s", ns->rtnl_socket, ns->stream.name, strerror(errno));
- return -1;
- }
- return 0;
- }
-
- for(hdr = (struct nlmsghdr *) buff;
- len > 0;
- len -= NLMSG_ALIGN(hdr->nlmsg_len),
- hdr = (struct nlmsghdr *) (((uint8_t *) hdr) + NLMSG_ALIGN(hdr->nlmsg_len))) {
- if((sizeof(*hdr) > (size_t)len) || (hdr->nlmsg_len > (size_t)len)) {
- clib_warning("rtnetlink buffer too small (%d Vs %d)", (int) hdr->nlmsg_len, (int) len);
- return -1;
- }
- if (rtnl_ns_recv(ns, hdr))
- return -1;
- }
- }
- return 0;
-}
-
-static void
-rtnl_process_timeout(rtnl_ns_t *ns)
-{
- switch (ns->state) {
- case RTNL_S_SYNC:
- rtnl_sync_timeout(ns);
- break;
- case RTNL_S_INIT:
- case RTNL_S_READY:
- clib_warning("Should not happen");
- break;
- }
-}
-
-static uword
-rtnl_process (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- rtnl_main_t *rm = &rtnl_main;
- uword event_type;
- uword *event_data = 0;
- rm->now = vlib_time_now(vm);
- f64 timeout = DBL_MAX;
- rtnl_ns_t *ns;
-
- //Setting up
- while (1) {
- vlib_process_wait_for_event_or_clock(vm, timeout - rm->now);
- event_type = vlib_process_get_events(vm, &event_data);
- rm->now = vlib_time_now(vm);
-
- if (event_type == ~0) { //Clock event or no event
- pool_foreach(ns, rm->streams, {
- if (ns->timeout < rm->now) {
- ns->timeout = DBL_MAX;
- rtnl_process_timeout(ns);
- }
- });
- } else {
- rtnl_ns_t *ns;
- uword *d;
- vec_foreach(d, event_data) {
- ns = &rm->streams[d[0]];
- switch (event_type)
- {
- case RTNL_E_CLOSE:
- rtnl_process_close(ns);
- break;
- case RTNL_E_OPEN:
- rtnl_process_open(ns);
- break;
- case RTNL_E_READ:
- rtnl_process_read(ns);
- break;
- }
- }
- }
-
- vec_reset_length (event_data);
-
- timeout = DBL_MAX;
- pool_foreach(ns, rm->streams, {
- if (ns->timeout < timeout)
- timeout = ns->timeout;
- });
- }
- return frame->n_vectors;
-}
-
-VLIB_REGISTER_NODE(rtnl_process_node, static) = {
- .function = rtnl_process,
- .name = "rtnl-process",
- .type = VLIB_NODE_TYPE_PROCESS,
-};
-
-u32
-rtnl_stream_open(rtnl_stream_t *template)
-{
- vlib_main_t *vm = vlib_get_main();
- rtnl_main_t *rm = &rtnl_main;
- rtnl_ns_t *ns;
- int fd;
- u8 *s = format((u8 *)0, "%U", format_rtnl_nsname2path, template->name);
- vec_add1(s, 0);
-
- if ((fd = open((char *)s, O_RDONLY)) < 0) {
- clib_unix_warning("open stream %s: ", s);
- vec_free(s);
- return ~0;
- }
-
- vec_free(s);
- pool_get(rm->streams, ns);
- ns->state = RTNL_S_INIT;
- ns->ns_fd = fd;
- ns->stream = *template;
- vlib_process_signal_event(vm, rtnl_process_node.index, RTNL_E_OPEN, (uword)(ns - rm->streams));
- return ns - rm->streams;
-}
-
-void
-rtnl_stream_close(u32 stream_index)
-{
- vlib_main_t *vm = vlib_get_main();
- rtnl_main_t *rm = &rtnl_main;
- ASSERT(!pool_is_free_index(rm->streams, stream_index));
- vlib_process_signal_event(vm, rtnl_process_node.index, RTNL_E_CLOSE, stream_index);
-}
-
-clib_error_t *
-rtnl_init (vlib_main_t * vm)
-{
- rtnl_main_t *rm = &rtnl_main;
- rm->streams = 0;
- return 0;
-}
-
-VLIB_INIT_FUNCTION (rtnl_init);
diff --git a/utils/extras/devices/rtnetlink/rtnl.h b/utils/extras/devices/rtnetlink/rtnl.h
deleted file mode 100644
index 3f96252c1..000000000
--- a/utils/extras/devices/rtnetlink/rtnl.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2016-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 RTNL_H_
-#define RTNL_H_
-
-#include <vlib/vlib.h>
-
-#include <linux/netlink.h>
-#include <vppinfra/clib.h>
-
-typedef enum {
- RTNL_ERR_UNKNOWN,
-} rtnl_error_t;
-
-#define RTNL_NETNS_NAMELEN 128
-
-/*
- * RTNL stream implements an RTNL overlay
- * for receiving continuous updates for a given namespace.
- * When the stream is initially opened, dump requests are sent
- * in order to retrieve the original state.
- * handle_error is called any time synchronization cannot be
- * achieved. When called, state is reset to its original state and
- * new dump requests are sent.
- */
-
-typedef struct rtnl_stream_s {
- char name[RTNL_NETNS_NAMELEN + 1];
- void (*recv_message)(struct nlmsghdr *hdr, uword opaque);
- void (*error)(rtnl_error_t err, uword opaque);
- uword opaque;
-} rtnl_stream_t;
-
-u32 rtnl_stream_open(rtnl_stream_t *template);
-void rtnl_stream_close(u32 handle);
-
-/*
- * Executes a function in a synchronously executed thread in the
- * given namespace.
- * Returns 0 on success, and -errno on error.
- */
-int rtnl_exec_in_namespace(u32 handle, void *(*fn)(void *), void *arg, void **ret);
-int rtnl_exec_in_namespace_by_name(char *nsname, void *(*fn)(void *), void *arg, void **ret);
-
-u8 *format_rtnl_nsname2path(u8 *s, va_list *args);
-
-#endif
diff --git a/utils/extras/devices/rtnetlink/test.c b/utils/extras/devices/rtnetlink/test.c
deleted file mode 100644
index 031748dd3..000000000
--- a/utils/extras/devices/rtnetlink/test.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2016-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 <librtnl/netns.h>
-
-#include <vnet/plugin/plugin.h>
-#include <librtnl/mapper.h>
-#include <vnet/ip/ip.h>
-#include <vnet/fib/fib.h>
-#include <vnet/fib/ip4_fib.h>
-#include <vnet/fib/ip6_fib.h>
-
-u32 handles[10];
-
-static void
-test_notify(void *obj, netns_type_t type, u32 flags, uword opaque) {
- u32 index = (u32) opaque;
- const char *action = (flags & NETNS_F_ADD)?"add":(flags & NETNS_F_DEL)?"del":"mod";
-
- switch (type) {
- case NETNS_TYPE_ADDR:
- clib_warning("%d: addr %s %U", index, action, format_ns_addr, (ns_addr_t *)obj);
- break;
- case NETNS_TYPE_ROUTE:
- clib_warning("%d: route %s %U", index, action, format_ns_route, (ns_route_t *)obj);
- break;
- case NETNS_TYPE_LINK:
- clib_warning("%d:link %s %U", index, action, format_ns_link, (ns_link_t *)obj);
- break;
- case NETNS_TYPE_NEIGH:
- clib_warning("%d: neigh %s %U", index, action, format_ns_neigh, (ns_neigh_t *)obj);
- break;
- }
-}
-
-static clib_error_t *
-test_enable_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- char *nsname = 0;
- u32 index;
- if (!unformat(input, "%s", &nsname)) {
- return clib_error_return(0, "unknown input `%U'",
- format_unformat_error, input);
- }
- if (!unformat(input, "%d", &index)) {
- return clib_error_return(0, "unknown input `%U'",
- format_unformat_error, input);
- }
-
- if (!strcmp(nsname, "default"))
- nsname[0] = 0;
-
- netns_sub_t sub;
- sub.notify = test_notify;
- sub.opaque = index;
- handles[index] = netns_open(nsname, &sub);
- if (handles[index] == ~0) {
- return clib_error_create("Could not open netns with name %s", nsname);
- }
- return 0;
-}
-
-static clib_error_t *
-test_disable_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- u32 index;
- if (!unformat(input, "%d", &index)) {
- return clib_error_return(0, "unknown input `%U'",
- format_unformat_error, input);
- }
-
- netns_close(handles[index]);
- return 0;
-}
-
-VLIB_CLI_COMMAND (rtnl_enable_command, static) = {
- .path = "test netns enable",
- .short_help = "test netns enable [<ns-name>|default] <index>",
- .function = test_enable_command_fn,
-};
-
-VLIB_CLI_COMMAND (rtnl_disable_command, static) = {
- .path = "test netns disable",
- .short_help = "test rtnl disable <index>",
- .function = test_disable_command_fn,
-};
-
-u32 mapper_indexes[10];
-
-static clib_error_t *
-mapper_ns_add_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- u32 index;
- char *nsname;
- u32 table_id;
- if (!unformat(input, "%d", &index))
- return clib_error_return(0, "invalid index `%U'",
- format_unformat_error, input);
- if (!unformat(input, "%s", &nsname))
- return clib_error_return(0, "invalid nsname `%U'",
- format_unformat_error, input);
- if (!unformat(input, "%d", &table_id))
- return clib_error_return(0, "invalid fib index `%U'",
- format_unformat_error, input);
-
- if (!strcmp(nsname, "default"))
- nsname[0] = 0;
-
- u32 fib4 = ip4_fib_index_from_table_id(table_id);
- u32 fib6 = ip6_fib_index_from_table_id(table_id);
-
- if (mapper_add_ns(nsname, fib4, fib6, &mapper_indexes[index]))
- return clib_error_return(0, "Could not add ns %s", nsname);
- return 0;
-}
-
-VLIB_CLI_COMMAND (mapper_ns_add_command, static) = {
- .path = "test mapper ns add",
- .short_help = "test mapper ns add <index> <nsname> <table-id>",
- .function = mapper_ns_add_command_fn,
-};
-
-static clib_error_t *
-mapper_ns_del_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- u32 index;
- if (!unformat(input, "%d", &index))
- return clib_error_return(0, "invalid index `%U'",
- format_unformat_error, input);
-
- if (mapper_del_ns(mapper_indexes[index]))
- return clib_error_return(0, "Could not del ns %d", index);
- return 0;
-}
-
-VLIB_CLI_COMMAND (mapper_ns_del_command, static) = {
- .path = "test mapper ns delete",
- .short_help = "test mapper ns delete <index>",
- .function = mapper_ns_del_command_fn,
-};
-
-static clib_error_t *
-mapper_iface_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- u32 nsindex;
- u32 ifindex;
- u32 sw_if_index;
- int del = 0;
- if (!unformat(input, "%d", &nsindex))
- return clib_error_return(0, "invalid nsindex `%U'",
- format_unformat_error, input);
- if (!unformat(input, "%d", &ifindex))
- return clib_error_return(0, "invalid ifindex `%U'",
- format_unformat_error, input);
- if (!unformat(input, "%d", &sw_if_index))
- return clib_error_return(0, "invalid sw_if_index `%U'",
- format_unformat_error, input);
- if (unformat(input, "del"))
- del = 1;
-
- clib_warning("mapper_add_del %d %d %d %d", mapper_indexes[nsindex], ifindex, sw_if_index, del);
-
- if (mapper_add_del(mapper_indexes[nsindex], ifindex, sw_if_index, del))
- return clib_error_return(0, "Could not add iface");
- return 0;
-}
-
-
-VLIB_CLI_COMMAND (mapper_iface_command, static) = {
- .path = "test mapper iface",
- .short_help = "test mapper iface <nsindex> <linux-ifindex> <sw_if_index> [del]",
- .function = mapper_iface_command_fn,
-};
-
-/* *INDENT-OFF* */
-VLIB_PLUGIN_REGISTER () = {
- //.version = VPP_BUILD_VER, FIXME
- .description = "netlink",
-};
-/* *INDENT-ON* */
-
diff --git a/utils/extras/rtinject/tap_inject.c b/utils/extras/rtinject/tap_inject.c
deleted file mode 100644
index f41ae86c8..000000000
--- a/utils/extras/rtinject/tap_inject.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright 2016 Intel Corporation
- *
- * 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 "tap_inject.h"
-
-#include <vnet/mfib/mfib_table.h>
-#include <vnet/ip/ip.h>
-#include <vnet/ip/lookup.h>
-#include <vnet/fib/fib.h>
-
-static tap_inject_main_t tap_inject_main;
-extern dpo_type_t tap_inject_dpo_type;
-
-tap_inject_main_t *
-tap_inject_get_main (void)
-{
- return &tap_inject_main;
-}
-
-void
-tap_inject_insert_tap (u32 sw_if_index, u32 tap_fd, u32 tap_if_index)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- vec_validate_init_empty (im->sw_if_index_to_tap_fd, sw_if_index, ~0);
- vec_validate_init_empty (im->sw_if_index_to_tap_if_index, sw_if_index, ~0);
-
- vec_validate_init_empty (im->tap_fd_to_sw_if_index, tap_fd, ~0);
-
- im->sw_if_index_to_tap_fd[sw_if_index] = tap_fd;
- im->sw_if_index_to_tap_if_index[sw_if_index] = tap_if_index;
-
- im->tap_fd_to_sw_if_index[tap_fd] = sw_if_index;
-
- hash_set (im->tap_if_index_to_sw_if_index, tap_if_index, sw_if_index);
-}
-
-void
-tap_inject_delete_tap (u32 sw_if_index)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
- u32 tap_fd = im->sw_if_index_to_tap_fd[sw_if_index];
- u32 tap_if_index = im->sw_if_index_to_tap_if_index[sw_if_index];
-
- im->sw_if_index_to_tap_if_index[sw_if_index] = ~0;
- im->sw_if_index_to_tap_fd[sw_if_index] = ~0;
- im->tap_fd_to_sw_if_index[tap_fd] = ~0;
-
- hash_unset (im->tap_if_index_to_sw_if_index, tap_if_index);
-}
-
-u32
-tap_inject_lookup_tap_fd (u32 sw_if_index)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- vec_validate_init_empty (im->sw_if_index_to_tap_fd, sw_if_index, ~0);
- return im->sw_if_index_to_tap_fd[sw_if_index];
-}
-
-u32
-tap_inject_lookup_sw_if_index_from_tap_fd (u32 tap_fd)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- vec_validate_init_empty (im->tap_fd_to_sw_if_index, tap_fd, ~0);
- return im->tap_fd_to_sw_if_index[tap_fd];
-}
-
-u32
-tap_inject_lookup_sw_if_index_from_tap_if_index (u32 tap_if_index)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
- uword * sw_if_index;
-
- sw_if_index = hash_get (im->tap_if_index_to_sw_if_index, tap_if_index);
- return sw_if_index ? *(u32 *)sw_if_index : ~0;
-}
-
-/* *INDENT-OFF* */
-VLIB_PLUGIN_REGISTER () = {
- // .version = VPP_BUILD_VER, FIXME
- .description = "router",
-};
-/* *INDENT-ON* */
-
-
-static void
-tap_inject_disable (void)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- im->flags &= ~TAP_INJECT_F_ENABLED;
-
- clib_warning ("tap-inject is not actually disabled.");
-}
-
-static clib_error_t *
-tap_inject_enable (void)
-{
- vlib_main_t * vm = vlib_get_main ();
- tap_inject_main_t * im = tap_inject_get_main ();
-
- if (tap_inject_is_enabled ())
- return 0;
-
- tap_inject_enable_netlink ();
-
- /* Only enable netlink? */
- if (im->flags & TAP_INJECT_F_CONFIG_NETLINK)
- {
- im->flags |= TAP_INJECT_F_ENABLED;
- return 0;
- }
-
- /* Register ARP and ICMP6 as neighbor nodes. */
- ethernet_register_input_type (vm, ETHERNET_TYPE_ARP, im->neighbor_node_index);
- ip6_register_protocol (IP_PROTOCOL_ICMP6, im->neighbor_node_index);
-
- /* Register remaining protocols. */
- ip4_register_protocol (IP_PROTOCOL_ICMP, im->tx_node_index);
-
- ip4_register_protocol (IP_PROTOCOL_OSPF, im->tx_node_index);
- ip4_register_protocol (IP_PROTOCOL_TCP, im->tx_node_index);
- ip4_register_protocol (IP_PROTOCOL_UDP, im->tx_node_index);
-
- ip6_register_protocol (IP_PROTOCOL_OSPF, im->tx_node_index);
- ip6_register_protocol (IP_PROTOCOL_TCP, im->tx_node_index);
- ip6_register_protocol (IP_PROTOCOL_UDP, im->tx_node_index);
-
- {
- dpo_id_t dpo = DPO_INVALID;
-
- const mfib_prefix_t pfx_224_0_0_0 = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_grp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0xe0000000),
- },
- .fp_src_addr = {
- .ip4.as_u32 = 0,
- },
- };
-
- dpo_set(&dpo, tap_inject_dpo_type, DPO_PROTO_IP4, ~0);
-
- index_t repi = replicate_create(1, DPO_PROTO_IP4);
- replicate_set_bucket(repi, 0, &dpo);
-
- mfib_table_entry_special_add(0,
- &pfx_224_0_0_0,
- MFIB_SOURCE_API,
- MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF,
- repi);
-
- dpo_reset(&dpo);
- }
-
- im->flags |= TAP_INJECT_F_ENABLED;
-
- return 0;
-}
-
-static uword
-tap_inject_iface_isr (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * f)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
- vnet_hw_interface_t * hw;
- u32 * hw_if_index;
- clib_error_t * err = 0;
-
- vec_foreach (hw_if_index, im->interfaces_to_enable)
- {
- hw = vnet_get_hw_interface (vnet_get_main (), *hw_if_index);
-
- if (hw->hw_class_index == ethernet_hw_interface_class.index)
- {
- err = tap_inject_tap_connect (hw);
- if (err)
- break;
- }
- }
-
- vec_foreach (hw_if_index, im->interfaces_to_disable)
- tap_inject_tap_disconnect (*hw_if_index);
-
- vec_free (im->interfaces_to_enable);
- vec_free (im->interfaces_to_disable);
-
- return err ? -1 : 0;
-}
-
-VLIB_REGISTER_NODE (tap_inject_iface_isr_node, static) = {
- .function = tap_inject_iface_isr,
- .name = "tap-inject-iface-isr",
- .type = VLIB_NODE_TYPE_INPUT,
- .state = VLIB_NODE_STATE_INTERRUPT,
- .vector_size = sizeof (u32),
-};
-
-
-static clib_error_t *
-tap_inject_interface_add_del (struct vnet_main_t * vnet_main, u32 hw_if_index,
- u32 add)
-{
- vlib_main_t * vm = vlib_get_main ();
- tap_inject_main_t * im = tap_inject_get_main ();
-
- if (!tap_inject_is_config_enabled ())
- return 0;
-
- tap_inject_enable ();
-
- if (add)
- vec_add1 (im->interfaces_to_enable, hw_if_index);
- else
- vec_add1 (im->interfaces_to_disable, hw_if_index);
-
- vlib_node_set_interrupt_pending (vm, tap_inject_iface_isr_node.index);
-
- return 0;
-}
-
-VNET_HW_INTERFACE_ADD_DEL_FUNCTION (tap_inject_interface_add_del);
-
-
-static clib_error_t *
-tap_inject_enable_disable_all_interfaces (int enable)
-{
- vnet_main_t * vnet_main = vnet_get_main ();
- tap_inject_main_t * im = tap_inject_get_main ();
- vnet_hw_interface_t * interfaces;
- vnet_hw_interface_t * hw;
- u32 ** indices;
-
- if (enable)
- tap_inject_enable ();
- else
- tap_inject_disable ();
-
- /* Collect all the interface indices. */
- interfaces = vnet_main->interface_main.hw_interfaces;
- indices = enable ? &im->interfaces_to_enable : &im->interfaces_to_disable;
- pool_foreach (hw, interfaces, vec_add1 (*indices, hw - interfaces));
-
- if (tap_inject_iface_isr (vlib_get_main (), 0, 0))
- return clib_error_return (0, "tap-inject interface add del isr failed");
-
- return 0;
-}
-
-static clib_error_t *
-tap_inject_cli (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- if (cmd->function_arg)
- {
- clib_error_t * err;
-
- if (tap_inject_is_config_disabled ())
- return clib_error_return (0,
- "tap-inject is disabled in config, thus cannot be enabled.");
-
- /* Enable */
- err = tap_inject_enable_disable_all_interfaces (1);
- if (err)
- {
- tap_inject_enable_disable_all_interfaces (0);
- return err;
- }
-
- im->flags |= TAP_INJECT_F_CONFIG_ENABLE;
- }
- else
- {
- /* Disable */
- tap_inject_enable_disable_all_interfaces (0);
- im->flags &= ~TAP_INJECT_F_CONFIG_ENABLE;
- }
-
- return 0;
-}
-
-VLIB_CLI_COMMAND (tap_inject_enable_cmd, static) = {
- .path = "enable tap-inject",
- .short_help = "enable tap-inject",
- .function = tap_inject_cli,
- .function_arg = 1,
-};
-
-VLIB_CLI_COMMAND (tap_inject_disable_cmd, static) = {
- .path = "disable tap-inject",
- .short_help = "disable tap-inject",
- .function = tap_inject_cli,
- .function_arg = 0,
-};
-
-
-static clib_error_t *
-show_tap_inject (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- vnet_main_t * vnet_main = vnet_get_main ();
- tap_inject_main_t * im = tap_inject_get_main ();
- u32 k, v;
-
- if (tap_inject_is_config_disabled ())
- {
- vlib_cli_output (vm, "tap-inject is disabled in config.\n");
- return 0;
- }
-
- if (!tap_inject_is_enabled ())
- {
- vlib_cli_output (vm, "tap-inject is not enabled.\n");
- return 0;
- }
-
- hash_foreach (k, v, im->tap_if_index_to_sw_if_index, {
- vlib_cli_output (vm, "%U -> %U",
- format_vnet_sw_interface_name, vnet_main,
- vnet_get_sw_interface (vnet_main, v),
- format_tap_inject_tap_name, k);
- });
-
- return 0;
-}
-
-VLIB_CLI_COMMAND (show_tap_inject_cmd, static) = {
- .path = "show tap-inject",
- .short_help = "show tap-inject",
- .function = show_tap_inject,
-};
-
-
-static clib_error_t *
-tap_inject_config (vlib_main_t * vm, unformat_input_t * input)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- im->flags |= TAP_INJECT_F_CONFIG_ENABLE;
-
- else if (unformat (input, "disable"))
- im->flags |= TAP_INJECT_F_CONFIG_DISABLE;
-
- else if (unformat (input, "netlink-only"))
- im->flags |= TAP_INJECT_F_CONFIG_NETLINK;
-
- else
- return clib_error_return (0, "syntax error `%U'",
- format_unformat_error, input);
- }
-
- if (tap_inject_is_config_enabled () && tap_inject_is_config_disabled ())
- return clib_error_return (0,
- "tap-inject cannot be both enabled and disabled.");
-
- return 0;
-}
-
-VLIB_CONFIG_FUNCTION (tap_inject_config, "tap-inject");
diff --git a/utils/extras/rtinject/tap_inject.h b/utils/extras/rtinject/tap_inject.h
deleted file mode 100644
index ec5121a09..000000000
--- a/utils/extras/rtinject/tap_inject.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2016 Intel Corporation
- *
- * 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 _TAP_INJECT_H
-#define _TAP_INJECT_H
-
-#include <vnet/plugin/plugin.h>
-#include <vnet/ip/ip.h>
-
-#ifndef ETHER_ADDR_LEN
-#define ETHER_ADDR_LEN 6
-#endif
-
-typedef struct {
- /*
- * tap-inject can be enabled or disabled in config file or during runtime.
- * When disabled in config, it is not possible to enable during runtime.
- *
- * When the netlink-only option is used, netlink configuration is monitored
- * and mirrored to the data plane but no traffic is passed between the host
- * and the data plane.
- */
-#define TAP_INJECT_F_CONFIG_ENABLE (1U << 0)
-#define TAP_INJECT_F_CONFIG_DISABLE (1U << 1)
-#define TAP_INJECT_F_CONFIG_NETLINK (1U << 2)
-#define TAP_INJECT_F_ENABLED (1U << 3)
-
- u32 flags;
-
- u32 * sw_if_index_to_tap_fd;
- u32 * sw_if_index_to_tap_if_index;
- u32 * tap_fd_to_sw_if_index;
- u32 * tap_if_index_to_sw_if_index;
-
- u32 * interfaces_to_enable;
- u32 * interfaces_to_disable;
-
- u32 * rx_file_descriptors;
-
- u32 rx_node_index;
- u32 tx_node_index;
- u32 neighbor_node_index;
-
- u32 * rx_buffers;
-
-} tap_inject_main_t;
-
-
-tap_inject_main_t * tap_inject_get_main (void);
-
-void tap_inject_insert_tap (u32 sw_if_index, u32 tap_fd, u32 tap_if_index);
-void tap_inject_delete_tap (u32 sw_if_index);
-
-u32 tap_inject_lookup_tap_fd (u32 sw_if_index);
-u32 tap_inject_lookup_sw_if_index_from_tap_fd (u32 tap_fd);
-u32 tap_inject_lookup_sw_if_index_from_tap_if_index (u32 tap_if_index);
-
-static inline int
-tap_inject_is_enabled (void)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- return !!(im->flags & TAP_INJECT_F_ENABLED);
-}
-
-static inline int
-tap_inject_is_config_enabled (void)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- return !!(im->flags & TAP_INJECT_F_CONFIG_ENABLE);
-}
-
-static inline int
-tap_inject_is_config_disabled (void)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- return !!(im->flags & TAP_INJECT_F_CONFIG_DISABLE);
-}
-
-
-/* Netlink */
-
-void tap_inject_enable_netlink (void);
-
-
-/* Tap */
-
-clib_error_t * tap_inject_tap_connect (vnet_hw_interface_t * hw);
-clib_error_t * tap_inject_tap_disconnect (u32 sw_if_index);
-
-u8 * format_tap_inject_tap_name (u8 * s, va_list * args);
-
-#endif /* _TAP_INJECT_H */
diff --git a/utils/extras/rtinject/tap_inject_netlink.c b/utils/extras/rtinject/tap_inject_netlink.c
deleted file mode 100644
index c0e0ce995..000000000
--- a/utils/extras/rtinject/tap_inject_netlink.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2016 Intel Corporation
- *
- * 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 "../devices/rtnetlink/netns.h"
-#include <vlibmemory/api.h>
-#include <vnet/ip/ip6_neighbor.h>
-#include <vnet/ip/lookup.h>
-#include <vnet/fib/fib.h>
-#include <vnet/ethernet/arp.h>
-#include <arpa/inet.h>
-#include <linux/mpls.h>
-#include <vnet/mpls/packet.h>
-
-#include "tap_inject.h"
-
-static void
-add_del_addr (ns_addr_t * a, int is_del)
-{
- vlib_main_t * vm = vlib_get_main ();
- u32 sw_if_index;
-
- sw_if_index = tap_inject_lookup_sw_if_index_from_tap_if_index (
- a->ifaddr.ifa_index);
-
- if (sw_if_index == ~0)
- return;
-
- if (a->ifaddr.ifa_family == AF_INET)
- {
- ip4_add_del_interface_address (vm, sw_if_index,
- (ip4_address_t *) a->local, a->ifaddr.ifa_prefixlen, is_del);
- }
- else if (a->ifaddr.ifa_family == AF_INET6)
- {
- ip6_add_del_interface_address (vm, sw_if_index,
- (ip6_address_t *) a->addr, a->ifaddr.ifa_prefixlen, is_del);
- }
-}
-
-
-struct set_flags_args {
- u32 index;
- u8 flags;
-};
-
-static void
-set_flags_cb (struct set_flags_args * a)
-{
- vnet_sw_interface_set_flags (vnet_get_main (), a->index, a->flags);
-}
-
-static void
-add_del_link (ns_link_t * l, int is_del)
-{
- struct set_flags_args args = { ~0, 0 };
- vnet_sw_interface_t * sw;
- u8 flags = 0;
- u32 sw_if_index;
-
- sw_if_index = tap_inject_lookup_sw_if_index_from_tap_if_index (
- l->ifi.ifi_index);
-
- if (sw_if_index == ~0)
- return;
-
- sw = vnet_get_sw_interface (vnet_get_main (), sw_if_index);
-
- flags = sw->flags;
-
- if (l->ifi.ifi_flags & IFF_UP)
- flags |= VNET_SW_INTERFACE_FLAG_ADMIN_UP;
- else
- flags &= ~VNET_SW_INTERFACE_FLAG_ADMIN_UP;
-
- args.index = sw_if_index;
- args.flags = flags;
-
- vl_api_rpc_call_main_thread (set_flags_cb, (u8 *)&args, sizeof (args));
-}
-
-
-static void
-add_del_neigh (ns_neigh_t * n, int is_del)
-{
- vnet_main_t * vnet_main = vnet_get_main ();
- vlib_main_t * vm = vlib_get_main ();
- u32 sw_if_index;
-
- sw_if_index = tap_inject_lookup_sw_if_index_from_tap_if_index (
- n->nd.ndm_ifindex);
-
- if (sw_if_index == ~0)
- return;
-
- if (n->nd.ndm_family == AF_INET)
- {
- ethernet_arp_ip4_over_ethernet_address_t a;
-
- memset (&a, 0, sizeof (a));
-
- clib_memcpy (&a.mac, n->lladdr, ETHER_ADDR_LEN);
- clib_memcpy (&a.ip4, n->dst, sizeof (a.ip4));
-
-
- if (n->nd.ndm_state & NUD_REACHABLE)
- {
- vnet_arp_set_ip4_over_ethernet (vnet_main, sw_if_index,
- &a,
- IP_NEIGHBOR_FLAG_NO_FIB_ENTRY);
-
- }
- else if (n->nd.ndm_state & NUD_FAILED)
- {
- vnet_arp_unset_ip4_over_ethernet (vnet_main, sw_if_index, &a);
- }
- }
- else if (n->nd.ndm_family == AF_INET6)
- {
- if (n->nd.ndm_state & NUD_REACHABLE)
- {
-
- mac_address_t * mac1;
- mac1=malloc(sizeof(mac_address_t));
- memcpy (mac1, n->lladdr, ETHER_ADDR_LEN);
- vnet_set_ip6_ethernet_neighbor (vm, sw_if_index,
- (ip6_address_t *) n->dst, (mac_address_t *) mac1,
- IP_NEIGHBOR_FLAG_NO_FIB_ENTRY);
- }
- else
- vnet_unset_ip6_ethernet_neighbor (vm, sw_if_index,
- (ip6_address_t *) n->dst);
- }
-}
-
-
-#define TAP_INJECT_HOST_ROUTE_TABLE_MAIN 254
-
-static void
-get_mpls_label_stack(struct mpls_label *addr, u32* l)
-{
- u32 entry = ntohl(addr[0].entry);
- u32 label = (entry & MPLS_LS_LABEL_MASK) >> MPLS_LS_LABEL_SHIFT;
-
- for(int i = 1; label != 0; i++) {
- *l++ = label;
- if(entry & MPLS_LS_S_MASK)
- return;
- entry = ntohl(addr[i].entry);
- label = (entry & MPLS_LS_LABEL_MASK) >> MPLS_LS_LABEL_SHIFT;
- }
-}
-
-static void
-add_del_route (ns_route_t * r, int is_del)
-{
- u32 sw_if_index;
-
- sw_if_index = tap_inject_lookup_sw_if_index_from_tap_if_index (r->oif);
-
- if (sw_if_index == ~0)
- return;
-
- if (r->rtm.rtm_family == AF_INET)
- {
- u32 stack[MPLS_STACK_DEPTH] = {0};
-
- fib_prefix_t prefix;
- ip46_address_t nh;
-
- memset (&prefix, 0, sizeof (prefix));
- prefix.fp_len = r->rtm.rtm_dst_len;
- prefix.fp_proto = FIB_PROTOCOL_IP4;
- clib_memcpy (&prefix.fp_addr.ip4, r->dst, sizeof (prefix.fp_addr.ip4));
- get_mpls_label_stack(r->encap, stack);
- memset (&nh, 0, sizeof (nh));
- clib_memcpy (&nh.ip4, r->gateway, sizeof (nh.ip4));
- if(*stack == 0)
- fib_table_entry_path_add (0, &prefix, FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE, prefix.fp_proto,
- &nh, sw_if_index, 0,
- 0 /* weight */, NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
- else {
- fib_route_path_t *rpaths = NULL, rpath;
- memset(&rpath, 0, sizeof(rpath));
- rpath.frp_weight = 1;
- rpath.frp_proto = DPO_PROTO_IP4;
- clib_memcpy(&rpath.frp_addr.ip4, r->gateway, sizeof(rpath.frp_addr.ip4));
- rpath.frp_sw_if_index = sw_if_index;
- for(int i = 0; i < MPLS_STACK_DEPTH && stack[i] != 0; i++) {
- fib_mpls_label_t fib_label = {stack[i],0,0,0};
- vec_add1(rpath.frp_label_stack, fib_label);
- }
- vec_add1(rpaths, rpath);
- fib_table_entry_path_add2(0,
- &prefix,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- rpaths);
- }
- }
- else if (r->rtm.rtm_family == AF_INET6)
- {
- fib_prefix_t prefix;
- ip46_address_t nh;
- memset (&prefix, 0, sizeof (prefix));
- prefix.fp_len = r->rtm.rtm_dst_len;
- prefix.fp_proto = FIB_PROTOCOL_IP6;
- clib_memcpy (&prefix.fp_addr.ip6, r->dst, sizeof (prefix.fp_addr.ip6));
- memset (&nh, 0, sizeof (nh));
- clib_memcpy (&nh.ip6, r->gateway, sizeof (nh.ip6));
- fib_table_entry_path_add (0, &prefix, FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE, prefix.fp_proto,
- &nh, sw_if_index, 0,
- 0 /* weight */, NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
- }
-/* else if (r->rtm.rtm_family == AF_MPLS)
- {
- u32 dst_label;
- get_mpls_label_stack((struct mpls_label*) r->dst, &dst_label);
- struct rtvia *via = (struct rtvia*) r->via;
- fib_prefix_t prefix;
- fib_route_path_t *rpaths = NULL, rpath;
- memset (&prefix, 0, sizeof (prefix));
- prefix.fp_len = 21;
- prefix.fp_label = dst_label;
- prefix.fp_proto = FIB_PROTOCOL_MPLS;
- prefix.fp_payload_proto = DPO_PROTO_IP4;
- memset(&rpath, 0, sizeof(rpath));
- clib_memcpy (&rpath.frp_addr.ip4, via->rtvia_addr, sizeof (rpath.frp_addr.ip4));
- rpath.frp_weight = 1;
- rpath.frp_proto = DPO_PROTO_IP4;
- rpath.frp_fib_index = 0;
- rpath.frp_sw_if_index = sw_if_index;
- vec_add1(rpaths, rpath);
- fib_table_entry_path_add2(0,
- &prefix,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- rpaths);
- }*/
-}
-
-
-static void
-netns_notify_cb (void * obj, netns_type_t type, u32 flags, uword opaque)
-{
- if (type == NETNS_TYPE_ADDR)
- add_del_addr ((ns_addr_t *)obj, flags & NETNS_F_DEL);
-
- else if (type == NETNS_TYPE_LINK)
- add_del_link ((ns_link_t *)obj, flags & NETNS_F_DEL);
-
- else if (type == NETNS_TYPE_NEIGH)
- add_del_neigh ((ns_neigh_t *)obj, flags & NETNS_F_DEL);
-
- else if (type == NETNS_TYPE_ROUTE)
- add_del_route ((ns_route_t *)obj, flags & NETNS_F_DEL);
-}
-
-void
-tap_inject_enable_netlink (void)
-{
- char nsname = 0;
- netns_sub_t sub = {
- .notify = netns_notify_cb,
- .opaque = 0,
- };
-
- netns_open (&nsname, &sub);
-}
diff --git a/utils/extras/rtinject/tap_inject_node.c b/utils/extras/rtinject/tap_inject_node.c
deleted file mode 100644
index 73c296451..000000000
--- a/utils/extras/rtinject/tap_inject_node.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright 2016 Intel Corporation
- *
- * 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 "tap_inject.h"
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <vnet/ethernet/arp_packet.h>
-
-vlib_node_registration_t tap_inject_rx_node;
-vlib_node_registration_t tap_inject_tx_node;
-vlib_node_registration_t tap_inject_neighbor_node;
-
-enum {
- NEXT_NEIGHBOR_ARP,
- NEXT_NEIGHBOR_ICMP6,
-};
-
-/**
- * @brief Dynamically added tap_inject DPO type
- */
-dpo_type_t tap_inject_dpo_type;
-
-static inline void
-tap_inject_tap_send_buffer (int fd, vlib_buffer_t * b)
-{
- struct iovec iov;
- ssize_t n_bytes;
-
- iov.iov_base = vlib_buffer_get_current (b);
- iov.iov_len = b->current_length;
-
- n_bytes = writev (fd, &iov, 1);
-
- if (n_bytes < 0)
- clib_warning ("writev failed");
- else if (n_bytes < b->current_length || b->flags & VLIB_BUFFER_NEXT_PRESENT)
- clib_warning ("buffer truncated");
-}
-
-static uword
-tap_inject_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f)
-{
- vlib_buffer_t * b;
- u32 * pkts;
- u32 fd;
- u32 i;
-
- pkts = vlib_frame_vector_args (f);
-
- for (i = 0; i < f->n_vectors; ++i)
- {
- b = vlib_get_buffer (vm, pkts[i]);
-
- fd = tap_inject_lookup_tap_fd (vnet_buffer (b)->sw_if_index[VLIB_RX]);
- if (fd == ~0)
- continue;
-
- /* Re-wind the buffer to the start of the Ethernet header. */
- vlib_buffer_advance (b, -b->current_data);
-
- tap_inject_tap_send_buffer (fd, b);
- }
-
- vlib_buffer_free (vm, pkts, f->n_vectors);
- return f->n_vectors;
-}
-
-VLIB_REGISTER_NODE (tap_inject_tx_node) = {
- .function = tap_inject_tx,
- .name = "tap-inject-tx",
- .vector_size = sizeof (u32),
- .type = VLIB_NODE_TYPE_INTERNAL,
-};
-
-
-static uword
-tap_inject_neighbor (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * f)
-{
- vlib_buffer_t * b;
- u32 * pkts;
- u32 fd;
- u32 i;
- u32 bi;
- u32 next_index = node->cached_next_index;
- u32 next = ~0;
- u32 n_left;
- u32 * to_next;
-
- pkts = vlib_frame_vector_args (f);
-
- for (i = 0; i < f->n_vectors; ++i)
- {
- bi = pkts[i];
- b = vlib_get_buffer (vm, bi);
-
- fd = tap_inject_lookup_tap_fd (vnet_buffer (b)->sw_if_index[VLIB_RX]);
- if (fd == ~0)
- {
- vlib_buffer_free (vm, &bi, 1);
- continue;
- }
-
- /* Re-wind the buffer to the start of the Ethernet header. */
- vlib_buffer_advance (b, -b->current_data);
-
- tap_inject_tap_send_buffer (fd, b);
-
- /* Send the buffer to a neighbor node too? */
- {
- ethernet_header_t * eth = vlib_buffer_get_current (b);
- u16 ether_type = htons (eth->type);
-
- if (ether_type == ETHERNET_TYPE_ARP)
- {
- ethernet_arp_header_t * arp = (void *)(eth + 1);
-
- if (arp->opcode == ntohs (ETHERNET_ARP_OPCODE_reply))
- next = NEXT_NEIGHBOR_ARP;
- }
- else if (ether_type == ETHERNET_TYPE_IP6)
- {
- ip6_header_t * ip = (void *)(eth + 1);
- icmp46_header_t * icmp = (void *)(ip + 1);
-
- if (ip->protocol == IP_PROTOCOL_ICMP6 &&
- icmp->type == ICMP6_neighbor_advertisement)
- next = NEXT_NEIGHBOR_ICMP6;
- }
- }
-
- if (next == ~0)
- {
- vlib_buffer_free (vm, &bi, 1);
- continue;
- }
-
- /* ARP and ICMP6 expect to start processing after the Ethernet header. */
- vlib_buffer_advance (b, sizeof (ethernet_header_t));
-
- vlib_get_next_frame (vm, node, next_index, to_next, n_left);
-
- *(to_next++) = bi;
- --n_left;
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
- n_left, bi, next);
- vlib_put_next_frame (vm, node, next_index, n_left);
- }
-
- return f->n_vectors;
-}
-
-VLIB_REGISTER_NODE (tap_inject_neighbor_node) = {
- .function = tap_inject_neighbor,
- .name = "tap-inject-neighbor",
- .vector_size = sizeof (u32),
- .type = VLIB_NODE_TYPE_INTERNAL,
- .n_next_nodes = 2,
- .next_nodes = {
- [NEXT_NEIGHBOR_ARP] = "arp-input",
- [NEXT_NEIGHBOR_ICMP6] = "icmp6-neighbor-solicitation",
- },
-};
-
-
-#define MTU 1500
-#define MTU_BUFFERS ((MTU + vlib_buffer_get_default_data_size(vm) - 1) / vlib_buffer_get_default_data_size(vm))
-#define NUM_BUFFERS_TO_ALLOC 32
-
-static inline uword
-tap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f, int fd)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
- u32 sw_if_index;
- struct iovec iov[MTU_BUFFERS];
- u32 bi[MTU_BUFFERS];
- vlib_buffer_t * b;
- ssize_t n_bytes;
- ssize_t n_bytes_left;
- u32 i, j;
-
- sw_if_index = tap_inject_lookup_sw_if_index_from_tap_fd (fd);
- if (sw_if_index == ~0)
- return 0;
-
- /* Allocate buffers in bulk when there are less than enough to rx an MTU. */
- if (vec_len (im->rx_buffers) < MTU_BUFFERS)
- {
- u32 len = vec_len (im->rx_buffers);
-
-
- u8 index = vlib_buffer_pool_get_default_for_numa (vm,0);
- len = vlib_buffer_alloc_from_pool(vm,
- &im->rx_buffers[len], NUM_BUFFERS_TO_ALLOC,
- index);
-
- _vec_len (im->rx_buffers) += len;
-
- if (vec_len (im->rx_buffers) < MTU_BUFFERS)
- {
- clib_warning ("failed to allocate buffers");
- return 0;
- }
- }
-
- /* Fill buffers from the end of the list to make it easier to resize. */
- for (i = 0, j = vec_len (im->rx_buffers) - 1; i < MTU_BUFFERS; ++i, --j)
- {
- vlib_buffer_t * b;
-
- bi[i] = im->rx_buffers[j];
-
- b = vlib_get_buffer (vm, bi[i]);
-
- iov[i].iov_base = b->data;
- iov[i].iov_len = VLIB_BUFFER_DEFAULT_DATA_SIZE;
- }
-
- n_bytes = readv (fd, iov, MTU_BUFFERS);
- if (n_bytes < 0)
- {
- clib_warning ("readv failed");
- return 0;
- }
-
- b = vlib_get_buffer (vm, bi[0]);
-
- vnet_buffer (b)->sw_if_index[VLIB_RX] = sw_if_index;
- vnet_buffer (b)->sw_if_index[VLIB_TX] = sw_if_index;
-
- n_bytes_left = n_bytes - VLIB_BUFFER_DEFAULT_DATA_SIZE;
-
- if (n_bytes_left > 0)
- {
- b->total_length_not_including_first_buffer = n_bytes_left;
- b->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
- }
-
- b->current_length = n_bytes;
-
- /* If necessary, configure any remaining buffers in the chain. */
- for (i = 1; n_bytes_left > 0; ++i, n_bytes_left -= VLIB_BUFFER_DEFAULT_DATA_SIZE)
- {
- b = vlib_get_buffer (vm, bi[i - 1]);
- b->current_length = VLIB_BUFFER_DEFAULT_DATA_SIZE;
- b->flags |= VLIB_BUFFER_NEXT_PRESENT;
- b->next_buffer = bi[i];
-
- b = vlib_get_buffer (vm, bi[i]);
- b->current_length = n_bytes_left;
- }
-
- _vec_len (im->rx_buffers) -= i;
-
- /* Get the packet to the output node. */
- {
- vnet_hw_interface_t * hw;
- vlib_frame_t * new_frame;
- u32 * to_next;
-
- hw = vnet_get_hw_interface (vnet_get_main (), sw_if_index);
-
- new_frame = vlib_get_frame_to_node (vm, hw->output_node_index);
- to_next = vlib_frame_vector_args (new_frame);
- to_next[0] = bi[0];
- new_frame->n_vectors = 1;
-
- vlib_put_frame_to_node (vm, hw->output_node_index, new_frame);
- }
-
- return 1;
-}
-
-static uword
-tap_inject_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
- u32 * fd;
- uword count = 0;
-
- vec_foreach (fd, im->rx_file_descriptors)
- {
- if (tap_rx (vm, node, f, *fd) != 1)
- {
- clib_warning ("rx failed");
- count = 0;
- break;
- }
- ++count;
- }
-
- vec_free (im->rx_file_descriptors);
-
- return count;
-}
-
-VLIB_REGISTER_NODE (tap_inject_rx_node) = {
- .function = tap_inject_rx,
- .name = "tap-inject-rx",
- .type = VLIB_NODE_TYPE_INPUT,
- .state = VLIB_NODE_STATE_INTERRUPT,
- .vector_size = sizeof (u32),
-};
-
-/**
- * @brief no-op lock function.
- */
-static void
-tap_inject_dpo_lock (dpo_id_t * dpo)
-{
-}
-
-/**
- * @brief no-op unlock function.
- */
-static void
-tap_inject_dpo_unlock (dpo_id_t * dpo)
-{
-}
-
-u8 *
-format_tap_inject_dpo (u8 * s, va_list * args)
-{
- return (format (s, "tap-inject:[%d]", 0));
-}
-
-const static dpo_vft_t tap_inject_vft = {
- .dv_lock = tap_inject_dpo_lock,
- .dv_unlock = tap_inject_dpo_unlock,
- .dv_format = format_tap_inject_dpo,
-};
-
-const static char *const tap_inject_tx_nodes[] = {
- "tap-inject-tx",
- NULL,
-};
-
-const static char *const *const tap_inject_nodes[DPO_PROTO_NUM] = {
- [DPO_PROTO_IP4] = tap_inject_tx_nodes,
- [DPO_PROTO_IP6] = tap_inject_tx_nodes,
-};
-
-static clib_error_t *
-tap_inject_init (vlib_main_t * vm)
-{
- tap_inject_main_t * im = tap_inject_get_main ();
-
- im->rx_node_index = tap_inject_rx_node.index;
- im->tx_node_index = tap_inject_tx_node.index;
- im->neighbor_node_index = tap_inject_neighbor_node.index;
-
- tap_inject_dpo_type = dpo_register_new_type (&tap_inject_vft, tap_inject_nodes);
-
- vec_alloc (im->rx_buffers, NUM_BUFFERS_TO_ALLOC);
- vec_reset_length (im->rx_buffers);
-
- return 0;
-}
-
-VLIB_INIT_FUNCTION (tap_inject_init);
diff --git a/utils/extras/rtinject/tap_inject_tap.c b/utils/extras/rtinject/tap_inject_tap.c
deleted file mode 100644
index a3ec9ffef..000000000
--- a/utils/extras/rtinject/tap_inject_tap.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2016 Intel Corporation
- *
- * 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 "tap_inject.h"
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <linux/if.h>
-#include <linux/if_arp.h>
-#include <linux/if_ether.h>
-#include <linux/if_tun.h>
-#include <netinet/in.h>
-#include <vnet/unix/tuntap.h>
-
-#include <vlib/unix/unix.h>
-
-
-static clib_error_t *
-tap_inject_tap_read (clib_file_t * f)
-{
- vlib_main_t * vm = vlib_get_main ();
- tap_inject_main_t * im = tap_inject_get_main ();
-
- vec_add1 (im->rx_file_descriptors, f->file_descriptor);
-
- vlib_node_set_interrupt_pending (vm, im->rx_node_index);
-
- return 0;
-}
-
-#define TAP_INJECT_TAP_BASE_NAME "vpp"
-
-clib_error_t *
-tap_inject_tap_connect (vnet_hw_interface_t * hw)
-{
- vnet_main_t * vnet_main = vnet_get_main ();
- vnet_sw_interface_t * sw = vnet_get_sw_interface (vnet_main, hw->hw_if_index);
- static const int one = 1;
- int fd;
- struct ifreq ifr;
- clib_file_t template;
- u32 tap_fd;
- u8 * name;
-
- memset (&ifr, 0, sizeof (ifr));
- memset (&template, 0, sizeof (template));
-
- ASSERT (hw->hw_if_index == sw->sw_if_index);
-
- /* Create the tap. */
- tap_fd = open ("/dev/net/tun", O_RDWR);
-
- if ((int)tap_fd < 0)
- return clib_error_return (0, "failed to open tun device");
-
- name = format (0, TAP_INJECT_TAP_BASE_NAME "%u%c", hw->hw_instance, 0);
-
- strncpy (ifr.ifr_name, (char *) name, sizeof (ifr.ifr_name) - 1);
- ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
-
- if (ioctl (tap_fd, TUNSETIFF, (void *)&ifr) < 0)
- {
- close (tap_fd);
- return clib_error_return (0, "failed to create tap");
- }
-
- if (ioctl (tap_fd, FIONBIO, &one) < 0)
- {
- close (tap_fd);
- return clib_error_return (0, "failed to set tap to non-blocking io");
- }
-
- /* Open a socket to configure the device. */
- fd = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL));
-
- if (fd < 0)
- {
- close (tap_fd);
- return clib_error_return (0, "failed to configure tap");
- }
-
- if (hw->hw_address)
- clib_memcpy (ifr.ifr_hwaddr.sa_data, hw->hw_address, ETHER_ADDR_LEN);
-
- ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
-
- /* Set the hardware address. */
- if (ioctl (fd, SIOCSIFHWADDR, &ifr) < 0)
- {
- close (tap_fd);
- close (fd);
- return clib_error_return (0, "failed to set tap hardware address");
- }
-
- /* Get the tap if index. */
- if (ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
- {
- close (tap_fd);
- close (fd);
- return clib_error_return (0, "failed to procure tap if index");
- }
-
- close (fd);
-
- /* Get notified when the tap needs to be read. */
- template.read_function = tap_inject_tap_read;
- template.file_descriptor = tap_fd;
-
- clib_file_add (&file_main, &template);
-
- tap_inject_insert_tap (sw->sw_if_index, tap_fd, ifr.ifr_ifindex);
-
- return 0;
-}
-
-clib_error_t *
-tap_inject_tap_disconnect (u32 sw_if_index)
-{
- u32 tap_fd;
-
- tap_fd = tap_inject_lookup_tap_fd (sw_if_index);
- if (tap_fd == ~0)
- return clib_error_return (0, "failed to disconnect tap");
-
- tap_inject_delete_tap (sw_if_index);
-
- close (tap_fd);
- return 0;
-}
-
-
-u8 *
-format_tap_inject_tap_name (u8 * s, va_list * args)
-{
- int fd;
- struct ifreq ifr;
-
- fd = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL));
-
- if (fd < 0)
- return 0;
-
- memset (&ifr, 0, sizeof (ifr));
-
- ifr.ifr_ifindex = va_arg (*args, u32);
-
- if (ioctl (fd, SIOCGIFNAME, &ifr) < 0)
- {
- close (fd);
- return 0;
- }
-
- close (fd);
-
- return format (s, "%s", ifr.ifr_name);
-}
diff --git a/utils/sysrepo-plugins/CMakeLists.txt b/utils/sysrepo-plugins/CMakeLists.txt
deleted file mode 100644
index 91726161f..000000000
--- a/utils/sysrepo-plugins/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# 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.
-#
-
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-project(hicn_sysrepo_plugin)
-
-include(GNUInstallDirs)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-
-# set default build type if not specified by user
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE debug)
-endif()
-string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
-
-# 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")
-
-# add subdirectories
-add_subdirectory(hicn-plugin)
-add_subdirectory(hicn-light)
-include(Packaging)
-include(Packager)
-make_packages()
diff --git a/utils/sysrepo-plugins/README.md b/utils/sysrepo-plugins/README.md
deleted file mode 100644
index 3f0ed2e34..000000000
--- a/utils/sysrepo-plugins/README.md
+++ /dev/null
@@ -1,329 +0,0 @@
-# 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.
-
-## Software Requirement
-
-- VPP
-
-- sysrepo
-
-- hicn-plugin
-
-- hicn-light
-
-## hICN yang model
-
-You can install the yang model using the following bash script:
-
-EXIT_CODE=0
-command -v sysrepoctl > /dev/null
-if [ $? != 0 ]; then
- echo "Could not find command \"sysrepoctl\"."
- exit ${EXIT_CODE}
-else
-sysrepoctl --install --yang=path_to_hicn_yang_model
-fi
-
-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
- +--rw hicn-conf
- | +--rw params
- | +--rw enable_disable? boolean
- | +--rw pit_max_size? int32
- | +--rw cs_max_size? int32
- | +--rw cs_reserved_app? int32
- | +--rw pit_dflt_lifetime_sec? float
- | +--rw pit_max_lifetime_sec? float
- | +--rw pit_min_lifetime_sec? float
- +--ro hicn-state
- +--ro states
- | +--ro pkts_processed? uint64
- | +--ro pkts_interest_count? uint64
- | +--ro pkts_data_count? uint64
- | +--ro pkts_from_cache_count? uint64
- | +--ro pkts_no_pit_count? uint64
- | +--ro pit_expired_count? uint64
- | +--ro cs_expired_count? uint64
- | +--ro cs_lru_count? uint64
- | +--ro pkts_drop_no_buf? uint64
- | +--ro interests_aggregated? uint64
- | +--ro interests_retx? uint64
- | +--ro interests_hash_collision? uint64
- | +--ro pit_entries_count? uint64
- | +--ro cs_entries_count? uint64
- | +--ro cs_entries_ntw_count? uint64
- +--ro strategy
- | +--ro description? uint8
- +--ro route
- | +--ro faceids? uint16
- | +--ro strategy_id? uint32
- +--ro strategies
- | +--ro n_strategies? uint8
- | +--ro strategy_id? uint32
- +--ro face-ip-params
- +--ro nh_addr? uint64
- +--ro swif? uint32
- +--ro flags? uint32
-
-
-To setup the startup configuration you can use the following script:
-
-EXIT_CODE=0
-command -v sysrepocfg > /dev/null
-if [ $? != 0 ]; then
- echo "Could not find command \"sysrepocfg\"."
- exit ${EXIT_CODE}
-else
-sysrepocfg -d startup -i path_to_startup_xml -f xml hicn
-fi
-
-
-startup.xml is placed in the yang-model. Here you can find the content:
-
-<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>
-
-As can be seen, it contains the leaves of the params in hicn-conf node which is used as the startup configuration. This configuration can be changed through the controler by subscribing which changes the target to the running state. hicn yang model provides a list of RPCs which allows controler to communicate directly with the hicn-plugin. This RPCs may also cause the modification in state data. Here you can find the list of RPCs:
-
- rpcs:
- +---x node-params-set
- | +---w input
- | +---w enable_disable? boolean
- | +---w pit_max_size? int32
- | +---w cs_max_size? int32
- | +---w cs_reserved_app? int32
- | +---w pit_dflt_lifetime_sec? float
- | +---w pit_max_lifetime_sec? float
- | +---w pit_min_lifetime_sec? float
- +---x node-params-get
- +---x node-stat-get
- +---x strategy-get
- | +---w input
- | +---w strategy_id? uint32
- +---x strategies-get
- +---x route-get
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- +---x route-del
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- +---x route-nhops-add
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w face_ids0? uint32
- | +---w face_ids1? uint32
- | +---w face_ids2? uint32
- | +---w face_ids3? uint32
- | +---w face_ids4? uint32
- | +---w face_ids5? uint32
- | +---w face_ids6? uint32
- | +---w n_faces? uint8
- +---x route-nhops-del
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w faceid? uint16
- +---x face-ip-params-get
- | +---w input
- | +---w faceid? uint16
- +---x face-ip-add
- | +---w input
- | +---w nh_addr0? uint64
- | +---w nh_addr1? uint64
- | +---w swif? uint32
- +---x face-ip-del
- | +---w input
- | +---w faceid? uint16
- +---x punting-add
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w swif? uint32
- +---x punting-del
- +---w input
- +---w prefix0? uint64
- +---w prefix1? uint64
- +---w len? uint8
- +---w swif? uint32
-
-
-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"/>
-
-<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>
-
-
-## Run the plugin
-
-Firstly, verify the plugin and binary libraries are located correctly, then run the vpp through (service vpp start). Next, run the sysrepo daemon (sysrepod), for debug mode: sysrepo -d -l 4 which runs with high verbosity. Then, run the sysrepo plugin (sysrepo-plugind), for debug mode: sysrep-plugind -d -l 4 which runs with high verbosity. Now, the hicn sysrepo plugin is loaded. Then, run the netopeer2-server which serves as NETCONF server.
-
-## Connect from netopeer2-cli
-
-In order to connect through the netopeer client run the netopeer2-cli. Then, follow these steps:
-
-connect --host XXX --login XXX
---> get (you can get the configuration and operational data)
---> get-config (you can get the configuratoin data)
---> edit-config --target running --config (you can modify the configuration but it needs an xml configuration input. For example,
-<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>
-)
---> user-rpc (you can call one of the rpc proposed by hicn model but it needs an xml input, you can pick one in controler_rpcs_instances.xml)
-
-## Connect from OpenDayligh (ODL) controller
-
-In order to connect througt the OpenDaylight follow these procedure:
-
-- run karaf distribution (./opendayligh_installation_folder/bin/karaf)
-- install the required feature list in DOL (feature:install odl-netconf-server odl-netconf-connector odl-restconf-all odl-netconf-topology or
- odl-netconf-clustered-topology)
-- run a rest client program (e.g., postman or RESTClient)
-- mount the remote netopeer2-server to the OpenDaylight by the following REST API:
-
-PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/hicn-node
-
-with the following body
-
- <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
- <node-id>hicn-node</node-id>
- <host xmlns="urn:opendaylight:netconf-node-topology">Remote_NETCONF_SERVER_IP</host>
- <port xmlns="urn:opendaylight:netconf-node-topology">830</port>
- <username xmlns="urn:opendaylight:netconf-node-topology">username</username>
- <password xmlns="urn:opendaylight:netconf-node-topology">password</password>
- <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
- <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">1</keepalive-delay>
- </node>
-
-Note that the header files must be set to Content-Type: application/xml, Accept: application/xml. There are more options which can be set but for simplicity we keep a short configuration to mount the remote node.
-
-- send the operation through the following REST API:
-
-POST http://localhost:8181/restconf/operations/network-topology:network-topology/topology/topology-netconf/node/hicn-node/yang-ext:mount/ietf-netconf:edit-config
-
-The body can be used the same as edit-config in netopeer2-cli.
-
-## Connect from Network Services Orchestrator (NSO)
-
-To connect NSO to the netopeer2-server, first, you need to write a NED package for your device. The procudeure to create NED for hicn is explaned in the following:
-
-Place hicn.yang model in a folder called hicn-yang-model, and follow these steps:
-
-- ncs-make-package --netconf-ned ./hicn-yang-model ./hicn-nso
-- cd hicn-nso/src; make
-- ncs-setup --ned-package ./hicn-nso --dest ./hicn-nso-project
-- cd hicn-nso-project
-- ncs
-- ncs_cli -C -u admin
-- configure
-- devices authgroups group authhicn default-map remote-name user_name remote-password password
-- devices device hicn address IP_device port 830 authgroup authhicn device-type netconf
-- state admin-state unlocked
-- commit
-- ssh fetch-host-keys
-
-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.
diff --git a/utils/sysrepo-plugins/cmake/FindHicnLight.cmake b/utils/sysrepo-plugins/cmake/FindHicnLight.cmake
deleted file mode 100644
index bce3265fa..000000000
--- a/utils/sysrepo-plugins/cmake/FindHicnLight.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-#sed 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(HICNLIGHT_SEARCH_PATH_LIST
- ${HICNLIGHT_HOME}
- $ENV{HICNLIGHT_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(HICNLIGHT_INCLUDE_DIR hicn/api/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
- HINTS ${HICNLIGHT_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib
- DOC "Find the hicn light lib"
-)
-
-set(HICNLIGHT_LIBRARIES ${HICNLIGHT_LIBRARY})
-set(HICNLIGHT_INCLUDE_DIRS ${HICNLIGHT_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Hicnlight HICNLIGHT_LIBRARIES HICNLIGHT_INCLUDE_DIRS)
-
-mark_as_advanced(HICNLIGHT_LIBRARY HICNLIGHT_INCLUDE_DIR)
diff --git a/utils/sysrepo-plugins/cmake/FindHicnPlugin.cmake b/utils/sysrepo-plugins/cmake/FindHicnPlugin.cmake
deleted file mode 100644
index f50ed736e..000000000
--- a/utils/sysrepo-plugins/cmake/FindHicnPlugin.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-#sed 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(HICNPLUGIN_SEARCH_PATH_LIST
- ${HICNPLUGIN_HOME}
- $ENV{HICNPLUGIN_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(HICNPLUGIN_INCLUDE_DIR vapi/hicn.api.vapi.h
- HINTS ${HICNPLUGIN_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the hicn plugin includes"
-)
-
-find_library(HICNPLUGIN_LIBRARY NAMES vpp_plugins/hicn_plugin.so
- HINTS ${HICNPLUGIN_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib
- DOC "Find the hicn plugin plugin"
-)
-
-set(HICNPLUGIN_LIBRARIES ${HICNPLUGIN_LIBRARY})
-set(HICNPLUGIN_INCLUDE_DIRS ${HICNPLUGIN_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(HicnPlugin DEFAULT_MSG HICNPLUGIN_LIBRARIES HICNPLUGIN_INCLUDE_DIRS)
-
-mark_as_advanced(HICNPLUGIN_LIBRARY HICNPLUGIN_INCLUDE_DIR) \ No newline at end of file
diff --git a/utils/sysrepo-plugins/cmake/FindSysrepo.cmake b/utils/sysrepo-plugins/cmake/FindSysrepo.cmake
deleted file mode 100644
index 4228ef93a..000000000
--- a/utils/sysrepo-plugins/cmake/FindSysrepo.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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(SYSREPO_SEARCH_PATH_LIST
- ${SYSREPO_HOME}
- $ENV{SYSREPO_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(SYSREPO_INCLUDE_DIR sysrepo/values.h
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the sysrepo includes"
-)
-
-find_path(SYSREPO_INCLUDE_MAIN_DIR sysrepo.h
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the sysrepo includes"
-)
-
-find_library(SYSREPO_LIBRARY NAMES libsysrepo.so
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib
- DOC "Find the sysrepo library"
-)
-
-set(SYSREPO_LIBRARIES ${SYSREPO_LIBRARY})
-set(SYSREPO_INCLUDE_DIRS ${SYSREPO_INCLUDE_DIR} ${SYSREPO_INCLUDE_MAIN_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Sysrepo DEFAULT_MSG SYSREPO_LIBRARIES SYSREPO_INCLUDE_DIRS)
-
-mark_as_advanced(SYSREPO_LIBRARY SYSREPO_INCLUDE_DIR SYSREPO_INCLUDE_MAIN_DIR) \ No newline at end of file
diff --git a/utils/sysrepo-plugins/cmake/FindVPP.cmake b/utils/sysrepo-plugins/cmake/FindVPP.cmake
deleted file mode 100644
index 62abc29da..000000000
--- a/utils/sysrepo-plugins/cmake/FindVPP.cmake
+++ /dev/null
@@ -1,178 +0,0 @@
-# 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.
-
-#if (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
- # in cache already
-# set(VPP_FOUND TRUE)
-#else (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
-
-set(VPP_SEARCH_PATH_LIST
-# ${VPP_HOME}
-# $ENV{VPP_HOME}
- /usr/lib
- /usr/lib64
- /usr/local/lib
- /usr/local/lib64
- /opt/local/lib
- /sw/lib
- /usr/local
- /opt
- /usr)
-
-# set(VPP_INCLUDE_PATH
-# /usr/include
-# /usr/local/include
-# /opt/local/include
-# /sw/include
-# )
-
-# set(VPP_LIBRARY_PATH
-# /usr/lib
-# /usr/lib64
-# /usr/local/lib
-# /usr/local/lib64
-# /opt/local/lib
-# /sw/lib
-# )
-
- find_path(VNET_INCLUDE_DIR
- NAMES
- vnet/vnet.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VLIB_API_INCLUDE_DIR
- NAMES
- vlibapi/api.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VLIBMEMORY_INCLUDE_DIR
- NAMES
- vlibmemory/api.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VPP_MSG_INCLUDE_DIR
- NAMES
- vpp/api/vpe_msg_enum.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VPP_ALL_INCLUDE_DIR
- NAMES
- vpp/api/vpe_all_api_h.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VAPI_INCLUDE_DIR
- NAMES
- vapi/interface.api.vapi.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_library(VLIBMEMORYCLIENT_LIBRARY
- NAMES
- vlibmemoryclient
- libvlibmemoryclient
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(SVM_LIBRARY
- NAMES
- svm
- libsvm
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VPPINFRA_LIBRARY
- NAMES
- vppinfra
- libvppinfra
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VLIB_LIBRARY
- NAMES
- vlib
- libvlib
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VATPLUGIN_LIBRARY
- NAMES
- vatplugin
- libvatplugin
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VAPI_LIBRARY
- NAMES
- vapiclient
- libvapiclient
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- if (VPP_INCLUDE_DIR AND VPP_LIBRARY)
- set(VPP_FOUND TRUE)
- else (VPP_INCLUDE_DIR AND VPP_LIBRARY)
- set(VPP_FOUND FALSE)
- endif (VPP_INCLUDE_DIR AND VPP_LIBRARY)
-
- set(VPP_INCLUDE_DIRS
- ${VNET_INCLUDE_DIR}
- ${VLIB_API_INCLUDE_DIR}
- ${VLIB_MEMORY_INCLUDE_DIR}
- ${VPP_MSG_INCLUDE_DIR}
- ${VPP_ALL_INCLUDE_DIR}
- ${VAPI_INCLUDE_DIR}
- )
-
-message(${VAPI_LIBRARY})
- set(VPP_LIBRARIES
- ${VLIBMEMORYCLIENT_LIBRARY}
- ${SVM_LIBRARY}
- ${VPPINFRA_LIBRARY}
- ${VLIB_LIBRARY}
- ${VATPLUGIN_LIBRARY}
- ${VAPI_LIBRARY}
- )
-
- # show the VPP_INCLUDE_DIRS and VPP_LIBRARIES variables only in the advanced view
- mark_as_advanced(VPP_INCLUDE_DIRS VPP_LIBRARIES)
-
-#endif (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
diff --git a/utils/sysrepo-plugins/cmake/Packager.cmake b/utils/sysrepo-plugins/cmake/Packager.cmake
deleted file mode 100644
index b19145025..000000000
--- a/utils/sysrepo-plugins/cmake/Packager.cmake
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright (c) 2017-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.
-
-#############
-# RPM/DEB/TGZ Packaging utils
-#
-
-set(CONTACT "hicn-dev@lists.fd.io" CACHE STRING "Contact")
-set(PACKAGE_MAINTAINER "ICN Team" CACHE STRING "Maintainer")
-set(PACKAGE_VENDOR "fd.io" CACHE STRING "Vendor")
-
-# macro(set)
-
-macro(make_packages)
- if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
- # parse /etc/os-release
- file(READ "/etc/os-release" os_version)
- string(REPLACE "\n" ";" os_version ${os_version})
- foreach(_ver ${os_version})
- string(REPLACE "=" ";" _ver ${_ver})
- list(GET _ver 0 _name)
- list(GET _ver 1 _value)
- set(OS_${_name} ${_value})
- endforeach()
-
- # extract version from git
- execute_process(
- COMMAND git describe --long --match v*
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- OUTPUT_VARIABLE VER
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- if (NOT VER)
- set(VER "v1.0-1-gcafe")
- endif()
-
- string(REGEX REPLACE "v(.*)-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3" VER ${VER})
- list(GET VER 0 tag)
- string(REPLACE "-" "~" tag ${tag})
- list(GET VER 1 commit_num)
- list(GET VER 2 commit_name)
-
- if (NOT DEFINED ENV{BUILD_NUMBER})
- set(bld "b1")
- else()
- set(bld "b$ENV{BUILD_NUMBER}")
- endif()
-
- message("Build number is: ${bld}")
-
- #define DEB and RPM version numbers
- if(${commit_num} EQUAL 0)
- set(deb_ver "${tag}")
- set(rpm_ver "${tag}")
- else()
- set(deb_ver "${tag}-${commit_num}-release")
- set(rpm_ver "${tag}-${commit_num}-release")
- endif()
-
- get_cmake_property(components COMPONENTS)
-
- if(OS_ID_LIKE MATCHES "debian")
- set(CPACK_GENERATOR "DEB")
- set(type "DEBIAN")
-
- execute_process(
- COMMAND dpkg --print-architecture
- OUTPUT_VARIABLE arch
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- set(CPACK_PACKAGE_VERSION "${deb_ver}")
- foreach(lc ${components})
- if (${lc} MATCHES ".*Unspecified.*")
- continue()
- endif()
-
- string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_FILE_NAME "${lc}_${deb_ver}_${arch}.deb")
-
- set(DEB_DEPS)
- if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
- string(REPLACE "stable_version" ${tag} DEB_DEPS ${${lc}_DEB_DEPENDENCIES})
- endif()
-
- set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${DEB_DEPS}")
- set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
- set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
- endforeach()
- elseif(OS_ID_LIKE MATCHES "rhel")
- set(CPACK_GENERATOR "RPM")
- set(type "RPM")
-
- execute_process(
- COMMAND uname -m
- OUTPUT_VARIABLE arch
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- set(CPACK_PACKAGE_VERSION "${rpm_ver}")
- foreach(lc ${components})
- if (${lc} MATCHES ".*Unspecified.*")
- continue()
- endif()
-
- string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
-
- set(RPM_DEPS)
- if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
- string(REPLACE "stable_version" ${tag} RPM_DEPS ${${lc}_RPM_DEPENDENCIES})
- endif()
-
- set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${RPM_DEPS}")
-
- if(${lc} MATCHES ".*-dev")
- set(package_name ${lc}el)
- else()
- set(package_name ${lc})
- endif()
-
- set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
- set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}.${arch}.rpm")
- endforeach()
- endif()
-
- if(CPACK_GENERATOR)
- set(CPACK_PACKAGE_NAME ${ARG_NAME})
- set(CPACK_STRIP_FILES OFF)
- set(CPACK_PACKAGE_VENDOR "${PACKAGE_VENDOR}")
- set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
- set(CPACK_${CPACK_GENERATOR}_COMPONENT_INSTALL ON)
- set(CPACK_${type}_PACKAGE_MAINTAINER "HICN Team")
- set(CPACK_${type}_PACKAGE_RELEASE 1)
- include(CPack)
- endif()
- endif()
-endmacro()
diff --git a/utils/sysrepo-plugins/cmake/Packaging.cmake b/utils/sysrepo-plugins/cmake/Packaging.cmake
deleted file mode 100644
index f5e8426fb..000000000
--- a/utils/sysrepo-plugins/cmake/Packaging.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2017-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.
-
-######################
-# Packages section
-######################
-
-set(hicn_sysrepo_plugin_DESCRIPTION
- "A Plugin to enable hICN VPP in sysrepo."
- CACHE STRING "Description for deb/rpm package."
-)
-
-set(hicn_sysrepo_plugin_DEB_DEPENDENCIES
- "hicn-plugin (= stable_version-release), vpp (= stable_version-release), vpp-plugins (= stable_version-release)"
- CACHE STRING "Dependencies for deb/rpm package."
-)
-
-set(hicn_sysrepo_plugin_RPM_DEPENDENCIES
-"hicn-plugin (= stable_version-release), vpp (= stable_version-release), vpp-plugins (= stable_version-release)"
-CACHE STRING "Dependencies for deb/rpm package."
-)
diff --git a/utils/sysrepo-plugins/hicn-light/CMakeLists.txt b/utils/sysrepo-plugins/hicn-light/CMakeLists.txt
deleted file mode 100644
index eea06592d..000000000
--- a/utils/sysrepo-plugins/hicn-light/CMakeLists.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# 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
deleted file mode 100644
index e1d3dd39a..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# 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
deleted file mode 100644
index ae436a8ad..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 16f65e5c4..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 6c4f938ce..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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
deleted file mode 100644
index adb7737aa..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/hicn_light_comm.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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)
-
-
-#define MEM_ALIGN 4096
-
-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
deleted file mode 100644
index 7cfb8363a..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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"
-#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) {
-
-
- 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
deleted file mode 100644
index e6e857bff..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/hicn_model.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 2f7b11efa..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#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
deleted file mode 100644
index 36698115a..000000000
--- a/utils/sysrepo-plugins/hicn-light/plugin/model/tlock.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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-plugin/CMakeLists.txt b/utils/sysrepo-plugins/hicn-plugin/CMakeLists.txt
deleted file mode 100644
index 4c3ef6d1a..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# 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")
-
-cmake_minimum_required(VERSION 2.8)
-project(sysrepo-vpp-plugins)
-
-# Cmake find modules
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
-
-find_package(VPP)
-find_package(PkgConfig)
-find_package(HicnPlugin)
-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/ietf/ietf_interface.c
- plugin/model/hicn_model.c
- plugin/model/tlock.c
- plugin/hicn_vpp_comm.c
- plugin/hicn_plugin.c
-)
-
-# build the source code into shared library
-add_library(hicn SHARED ${PLUGINS_SOURCES})
-target_include_directories(hicn PUBLIC ${VPP_INCLUDE_DIRS} ${HICNPLUGIN_INCLUDE_DIRS})
-target_link_libraries(hicn ${SYSREPO_LIBRARIES} ${VPP_LIBRARIES} ${HICNPLUGIN_LIBRARIES})
-
-#set_target_properties(hicn
-# PROPERTIES
-# LINKER_LANGUAGE C
-# INSTALL_RPATH ${VPP_HOME}/lib)
-
-# install the plugin into plugins dir
-install(TARGETS hicn DESTINATION ${SR_PLUGINS_DIR} COMPONENT hicn_sysrepo_plugin)
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c
deleted file mode 100644
index 262e98553..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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_plugin.h"
-#include "model/hicn_model.h"
-#include "ietf/ietf_interface.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_vpp();
- if (SR_ERR_OK != rc) {
- HICN_LOG_ERR("vpp connect error , with return %d.", rc);
- return SR_ERR_INTERNAL;
- }
-
- // HICN subscribe
- hicn_subscribe_events(session, &subscription);
-
- // IETF subscribe
- ietf_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 pligin unload plugin ok.");
- hicn_disconnect_vpp();
- HICN_LOG_DBG_MSG("hicn plugin disconnect vpp 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 vpp */
- rc = hicn_connect_vpp();
- if (-1 == rc) {
- fprintf(stderr, "vpp 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_vpp();
- return rc;
-} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.h b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.h
deleted file mode 100644
index 4e48c8c29..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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_PLUGIN_H__
-#define __HICN_PLUGIN_H__
-
-#include "hicn_vpp_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_PLUGIN_H__ \ 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
deleted file mode 100644
index f044c5b1b..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_vpp_comm.h"
-#include <vapi/vapi.h>
-
-
-
-
-#define APP_NAME "hicn_plugin"
-#define MAX_OUTSTANDING_REQUESTS 4
-#define RESPONSE_QUEUE_SIZE 2
-vapi_ctx_t g_vapi_ctx_instance=NULL;
-
-// Use VAPI macros to define symbols
-
-
-
-int hicn_connect_vpp() {
- HICN_INVOKE_BEGIN;
- if (g_vapi_ctx_instance == NULL) {
- vapi_error_e rv = vapi_ctx_alloc(&g_vapi_ctx_instance);
- rv = vapi_connect(g_vapi_ctx_instance, APP_NAME, NULL,
- MAX_OUTSTANDING_REQUESTS, RESPONSE_QUEUE_SIZE,
- VAPI_MODE_BLOCKING, true);
- if (rv != VAPI_OK) {
- HICN_LOG_ERR("*connect %s faild,with return %d", APP_NAME, rv);
- vapi_ctx_free(g_vapi_ctx_instance);
- return -1;
- }
- HICN_LOG_DBG("*connected %s ok", APP_NAME);
- } else {
- HICN_LOG_DBG("connection %s keeping", APP_NAME);
- }
- HICN_INVOKE_END;
- return 0;
-}
-
-int hicn_disconnect_vpp() {
- if (NULL != g_vapi_ctx_instance) {
- vapi_disconnect(g_vapi_ctx_instance);
- vapi_ctx_free(g_vapi_ctx_instance);
- g_vapi_ctx_instance = NULL;
- }
- return 0;
-} \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h b/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h
deleted file mode 100644
index fd71dbaf2..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/hicn_vpp_comm.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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_VPP_COMMM_H__
-#define __HICN_VPP_COMMM_H__
-#include <sysrepo.h>
-#include <sysrepo/plugins.h> //for HICN_LOG_DBG
-#include <sysrepo/values.h>
-#include <vapi/vapi.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
-
-
-// ctx vpp connect
-extern vapi_ctx_t g_vapi_ctx_instance;
-
-//Here it is the definition
-
-#define VPP_INTFC_NAME_LEN 64
-#define VPP_MAC_ADDRESS_LEN 8
-#define VPP_IP6_ADDRESS_LEN 16
-#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_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, arg6)
-
-
-/**
- * when use tihs must fist DEFINE_VAPI_MSG_IDS_VXLAN_API_JSON
- */
-#define HICN_VPP_VAPI_RECV \
- do { \
- size_t size; \
- int recv_vapimsgid = -1; \
- vapi_recv(g_vapi_ctx_instance, (void *)&resp, &size, 0, 0); \
- recv_vapimsgid = vapi_lookup_vapi_msg_id_t( \
- g_vapi_ctx_instance, ntohs(resp->header._vl_msg_id)); \
- if (recv_vapimsgid <= vapi_msg_id_get_next_index_reply || \
- recv_vapimsgid >= vapi_get_message_count()) { \
- HICN_LOG_DBG("***recv error msgid[%d] not in [0-%d) ,try again!***\n", \
- recv_vapimsgid, vapi_get_message_count()); \
- } else { \
- HICN_LOG_DBG("recv msgid [%d]\n", recv_vapimsgid); \
- break; \
- } \
- } while (1);
-
-#define HICN_REGISTER_RPC_EVT_HANDLER(rpc_evt_handle) \
- do { \
- sr_error_t rc = rpc_evt_handle(session, &subscription); \
- if (SR_ERR_OK != rc) { \
- HICN_LOG_ERR("load plugin failed: %s", sr_strerror(rc)); \
- sr_unsubscribe(session, subscription); \
- HICN_INVOKE_ENDX(sr_strerror(rc)); \
- return rc; \
- } \
- } 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();
-
-#endif //__HICN_VPP_COMMM_H__ \ No newline at end of file
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c b/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c
deleted file mode 100644
index f02605895..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- * Copyright (c) 2016 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 <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <sysrepo.h>
-#include <sysrepo/plugins.h>
-#include <sysrepo/values.h>
-#include <sysrepo/xpath.h>
-#include <vnet/interface.h>
-#include <vnet/vnet.h>
-#include <vnet/ip/ip.h>
-#include <vapi/interface.api.vapi.h>
-
-#include "ietf_interface.h"
-#include "../hicn_vpp_comm.h"
-
-
-
-DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON;
-
-typedef struct hicn_interface_
-{
- u32 sw_if_index;
- char interface_name[VPP_INTFC_NAME_LEN];
- u8 l2_address[VPP_MAC_ADDRESS_LEN];
- u32 l2_address_length;
- u64 link_speed;
- u16 link_mtu;
- u8 admin_up_down;
- u8 link_up_down;
-} hicnIntfc;
-
-typedef struct _ietf_sw_interface_dump_ctx
-{
- u8 last_called;
- int num_ifs;
- int capacity;
- hicnIntfc * intfcArray;
-} ietf_sw_interface_dump_ctx;
-
-static i32 ietf_setInterfaceFlags(u32 sw_if_index, u8 admin_up_down);
-static i32 ietf_interface_name2index(const char *name, u32* if_index);
-static i32 ietf_interface_add_del_addr(u32 sw_if_index, u8 is_add, u8 is_ipv6,
- u8 del_all, u8 address_length,
- u8 address[VPP_IP6_ADDRESS_LEN]);
-static int ietf_initSwInterfaceDumpCTX(ietf_sw_interface_dump_ctx * dctx);
-static int ietf_freeSwInterfaceDumpCTX(ietf_sw_interface_dump_ctx * dctx);
-
-/**
- * @brief Helper function for converting netmask into prefix length.
- */
-static uint8_t
-netmask_to_prefix(const char *netmask)
-{
- in_addr_t n = 0;
- uint8_t i = 0;
-
- inet_pton(AF_INET, netmask, &n);
-
- while (n > 0) {
- n = n >> 1;
- i++;
- }
-
- return i;
-}
-
-/**
- * @brief Helper function for converting IPv4/IPv6 address string into binary representation.
- */
-static int
-ip_addr_str_to_binary(const char *ip_address_str, uint8_t *ip_address_bin, bool is_ipv6)
-{
- struct in6_addr addr6 = { 0, };
- struct in_addr addr4 = { 0, };
- int ret = 0;
-
- if (is_ipv6) {
- ret = inet_pton(AF_INET6, ip_address_str, &(addr6));
- if (1 == ret)
- {
- memcpy(ip_address_bin, &addr6, sizeof(addr6));
- }
- } else {
- ret = inet_pton(AF_INET, ip_address_str, &(addr4));
- if (1 == ret)
- {
- memcpy(ip_address_bin, &addr4, sizeof(addr4));
- }
- }
-
- return ret;
-}
-
-/**
- * @brief Enable or disable given interface.
- */
-static int
-interface_enable_disable(const char *if_name, bool enable)
-{
- uint32_t if_index = ~0;
- int rc = 0;
-
- SRP_LOG_DBG("%s interface '%s'", enable ? "Enabling" : "Disabling", if_name);
-
- /* get interface index */
- rc = ietf_interface_name2index(if_name, &if_index);
- if (0 != rc) {
- SRP_LOG_ERR("Invalid interface name: %s", if_name);
- return SR_ERR_INVAL_ARG;
- }
-
- /* enable/disable interface */
- rc = ietf_setInterfaceFlags(if_index, (uint8_t)enable);
- if (0 != rc) {
- SRP_LOG_ERR("Error by processing of the sw_interface_set_flags request, rc=%d", rc);
- return SR_ERR_OPERATION_FAILED;
- } else {
- return SR_ERR_OK;
- }
-}
-
-/**
- * @brief Callback to be called by any config change of "/ietf-interfaces:interfaces/interface/enabled" leaf.
- */
-static int
-ietf_interface_enable_disable_cb(sr_session_ctx_t *session, const char *xpath, sr_notif_event_t event, void *private_ctx)
-{
- char *if_name = NULL;
- 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("'%s' modified, event=%d", xpath, event);
-
- /* 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;
- }
-
- /* 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)))) {
-
- SRP_LOG_DBG("A change detected in '%s', op=%d", new_val ? new_val->xpath : old_val->xpath, op);
- if_name = sr_xpath_key_value(new_val ? new_val->xpath : old_val->xpath, "interface", "name", &xpath_ctx);
- switch (op) {
- case SR_OP_CREATED:
- case SR_OP_MODIFIED:
- op_rc = interface_enable_disable(if_name, new_val->data.bool_val);
- break;
- case SR_OP_DELETED:
- op_rc = interface_enable_disable(if_name, false /* !enable */);
- break;
- default:
- break;
- }
- sr_xpath_recover(&xpath_ctx);
- if (SR_ERR_INVAL_ARG == op_rc) {
- sr_set_error(session, "Invalid interface name.", new_val ? new_val->xpath : old_val->xpath);
- }
- sr_free_val(old_val);
- sr_free_val(new_val);
- }
- sr_free_change_iter(iter);
-
- return op_rc;
-}
-
-/**
- * @brief Add or remove IPv4/IPv6 address to/from an interface.
- */
-static int
-interface_ipv46_config_add_remove(const char *if_name, uint8_t *addr, uint8_t prefix, bool is_ipv6, bool add)
-{
- uint32_t if_index = ~0;
- int rc = 0;
-
- SRP_LOG_DBG("%s IP config on interface '%s'.", add ? "Adding" : "Removing", if_name);
-
- /* get interface index */
- rc = ietf_interface_name2index(if_name, &if_index);
- if (0 != rc) {
- SRP_LOG_ERR("Invalid interface name: %s", if_name);
- return SR_ERR_INVAL_ARG;
- }
-
- /* add del addr */
- rc = ietf_interface_add_del_addr(if_index, (uint8_t)add, (uint8_t)is_ipv6, 0, prefix, addr);
- if (0 != rc) {
- SRP_LOG_ERR("Error by processing of the sw_interface_set_flags request, rc=%d", rc);
- return SR_ERR_OPERATION_FAILED;
- } else {
- return SR_ERR_OK;
- }
-}
-int ietf_initSwInterfaceDumpCTX(ietf_sw_interface_dump_ctx * dctx)
-{
- if(dctx == NULL)
- return -1;
-
- dctx->intfcArray = NULL;
- dctx->last_called = false;
- dctx->capacity = 0;
- dctx->num_ifs = 0;
- return 0;
-}
-int ietf_freeSwInterfaceDumpCTX(ietf_sw_interface_dump_ctx * dctx)
-{
- if(dctx == NULL)
- return -1;
-
- if(dctx->intfcArray != NULL)
- {
- free(dctx->intfcArray);
- }
-
- return ietf_initSwInterfaceDumpCTX(dctx);
-}
-vapi_error_e
-ietf_sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
- vapi_error_e rv, bool is_last,
- vapi_payload_sw_interface_details * reply)
-{
- ietf_sw_interface_dump_ctx *dctx = callback_ctx;
- if (is_last)
- {
- dctx->last_called = true;
- }
- else
- {
- if(dctx->capacity == 0 && dctx->intfcArray == NULL)
- {
- dctx->capacity = 10;
- dctx->intfcArray = (hicnIntfc*)malloc( sizeof(hicnIntfc)*dctx->capacity );
- }
- if(dctx->num_ifs >= dctx->capacity-1)
- {
-
- dctx->capacity += 10;
- dctx->intfcArray = (hicnIntfc*)realloc(dctx->intfcArray, sizeof(hicnIntfc)*dctx->capacity );
- }
-
- hicnIntfc * thisIntfc = &dctx->intfcArray[dctx->num_ifs];
-
- thisIntfc->sw_if_index = reply->sw_if_index;
- memcpy(thisIntfc->interface_name, reply->interface_name, VPP_INTFC_NAME_LEN);
- thisIntfc->l2_address_length = reply->l2_address_length;
- memcpy(thisIntfc->l2_address, reply->l2_address, reply->l2_address_length );
- //thisIntfc->link_speed = reply->link_speed;
-#define ONE_MEGABIT (uint64_t)1000000
- switch (reply->link_speed << VNET_HW_INTERFACE_FLAG_SPEED_SHIFT)
- {
- default:
- thisIntfc->link_speed = 0;
- break;
- }
-
- thisIntfc->link_mtu = reply->link_mtu;
- thisIntfc->admin_up_down = reply->admin_up_down;
- thisIntfc->link_up_down = reply->link_up_down;
-
- dctx->num_ifs += 1;
- }
- return VAPI_OK;
-}
-
-static i32 ietf_interface_name2index(const char *name, u32* if_index)
-{
- ARG_CHECK2(-1, name, if_index);
-
- i32 ret = -1;
- ietf_sw_interface_dump_ctx dctx = {false, 0, 0, 0};
- vapi_msg_sw_interface_dump *dump;
- vapi_error_e rv;
- dctx.last_called = false;
-
- 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));
-
- while (VAPI_EAGAIN == (rv = vapi_sw_interface_dump(g_vapi_ctx_instance, dump, ietf_sw_interface_dump_cb, &dctx)))
- ;
-
- int i = 0;
- for (; i < dctx.num_ifs; ++i)
- {
- if (strcmp(dctx.intfcArray[i].interface_name, name) == 0)
- {
- *if_index = dctx.intfcArray[i].sw_if_index;
- ret = 0;
- break;
- }
- }
- ietf_freeSwInterfaceDumpCTX(&dctx);
-
- return ret;
-}
-
-i32 ietf_interface_add_del_addr( u32 sw_if_index, u8 is_add, u8 is_ipv6, u8 del_all,
- u8 address_length, u8 address[VPP_IP6_ADDRESS_LEN] )
-{
- i32 ret = -1;
- vapi_msg_sw_interface_add_del_address *msg = vapi_alloc_sw_interface_add_del_address(g_vapi_ctx_instance);
- msg->payload.sw_if_index = sw_if_index;
- msg->payload.is_add = is_add;
- msg->payload.is_ipv6 = is_ipv6;
- msg->payload.del_all = del_all;
- msg->payload.address_length = address_length;
- memcpy(msg->payload.address, address, VPP_IP6_ADDRESS_LEN);
- vapi_msg_sw_interface_add_del_address_hton (msg);
-
- vapi_send (g_vapi_ctx_instance, msg);
-
- vapi_msg_sw_interface_add_del_address_reply *resp;
-
- HICN_VPP_VAPI_RECV;
-
- vapi_msg_sw_interface_add_del_address_reply_hton(resp);
- ret = resp->payload.retval;
- vapi_msg_free (g_vapi_ctx_instance, resp);
- return ret;
-}
-
-i32 ietf_setInterfaceFlags(u32 sw_if_index, u8 admin_up_down)
-{
- i32 ret = -1;
- vapi_msg_sw_interface_set_flags *msg = vapi_alloc_sw_interface_set_flags(g_vapi_ctx_instance);
- msg->payload.sw_if_index = sw_if_index;
- msg->payload.admin_up_down = admin_up_down;
- vapi_msg_sw_interface_set_flags_hton (msg);
-
- vapi_send (g_vapi_ctx_instance, msg);
-
- vapi_msg_sw_interface_set_flags_reply *resp;
-
- HICN_VPP_VAPI_RECV;
-
- vapi_msg_sw_interface_set_flags_reply_ntoh(resp);
- ret = resp->payload.retval;
- vapi_msg_free (g_vapi_ctx_instance, resp);
- return ret;
-}
-
-
-/**
- * @brief Modify existing IPv4/IPv6 config on an interface.
- */
-static int
-interface_ipv46_config_modify(sr_session_ctx_t *session, const char *if_name,
- sr_val_t *old_val, sr_val_t *new_val, bool is_ipv6)
-{
- sr_xpath_ctx_t xpath_ctx = { 0, };
- char *addr_str = NULL;
- uint8_t addr[16] = { 0, };
- uint8_t prefix = 0;
- int rc = SR_ERR_OK;
-
- SRP_LOG_DBG("Updating IP config on interface '%s'.", if_name);
-
- /* get old config to be deleted */
- if (SR_UINT8_T == old_val->type) {
- prefix = old_val->data.uint8_val;
- } else if (SR_STRING_T == old_val->type) {
- prefix = netmask_to_prefix(old_val->data.string_val);
- } else {
- return SR_ERR_INVAL_ARG;
- }
- addr_str = sr_xpath_key_value((char*)old_val->xpath, "address", "ip", &xpath_ctx);
- ip_addr_str_to_binary(addr_str, addr, is_ipv6);
- sr_xpath_recover(&xpath_ctx);
-
- /* delete old IP config */
- rc = interface_ipv46_config_add_remove(if_name, addr, prefix, is_ipv6, false /* remove */);
- if (SR_ERR_OK != rc) {
- SRP_LOG_ERR("Unable to remove old IP address config, rc=%d", rc);
- return rc;
- }
-
- /* update the config with the new value */
- if (sr_xpath_node_name_eq(new_val->xpath, "prefix-length")) {
- prefix = new_val->data.uint8_val;
- } else if (sr_xpath_node_name_eq(new_val->xpath, "netmask")) {
- prefix = netmask_to_prefix(new_val->data.string_val);
- }
-
- /* set new IP config */
- rc = interface_ipv46_config_add_remove(if_name, addr, prefix, is_ipv6, true /* add */);
- if (SR_ERR_OK != rc) {
- SRP_LOG_ERR("Unable to remove old IP address config, rc=%d", rc);
- return rc;
- }
-
- return rc;
-}
-
-/**
- * @brief Callback to be called by any config change in subtrees "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address"
- * or "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address".
- */
-static int
-ietf_interface_ipv46_address_change_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, };
- bool is_ipv6 = false, has_addr = false, has_prefix = false;
- uint8_t addr[16] = { 0, };
- uint8_t prefix = 0;
- char *node_name = NULL, *if_name = NULL;
- 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("'%s' modified, event=%d", xpath, event);
-
- /* check whether we are handling ipv4 or ipv6 config */
- node_name = sr_xpath_node_idx((char*)xpath, 2, &xpath_ctx);
- if (NULL != node_name && 0 == strcmp(node_name, "ipv6")) {
- is_ipv6 = true;
- }
- sr_xpath_recover(&xpath_ctx);
-
- /* 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;
- }
-
- /* 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)))) {
-
- SRP_LOG_DBG("A change detected in '%s', op=%d", new_val ? new_val->xpath : old_val->xpath, op);
- if_name = strdup(sr_xpath_key_value(new_val ? new_val->xpath : old_val->xpath, "interface", "name", &xpath_ctx));
- sr_xpath_recover(&xpath_ctx);
-
- switch (op) {
- case SR_OP_CREATED:
- if (SR_LIST_T == new_val->type) {
- /* create on list item - reset state vars */
- has_addr = has_prefix = false;
- } else {
- if (sr_xpath_node_name_eq(new_val->xpath, "ip")) {
- ip_addr_str_to_binary(new_val->data.string_val, addr, is_ipv6);
- has_addr = true;
- } else if (sr_xpath_node_name_eq(new_val->xpath, "prefix-length")) {
- prefix = new_val->data.uint8_val;
- has_prefix = true;
- } else if (sr_xpath_node_name_eq(new_val->xpath, "netmask")) {
- prefix = netmask_to_prefix(new_val->data.string_val);
- has_prefix = true;
- }
- if (has_addr && has_prefix) {
- op_rc = interface_ipv46_config_add_remove(if_name, addr, prefix, is_ipv6, true /* add */);
- }
- }
- break;
- case SR_OP_MODIFIED:
- op_rc = interface_ipv46_config_modify(session, if_name, old_val, new_val, is_ipv6);
- break;
- case SR_OP_DELETED:
- if (SR_LIST_T == old_val->type) {
- /* delete on list item - reset state vars */
- has_addr = has_prefix = false;
- } else {
- if (sr_xpath_node_name_eq(old_val->xpath, "ip")) {
- ip_addr_str_to_binary(old_val->data.string_val, addr, is_ipv6);
- has_addr = true;
- } else if (sr_xpath_node_name_eq(old_val->xpath, "prefix-length")) {
- prefix = old_val->data.uint8_val;
- has_prefix = true;
- } else if (sr_xpath_node_name_eq(old_val->xpath, "netmask")) {
- prefix = netmask_to_prefix(old_val->data.string_val);
- has_prefix = true;
- }
- if (has_addr && has_prefix) {
- op_rc = interface_ipv46_config_add_remove(if_name, addr, prefix, is_ipv6, false /* !add */);
- }
- }
- break;
- default:
- break;
- }
- if (SR_ERR_INVAL_ARG == op_rc) {
- sr_set_error(session, "Invalid interface name.", new_val ? new_val->xpath : old_val->xpath);
- }
- free(if_name);
- sr_free_val(old_val);
- sr_free_val(new_val);
- }
- sr_free_change_iter(iter);
-
- return op_rc;
-}
-
-/**
- * @brief Callback to be called by any config change under "/ietf-interfaces:interfaces-state/interface" path.
- * Does not provide any functionality, needed just to cover not supported config leaves.
- */
-static int
-ietf_interface_change_cb(sr_session_ctx_t *session, const char *xpath, sr_notif_event_t event, void *private_ctx)
-{
- SRP_LOG_DBG("'%s' modified, event=%d", xpath, event);
-
- return SR_ERR_OK;
-}
-
-
-int ietf_subscribe_events(sr_session_ctx_t *session,
- sr_subscription_ctx_t **subscription){
-
- int rc = SR_ERR_OK;
- SRP_LOG_DBG_MSG("Subscriging ietf.");
-
- //
- rc = sr_subtree_change_subscribe(session, "/ietf-interfaces:interfaces/interface", ietf_interface_change_cb,
- NULL,
- 0, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
-
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /ietf-interfaces:interfaces/interface\n");
- goto error;
- }
-
- rc = sr_subtree_change_subscribe(session, "/ietf-interfaces:interfaces/interface/enabled", ietf_interface_enable_disable_cb,
- NULL,
- 100, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /ietf-interfaces:interfaces/interface/enabled\n");
- goto error;
- }
-
- rc = sr_subtree_change_subscribe(session, "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address", ietf_interface_ipv46_address_change_cb,
- NULL,
- 99, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
-
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address\n");
- goto error;
- }
-
- rc = sr_subtree_change_subscribe(session, "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address", ietf_interface_ipv46_address_change_cb,
- NULL,
- 98, SR_SUBSCR_CTX_REUSE | SR_SUBSCR_EV_ENABLED, subscription);
-
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address\n");
- goto error;
- }
-
- /* rc = sr_dp_get_items_subscribe(session, "/ietf-interfaces:interfaces-state", ietf_interface_state_cb,
- NULL, SR_SUBSCR_CTX_REUSE,
- subscription);
- if (rc != SR_ERR_OK) {
- SRP_LOG_DBG_MSG("Problem in subscription /ietf-interfaces:interfaces-state\n");
- goto error;
- }*/
-
-
- SRP_LOG_INF_MSG("ietf initialized successfully.");
- return SR_ERR_OK;
-
- error:
- SRP_LOG_ERR_MSG("Error by initialization of the ietf.");
- return rc;
-}
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h b/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h
deleted file mode 100644
index 0f6c7f8b4..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2018 HUACHENTEL and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IETF_INTERFACE_H__
-#define __IETF_INTERFACE_H__
-
-int ietf_subscribe_events(sr_session_ctx_t *session,
- sr_subscription_ctx_t **subscription);
-
-
-#endif /* __IETF_INTERFACE_H__ */
diff --git a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c b/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c
deleted file mode 100644
index b49839c53..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.c
+++ /dev/null
@@ -1,1455 +0,0 @@
-/*
-* 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>
-#include <hicn/api/ip_address.h>
-#include "../hicn_plugin.h"
-#include "../hicn_vpp_comm.h"
-#include "hicn_model.h"
-#include "tlock.h"
-
-
-DEFINE_VAPI_MSG_IDS_HICN_API_JSON
-
-
-// Shared local variables between state and RPCs
-
-volatile hicn_state_t * hicn_state = NULL;
-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_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 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;
-
-}
-
-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");
-}
-
-
-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;
-
- 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;
-
- 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;
-
- 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[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[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[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;
-
- 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[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[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 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/strategies/strategy_id");
- vals[1].type = SR_UINT32_T;
- vals[1].data.uint32_val = hicn_strategies->strategy_id[0];
-}
-
-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[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){
-
- struct hicn_faces_s * temp = hicn_faces->next;
- int face =0;
-
- for(int count=0; count<nleaves; count++){
-
-
- // 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;
- }
-
-
- 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;
-
-
- face++;
-
-
- 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;
-
- 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++;
-
- 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++;
-
- 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;
-
- face++;
-
- 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;
-
- face++;
-
- 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;
-
- face++;
-
- 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);
-
- printf("%" PRId64 "\n", temp->face.drx_bytes);
-
- temp=temp->next;
-
- }
- SRP_LOG_DBG_MSG("Faces state updated \n");
- 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;
-}
-
-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;
-
-
-
- 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;
- }
-
-
- rc = sr_new_values(NSTRATEGIES_LEAVES, &vals);
- if (SR_ERR_OK != rc) {
- return rc;
- }
-
- SRP_LOG_DBG("Requesting state data for '%s'", xpath);
- tlock(strategies);
- strategies_update(vals);
- tunlock(strategies);
-
- *values = vals;
- *values_cnt = NSTRATEGIES_LEAVES;
- 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.
-*/
-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;
-
- msg = vapi_alloc_hicn_api_node_params_get(g_vapi_ctx_instance);
-
-
-
-
- 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");
- return SR_ERR_OK;
- }
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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) {
-
- 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_hicn_api_node_stats_get_hton(msg);
- params_send(msg,resp);
- vapi_msg_hicn_api_node_stats_get_reply_ntoh(resp);
-
- if(resp->payload.retval){
- SRP_LOG_DBG_MSG("Error updating state");
- return SR_ERR_OPERATION_FAILED;
- }
- tlock(state);
-
- state_cache(resp);
-
- tunlock(state);
- return SR_ERR_OK;
-
-}
-
-/**
-* @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");
- 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;
-
- 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;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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");
- vapi_msg_hicn_api_strategies_get *msg;
- vapi_msg_hicn_api_strategies_get_reply *resp;
-
- 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);
- 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;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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) {
-
- 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;
- 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);
-
- }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);
- params_send(msg,resp);
- 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;
-}
-
-/**
-* @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");
- 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);
-
- 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")){
-
- 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.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_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;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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) {
-
- 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);
-
- 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);
-
- }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_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;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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");
- 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.uint32_val;
-
- 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)",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;
-
-}
-
-/**
-* @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;
-
- 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 * 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);
-
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
-
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.swif = input[3].data.uint32_val;
-
-
- 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;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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;
-
- 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 * 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);
-
- }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.uint32_val;
-
- vapi_msg_hicn_api_route_nhop_del_hton(msg);
- params_send(msg,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;
- }
-
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-/**
-* @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) {
-
- 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;
- 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);
-
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
-
-
- msg->payload.len = input[2].data.uint8_val;
- msg->payload.swif = input[3].data.uint32_val;
-
- vapi_msg_hicn_api_punting_del_hton(msg);
- params_send(msg,resp);
- vapi_msg_hicn_api_punting_del_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;
-}
-
-/**
-* @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.uint32_val;
-
- 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;
- }
-
- 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_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");
-
-
- 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")){
- 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 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.local_addr[0],tmp,B64);
- memcpy(&msg->payload.local_addr[1],tmp+B64,B64);
-
- }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;
- 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);
-
-
- }else if(strcmp(input[3].data.string_val,"-1")){
-
- 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);
-
- }else{
- SRP_LOG_DBG_MSG("Invalid local IP address");
- return SR_ERR_OPERATION_FAILED;
- }
-
- msg->payload.swif = input[4].data.uint32_val; // This is the idx number of interface
-
-
- 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_MSG("Successfully done");
- return SR_ERR_OK;
- }
-
- SRP_LOG_DBG_MSG("Operation failed");
- return SR_ERR_OPERATION_FAILED;
-}
-
-
-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)
-{
-
- 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;
-}
-
-/**
-* @brief API to del hicn face state details in vpp.
-*/
-
-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;
-}
-
-
-/**
-* @brief Thread to update the state
-*/
-static void *state_thread(void *arg) {
-
- // mapping can be retrieved by cpuinfo
- int map = 0;
- cpu_set_t cpuset;
- CPU_ZERO(&cpuset);
- CPU_SET(map, &cpuset);
-
- // 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);
- }
-
- 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;
-
- while(true){
-
- msg = vapi_alloc_hicn_api_node_stats_get(g_vapi_ctx_instance);
- vapi_msg_hicn_api_node_stats_get_hton(msg);
-
- 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;
- }
-
- HICN_VPP_VAPI_RECV;
-
- 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;
- }
-
- //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);
-
- tlock(state);
- state_cache(resp);
- SRP_LOG_DBG_MSG("state updated");
- tunlock(state);
- sleep(1);
-
- }
- return NULL;
-}
-
-/**
-* @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.");
-
- 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.");
-
- //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;
- }
-
- SRP_LOG_DBG_MSG("buffer initialized successfully.");
-
-
- rc=init_face_pool(current);
-
- if(rc!= SR_ERR_OK){
- SRP_LOG_DBG_MSG("Problem in initializing the face pool\n");
- goto error;
- }
-
-
- SRP_LOG_DBG_MSG("face pool created successfully.");
-
-
- // 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 node-params-get\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;
- }
-
- // 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;
- }
-
- 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;
-} \ 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
deleted file mode 100644
index 6cb5d2710..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/hicn_model.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-* 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
-// better to initialize the lock by 0
-#define NLOCKS 5
-#define LOCK_INIT 0
-
-
-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 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__)) {
-
-
- 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;
-} hicn_strategy_t;
-
-
-typedef struct __attribute__ ((__packed__)) {
-
- uint8_t n_strategies;
- uint32_t strategy_id[256];
- int32_t retval;
-} hicn_strategies_t;
-
-typedef struct __attribute__ ((__packed__)) {
- 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;
-} 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);
-
-#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
deleted file mode 100644
index d27ae6492..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#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 tlock(int Lock_Number ){
-
- int my_ticket = __sync_fetch_and_add(&En[Lock_Number] , 1 );
- while ( my_ticket != De[ 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
deleted file mode 100644
index 8cdfc8b5b..000000000
--- a/utils/sysrepo-plugins/hicn-plugin/plugin/model/tlock.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 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/yang/hicn/hicn.yang b/utils/sysrepo-plugins/yang/hicn/hicn.yang
deleted file mode 100644
index 484fec6f0..000000000
--- a/utils/sysrepo-plugins/yang/hicn/hicn.yang
+++ /dev/null
@@ -1,571 +0,0 @@
-module hicn {
-namespace "urn:sysrepo:hicn";
-prefix hcn;
-
-revision 2019-05-7 {
- 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 VPP.";
- 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 lip4 {
- description "IP version 4 local address.";
- type string;
- }
-
-leaf lip6 {
- description "IP version 6 local address.";
- type string;
- }
-
-leaf rip4 {
- description "IP version 4 local address.";
- type string;
- }
-
-leaf rip6 {
- description "IP version 6 local address.";
- type string;
- }
-
-leaf swif {
- description "Interface Index.";
- type uint32;
- }
-}
-
-grouping route_nhops_add {
-
-leaf ip4 {
- description "ip4 to be added to the FIB.";
- type string;
- }
-
-leaf ip6 {
- description "ip6 to be added to the FIB.";
- type string;
- }
-
-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 ip4 {
- description "ip4 to be added to the FIB.";
- type string;
- }
-
-leaf ip6 {
- description "ip6 to be added to the FIB.";
- type string;
- }
-
-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 uint32;
- }
-
-}
-
-grouping route_del {
-
-leaf ip4 {
- description "ip4 to be added to the FIB.";
- type string;
- }
-
-leaf ip6 {
- description "ip6 to be added to the FIB.";
- type string;
- }
-
-leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-}
-
-
-grouping route_get {
-
-
-leaf ip4 {
- description "ip4 to be added to the FIB.";
- type string;
- }
-
-leaf ip6 {
- description "ip6 to be added to the FIB.";
- type string;
- }
-
-leaf len {
- description "Length of the prefix.";
- type uint8;
- }
-}
-
-grouping punting_add {
-
-leaf ip4 {
- description "ip4 to be added to the FIB.";
- type string;
- }
-
-leaf ip6 {
- description "ip6 to be added to the FIB.";
- type string;
- }
-
-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 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 {
-
- leaf description {
- description "Enable / disable ICN forwarder in VPP.";
- type uint8;
- }
-}
-
-grouping route-reply {
-
- leaf faceids {
- description "Enable / disable ICN forwarder in VPP.";
- type uint32;
-
- }
-
- leaf strategy_id {
- description "compile-time plugin features.";
- type uint32;
- }
-}
-
-grouping strategies-reply {
- leaf n_strategies {
- description "Enable / disable ICN forwarder in VPP.";
- type uint8;
- }
- leaf strategy_id {
- description "Enable / disable ICN forwarder in VPP.";
- type uint32;
- }
-
-}
-
-/* Hicn configuration */
-
-container hicn-conf {
- description "config data container for the hicn-vpp.";
- 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 routes{
- uses route-reply;
- }
- container strategies{
- uses strategies-reply;
- }
- container faces{
- uses face-stats-reply;
- }
-
-}
-
-/* RPC Definitions */
-
-
-rpc node-params-set {
- description "Operation to set hicn params in vpp.";
- input {
- uses params;
- }
-}
-
-rpc node-params-get {
- description "Operation to get hicn parameter in vpp.";
-}
-
-
-rpc node-stat-get {
- description "Operation to get hicn status in vpp.";
-}
-
-
-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 uint32;
- }
- }
-}
-
-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 uint32;
- }
- }
-}
-
-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*/
- }
-}
-
-rpc face-stats-details {
- description "Operation to take stat per face.";
-}
-
-
-}
diff --git a/utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml b/utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml
deleted file mode 100644
index db79fd4ef..000000000
--- a/utils/sysrepo-plugins/yang/hicn/rpc_call_samples.xml
+++ /dev/null
@@ -1,78 +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">
- <ip4>192.168.1.1</ip4>
- <ip6>-1</ip6>
- <len>24</len>
-</route-get>
-
-<route-del xmlns="urn:sysrepo:hicn">
- <ip4>192.168.1.1</ip4>
- <ip6>-1</ip6>
- <len>30</len>
-</route-del>
-
-<route-nhops-add xmlns="urn:sysrepo:hicn">
- <ip4>192.168.1.1</ip4>
- <ip6>-1</ip6>
- <len>24</len>
- <face_ids0>0</face_ids0>
- <face_ids1>0</face_ids1>
- <face_ids2>0</face_ids2>
- <face_ids3>0</face_ids3>
- <face_ids4>0</face_ids4>
- <face_ids5>0</face_ids5>
- <face_ids6>0</face_ids6>
- <n_faces>1</n_faces>
-</route-nhops-add>
-
-<route-nhops-del xmlns="urn:sysrepo:hicn">
- <ip4>192.168.1.1</ip4>
- <ip6>-1</ip6>
- <len>24</len>
- <faceid>0</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">
- <lip4>192.168.1.10</lip4>
- <lip6>-1</lip6>
- <rip4>192.168.1.1</rip4>
- <rip6>-1</rip6>
- <swif>0</swif>
-</face-ip-add>
-
-
-<face-ip-del xmlns="urn:sysrepo:hicn">
- <faceid>0</faceid>
-</face-ip-del>
-
-<punting-add xmlns="urn:sysrepo:hicn">
- <ip4>192.168.0.1</ip4>
- <ip6>-1</ip6>
- <len>24</len>
- <swif>0</swif>
-</punting-add>
-
-
-<punting-del xmlns="urn:sysrepo:hicn">
- <ip4>192.168.0.1</ip4>
- <ip6>-1</ip6>
- <len>24</len>
- <swif>0</swif>
-</punting-del>
-
-<face-stats-details xmlns="urn:sysrepo:hicn"/>
diff --git a/utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml b/utils/sysrepo-plugins/yang/hicn/sysrepo_startup.xml
deleted file mode 100644
index f88e13ea2..000000000
--- a/utils/sysrepo-plugins/yang/hicn/sysrepo_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/yang/ietf/iana-if-type@2014-05-08.yang b/utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang
deleted file mode 100644
index 4138ba46e..000000000
--- a/utils/sysrepo-plugins/yang/ietf/iana-if-type@2014-05-08.yang
+++ /dev/null
@@ -1,1704 +0,0 @@
-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
deleted file mode 100644
index f66c205ce..000000000
--- a/utils/sysrepo-plugins/yang/ietf/ietf-interfaces.yang
+++ /dev/null
@@ -1,1123 +0,0 @@
-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
deleted file mode 100644
index 79606cc07..000000000
--- a/utils/sysrepo-plugins/yang/ietf/ietf-ip@2014-06-16.yang
+++ /dev/null
@@ -1,742 +0,0 @@
-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
deleted file mode 100644
index ee58fa3ab..000000000
--- a/utils/sysrepo-plugins/yang/ietf/ietf-yang-types@2013-07-15.yang
+++ /dev/null
@@ -1,474 +0,0 @@
-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.";
- }
-}