Make the Basic pipeline more portable
This change makes the Basic pipeline compile better with different
compilers. One change is this: the type parameter for a v1model meter
instance cannot be a programmer-defined enum. This is because in P4_16,
enums don't necessarily have underlying bitstring types and the
language doesn't specify that enum members should be assigned a
numerical value in any given way.
Change-Id: Id2b758eb2b6e76aa708c2e03e7a001667efddb3d
diff --git a/pipelines/basic/src/main/resources/include/wcmp.p4 b/pipelines/basic/src/main/resources/include/wcmp.p4
index 9d6e00f..7bc5332 100644
--- a/pipelines/basic/src/main/resources/include/wcmp.p4
+++ b/pipelines/basic/src/main/resources/include/wcmp.p4
@@ -27,6 +27,10 @@
direct_counter(CounterType.packets_and_bytes) wcmp_table_counter;
action_selector(HashAlgorithm.crc16, 32w64, 32w16) wcmp_selector;
+ action set_egress_port(port_t port) {
+ standard_metadata.egress_spec = port;
+ }
+
table wcmp_table {
support_timeout = false;
key = {
@@ -38,7 +42,7 @@
local_metadata.l4_dst_port : selector;
}
actions = {
- set_egress_port(standard_metadata);
+ set_egress_port;
}
implementation = wcmp_selector;
counters = wcmp_table_counter;