-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skeleton NF Functionality Improvements (#313)
Adds a "skeleton" network function to be used as a template for the creation of future NFs. Illustrates how to use the packet handler, setup, and user callback functions. Co-authored-by: jett <jett@localhost>
- Loading branch information
1 parent
e04dcf6
commit f5ef56c
Showing
5 changed files
with
451 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# openNetVM | ||
# https://github.com/sdnfv/openNetVM | ||
# | ||
# BSD LICENSE | ||
# | ||
# Copyright(c) | ||
# 2015-2017 George Washington University | ||
# 2015-2017 University of California Riverside | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# The name of the author may not be used to endorse or promote | ||
# products derived from this software without specific prior | ||
# written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
ifeq ($(RTE_SDK),) | ||
$(error "Please define RTE_SDK environment variable") | ||
endif | ||
|
||
|
||
# Default target, can be overriden by command line or environment | ||
include $(RTE_SDK)/mk/rte.vars.mk | ||
RTE_TARGET ?= x86_64-native-linuxapp-gcc | ||
|
||
# binary name [EDIT & ADD NF TAG TO "examples" VARIABLE WITHIN MAKEFILE OF EXAMPLES DIRECTORY] | ||
APP = skeleton | ||
|
||
# all source are stored in SRCS-y | ||
SRCS-y := skeleton.c | ||
|
||
ONVM= $(SRCDIR)/../../onvm | ||
|
||
CFLAGS += $(WERROR_FLAGS) -O3 $(USER_FLAGS) | ||
|
||
CFLAGS += -I$(ONVM)/onvm_nflib | ||
CFLAGS += -I$(ONVM)/lib | ||
LDFLAGS += $(ONVM)/onvm_nflib/$(RTE_TARGET)/libonvm.a | ||
LDFLAGS += $(ONVM)/lib/$(RTE_TARGET)/lib/libonvmhelper.a -lm | ||
|
||
# workaround for a gcc bug with noreturn attribute | ||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 | ||
ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) | ||
CFLAGS_main.o += -Wno-return-type | ||
endif | ||
|
||
include $(RTE_SDK)/mk/rte.extapp.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Skeleton | ||
== | ||
This is an example NF that acts as a basic skeleton NF. | ||
|
||
Compilation and Execution | ||
-- | ||
``` | ||
cd examples | ||
make | ||
cd skeleton | ||
./go.sh SERVICE_ID [-p TIME_PRINT_DELAY | -v PACKET_PRINT_DELAY] | ||
OR | ||
./go.sh -F CONFIG_FILE -- -- [-p PRINT_DELAY] | ||
OR | ||
sudo ./build/skeleton -l CORELIST -n 3 --proc-type=secondary -- -r SERVICE_ID -- [-p TIME_PRINT_DELAY | -v PACKET_PRINT_DELAY] | ||
``` | ||
|
||
App Specific Arguments | ||
-- | ||
- `-p <time_print_delay>`: time between each print, e.g. `-p 1` prints after every second. | ||
- `-v <packet_print_delay>`: number of packets between each print, e.g. `-v 1` prints after every packet. | ||
|
||
Config File Support | ||
-- | ||
This NF supports the NF generating arguments from a config file. For | ||
additional reading, see [Examples.md](../../docs/Examples.md) | ||
|
||
See `../example_config.json` for all possible options that can be set. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
#The go.sh script is a convinient way to run start_nf.sh without specifying NF_NAME | ||
|
||
NF_DIR=${PWD##*/} | ||
|
||
if [ ! -f ../start_nf.sh ]; then | ||
echo "ERROR: The ./go.sh script can only be used from the NF folder" | ||
echo "If running from other directory use examples/start_nf.sh" | ||
exit 1 | ||
fi | ||
|
||
# only check for running manager if not in Docker | ||
if [[ -z $(pgrep -u root -f "/onvm/onvm_mgr/.*/onvm_mgr") ]] && ! grep -q "docker" /proc/1/cgroup | ||
then | ||
echo "NF cannot start without a running manager" | ||
exit 1 | ||
fi | ||
|
||
../start_nf.sh "$NF_DIR" "$@" |
Oops, something went wrong.