summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar@cisco.com>2022-03-30 22:29:28 +0200
committerMauro Sardara <msardara@cisco.com>2022-03-31 19:51:47 +0200
commitc46e5df56b67bb8ea7a068d39324c640084ead2b (patch)
treeeddeb17785938e09bc42eec98ee09b8a28846de6 /Makefile
parent18fa668f25d3cc5463417ce7df6637e31578e898 (diff)
feat: boostrap hicn 22.02
The current patch provides several new features, improvements, bug fixes and also complete rewrite of entire components. - lib The hicn packet parser has been improved with a new packet format fully based on UDP. The TCP header is still temporarily supported but the UDP header will replace completely the new hicn packet format. Improvements have been made to make sure every packet parsing operation is made via this library. The current new header can be used as header between the payload and the UDP header or as trailer in the UDP surplus area to be tested when UDP options will start to be used. - hicn-light The portable packet forwarder has been completely rewritten from scratch with the twofold objective to improve performance and code size but also to drop dependencies such as libparc which is now removed by the current implementation. - hicn control the control library is the agent that is used to program the packet forwarders via their binary API. This component has benefited from significant improvements in terms of interaction model which is now event driven and more robust to failures. - VPP plugin has been updated to support VPP 22.02 - transport Major improvement have been made to the RTC protocol, to the support of IO modules and to the security sub system. Signed manifests are the default data authenticity and integrity framework. Confidentiality can be enabled by sharing the encryption key to the prod/cons layer. The library has been tested with group key based applications such as broadcast/multicast and real-time on-line meetings with trusted server keys or MLS. - testing Unit testing has been introduced using GoogleTest. One third of the code base is covered by unit testing with priority on critical features. Functional testing has also been introduce using Docker, linux bridging and Robot Framework to define test with Less Code techniques to facilitate the extension of the coverage. Co-authored-by: Mauro Sardara <msardara@cisco.com> Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Angelo Mantellini <manangel@cisco.com> Co-authored-by: Jacques Samain <jsamain@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Enrico Loparco <eloparco@cisco.com> Co-authored-by: Giulio Grassi <gigrassi@cisco.com> Change-Id: I75d0ef70f86d921e3ef503c99271216ff583c215 Signed-off-by: Luca Muscariello <muscariello@ieee.org> Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile240
1 files changed, 240 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..3d74f9b72
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,240 @@
+# Copyright (c) 2021-2022 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.
+
+
+export WS_ROOT=$(CURDIR)
+SHELL := /bin/bash
+FUNCTIONAL := tests/run-functional.sh
+MKDIR := mkdir -p
+RM := rm
+VERSIONFILE := $(CURDIR)/versions.cmake
+
+# Docker stuff
+DOCKER := docker
+DEV_IMAGE := hicn-dev-img
+DOCKERFILE := Dockerfile.dev
+DEV_CONTAINER := hicn-dev
+
+#
+# OS Detection
+#
+ifeq ($(shell uname),Darwin)
+OS_ID = macos
+OPENSSL_ROOT=/usr/local/opt/openssl@1.1
+else
+OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+OS_VERSION_ID = $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+endif
+
+ifeq ($(shell uname),Darwin)
+BUILD_HICNPLUGIN := OFF
+PUNTING := OFF
+else
+BUILD_HICNPLUGIN := ON
+PUNTING := ON
+endif
+
+DEB_DEPENDS = cmake ninja-build unzip python3-ply libasio-dev
+DEB_DEPENDS += libconfig-dev libconfig++-dev libevent-dev
+DEB_DEPENDS += build-essential vpp-dev libvppinfra-dev
+DEB_DEPENDS += vpp-plugin-core libcurl4-openssl-dev
+DEB_DEPENDS += doxygen
+
+MACOS_DEPENDS = asio libconfig ninja
+
+.PHONY = help
+help:
+ @echo "Targets"
+ @echo " dep - install software dependencies"
+ @echo " build - build debug binaries. Optional argument: INSTALL_DIR"
+ @echo " build-release - build release binaries"
+ @echo " build-coverage - build with coverage metainformation"
+ @echo " wipe - wipe debug binaries"
+ @echo " wipe-release - wipe release binaries"
+ @echo " docs - build documentation"
+ @echo ""
+ @echo "Make Arguments:"
+ @echo " INSTALL_PREFIX=<path> - Install software at specified location."
+ @echo " BUILD_PATH=<path> - Path of build folder."
+ @echo " VPP_HOME=<path> - Path of VPP"
+ @echo " OPENSSL_ROOT=<path> - Path of Openssl installation"
+ @echo " ENABLE_RELY=<ON/OFF> - Enable/disable rely compilation"
+ @echo " SONAR_BUILD_WRAPPER=<path>" - Path of sonarqube build wrapper
+ @echo " SONAR_OUT_DIR=<path>" - Path of directory of sonarqube report
+ @echo "Current Arguments:"
+ @echo " INSTALL_PREFIX=$(INSTALL_PREFIX)"
+ @echo " VPP_HOME=$(VPP_HOME)"
+ @echo " OPENSSL_ROOT=$(OPENSSL_ROOT)"
+ @echo " ENABLE_RELY=$(ENABLE_RELY)"
+ @echo " SONAR_BUILD_WRAPPER=$(SONAR_BUILD_WRAPPER)"
+ @echo " SONAR_OUT_DIR=$(SONAR_OUT_DIR)"
+
+.PHONY = vpp-dep
+vpp-dep:
+ VERSION_PATH=$(VERSIONFILE) sudo -E $(SHELL) scripts/install-vpp.sh
+
+.PHONY = dep
+dep: vpp-dep
+ifeq ($(shell uname),Darwin)
+ brew install $(MACOS_DEPENDS)
+else ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
+ @sudo -E apt-get update
+ @sudo -E apt-get $(APT_ARGS) -y install $(DEB_DEPENDS) --no-install-recommends
+else
+ @echo "Operating system not supported (yet)"
+endif
+
+.PHONY = deps
+deps: dep
+
+define build_folder
+ $(eval LOWER_BUILDTYPE=$(shell echo $(2) | tr A-Z a-z))
+ $(eval BUILD_FOLDER=$(or $(BUILD_PATH), build-$(LOWER_BUILDTYPE)-$(OS_ID)))
+ $(1) := $$(BUILD_FOLDER)
+endef
+
+define configure
+ $(eval $(call build_folder,BUILD_FOLDER,$(1)))
+ $(eval PREFIX=$(or $(INSTALL_PREFIX), $(WS_ROOT)/install-$(LOWER_BUILDTYPE)))
+ $(eval COVERAGE=$(or $(COVERAGE), OFF))
+ $(eval VPP_HOME=$(or $(VPP_HOME), /usr))
+ $(eval ENABLE_RELY=$(or $(ENABLE_RELY), OFF))
+ $(MKDIR) $(BUILD_FOLDER)
+ cmake \
+ -B $(BUILD_FOLDER) \
+ -S $(WS_ROOT) \
+ -G Ninja \
+ -DCMAKE_INSTALL_PREFIX=$(PREFIX) \
+ -DCMAKE_BUILD_TYPE=$(1) \
+ -DBUILD_HICNLIGHT=ON \
+ -DBUILD_APPS=ON \
+ -DBUILD_SYSREPOPLUGIN=OFF \
+ -DBUILD_EXTRAS=OFF \
+ -DBUILD_TELEMETRY=OFF \
+ -DBUILD_CTRL=ON \
+ -DBUILD_HICNPLUGIN=$(BUILD_HICNPLUGIN) \
+ -DVPP_HOME=$(VPP_HOME) \
+ -DCOVERAGE=$(COVERAGE) \
+ -DENABLE_RELY=$(ENABLE_RELY) \
+ -DOPENSSL_ROOT_DIR=$(OPENSSL_ROOT) \
+ -DBUILD_TESTS=ON
+endef
+
+define build
+ $(eval $(call build_folder,BUILD_FOLDER,$(1)))
+ cmake --build $(BUILD_FOLDER) -- -j 4 install
+endef
+
+define build_coverage
+ $(eval $(call build_folder,BUILD_FOLDER,$(1)))
+ $(eval SONAR_OUT_DIR=$(or $(SONAR_OUT_DIR), $(WS_ROOT)/sonarqube-output))
+ $(SONAR_BUILD_WRAPPER) --out-dir $(SONAR_OUT_DIR) cmake --build $(BUILD_FOLDER) -- install
+endef
+
+define package
+ $(eval $(call build_folder,BUILD_FOLDER,$(1)))
+ cmake --build $(BUILD_FOLDER) -- package
+endef
+
+.PHONY: configure-debug
+configure-debug:
+ $(call configure,Debug,)
+
+.PHONY: configure-release
+configure-release:
+ $(call configure,Release,)
+
+.PHONY = build
+build: configure-debug
+ $(call build,Debug,)
+
+.PHONY = build-coverage
+build-coverage:
+ifndef SONAR_BUILD_WRAPPER
+ $(error SONAR_BUILD_WRAPPER is not set)
+endif
+ $(eval COVERAGE := ON)
+ $(call configure,Debug,)
+ $(call build_coverage,Debug,)
+
+.PHONY = build-release
+build-release: configure-release
+ $(call build,Release,)
+
+.PHONY = package
+package: build
+ $(call package,Debug,)
+
+.PHONY = package-release
+package-release: build-release
+ $(call package,Release,)
+
+define wipe
+ $(eval LOWER_BUILDTYPE=$(shell echo $(1) | tr A-Z a-z))
+ $(RM) -rf build-$(LOWER_BUILDTYPE)-$(OS_ID)
+ $(RM) -rf install-$(LOWER_BUILDTYPE)
+endef
+
+.PHONY = wipe
+wipe:
+ $(call wipe,Debug,)
+
+.PHONY = wipe-release
+wipe-release:
+ $(call wipe,Release,)
+
+define test
+ $(eval $(call build_folder,BUILD_FOLDER,$(1)))
+ cmake --build $(BUILD_FOLDER) -- test
+endef
+
+.PHONY = test-debug
+test-debug: build
+ $(call test, Debug,)
+
+.PHONY = test
+test: build-release
+ $(call test, Release,)
+
+.PHONY = functional
+functional:
+ $(SHELL) $(FUNCTIONAL)
+
+define documentation
+ python3 -m pip install --user virtualenv
+ python3 -m virtualenv env
+ (source $(WS_ROOT)/env/bin/activate; \
+ pip install -r $(WS_ROOT)/docs/etc/requirements.txt; \
+ cd docs; \
+ make html )
+endef
+
+.PHONY = doc
+doc:
+ $(call documentation,)
+
+
+.PHONY = docker
+docker:
+ $(DOCKER) build -t $(DEV_IMAGE) -f $(DOCKERFILE) ${PWD}
+ifeq ($(strip $(shell $(DOCKER) ps -q -f name=$(DEV_CONTAINER))),)
+ifneq ($(shell $(DOCKER) ps -aq -f status=exited -f name=$(DEV_CONTAINER)),)
+ docker rm $(DEV_CONTAINER)
+endif
+ $(DOCKER) run -dv ${PWD}:/workspace -w /workspace --name $(DEV_CONTAINER) --entrypoint=tail $(DEV_IMAGE) -f /dev/null
+endif
+ $(DOCKER) exec -it $(DEV_CONTAINER) bash
+
+.PHONY = wipe-docker
+wipe-docker:
+ $(DOCKER) rm --force $(DEV_CONTAINER) \ No newline at end of file