2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00
Files
openvswitch/tests/automake.mk
Joe Stringer 07659514c3 Add support for connection tracking.
This patch adds a new action and fields to OVS that allow connection
tracking to be performed. This support works in conjunction with the
Linux kernel support merged into the Linux-4.3 development cycle.

Packets have two possible states with respect to connection tracking:
Untracked packets have not previously passed through the connection
tracker, while tracked packets have previously been through the
connection tracker. For OpenFlow pipeline processing, untracked packets
can become tracked, and they will remain tracked until the end of the
pipeline. Tracked packets cannot become untracked.

Connections can be unknown, uncommitted, or committed. Packets which are
untracked have unknown connection state. To know the connection state,
the packet must become tracked. Uncommitted connections have no
connection state stored about them, so it is only possible for the
connection tracker to identify whether they are a new connection or
whether they are invalid. Committed connections have connection state
stored beyond the lifetime of the packet, which allows later packets in
the same connection to be identified as part of the same established
connection, or related to an existing connection - for instance ICMP
error responses.

The new 'ct' action transitions the packet from "untracked" to
"tracked" by sending this flow through the connection tracker.
The following parameters are supported initally:

- "commit": When commit is executed, the connection moves from
  uncommitted state to committed state. This signals that information
  about the connection should be stored beyond the lifetime of the
  packet within the pipeline. This allows future packets in the same
  connection to be recognized as part of the same "established" (est)
  connection, as well as identifying packets in the reply (rpl)
  direction, or packets related to an existing connection (rel).
- "zone=[u16|NXM]": Perform connection tracking in the zone specified.
  Each zone is an independent connection tracking context. When the
  "commit" parameter is used, the connection will only be committed in
  the specified zone, and not in other zones. This is 0 by default.
- "table=NUMBER": Fork pipeline processing in two. The original instance
  of the packet will continue processing the current actions list as an
  untracked packet. An additional instance of the packet will be sent to
  the connection tracker, which will be re-injected into the OpenFlow
  pipeline to resume processing in the specified table, with the
  ct_state and other ct match fields set. If the table is not specified,
  then the packet is submitted to the connection tracker, but the
  pipeline does not fork and the ct match fields are not populated. It
  is strongly recommended to specify a table later than the current
  table to prevent loops.

When the "table" option is used, the packet that continues processing in
the specified table will have the ct_state populated. The ct_state may
have any of the following flags set:

- Tracked (trk): Connection tracking has occurred.
- Reply (rpl): The flow is in the reply direction.
- Invalid (inv): The connection tracker couldn't identify the connection.
- New (new): This is the beginning of a new connection.
- Established (est): This is part of an already existing connection.
- Related (rel): This connection is related to an existing connection.

For more information, consult the ovs-ofctl(8) man pages.

Below is a simple example flow table to allow outbound TCP traffic from
port 1 and drop traffic from port 2 that was not initiated by port 1:

    table=0,priority=1,action=drop
    table=0,arp,action=normal
    table=0,in_port=1,tcp,ct_state=-trk,action=ct(commit,zone=9),2
    table=0,in_port=2,tcp,ct_state=-trk,action=ct(zone=9,table=1)
    table=1,in_port=2,ct_state=+trk+est,tcp,action=1
    table=1,in_port=2,ct_state=+trk+new,tcp,action=drop

Based on original design by Justin Pettit, contributions from Thomas
Graf and Daniele Di Proietto.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-10-13 15:34:15 -07:00

393 lines
12 KiB
Makefile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

EXTRA_DIST += \
$(COMMON_MACROS_AT) \
$(TESTSUITE_AT) \
$(SYSTEM_TESTSUITE_AT) \
$(SYSTEM_KMOD_TESTSUITE_AT) \
$(SYSTEM_USERSPACE_TESTSUITE_AT) \
$(TESTSUITE) \
$(SYSTEM_KMOD_TESTSUITE) \
$(SYSTEM_USERSPACE_TESTSUITE) \
tests/atlocal.in \
$(srcdir)/package.m4 \
$(srcdir)/tests/testsuite \
$(srcdir)/tests/testsuite.patch
COMMON_MACROS_AT = \
tests/ovsdb-macros.at \
tests/ovs-macros.at \
tests/ofproto-macros.at
TESTSUITE_AT = \
tests/testsuite.at \
tests/completion.at \
tests/library.at \
tests/heap.at \
tests/bundle.at \
tests/classifier.at \
tests/check-structs.at \
tests/daemon.at \
tests/daemon-py.at \
tests/ofp-actions.at \
tests/ofp-print.at \
tests/ofp-util.at \
tests/ofp-errors.at \
tests/ovs-ofctl.at \
tests/odp.at \
tests/mpls-xlate.at \
tests/multipath.at \
tests/bfd.at \
tests/cfm.at \
tests/lacp.at \
tests/lib.at \
tests/learn.at \
tests/vconn.at \
tests/file_name.at \
tests/aes128.at \
tests/unixctl-py.at \
tests/uuid.at \
tests/json.at \
tests/jsonrpc.at \
tests/jsonrpc-py.at \
tests/tunnel.at \
tests/tunnel-push-pop.at \
tests/lockfile.at \
tests/reconnect.at \
tests/ovs-vswitchd.at \
tests/dpif-netdev.at \
tests/dpctl.at \
tests/ofproto-dpif.at \
tests/bridge.at \
tests/vlan-splinters.at \
tests/ofproto.at \
tests/ovsdb.at \
tests/ovsdb-log.at \
tests/ovsdb-types.at \
tests/ovsdb-data.at \
tests/ovsdb-column.at \
tests/ovsdb-table.at \
tests/ovsdb-row.at \
tests/ovsdb-schema.at \
tests/ovsdb-condition.at \
tests/ovsdb-mutation.at \
tests/ovsdb-query.at \
tests/ovsdb-transaction.at \
tests/ovsdb-execution.at \
tests/ovsdb-trigger.at \
tests/ovsdb-tool.at \
tests/ovsdb-server.at \
tests/ovsdb-monitor.at \
tests/ovsdb-idl.at \
tests/ovs-vsctl.at \
tests/ovs-monitor-ipsec.at \
tests/ovs-xapi-sync.at \
tests/stp.at \
tests/rstp.at \
tests/interface-reconfigure.at \
tests/vlog.at \
tests/vtep-ctl.at \
tests/auto-attach.at \
tests/ovn.at \
tests/ovn-nbctl.at \
tests/ovn-sbctl.at \
tests/ovn-controller.at \
tests/ovn-controller-vtep.at
SYSTEM_KMOD_TESTSUITE_AT = \
tests/system-common-macros.at \
tests/system-kmod-testsuite.at \
tests/system-kmod-macros.at
SYSTEM_USERSPACE_TESTSUITE_AT = \
tests/system-userspace-testsuite.at \
tests/system-userspace-macros.at
SYSTEM_TESTSUITE_AT = \
tests/system-common-macros.at \
tests/system-traffic.at
TESTSUITE = $(srcdir)/tests/testsuite
TESTSUITE_PATCH = $(srcdir)/tests/testsuite.patch
SYSTEM_KMOD_TESTSUITE = $(srcdir)/tests/system-kmod-testsuite
SYSTEM_USERSPACE_TESTSUITE = $(srcdir)/tests/system-userspace-testsuite
DISTCLEANFILES += tests/atconfig tests/atlocal
AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:$(PTHREAD_WIN32_DIR_DLL):ovn:ovn/controller-vtep:ovn/northd:ovn/utilities:ovn/controller
check-local: tests/atconfig tests/atlocal $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
# Python Coverage support.
# Requires coverage.py http://nedbatchelder.com/code/coverage/.
COVERAGE = coverage
COVERAGE_FILE='$(abs_srcdir)/.coverage'
check-pycov: all tests/atconfig tests/atlocal $(TESTSUITE) clean-pycov
PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE) PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
@cd $(srcdir) && $(COVERAGE) combine && COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
@echo
@echo '----------------------------------------------------------------------'
@echo 'Annotated coverage source has the ",cover" extension.'
@echo '----------------------------------------------------------------------'
@echo
@COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) report
# valgrind support
valgrind_wrappers = \
tests/valgrind/ovs-appctl \
tests/valgrind/ovs-ofctl \
tests/valgrind/ovstest \
tests/valgrind/ovs-vsctl \
tests/valgrind/ovs-vswitchd \
tests/valgrind/ovsdb-client \
tests/valgrind/ovsdb-server \
tests/valgrind/ovsdb-tool \
tests/valgrind/test-aes128 \
tests/valgrind/test-atomic \
tests/valgrind/test-bundle \
tests/valgrind/test-byte-order \
tests/valgrind/test-classifier \
tests/valgrind/test-cmap \
tests/valgrind/test-csum \
tests/valgrind/test-flows \
tests/valgrind/test-hash \
tests/valgrind/test-hindex \
tests/valgrind/test-hmap \
tests/valgrind/test-json \
tests/valgrind/test-jsonrpc \
tests/valgrind/test-list \
tests/valgrind/test-lockfile \
tests/valgrind/test-multipath \
tests/valgrind/test-odp \
tests/valgrind/test-ofpbuf \
tests/valgrind/test-ovsdb \
tests/valgrind/test-packets \
tests/valgrind/test-random \
tests/valgrind/test-reconnect \
tests/valgrind/test-rstp \
tests/valgrind/test-sha1 \
tests/valgrind/test-stp \
tests/valgrind/test-type-props \
tests/valgrind/test-unix-socket \
tests/valgrind/test-uuid \
tests/valgrind/test-vconn
$(valgrind_wrappers): tests/valgrind-wrapper.in
@test -d tests/valgrind || mkdir tests/valgrind
$(AM_V_GEN) sed -e 's,[@]wrap_program[@],$@,' \
$(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp && \
chmod +x $@.tmp && \
mv $@.tmp $@
CLEANFILES += $(valgrind_wrappers)
EXTRA_DIST += tests/valgrind-wrapper.in
VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
--suppressions=$(abs_top_srcdir)/tests/glibc.supp \
--suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
EXTRA_DIST += tests/glibc.supp tests/openssl.supp
check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) \
$(valgrind_wrappers) $(check_DATA)
$(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
@echo
@echo '----------------------------------------------------------------------'
@echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
@echo '----------------------------------------------------------------------'
# OFTest support.
check-oftest: all
$(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-oftest
EXTRA_DIST += tests/run-oftest
# Ryu support.
check-ryu: all
$(AM_V_at)srcdir='$(srcdir)' $(SHELL) $(srcdir)/tests/run-ryu
EXTRA_DIST += tests/run-ryu
# Run kmod tests. Assume kernel modules has been installed or linked into the kernel
check-kernel: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
$(SHELL) '$(SYSTEM_KMOD_TESTSUITE)' -C tests AUTOTEST_PATH='$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
# Testing the out of tree Kernel module
check-kmod: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
$(MAKE) modules_install
modprobe -r openvswitch
$(MAKE) check-kernel
check-system-userspace: all tests/atconfig tests/atlocal $(SYSTEM_USERSPACE_TESTSUITE)
$(SHELL) '$(SYSTEM_USERSPACE_TESTSUITE)' -C tests AUTOTEST_PATH='$(AUTOTEST_PATH)' $(TESTSUITEFLAGS)
clean-local:
test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
AUTOTEST = $(AUTOM4TE) --language=autotest
if WIN32
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(COMMON_MACROS_AT) $(TESTSUITE_PATCH)
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o testsuite.tmp $@.at
patch -p0 testsuite.tmp $(TESTSUITE_PATCH)
$(AM_V_at)mv testsuite.tmp $@
else
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(COMMON_MACROS_AT)
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
$(AM_V_at)mv $@.tmp $@
endif
$(SYSTEM_KMOD_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_KMOD_TESTSUITE_AT) $(COMMON_MACROS_AT)
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
$(AM_V_at)mv $@.tmp $@
$(SYSTEM_USERSPACE_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_USERSPACE_TESTSUITE_AT) $(COMMON_MACROS_AT)
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
$(AM_V_at)mv $@.tmp $@
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
$(AM_V_GEN):;{ \
echo '# Signature of the current package.' && \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
} >'$(srcdir)/package.m4'
noinst_PROGRAMS += tests/test-ovsdb
tests_test_ovsdb_SOURCES = tests/test-ovsdb.c
nodist_tests_test_ovsdb_SOURCES = tests/idltest.c tests/idltest.h
EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
noinst_PROGRAMS += tests/test-lib
tests_test_lib_SOURCES = \
tests/test-lib.c
tests_test_lib_LDADD = lib/libopenvswitch.la
# idltest schema and IDL
OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
IDLTEST_IDL_FILES = tests/idltest.ovsschema tests/idltest.ann
EXTRA_DIST += $(IDLTEST_IDL_FILES) tests/idltest2.ovsschema
tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
$(AM_V_GEN)$(OVSDB_IDLC) -C $(srcdir) annotate $(IDLTEST_IDL_FILES) > $@.tmp && \
mv $@.tmp $@
tests/idltest.c: tests/idltest.h
if DPDK_NETDEV
noinst_PROGRAMS += tests/test-dpdkr
tests_test_dpdkr_SOURCES = \
tests/dpdk/ring_client.c
tests_test_dpdkr_LDADD = lib/libopenvswitch.la $(LIBS)
endif
noinst_PROGRAMS += tests/ovstest
tests_ovstest_SOURCES = \
tests/ovstest.c \
tests/ovstest.h \
tests/test-aes128.c \
tests/test-atomic.c \
tests/test-bundle.c \
tests/test-byte-order.c \
tests/test-classifier.c \
tests/test-cmap.c \
tests/test-csum.c \
tests/test-flows.c \
tests/test-hash.c \
tests/test-heap.c \
tests/test-hindex.c \
tests/test-hmap.c \
tests/test-json.c \
tests/test-jsonrpc.c \
tests/test-list.c \
tests/test-lockfile.c \
tests/test-multipath.c \
tests/test-netflow.c \
tests/test-odp.c \
tests/test-ofpbuf.c \
tests/test-ovn.c \
tests/test-packets.c \
tests/test-random.c \
tests/test-reconnect.c \
tests/test-rstp.c \
tests/test-sflow.c \
tests/test-sha1.c \
tests/test-stp.c \
tests/test-util.c \
tests/test-uuid.c \
tests/test-bitmap.c \
tests/test-vconn.c \
tests/test-aa.c
if !WIN32
tests_ovstest_SOURCES += \
tests/test-unix-socket.c
endif
tests_ovstest_LDADD = lib/libopenvswitch.la ovn/lib/libovn.la
dist_check_SCRIPTS = tests/flowgen.pl
noinst_PROGRAMS += tests/test-strtok_r
tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
noinst_PROGRAMS += tests/test-type-props
tests_test_type_props_SOURCES = tests/test-type-props.c
# Python tests.
CHECK_PYFILES = \
tests/appctl.py \
tests/test-daemon.py \
tests/test-json.py \
tests/test-jsonrpc.py \
tests/test-l7.py \
tests/test-ovsdb.py \
tests/test-reconnect.py \
tests/MockXenAPI.py \
tests/test-unix-socket.py \
tests/test-unixctl.py \
tests/test-vlog.py
EXTRA_DIST += $(CHECK_PYFILES)
PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
if HAVE_OPENSSL
TESTPKI_FILES = \
tests/testpki-cacert.pem \
tests/testpki-cert.pem \
tests/testpki-privkey.pem \
tests/testpki-req.pem \
tests/testpki-cert2.pem \
tests/testpki-privkey2.pem \
tests/testpki-req2.pem
check_DATA += $(TESTPKI_FILES)
CLEANFILES += $(TESTPKI_FILES)
tests/testpki-cacert.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/switchca/cacert.pem $@
tests/testpki-cert.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test-cert.pem $@
tests/testpki-req.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test-req.pem $@
tests/testpki-privkey.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test-privkey.pem $@
tests/testpki-cert2.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test2-cert.pem $@
tests/testpki-req2.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test2-req.pem $@
tests/testpki-privkey2.pem: tests/pki/stamp
$(AM_V_GEN)cp tests/pki/test2-privkey.pem $@
OVS_PKI = $(SHELL) $(srcdir)/utilities/ovs-pki.in --dir=tests/pki --log=tests/ovs-pki.log
tests/pki/stamp:
$(AM_V_at)rm -f tests/pki/stamp
$(AM_V_at)rm -rf tests/pki
$(AM_V_GEN)$(OVS_PKI) init && \
$(OVS_PKI) req+sign tests/pki/test && \
$(OVS_PKI) req+sign tests/pki/test2 && \
: > tests/pki/stamp
CLEANFILES += tests/ovs-pki.log
CLEAN_LOCAL += clean-pki
clean-pki:
rm -f tests/pki/stamp
rm -rf tests/pki
endif