ONOS-7058 Refactored default pipeconfs in new pipelines directory
- Minimal refactoring of P4 programs
- Removed symlinks to BMv2 JSON/P4Info
- Bumped p4c commit (which fixes known parser bug)
- Renamed "default" pipeconf to "basic" (ONOS-6818)
Change-Id: I319f8b142ab22dba9b15457e28cd62d17f78a423
diff --git a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
index 1c9c4ab..fda5053 100644
--- a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
+++ b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
@@ -60,7 +60,9 @@
import java.util.stream.Collectors;
import static org.easymock.EasyMock.niceMock;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
import static org.onosproject.net.pi.runtime.PiActionGroup.Type.SELECT;
import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.INSERT;
@@ -72,7 +74,7 @@
*/
public class P4RuntimeGroupTest {
private static final String PIPECONF_ID = "p4runtime-mock-pipeconf";
- private static final String P4INFO_PATH = "/default.p4info";
+ private static final String P4INFO_PATH = "/test.p4info";
private static final PiPipeconf PIPECONF = buildPipeconf();
private static final int P4_INFO_ACT_PROF_ID = 285227860;
private static final PiActionProfileId ACT_PROF_ID = PiActionProfileId.of("ecmp_selector");
diff --git a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
index 80127ff..20d6705 100644
--- a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
+++ b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
@@ -44,7 +44,9 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
-import static org.onlab.util.ImmutableByteSequence.*;
+import static org.onlab.util.ImmutableByteSequence.copyFrom;
+import static org.onlab.util.ImmutableByteSequence.fit;
+import static org.onlab.util.ImmutableByteSequence.ofOnes;
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
import static org.onosproject.p4runtime.ctl.TableEntryEncoder.decode;
import static org.onosproject.p4runtime.ctl.TableEntryEncoder.encode;
@@ -64,7 +66,7 @@
private static final String ETHER_TYPE = "etherType";
private final Random rand = new Random();
- private final URL p4InfoUrl = this.getClass().getResource("/default.p4info");
+ private final URL p4InfoUrl = this.getClass().getResource("/test.p4info");
private final PiPipeconf defaultPipeconf = DefaultPiPipeconf.builder()
.withId(new PiPipeconfId("mock"))
diff --git a/protocols/p4runtime/ctl/src/test/resources/default.p4info b/protocols/p4runtime/ctl/src/test/resources/default.p4info
deleted file mode 120000
index 4dda381..0000000
--- a/protocols/p4runtime/ctl/src/test/resources/default.p4info
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../tools/test/p4src/p4-16/p4c-out/default.p4info
\ No newline at end of file
diff --git a/protocols/p4runtime/ctl/src/test/resources/test.p4info b/protocols/p4runtime/ctl/src/test/resources/test.p4info
new file mode 100644
index 0000000..8fc1443
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/test/resources/test.p4info
@@ -0,0 +1,191 @@
+tables {
+ preamble {
+ id: 33617813
+ name: "table0"
+ alias: "table0"
+ }
+ match_fields {
+ id: 1
+ name: "standard_metadata.ingress_port"
+ bitwidth: 9
+ match_type: TERNARY
+ }
+ match_fields {
+ id: 2
+ name: "hdr.ethernet.dstAddr"
+ bitwidth: 48
+ match_type: TERNARY
+ }
+ match_fields {
+ id: 3
+ name: "hdr.ethernet.srcAddr"
+ bitwidth: 48
+ match_type: TERNARY
+ }
+ match_fields {
+ id: 4
+ name: "hdr.ethernet.etherType"
+ bitwidth: 16
+ match_type: TERNARY
+ }
+ action_refs {
+ id: 16794308
+ }
+ action_refs {
+ id: 16829080
+ }
+ action_refs {
+ id: 16824896
+ }
+ action_refs {
+ id: 16784184
+ }
+ direct_resource_ids: 301990488
+ size: 1024
+}
+tables {
+ preamble {
+ id: 33573767
+ name: "ecmp"
+ alias: "ecmp"
+ }
+ match_fields {
+ id: 1
+ name: "meta.ecmp_metadata.ecmp_group_id"
+ bitwidth: 8
+ match_type: EXACT
+ }
+ action_refs {
+ id: 16794308
+ }
+ action_refs {
+ id: 16800567
+ annotations: "@defaultonly()"
+ }
+ implementation_id: 285227860
+ direct_resource_ids: 302048161
+ size: 1024
+}
+actions {
+ preamble {
+ id: 16794308
+ name: "set_egress_port"
+ alias: "set_egress_port"
+ }
+ params {
+ id: 1
+ name: "port"
+ bitwidth: 9
+ }
+}
+actions {
+ preamble {
+ id: 16829080
+ name: "send_to_cpu"
+ alias: "send_to_cpu"
+ }
+}
+actions {
+ preamble {
+ id: 16784184
+ name: "_drop"
+ alias: "_drop"
+ }
+}
+actions {
+ preamble {
+ id: 16800567
+ name: "NoAction"
+ alias: "NoAction"
+ }
+}
+actions {
+ preamble {
+ id: 16824896
+ name: "do_ecmp"
+ alias: "do_ecmp"
+ }
+ params {
+ id: 1
+ name: "ecmp_group_id"
+ bitwidth: 8
+ }
+}
+action_profiles {
+ preamble {
+ id: 285227860
+ name: "ecmp_selector"
+ alias: "ecmp_selector"
+ }
+ table_ids: 33573767
+ with_selector: true
+ size: 64
+}
+counters {
+ preamble {
+ id: 302025528
+ name: "port_counters_control.egress_port_counter"
+ alias: "egress_port_counter"
+ }
+ spec {
+ unit: PACKETS
+ }
+ size: 255
+}
+counters {
+ preamble {
+ id: 301999025
+ name: "port_counters_control.ingress_port_counter"
+ alias: "ingress_port_counter"
+ }
+ spec {
+ unit: PACKETS
+ }
+ size: 255
+}
+direct_counters {
+ preamble {
+ id: 301990488
+ name: "table0_counter"
+ alias: "table0_counter"
+ }
+ spec {
+ unit: PACKETS
+ }
+ direct_table_id: 33617813
+}
+direct_counters {
+ preamble {
+ id: 302048161
+ name: "ecmp_counter"
+ alias: "ecmp_counter"
+ }
+ spec {
+ unit: PACKETS
+ }
+ direct_table_id: 33573767
+}
+controller_packet_metadata {
+ preamble {
+ id: 2868941301
+ name: "packet_in"
+ annotations: "@controller_header(\"packet_in\")"
+ }
+ metadata {
+ id: 1
+ name: "ingress_port"
+ bitwidth: 9
+ }
+}
+controller_packet_metadata {
+ preamble {
+ id: 2868916615
+ name: "packet_out"
+ annotations: "@controller_header(\"packet_out\")"
+ }
+ metadata {
+ id: 1
+ name: "egress_port"
+ bitwidth: 9
+ }
+}
\ No newline at end of file