Improve fabric.p4 to reduce pipeline resources and refactor pipeconf impl
This patch affects both the P4 pipeline implementation and the
Java pipeconf.
P4 PIPELINE
- Less tables and smarter use of metadata to reduce inter-tables
dependencies and favor parallel execution of tables.
- Removed unused actions / renamed existing ones to make forwarding
behavior clearer (e.g. ingress_port_vlan table)
- Remove co-existence of simple and hansed table. Hashed should be the
default one, but implementations that do not support action profiles
might compile fabric.p4 to use the simple one.
- Use @name annotations for match fields to make control plane
independent of table implementation.
- Use @hidden to avoid showing actions and table on the p4info that
cannot be controlled at runtime.
- First attempt to support double VLAN cross-connect (xconnect table).
- New design has been tested with "fabric-refactoring" branch of
fabric-p4test:
github.com/opennetworkinglab/fabric-p4test/tree/fabric-refactoring
JAVA PIPECONF
This patch brings a major refactoring that reflects the experience
gathered in the past months of working on fabric.p4 and reasoning on its
pipeconf implementation. Indeed, the FlowObjective API is
under-specified and sometimes ambiguous which makes the process of
creating and maintaining a pipeliner implementation tedious. This
refactoring brings a simplified implementation by removing unused/
unnecessary functionalities and by recognizing commonality when possible
(e.g. by means of abstract and utility classes). It also makes design
patterns more explicit and consistent. Overall, the goal is to reduce
technical debt and to make it easier to support new features as we
evolve fabric.p4
Changes include:
- Changes in pipeliner/interpreter to reflect new pipeline design.
- By default translate objective treatment to PiAction. This favors
debuggability of flow rules in ONOS.
- Support new NextObjective’s NextTreatment class.
- Remove lots of unused/unnecessary code (e.g. async callback handling
for pending objective install status in pipeliner as current
implementation was always returning success)
- Gather commonality in abstract classes and simplify implementation
for objective translator (filtering, forwarding, next)
- New implementation of ForwardingFunctionTypes (FFT) that looks at
criterion instance values along with their types (to avoid relying on
case-specific if-else conditions to recognize variants of an FFT)
- Adaptive translation of NextObjective based on presence of simple or
hashed table.
- Support DENY FilteringObjective
Also:
- Fix onos-p4-gen-constants to avoid generating conflicting
PiMatchFieldId variable names.
- Install Graphviz tools in p4vm to generate p4c graphs
- Generate p4c graphs by default when compiling fabric.p4
- Use more compact Hex string when printing PI values
Change-Id: Ife79e44054dc5bc48833f95d0551a7370150eac5
diff --git a/tools/dev/bin/onos-gen-p4-constants b/tools/dev/bin/onos-gen-p4-constants
index 566ba4f..80f8f63 100755
--- a/tools/dev/bin/onos-gen-p4-constants
+++ b/tools/dev/bin/onos-gen-p4-constants
@@ -1,11 +1,10 @@
#!/usr/bin/env python2.7
# -*- utf-8 -*-
import argparse
-import re
import google.protobuf.text_format as tf
+import re
from p4.config.v1 import p4info_pb2
-
copyright = '''/*
* Copyright 2017-present Open Networking Foundation
*
@@ -74,6 +73,9 @@
PI_PKT_META_ID = 'PiControlMetadataId'
PI_PKT_META_ID_CST = 'PiControlMetadataId.of("%s")'
+HF_VAR_PREFIX = 'HDR_'
+
+
class ConstantClassGenerator(object):
headers = set()
header_fields = set()
@@ -125,6 +127,8 @@
def const_line(self, name, type, constructor):
var_name = self.convert_camel_to_all_caps(name)
+ if type == PI_HF_FIELD_ID:
+ var_name = HF_VAR_PREFIX + var_name
val = constructor % (name, )
line = CONST_FMT % (type, var_name, val)
diff --git a/tools/dev/p4vm/install-p4-tools.sh b/tools/dev/p4vm/install-p4-tools.sh
index e2ca928..8efc4a3 100755
--- a/tools/dev/p4vm/install-p4-tools.sh
+++ b/tools/dev/p4vm/install-p4-tools.sh
@@ -50,8 +50,10 @@
curl \
flex \
git \
+ graphviz \
libavl-dev \
libboost-dev \
+ libboost-graph-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-filesystem-dev \