Pi classes to support P4Runtime action profiles
+ modified default.p4 with ECMP capabilities (via action profiles)
+ sketched translation logic of ONOS groups (in Bmv2GroupProgrammable)
+ replaced existing instances of default.json/p4info with symlinks to
p4src build directory (to avoid inconsistencies)
Change-Id: If82f0b8ce296c9b616415d99864d216b77645a87
diff --git a/apps/p4runtime-test/BUCK b/apps/p4runtime-test/BUCK
index 842fe2d..3ba5b5e 100644
--- a/apps/p4runtime-test/BUCK
+++ b/apps/p4runtime-test/BUCK
@@ -8,6 +8,7 @@
'//protocols/p4runtime/api:onos-protocols-p4runtime-api',
'//protocols/p4runtime/ctl:onos-protocols-p4runtime-ctl',
'//protocols/p4runtime/proto:onos-protocols-p4runtime-proto',
+ '//drivers/bmv2:onos-drivers-bmv2',
'//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
'//lib:grpc-stub-' + GRPC_VER,
'//lib:protobuf-java-' + PROTOBUF_VER,
diff --git a/apps/p4runtime-test/src/test/java/org/onosproject/p4runtime/test/P4RuntimeTest.java b/apps/p4runtime-test/src/test/java/org/onosproject/p4runtime/test/P4RuntimeTest.java
index 0f8d238..ab0a57e 100644
--- a/apps/p4runtime-test/src/test/java/org/onosproject/p4runtime/test/P4RuntimeTest.java
+++ b/apps/p4runtime-test/src/test/java/org/onosproject/p4runtime/test/P4RuntimeTest.java
@@ -18,66 +18,165 @@
import io.grpc.ManagedChannelBuilder;
import io.grpc.netty.NettyChannelBuilder;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.onlab.util.ImmutableByteSequence;
import org.onosproject.bmv2.model.Bmv2PipelineModelParser;
+import org.onosproject.drivers.bmv2.Bmv2DefaultInterpreter;
import org.onosproject.grpc.ctl.GrpcControllerImpl;
import org.onosproject.net.DeviceId;
import org.onosproject.net.pi.model.DefaultPiPipeconf;
import org.onosproject.net.pi.model.PiPipeconf;
import org.onosproject.net.pi.model.PiPipeconfId;
import org.onosproject.net.pi.model.PiPipelineInterpreter;
-import org.onosproject.p4runtime.api.P4RuntimeClient;
+import org.onosproject.net.pi.runtime.PiPacketMetadata;
+import org.onosproject.net.pi.runtime.PiPacketMetadataId;
+import org.onosproject.net.pi.runtime.PiPacketOperation;
+import org.onosproject.net.pi.runtime.PiTableId;
+import org.onosproject.p4runtime.ctl.P4RuntimeClientImpl;
import org.onosproject.p4runtime.ctl.P4RuntimeControllerImpl;
+import p4.P4RuntimeGrpc;
+import p4.P4RuntimeOuterClass;
import java.net.URL;
import java.util.concurrent.ExecutionException;
+import static org.onlab.util.ImmutableByteSequence.copyFrom;
+import static org.onlab.util.ImmutableByteSequence.fit;
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.BMV2_JSON;
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
+import static org.onosproject.net.pi.runtime.PiPacketOperation.Type.PACKET_OUT;
+import static p4.P4RuntimeOuterClass.ActionProfileGroup.Type.SELECT;
+import static p4.P4RuntimeOuterClass.Update.Type.INSERT;
/**
* Class used for quick testing of P4Runtime with real devices. To be removed before release.
*/
public class P4RuntimeTest {
- private final URL p4InfoUrl = this.getClass().getResource("/default.p4info");
- private final URL jsonUrl = this.getClass().getResource("/default.json");
+ private static final String GRPC_SERVER_ADDR = "192.168.56.102";
+ private static final int GRPC_SERVER_PORT = 55044;
+
+ private final URL p4InfoUrl = this.getClass().getResource("/bmv2/default.p4info");
+ private final URL jsonUrl = this.getClass().getResource("/bmv2/default.json");
private final PiPipeconf bmv2DefaultPipeconf = DefaultPiPipeconf.builder()
- .withId(new PiPipeconfId("mock"))
+ .withId(new PiPipeconfId("mock-bmv2"))
.withPipelineModel(Bmv2PipelineModelParser.parse(jsonUrl))
-// .addBehaviour(PiPipelineInterpreter.class, Bmv2DefaultInterpreter.class)
+ .addBehaviour(PiPipelineInterpreter.class, Bmv2DefaultInterpreter.class)
.addExtension(P4_INFO_TEXT, p4InfoUrl)
.addExtension(BMV2_JSON, jsonUrl)
.build();
+ private final P4RuntimeControllerImpl controller = new P4RuntimeControllerImpl();
+ private final GrpcControllerImpl grpcController = new GrpcControllerImpl();
+ private final DeviceId deviceId = DeviceId.deviceId("dummy:1");
+ private final ManagedChannelBuilder channelBuilder = NettyChannelBuilder
+ .forAddress(GRPC_SERVER_ADDR, GRPC_SERVER_PORT)
+ .usePlaintext(true);
+ private P4RuntimeClientImpl client;
- @Test
- @Ignore
- public void testRuntime() throws ExecutionException, InterruptedException,
- PiPipelineInterpreter.PiInterpreterException, IllegalAccessException, InstantiationException {
-
- // FIXME: remove me.
-
- P4RuntimeControllerImpl controller = new P4RuntimeControllerImpl();
- GrpcControllerImpl grpcController = new GrpcControllerImpl();
+ @Before
+ public void setUp() throws Exception {
controller.grpcController = grpcController;
GrpcControllerImpl.enableMessageLog = true;
grpcController.activate();
- DeviceId deviceId = DeviceId.deviceId("dummy:1");
+ }
- ManagedChannelBuilder channelBuilder = NettyChannelBuilder
- .forAddress("192.168.56.102", 59975)
- .usePlaintext(true);
+ private void createClientAndSetPipelineConfig(PiPipeconf pipeconf, PiPipeconf.ExtensionType extensionType)
+ throws ExecutionException, InterruptedException, PiPipelineInterpreter.PiInterpreterException,
+ IllegalAccessException, InstantiationException {
assert (controller.createClient(deviceId, 1, channelBuilder));
- P4RuntimeClient client = controller.getClient(deviceId);
+ client = (P4RuntimeClientImpl) controller.getClient(deviceId);
- assert (client.setPipelineConfig(bmv2DefaultPipeconf, PiPipeconf.ExtensionType.BMV2_JSON).get());
-
+ assert (client.setPipelineConfig(pipeconf, extensionType).get());
assert (client.initStreamChannel().get());
+ }
+ private void testActionProfile(int actionProfileId) {
+
+ P4RuntimeGrpc.P4RuntimeBlockingStub stub = client.blockingStub();
+
+ P4RuntimeOuterClass.ActionProfileMember profileMemberMsg = P4RuntimeOuterClass.ActionProfileMember.newBuilder()
+ .setActionProfileId(actionProfileId)
+ // .setMemberId(1)
+ .setAction(P4RuntimeOuterClass.Action.newBuilder()
+ .setActionId(16793508)
+ .build())
+ .build();
+
+ P4RuntimeOuterClass.ActionProfileGroup groupMsg = P4RuntimeOuterClass.ActionProfileGroup.newBuilder()
+ .setActionProfileId(actionProfileId)
+ .setGroupId(1)
+ .setType(SELECT)
+ .addMembers(P4RuntimeOuterClass.ActionProfileGroup.Member.newBuilder()
+ .setMemberId(1)
+ .setWeight(1)
+ .build())
+ .setMaxSize(3)
+ .build();
+
+ P4RuntimeOuterClass.WriteRequest writeRequest = P4RuntimeOuterClass.WriteRequest.newBuilder()
+ .setDeviceId(client.p4DeviceId())
+ .addUpdates(P4RuntimeOuterClass.Update.newBuilder()
+ .setType(INSERT)
+ .setEntity(P4RuntimeOuterClass.Entity.newBuilder()
+ .setActionProfileGroup(groupMsg)
+ .build())
+ .build())
+ .addUpdates(P4RuntimeOuterClass.Update.newBuilder()
+ .setType(INSERT)
+ .setEntity(P4RuntimeOuterClass.Entity.newBuilder()
+ .setActionProfileMember(profileMemberMsg)
+ .build())
+ .build())
+ .build();
+
+ stub.write(writeRequest);
+ }
+
+ private void testPacketOut() throws IllegalAccessException, InstantiationException, ExecutionException,
+ InterruptedException, ImmutableByteSequence.ByteSequenceTrimException {
+
+ PiPacketOperation packetOperation = PiPacketOperation.builder()
+ .withData(ImmutableByteSequence.ofOnes(10))
+ .withType(PACKET_OUT)
+ .withMetadata(PiPacketMetadata.builder()
+ .withId(PiPacketMetadataId.of("egress_port"))
+ .withValue(fit(copyFrom(1), 9))
+ .build())
+ .build();
+
+ assert (client.packetOut(packetOperation, bmv2DefaultPipeconf).get());
+ }
+
+ private void testDumpTable(String tableName, PiPipeconf pipeconf) throws ExecutionException, InterruptedException {
+ assert (client.dumpTable(PiTableId.of(tableName), pipeconf).get().size() == 0);
+ }
+
+ @Test
+ @Ignore
+ public void testBmv2() throws Exception {
+
+ createClientAndSetPipelineConfig(bmv2DefaultPipeconf, BMV2_JSON);
+
+ testDumpTable("table0", bmv2DefaultPipeconf);
+
+ // testPacketOut();
+
+ testActionProfile(285261835);
+ }
+
+ @Test
+ @Ignore
+ public void testTofino() throws Exception {
+
+ createClientAndSetPipelineConfig(bmv2DefaultPipeconf, null);
+ }
+
+// OLD STUFF
// log.info("++++++++++++++++++++++++++++");
//
// PiPipelineInterpreter interpreter = (PiPipelineInterpreter) defaultPipeconf
@@ -110,5 +209,4 @@
// assert(client.writeTableEntries(Lists.newArrayList(piTableEntry), INSERT, defaultPipeconf).get());
// assert(client.dumpTable(PiTableId.of(TABLE_0), defaultPipeconf).get().size() == 1);
- }
}
diff --git a/apps/p4runtime-test/src/test/resources/bmv2/default.json b/apps/p4runtime-test/src/test/resources/bmv2/default.json
new file mode 120000
index 0000000..f2a3e07
--- /dev/null
+++ b/apps/p4runtime-test/src/test/resources/bmv2/default.json
@@ -0,0 +1 @@
+../../../../../../tools/test/p4src/p4-16/p4c-out/default.json
\ No newline at end of file
diff --git a/apps/p4runtime-test/src/test/resources/bmv2/default.p4info b/apps/p4runtime-test/src/test/resources/bmv2/default.p4info
new file mode 120000
index 0000000..4dda381
--- /dev/null
+++ b/apps/p4runtime-test/src/test/resources/bmv2/default.p4info
@@ -0,0 +1 @@
+../../../../../../tools/test/p4src/p4-16/p4c-out/default.p4info
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java
new file mode 100644
index 0000000..57fab9d
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+
+import java.util.Collection;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Action group of a protocol-independent pipeline.
+ */
+@Beta
+public final class PiActionGroup {
+
+ /**
+ * Type of action group.
+ */
+ public enum Type {
+ /**
+ * Load-balancing among different members in a group.
+ */
+ SELECT
+ }
+
+ private final PiActionGroupId id;
+ private final Type type;
+ private final ImmutableSet<PiActionGroupMember> members;
+
+ private PiActionGroup(PiActionGroupId id, Type type, ImmutableSet<PiActionGroupMember> members) {
+ this.id = id;
+ this.type = type;
+ this.members = members;
+ }
+
+ /**
+ * Returns the identifier of this action group.
+ *
+ * @return action group identifier
+ */
+ public PiActionGroupId id() {
+ return id;
+ }
+
+ /**
+ * Returns the type of this action group.
+ *
+ * @return action group type
+ */
+ public Type type() {
+ return type;
+ }
+
+ /**
+ * Returns the members of this action group.
+ *
+ * @return collection of action members.
+ */
+ public Collection<PiActionGroupMember> members() {
+ return members;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PiActionGroup that = (PiActionGroup) o;
+ return id == that.id &&
+ Objects.equal(type, that.type) &&
+ Objects.equal(members, that.members);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, type, members);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("groupId", id)
+ .add("type", type)
+ .add("members", members)
+ .toString();
+ }
+
+ /**
+ * Returns a new builder of action groups.
+ *
+ * @return action group builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder of action groups.
+ */
+ public static final class Builder {
+
+ private PiActionGroupId id;
+ private Type type;
+ private Map<PiActionGroupMemberId, PiActionGroupMember> members = Maps.newHashMap();
+
+ private Builder() {
+ // hides constructor.
+ }
+
+ /**
+ * Sets the identifier of this action group.
+ *
+ * @param id action group identifier
+ * @return this
+ */
+ public Builder withId(PiActionGroupId id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Sets the type of this action group.
+ *
+ * @param type action group type
+ * @return this
+ */
+ public Builder withType(Type type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Adds one member to this action group.
+ *
+ * @param member action group member
+ * @return this
+ */
+ public Builder addMember(PiActionGroupMember member) {
+ members.put(member.id(), member);
+ return this;
+ }
+
+ /**
+ * Adds many members to this action group.
+ *
+ * @param members action group members
+ * @return this
+ */
+ public Builder addMembers(Collection<PiActionGroupMember> members) {
+ members.forEach(this::addMember);
+ return this;
+ }
+
+ /**
+ * Creates a new action group.
+ *
+ * @return action group
+ */
+ public PiActionGroup build() {
+ checkNotNull(id);
+ checkNotNull(type);
+ checkArgument(members.size() > 0, "Members cannot be empty");
+ return new PiActionGroup(id, type, ImmutableSet.copyOf(members.values()));
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupId.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupId.java
new file mode 100644
index 0000000..675ef59
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupId.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.annotations.Beta;
+import org.onlab.util.Identifier;
+
+/**
+ * Identifier of an action group in a protocol-independent pipeline.
+ */
+@Beta
+public final class PiActionGroupId extends Identifier<Integer> implements PiTableAction {
+
+ private PiActionGroupId(int id) {
+ super(id);
+ }
+
+ /**
+ * Returns an action group identifier for the given integer value.
+ *
+ * @param id identifier
+ * @return action group
+ */
+ public static PiActionGroupId of(int id) {
+ return new PiActionGroupId(id);
+ }
+
+ /*
+ In P4Runtime, groups can be referenced directly as table actions (i.e. without invoking the selector).
+ In future we should consider having a more appropriate wrapper class for group IDs, instead of implementing
+ the PiTableAction interface.
+ */
+ @Override
+ public Type type() {
+ return Type.ACTION_GROUP_ID;
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMember.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMember.java
new file mode 100644
index 0000000..67566d6
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMember.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Member of an action group in a protocol-independent pipeline.
+ */
+@Beta
+public final class PiActionGroupMember {
+
+ private final PiActionGroupMemberId id;
+ private final PiAction action;
+ private final int weight;
+
+ private PiActionGroupMember(PiActionGroupMemberId id, PiAction action, int weight) {
+ this.id = id;
+ this.action = action;
+ this.weight = weight;
+ }
+
+ /**
+ * Returns the identifier of this member.
+ *
+ * @return member identifier
+ */
+ public PiActionGroupMemberId id() {
+ return id;
+ }
+
+ /**
+ * Returns the action associated to this member.
+ *
+ * @return action
+ */
+ public PiAction action() {
+ return action;
+ }
+
+ /**
+ * Returns the weight associated to this member. Valid if the action group is of type {@link
+ * PiActionGroup.Type#SELECT}.
+ *
+ * @return weight
+ */
+ public int weight() {
+ return weight;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof PiActionGroupMember)) {
+ return false;
+ }
+ PiActionGroupMember that = (PiActionGroupMember) o;
+ return weight == that.weight &&
+ Objects.equal(id, that.id) &&
+ Objects.equal(action, that.action);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, action, weight);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("id", id)
+ .add("action", action)
+ .add("weight", weight)
+ .toString();
+ }
+
+ /**
+ * Returns a new builder of action group members.
+ *
+ * @return member builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder of action group members.
+ */
+ public static final class Builder {
+
+ private PiActionGroupMemberId id;
+ private PiAction action;
+ private int weight;
+
+ private Builder() {
+ // Hides constructor.
+ }
+
+ /**
+ * Sets the identifier of this member.
+ *
+ * @param id member identifier
+ * @return this
+ */
+ public Builder withId(PiActionGroupMemberId id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Sets the action of this member.
+ *
+ * @param action action
+ * @return this
+ */
+ public Builder withAction(PiAction action) {
+ this.action = action;
+ return this;
+ }
+
+ /**
+ * Sets the weight of this member. Valid if the action group is of type {@link PiActionGroup.Type#SELECT}.
+ * <p>
+ * Default value is 0.
+ *
+ * @param weight weight
+ * @return this
+ */
+ public Builder withWeight(int weight) {
+ this.weight = weight;
+ return this;
+ }
+
+ /**
+ * Creates a new action group member.
+ *
+ * @return action group member
+ */
+ public PiActionGroupMember build() {
+ checkNotNull(id);
+ checkNotNull(action);
+ return new PiActionGroupMember(id, action, weight);
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMemberId.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMemberId.java
new file mode 100644
index 0000000..8669388
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroupMemberId.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.annotations.Beta;
+import org.onlab.util.Identifier;
+
+/**
+ * Identifier of a member of an action group in a protocol-independent pipeline.
+ */
+@Beta
+public final class PiActionGroupMemberId extends Identifier<Integer> implements PiTableAction {
+
+ private PiActionGroupMemberId(int id) {
+ super(id);
+ }
+
+ /**
+ * Returns an action group identifier for the given integer value.
+ *
+ * @param id identifier
+ * @return action group
+ */
+ public static PiActionGroupMemberId of(int id) {
+ return new PiActionGroupMemberId(id);
+ }
+
+ /*
+ In P4Runtime, group members can be referenced directly as table actions.
+ In future we should consider having a more appropriate wrapper class for group member IDs, instead of implementing
+ the PiTableAction interface.
+ */
+ @Override
+ public Type type() {
+ return Type.GROUP_MEMBER_ID;
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableAction.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableAction.java
index a4d4038..eb842d4 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableAction.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableAction.java
@@ -38,15 +38,14 @@
*/
ACTION,
- // TODO: in P4Runtime a table action can be any of the following 3.
- // How to represent action profiles?
- /* message TableAction {
- oneof type {
- Action action = 1;
- uint32 action_profile_member_id = 2;
- uint32 action_profile_group_id = 3;
- }
- }
- */
+ /**
+ * Executes the action group specified by the given identifier.
+ */
+ ACTION_GROUP_ID,
+
+ /**
+ * Executes the action member group specified by the given identifier.
+ */
+ GROUP_MEMBER_ID
}
}
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2GroupProgrammable.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2GroupProgrammable.java
new file mode 100644
index 0000000..0bca13b
--- /dev/null
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2GroupProgrammable.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.bmv2;
+
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.net.group.GroupBucket;
+import org.onosproject.net.group.GroupDescription;
+import org.onosproject.net.group.GroupOperation;
+import org.onosproject.net.group.GroupOperations;
+import org.onosproject.net.group.GroupProgrammable;
+import org.onosproject.net.pi.model.PiPipelineInterpreter;
+import org.onosproject.net.pi.runtime.PiAction;
+import org.onosproject.net.pi.runtime.PiActionGroup;
+import org.onosproject.net.pi.runtime.PiActionGroupId;
+import org.onosproject.net.pi.runtime.PiActionGroupMember;
+import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
+import org.onosproject.net.pi.runtime.PiTableId;
+
+import java.nio.ByteBuffer;
+
+public class Bmv2GroupProgrammable extends AbstractHandlerBehaviour implements GroupProgrammable {
+
+ /*
+ Work in progress.
+ */
+
+ private Device device;
+
+ /*
+ About action groups in P4runtime:
+ The type field is a place holder in p4runtime.proto right now, and we haven't defined it yet. You can assume all
+ the groups are "select" as per the OF spec. As a remainder, in the P4 terminology a member corresponds to an OF
+ bucket. Each member can also be used directly in the match table (kind of like an OF indirect group).
+ */
+
+ @Override
+ public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
+
+ for (GroupOperation groupOp : groupOps.operations()) {
+ switch (groupOp.opType()) {
+ case ADD:
+ addGroup(deviceId, groupOp);
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+ }
+
+ private void addGroup(DeviceId deviceId, GroupOperation groupOp) {
+
+ // Most of this logic can go in a core service, e.g. PiGroupTranslationService
+
+ // From a P4Runtime perspective, we need first to insert members, then the group.
+
+ PiActionGroupId piActionGroupId = PiActionGroupId.of(groupOp.groupId().id());
+
+ PiActionGroup.Builder piActionGroupBuilder = PiActionGroup.builder()
+ .withId(piActionGroupId)
+ .withType(PiActionGroup.Type.SELECT);
+
+ if (groupOp.groupType() != GroupDescription.Type.SELECT) {
+ // log error
+ }
+
+ int bucketIdx = 0;
+ for (GroupBucket bucket : groupOp.buckets().buckets()) {
+ /*
+ Problem:
+ In P4Runtime action group members, i.e. action buckets, are associated to a numeric ID chosen
+ at member insertion time. This ID must be unique for the whole action profile (i.e. the group table in
+ OpenFlow). In ONOS, GroupBucket doesn't specify any ID.
+
+ Solutions:
+ - Change GroupBucket API to force application wanting to perform group operations to specify a member id.
+ - Maintain state to dynamically allocate/deallocate member IDs, e.g. in a dedicated service, or in a
+ P4Runtime Group Provider.
+
+ Hack:
+ Statically derive member ID by combining groupId and position of the bucket in the list.
+ */
+ int memberId = ByteBuffer.allocate(4)
+ .putShort((short) (piActionGroupId.id() % 2 ^ 16))
+ .putShort((short) (bucketIdx % 2 ^ 16))
+ .getInt();
+
+ // Need an interpreter to map the bucket treatment to a PI action
+
+ if (!device.is(PiPipelineInterpreter.class)) {
+ // log error
+ }
+
+ PiPipelineInterpreter interpreter = device.as(PiPipelineInterpreter.class);
+
+ /*
+ Problem:
+ In P4Runtime, action profiles (i.e. group tables) are specific to one or more tables.
+ Mapping of treatments depends on the target table. How do we derive the target table from here?
+
+ Solution:
+ - Change GroupDescription to allow applications to specify a table where this group will be called from.
+
+ Hack:
+ Assume we support pipelines with only one action profile associated to only one table, i.e. derive the
+ table ID by looking at the P4Info.
+ */
+
+ PiTableId piTableId = PiTableId.of("derive from P4Info");
+
+
+ PiAction action = null;
+ try {
+ action = interpreter.mapTreatment(bucket.treatment(), piTableId);
+ } catch (PiPipelineInterpreter.PiInterpreterException e) {
+ // log error
+ }
+
+ PiActionGroupMember member = PiActionGroupMember.builder()
+ .withId(PiActionGroupMemberId.of(memberId))
+ .withAction(action)
+ .withWeight(bucket.weight())
+ .build();
+
+ piActionGroupBuilder.addMember(member);
+
+ // Use P4RuntimeClient to install member;
+ // TODO: implement P4RuntimeClient method.
+ }
+
+ PiActionGroup piActionGroup = piActionGroupBuilder.build();
+
+ // Use P4RuntimeClient to insert group.
+ // TODO: implement P4RuntimeClient method.
+ }
+}
diff --git a/drivers/bmv2/src/main/resources/default.json b/drivers/bmv2/src/main/resources/default.json
deleted file mode 100644
index 3a46dcc..0000000
--- a/drivers/bmv2/src/main/resources/default.json
+++ /dev/null
@@ -1,2697 +0,0 @@
-{
- "program" : "default.p4",
- "__meta__" : {
- "version" : [2, 7],
- "compiler" : "https://github.com/p4lang/p4c"
- },
- "header_types" : [
- {
- "name" : "scalars_0",
- "id" : 0,
- "fields" : [
- ["tmp", 32, false],
- ["tmp_0", 32, false]
- ]
- },
- {
- "name" : "standard_metadata",
- "id" : 1,
- "fields" : [
- ["ingress_port", 9, false],
- ["egress_spec", 9, false],
- ["egress_port", 9, false],
- ["clone_spec", 32, false],
- ["instance_type", 32, false],
- ["drop", 1, false],
- ["recirculate_port", 16, false],
- ["packet_length", 32, false],
- ["enq_timestamp", 32, false],
- ["enq_qdepth", 19, false],
- ["deq_timedelta", 32, false],
- ["deq_qdepth", 19, false],
- ["ingress_global_timestamp", 48, false],
- ["lf_field_list", 32, false],
- ["mcast_grp", 16, false],
- ["resubmit_flag", 1, false],
- ["egress_rid", 16, false],
- ["_padding", 5, false]
- ]
- },
- {
- "name" : "ethernet_t",
- "id" : 2,
- "fields" : [
- ["dstAddr", 48, false],
- ["srcAddr", 48, false],
- ["etherType", 16, false]
- ]
- },
- {
- "name" : "ipv4_t",
- "id" : 3,
- "fields" : [
- ["version", 4, false],
- ["ihl", 4, false],
- ["diffserv", 8, false],
- ["totalLen", 16, false],
- ["identification", 16, false],
- ["flags", 3, false],
- ["fragOffset", 13, false],
- ["ttl", 8, false],
- ["protocol", 8, false],
- ["hdrChecksum", 16, false],
- ["srcAddr", 32, false],
- ["dstAddr", 32, false]
- ]
- },
- {
- "name" : "tcp_t",
- "id" : 4,
- "fields" : [
- ["srcPort", 16, false],
- ["dstPort", 16, false],
- ["seqNo", 32, false],
- ["ackNo", 32, false],
- ["dataOffset", 4, false],
- ["res", 3, false],
- ["ecn", 3, false],
- ["ctrl", 6, false],
- ["window", 16, false],
- ["checksum", 16, false],
- ["urgentPtr", 16, false]
- ]
- },
- {
- "name" : "udp_t",
- "id" : 5,
- "fields" : [
- ["srcPort", 16, false],
- ["dstPort", 16, false],
- ["length_", 16, false],
- ["checksum", 16, false]
- ]
- },
- {
- "name" : "ecmp_metadata_t",
- "id" : 6,
- "fields" : [
- ["groupId", 16, false],
- ["selector", 16, false]
- ]
- },
- {
- "name" : "wcmp_meta_t",
- "id" : 7,
- "fields" : [
- ["groupId", 16, false],
- ["numBits", 8, false],
- ["selector", 64, false]
- ]
- },
- {
- "name" : "intrinsic_metadata_t",
- "id" : 8,
- "fields" : [
- ["ingress_global_timestamp", 32, false],
- ["lf_field_list", 32, false],
- ["mcast_grp", 16, false],
- ["egress_rid", 16, false]
- ]
- }
- ],
- "headers" : [
- {
- "name" : "standard_metadata_3",
- "id" : 0,
- "header_type" : "standard_metadata",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "standard_metadata_4",
- "id" : 1,
- "header_type" : "standard_metadata",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "standard_metadata_5",
- "id" : 2,
- "header_type" : "standard_metadata",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "scalars",
- "id" : 3,
- "header_type" : "scalars_0",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "standard_metadata",
- "id" : 4,
- "header_type" : "standard_metadata",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "ethernet",
- "id" : 5,
- "header_type" : "ethernet_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
- "name" : "ipv4",
- "id" : 6,
- "header_type" : "ipv4_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
- "name" : "tcp",
- "id" : 7,
- "header_type" : "tcp_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
- "name" : "udp",
- "id" : 8,
- "header_type" : "udp_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
- "name" : "ecmp_metadata",
- "id" : 9,
- "header_type" : "ecmp_metadata_t",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "wcmp_meta",
- "id" : 10,
- "header_type" : "wcmp_meta_t",
- "metadata" : true,
- "pi_omit" : true
- },
- {
- "name" : "intrinsic_metadata",
- "id" : 11,
- "header_type" : "intrinsic_metadata_t",
- "metadata" : true,
- "pi_omit" : true
- }
- ],
- "header_stacks" : [],
- "header_union_types" : [],
- "header_unions" : [],
- "header_union_stacks" : [],
- "field_lists" : [],
- "errors" : [
- ["NoError", 1],
- ["PacketTooShort", 2],
- ["NoMatch", 3],
- ["StackOutOfBounds", 4],
- ["HeaderTooShort", 5],
- ["ParserTimeout", 6]
- ],
- "enums" : [],
- "parsers" : [
- {
- "name" : "parser",
- "id" : 0,
- "init_state" : "start",
- "parse_states" : [
- {
- "name" : "parse_ipv4",
- "id" : 0,
- "parser_ops" : [
- {
- "parameters" : [
- {
- "type" : "regular",
- "value" : "ipv4"
- }
- ],
- "op" : "extract"
- }
- ],
- "transitions" : [
- {
- "value" : "0x06",
- "mask" : null,
- "next_state" : "parse_tcp"
- },
- {
- "value" : "0x11",
- "mask" : null,
- "next_state" : "parse_udp"
- },
- {
- "value" : "default",
- "mask" : null,
- "next_state" : null
- }
- ],
- "transition_key" : [
- {
- "type" : "field",
- "value" : ["ipv4", "protocol"]
- }
- ]
- },
- {
- "name" : "parse_tcp",
- "id" : 1,
- "parser_ops" : [
- {
- "parameters" : [
- {
- "type" : "regular",
- "value" : "tcp"
- }
- ],
- "op" : "extract"
- }
- ],
- "transitions" : [
- {
- "value" : "default",
- "mask" : null,
- "next_state" : null
- }
- ],
- "transition_key" : []
- },
- {
- "name" : "parse_udp",
- "id" : 2,
- "parser_ops" : [
- {
- "parameters" : [
- {
- "type" : "regular",
- "value" : "udp"
- }
- ],
- "op" : "extract"
- }
- ],
- "transitions" : [
- {
- "value" : "default",
- "mask" : null,
- "next_state" : null
- }
- ],
- "transition_key" : []
- },
- {
- "name" : "start",
- "id" : 3,
- "parser_ops" : [
- {
- "parameters" : [
- {
- "type" : "regular",
- "value" : "ethernet"
- }
- ],
- "op" : "extract"
- }
- ],
- "transitions" : [
- {
- "value" : "0x0800",
- "mask" : null,
- "next_state" : "parse_ipv4"
- },
- {
- "value" : "default",
- "mask" : null,
- "next_state" : null
- }
- ],
- "transition_key" : [
- {
- "type" : "field",
- "value" : ["ethernet", "etherType"]
- }
- ]
- }
- ]
- }
- ],
- "deparsers" : [
- {
- "name" : "deparser",
- "id" : 0,
- "source_info" : {
- "filename" : "include/parsers.p4",
- "line" : 43,
- "column" : 8,
- "source_fragment" : "DeparserImpl"
- },
- "order" : ["ethernet", "ipv4", "udp", "tcp"]
- }
- ],
- "meter_arrays" : [],
- "counter_arrays" : [
- {
- "name" : "table0_counter",
- "id" : 0,
- "is_direct" : true,
- "binding" : "table0"
- },
- {
- "name" : "port_counters_control.egress_port_counter",
- "id" : 1,
- "source_info" : {
- "filename" : "include/port_counters.p4",
- "line" : 6,
- "column" : 38,
- "source_fragment" : "egress_port_counter"
- },
- "size" : 254,
- "is_direct" : false
- },
- {
- "name" : "port_counters_control.ingress_port_counter",
- "id" : 2,
- "source_info" : {
- "filename" : "include/port_counters.p4",
- "line" : 7,
- "column" : 38,
- "source_fragment" : "ingress_port_counter"
- },
- "size" : 254,
- "is_direct" : false
- }
- ],
- "register_arrays" : [],
- "calculations" : [],
- "learn_lists" : [],
- "actions" : [
- {
- "name" : "set_egress_port",
- "id" : 0,
- "runtime_data" : [
- {
- "name" : "port",
- "bitwidth" : 9
- }
- ],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_spec"]
- },
- {
- "type" : "runtime_data",
- "value" : 0
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 9,
- "column" : 4,
- "source_fragment" : "standard_metadata.egress_spec = port"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_3", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 8,
- "column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
- }
- }
- ]
- },
- {
- "name" : "send_to_cpu",
- "id" : 1,
- "runtime_data" : [],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_spec"]
- },
- {
- "type" : "hexstr",
- "value" : "0x00ff"
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 5,
- "column" : 4,
- "source_fragment" : "standard_metadata.egress_spec = 9w255"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_4", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 4,
- "column" : 45,
- "source_fragment" : "standard_metadata) { ..."
- }
- }
- ]
- },
- {
- "name" : "drop",
- "id" : 2,
- "runtime_data" : [],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_spec"]
- },
- {
- "type" : "hexstr",
- "value" : "0x01ff"
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 13,
- "column" : 4,
- "source_fragment" : "standard_metadata.egress_spec = 9w511"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "clone_spec"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "clone_spec"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "instance_type"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "instance_type"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "drop"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "drop"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "recirculate_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "recirculate_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "packet_length"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "packet_length"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "enq_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "enq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "enq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_timedelta"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "deq_timedelta"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "deq_qdepth"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "deq_qdepth"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_global_timestamp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "ingress_global_timestamp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "lf_field_list"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "lf_field_list"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "mcast_grp"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "mcast_grp"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "resubmit_flag"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "resubmit_flag"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_rid"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata_5", "egress_rid"]
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 12,
- "column" : 38,
- "source_fragment" : "standard_metadata) { ..."
- }
- }
- ]
- },
- {
- "name" : "NoAction",
- "id" : 3,
- "runtime_data" : [],
- "primitives" : []
- },
- {
- "name" : "act",
- "id" : 4,
- "runtime_data" : [],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["scalars", "tmp"]
- },
- {
- "type" : "expression",
- "value" : {
- "type" : "expression",
- "value" : {
- "op" : "&",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0xffffffff"
- }
- }
- }
- }
- ]
- },
- {
- "op" : "count",
- "parameters" : [
- {
- "type" : "counter_array",
- "value" : "port_counters_control.ingress_port_counter"
- },
- {
- "type" : "field",
- "value" : ["scalars", "tmp"]
- }
- ],
- "source_info" : {
- "filename" : "include/port_counters.p4",
- "line" : 11,
- "column" : 12,
- "source_fragment" : "ingress_port_counter.count((bit<32>)standard_metadata.ingress_port)"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["scalars", "tmp_0"]
- },
- {
- "type" : "expression",
- "value" : {
- "type" : "expression",
- "value" : {
- "op" : "&",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0xffffffff"
- }
- }
- }
- }
- ]
- },
- {
- "op" : "count",
- "parameters" : [
- {
- "type" : "counter_array",
- "value" : "port_counters_control.egress_port_counter"
- },
- {
- "type" : "field",
- "value" : ["scalars", "tmp_0"]
- }
- ],
- "source_info" : {
- "filename" : "include/port_counters.p4",
- "line" : 12,
- "column" : 12,
- "source_fragment" : "egress_port_counter.count((bit<32>)standard_metadata.egress_spec)"
- }
- }
- ]
- }
- ],
- "pipelines" : [
- {
- "name" : "ingress",
- "id" : 0,
- "source_info" : {
- "filename" : "default.p4",
- "line" : 10,
- "column" : 8,
- "source_fragment" : "ingress"
- },
- "init_table" : "table0",
- "tables" : [
- {
- "name" : "table0",
- "id" : 0,
- "source_info" : {
- "filename" : "default.p4",
- "line" : 13,
- "column" : 10,
- "source_fragment" : "table0"
- },
- "key" : [
- {
- "match_type" : "ternary",
- "target" : ["standard_metadata", "ingress_port"],
- "mask" : null
- },
- {
- "match_type" : "ternary",
- "target" : ["ethernet", "dstAddr"],
- "mask" : null
- },
- {
- "match_type" : "ternary",
- "target" : ["ethernet", "srcAddr"],
- "mask" : null
- },
- {
- "match_type" : "ternary",
- "target" : ["ethernet", "etherType"],
- "mask" : null
- }
- ],
- "match_type" : "ternary",
- "type" : "simple",
- "max_size" : 1024,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [0, 1, 2, 3],
- "actions" : ["set_egress_port", "send_to_cpu", "drop", "NoAction"],
- "base_default_next" : "node_3",
- "next_tables" : {
- "set_egress_port" : "node_3",
- "send_to_cpu" : "node_3",
- "drop" : "node_3",
- "NoAction" : "node_3"
- },
- "default_entry" : {
- "action_id" : 3,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- },
- {
- "name" : "tbl_act",
- "id" : 1,
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [4],
- "actions" : ["act"],
- "base_default_next" : null,
- "next_tables" : {
- "act" : null
- },
- "default_entry" : {
- "action_id" : 4,
- "action_const" : true,
- "action_data" : [],
- "action_entry_const" : true
- }
- }
- ],
- "action_profiles" : [],
- "conditionals" : [
- {
- "name" : "node_3",
- "id" : 0,
- "source_info" : {
- "filename" : "include/port_counters.p4",
- "line" : 10,
- "column" : 12,
- "source_fragment" : "standard_metadata.egress_spec < 254"
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "<",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x00fe"
- }
- }
- },
- "false_next" : null,
- "true_next" : "tbl_act"
- }
- ]
- },
- {
- "name" : "egress",
- "id" : 1,
- "source_info" : {
- "filename" : "default.p4",
- "line" : 36,
- "column" : 8,
- "source_fragment" : "egress"
- },
- "init_table" : null,
- "tables" : [],
- "action_profiles" : [],
- "conditionals" : []
- }
- ],
- "checksums" : [],
- "force_arith" : [],
- "extern_instances" : [],
- "field_aliases" : [
- [
- "queueing_metadata.enq_timestamp",
- ["standard_metadata", "enq_timestamp"]
- ],
- [
- "queueing_metadata.enq_qdepth",
- ["standard_metadata", "enq_qdepth"]
- ],
- [
- "queueing_metadata.deq_timedelta",
- ["standard_metadata", "deq_timedelta"]
- ],
- [
- "queueing_metadata.deq_qdepth",
- ["standard_metadata", "deq_qdepth"]
- ],
- [
- "intrinsic_metadata.ingress_global_timestamp",
- ["standard_metadata", "ingress_global_timestamp"]
- ],
- [
- "intrinsic_metadata.lf_field_list",
- ["standard_metadata", "lf_field_list"]
- ],
- [
- "intrinsic_metadata.mcast_grp",
- ["standard_metadata", "mcast_grp"]
- ],
- [
- "intrinsic_metadata.resubmit_flag",
- ["standard_metadata", "resubmit_flag"]
- ],
- [
- "intrinsic_metadata.egress_rid",
- ["standard_metadata", "egress_rid"]
- ]
- ]
-}
\ No newline at end of file
diff --git a/drivers/bmv2/src/main/resources/default.json b/drivers/bmv2/src/main/resources/default.json
new file mode 120000
index 0000000..c5028d8
--- /dev/null
+++ b/drivers/bmv2/src/main/resources/default.json
@@ -0,0 +1 @@
+../../../../../tools/test/p4src/p4-16/p4c-out/default.json
\ No newline at end of file
diff --git a/drivers/bmv2/src/main/resources/default.p4info b/drivers/bmv2/src/main/resources/default.p4info
deleted file mode 100644
index bd3649d..0000000
--- a/drivers/bmv2/src/main/resources/default.p4info
+++ /dev/null
@@ -1,113 +0,0 @@
-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: 16793508
- }
- action_refs {
- id: 16800567
- annotations: "@defaultonly()"
- }
- direct_resource_ids: 301990488
- size: 1024
- with_entry_timeout: true
-}
-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: 16793508
- name: "drop"
- alias: "drop"
- }
-}
-actions {
- preamble {
- id: 16800567
- name: "NoAction"
- alias: "NoAction"
- }
-}
-counters {
- preamble {
- id: 302025528
- name: "port_counters_control.egress_port_counter"
- alias: "egress_port_counter"
- }
- spec {
- unit: PACKETS
- }
- size: 254
-}
-counters {
- preamble {
- id: 301999025
- name: "port_counters_control.ingress_port_counter"
- alias: "ingress_port_counter"
- }
- spec {
- unit: PACKETS
- }
- size: 254
-}
-direct_counters {
- preamble {
- id: 301990488
- name: "table0_counter"
- alias: "table0_counter"
- }
- spec {
- unit: PACKETS
- }
- direct_table_id: 33617813
-}
diff --git a/drivers/bmv2/src/main/resources/default.p4info b/drivers/bmv2/src/main/resources/default.p4info
new file mode 120000
index 0000000..8f71cbe
--- /dev/null
+++ b/drivers/bmv2/src/main/resources/default.p4info
@@ -0,0 +1 @@
+../../../../../tools/test/p4src/p4-16/p4c-out/default.p4info
\ No newline at end of file
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
index bb2d16b..78a0222 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
@@ -349,6 +349,24 @@
return true;
}
+ /**
+ * Returns the internal P4 device ID associated with this client.
+ *
+ * @return P4 device ID
+ */
+ public int p4DeviceId() {
+ return p4DeviceId;
+ }
+
+ /**
+ * For testing purpose only. TODO: remove before release.
+ *
+ * @return blocking stub
+ */
+ public P4RuntimeGrpc.P4RuntimeBlockingStub blockingStub() {
+ return this.blockingStub;
+ }
+
@Override
public void shutdown() {
diff --git a/tools/test/p4src/p4-16/default.p4 b/tools/test/p4src/p4-16/default.p4
index 13243b2..2bee27f 100644
--- a/tools/test/p4src/p4-16/default.p4
+++ b/tools/test/p4src/p4-16/default.p4
@@ -11,21 +11,32 @@
control ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
direct_counter(CounterType.packets) table0_counter;
+ action_selector(HashAlgorithm.crc16, 32w64, 32w16) ecmp_selector;
table table0 {
support_timeout = true;
+ key = {
+ standard_metadata.ingress_port : ternary;
+ hdr.ethernet.dstAddr : ternary;
+ hdr.ethernet.srcAddr : ternary;
+ hdr.ethernet.etherType : ternary;
+ // Not for matching.
+ // Inputs to the hash function of the action selector.
+ hdr.ipv4.srcAddr : selector;
+ hdr.ipv4.dstAddr : selector;
+ hdr.ipv4.protocol : selector;
+ hdr.tcp.srcPort : selector;
+ hdr.tcp.dstPort : selector;
+ hdr.udp.srcPort : selector;
+ hdr.udp.dstPort : selector;
+ }
actions = {
set_egress_port(standard_metadata);
send_to_cpu(standard_metadata);
drop(standard_metadata);
}
- key = {
- standard_metadata.ingress_port: ternary;
- hdr.ethernet.dstAddr : ternary;
- hdr.ethernet.srcAddr : ternary;
- hdr.ethernet.etherType : ternary;
- }
counters = table0_counter;
+ implementation = ecmp_selector;
}
PacketIoIngressControl() packet_io_ingress_control;
diff --git a/tools/test/p4src/p4-16/p4c-out/.gitignore b/tools/test/p4src/p4-16/p4c-out/.gitignore
deleted file mode 100644
index dfbb6b2..0000000
--- a/tools/test/p4src/p4-16/p4c-out/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.json
-*.p4info
diff --git a/apps/p4runtime-test/src/test/resources/default.json b/tools/test/p4src/p4-16/p4c-out/default.json
similarity index 81%
rename from apps/p4runtime-test/src/test/resources/default.json
rename to tools/test/p4src/p4-16/p4c-out/default.json
index 3a46dcc..8b9070c 100644
--- a/apps/p4runtime-test/src/test/resources/default.json
+++ b/tools/test/p4src/p4-16/p4c-out/default.json
@@ -92,25 +92,41 @@
]
},
{
- "name" : "ecmp_metadata_t",
+ "name" : "packet_out_header_t",
"id" : 6,
"fields" : [
- ["groupId", 16, false],
+ ["egress_port", 9, false],
+ ["_padding_0", 7, false]
+ ]
+ },
+ {
+ "name" : "packet_in_header_t",
+ "id" : 7,
+ "fields" : [
+ ["ingress_port", 9, false],
+ ["_padding_1", 7, false]
+ ]
+ },
+ {
+ "name" : "ecmp_metadata_t",
+ "id" : 8,
+ "fields" : [
+ ["group_id", 16, false],
["selector", 16, false]
]
},
{
- "name" : "wcmp_meta_t",
- "id" : 7,
+ "name" : "wcmp_metadata_t",
+ "id" : 9,
"fields" : [
- ["groupId", 16, false],
+ ["group_id", 16, false],
["numBits", 8, false],
["selector", 64, false]
]
},
{
"name" : "intrinsic_metadata_t",
- "id" : 8,
+ "id" : 10,
"fields" : [
["ingress_global_timestamp", 32, false],
["lf_field_list", 32, false],
@@ -184,22 +200,36 @@
"pi_omit" : true
},
{
- "name" : "ecmp_metadata",
+ "name" : "packet_out",
"id" : 9,
+ "header_type" : "packet_out_header_t",
+ "metadata" : false,
+ "pi_omit" : true
+ },
+ {
+ "name" : "packet_in",
+ "id" : 10,
+ "header_type" : "packet_in_header_t",
+ "metadata" : false,
+ "pi_omit" : true
+ },
+ {
+ "name" : "ecmp_metadata",
+ "id" : 11,
"header_type" : "ecmp_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "wcmp_meta",
- "id" : 10,
- "header_type" : "wcmp_meta_t",
+ "id" : 12,
+ "header_type" : "wcmp_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "intrinsic_metadata",
- "id" : 11,
+ "id" : 13,
"header_type" : "intrinsic_metadata_t",
"metadata" : true,
"pi_omit" : true
@@ -226,13 +256,69 @@
"init_state" : "start",
"parse_states" : [
{
- "name" : "parse_ipv4",
+ "name" : "parse_packet_out",
"id" : 0,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
+ "value" : "packet_out"
+ }
+ ],
+ "op" : "extract"
+ }
+ ],
+ "transitions" : [
+ {
+ "value" : "default",
+ "mask" : null,
+ "next_state" : "parse_ethernet"
+ }
+ ],
+ "transition_key" : []
+ },
+ {
+ "name" : "parse_ethernet",
+ "id" : 1,
+ "parser_ops" : [
+ {
+ "parameters" : [
+ {
+ "type" : "regular",
+ "value" : "ethernet"
+ }
+ ],
+ "op" : "extract"
+ }
+ ],
+ "transitions" : [
+ {
+ "value" : "0x0800",
+ "mask" : null,
+ "next_state" : "parse_ipv4"
+ },
+ {
+ "value" : "default",
+ "mask" : null,
+ "next_state" : null
+ }
+ ],
+ "transition_key" : [
+ {
+ "type" : "field",
+ "value" : ["ethernet", "etherType"]
+ }
+ ]
+ },
+ {
+ "name" : "parse_ipv4",
+ "id" : 2,
+ "parser_ops" : [
+ {
+ "parameters" : [
+ {
+ "type" : "regular",
"value" : "ipv4"
}
],
@@ -265,7 +351,7 @@
},
{
"name" : "parse_tcp",
- "id" : 1,
+ "id" : 3,
"parser_ops" : [
{
"parameters" : [
@@ -288,7 +374,7 @@
},
{
"name" : "parse_udp",
- "id" : 2,
+ "id" : 4,
"parser_ops" : [
{
"parameters" : [
@@ -311,34 +397,24 @@
},
{
"name" : "start",
- "id" : 3,
- "parser_ops" : [
- {
- "parameters" : [
- {
- "type" : "regular",
- "value" : "ethernet"
- }
- ],
- "op" : "extract"
- }
- ],
+ "id" : 5,
+ "parser_ops" : [],
"transitions" : [
{
- "value" : "0x0800",
+ "value" : "0xff",
"mask" : null,
- "next_state" : "parse_ipv4"
+ "next_state" : "parse_packet_out"
},
{
"value" : "default",
"mask" : null,
- "next_state" : null
+ "next_state" : "parse_ethernet"
}
],
"transition_key" : [
{
"type" : "field",
- "value" : ["ethernet", "etherType"]
+ "value" : ["standard_metadata", "ingress_port"]
}
]
}
@@ -351,11 +427,11 @@
"id" : 0,
"source_info" : {
"filename" : "include/parsers.p4",
- "line" : 43,
+ "line" : 49,
"column" : 8,
"source_fragment" : "DeparserImpl"
},
- "order" : ["ethernet", "ipv4", "udp", "tcp"]
+ "order" : ["packet_in", "ethernet", "ipv4", "udp", "tcp"]
}
],
"meter_arrays" : [],
@@ -419,9 +495,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -438,9 +514,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -457,9 +533,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -476,9 +552,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -495,9 +571,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -514,9 +590,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -533,9 +609,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -552,9 +628,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -571,9 +647,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -590,9 +666,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -609,9 +685,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -628,9 +704,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -647,9 +723,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -666,9 +742,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -685,9 +761,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -704,9 +780,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -723,9 +799,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -742,7 +818,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 9,
+ "line" : 11,
"column" : 4,
"source_fragment" : "standard_metadata.egress_spec = port"
}
@@ -761,9 +837,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -780,9 +856,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -799,9 +875,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -818,9 +894,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -837,9 +913,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -856,9 +932,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -875,9 +951,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -894,9 +970,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -913,9 +989,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -932,9 +1008,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -951,9 +1027,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -970,9 +1046,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -989,9 +1065,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -1008,9 +1084,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -1027,9 +1103,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -1046,9 +1122,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
},
{
@@ -1065,9 +1141,9 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 8,
+ "line" : 10,
"column" : 49,
- "source_fragment" : "standard_metadata, Port port) { ..."
+ "source_fragment" : "standard_metadata, port_t port) { ..."
}
}
]
@@ -1091,7 +1167,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1110,7 +1186,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1129,7 +1205,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1148,7 +1224,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1167,7 +1243,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1186,7 +1262,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1205,7 +1281,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1224,7 +1300,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1243,7 +1319,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1262,7 +1338,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1281,7 +1357,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1300,7 +1376,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1319,7 +1395,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1338,7 +1414,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1357,7 +1433,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1376,7 +1452,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1395,7 +1471,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1414,7 +1490,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 5,
+ "line" : 7,
"column" : 4,
"source_fragment" : "standard_metadata.egress_spec = 9w255"
}
@@ -1433,7 +1509,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1452,7 +1528,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1471,7 +1547,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1490,7 +1566,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1509,7 +1585,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1528,7 +1604,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1547,7 +1623,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1566,7 +1642,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1585,7 +1661,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1604,7 +1680,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1623,7 +1699,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1642,7 +1718,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1661,7 +1737,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1680,7 +1756,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1699,7 +1775,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1718,7 +1794,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1737,7 +1813,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 4,
+ "line" : 6,
"column" : 45,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1763,7 +1839,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1782,7 +1858,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1801,7 +1877,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1820,7 +1896,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1839,7 +1915,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1858,7 +1934,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1877,7 +1953,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1896,7 +1972,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1915,7 +1991,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1934,7 +2010,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1953,7 +2029,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1972,7 +2048,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -1991,7 +2067,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2010,7 +2086,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2029,7 +2105,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2048,7 +2124,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2067,7 +2143,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2086,7 +2162,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 13,
+ "line" : 15,
"column" : 4,
"source_fragment" : "standard_metadata.egress_spec = 9w511"
}
@@ -2105,7 +2181,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2124,7 +2200,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2143,7 +2219,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2162,7 +2238,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2181,7 +2257,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2200,7 +2276,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2219,7 +2295,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2238,7 +2314,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2257,7 +2333,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2276,7 +2352,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2295,7 +2371,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2314,7 +2390,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2333,7 +2409,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2352,7 +2428,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2371,7 +2447,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2390,7 +2466,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2409,7 +2485,7 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 12,
+ "line" : 14,
"column" : 38,
"source_fragment" : "standard_metadata) { ..."
}
@@ -2432,6 +2508,32 @@
"parameters" : [
{
"type" : "field",
+ "value" : ["standard_metadata", "egress_spec"]
+ },
+ {
+ "type" : "field",
+ "value" : ["packet_out", "egress_port"]
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 7,
+ "column" : 12,
+ "source_fragment" : "standard_metadata.egress_spec = hdr.packet_out.egress_port"
+ }
+ }
+ ]
+ },
+ {
+ "name" : "act_0",
+ "id" : 5,
+ "runtime_data" : [],
+ "primitives" : [
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
"value" : ["scalars", "tmp"]
},
{
@@ -2518,6 +2620,69 @@
}
}
]
+ },
+ {
+ "name" : "act_1",
+ "id" : 6,
+ "runtime_data" : [],
+ "primitives" : [
+ {
+ "op" : "add_header",
+ "parameters" : [
+ {
+ "type" : "header",
+ "value" : "packet_in"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 16,
+ "column" : 12,
+ "source_fragment" : "hdr.packet_in.setValid()"
+ }
+ },
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["packet_in", "ingress_port"]
+ },
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "ingress_port"]
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 17,
+ "column" : 12,
+ "source_fragment" : "hdr.packet_in.ingress_port = standard_metadata.ingress_port"
+ }
+ }
+ ]
+ },
+ {
+ "name" : "act_2",
+ "id" : 7,
+ "runtime_data" : [],
+ "primitives" : [
+ {
+ "op" : "remove_header",
+ "parameters" : [
+ {
+ "type" : "header",
+ "value" : "packet_out"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 14,
+ "column" : 8,
+ "source_fragment" : "hdr.packet_out.setInvalid()"
+ }
+ }
+ ]
}
],
"pipelines" : [
@@ -2526,18 +2691,41 @@
"id" : 0,
"source_info" : {
"filename" : "default.p4",
- "line" : 10,
+ "line" : 11,
"column" : 8,
"source_fragment" : "ingress"
},
- "init_table" : "table0",
+ "init_table" : "node_2",
"tables" : [
{
- "name" : "table0",
+ "name" : "tbl_act",
"id" : 0,
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [4],
+ "actions" : ["act"],
+ "base_default_next" : "node_4",
+ "next_tables" : {
+ "act" : "node_4"
+ },
+ "default_entry" : {
+ "action_id" : 4,
+ "action_const" : true,
+ "action_data" : [],
+ "action_entry_const" : true
+ }
+ },
+ {
+ "name" : "table0",
+ "id" : 1,
"source_info" : {
"filename" : "default.p4",
- "line" : 13,
+ "line" : 16,
"column" : 10,
"source_fragment" : "table0"
},
@@ -2564,29 +2752,24 @@
}
],
"match_type" : "ternary",
- "type" : "simple",
+ "type" : "indirect_ws",
+ "action_profile" : "ecmp_selector",
"max_size" : 1024,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [0, 1, 2, 3],
"actions" : ["set_egress_port", "send_to_cpu", "drop", "NoAction"],
- "base_default_next" : "node_3",
+ "base_default_next" : "node_6",
"next_tables" : {
- "set_egress_port" : "node_3",
- "send_to_cpu" : "node_3",
- "drop" : "node_3",
- "NoAction" : "node_3"
- },
- "default_entry" : {
- "action_id" : 3,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
+ "set_egress_port" : "node_6",
+ "send_to_cpu" : "node_6",
+ "drop" : "node_6",
+ "NoAction" : "node_6"
}
},
{
- "name" : "tbl_act",
- "id" : 1,
+ "name" : "tbl_act_0",
+ "id" : 2,
"key" : [],
"match_type" : "exact",
"type" : "simple",
@@ -2594,26 +2777,117 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [4],
- "actions" : ["act"],
+ "action_ids" : [5],
+ "actions" : ["act_0"],
"base_default_next" : null,
"next_tables" : {
- "act" : null
+ "act_0" : null
},
"default_entry" : {
- "action_id" : 4,
+ "action_id" : 5,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
}
],
- "action_profiles" : [],
+ "action_profiles" : [
+ {
+ "name" : "ecmp_selector",
+ "id" : 0,
+ "max_size" : 64,
+ "selector" : {
+ "algo" : "crc16",
+ "input" : [
+ {
+ "type" : "field",
+ "value" : ["ipv4", "srcAddr"]
+ },
+ {
+ "type" : "field",
+ "value" : ["ipv4", "dstAddr"]
+ },
+ {
+ "type" : "field",
+ "value" : ["ipv4", "protocol"]
+ },
+ {
+ "type" : "field",
+ "value" : ["tcp", "srcPort"]
+ },
+ {
+ "type" : "field",
+ "value" : ["tcp", "dstPort"]
+ },
+ {
+ "type" : "field",
+ "value" : ["udp", "srcPort"]
+ },
+ {
+ "type" : "field",
+ "value" : ["udp", "dstPort"]
+ }
+ ]
+ }
+ }
+ ],
"conditionals" : [
{
- "name" : "node_3",
+ "name" : "node_2",
"id" : 0,
"source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 6,
+ "column" : 12,
+ "source_fragment" : "hdr.packet_out.isValid()"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "==",
+ "left" : {
+ "type" : "field",
+ "value" : ["packet_out", "$valid$"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x01"
+ }
+ }
+ },
+ "true_next" : "tbl_act",
+ "false_next" : "node_4"
+ },
+ {
+ "name" : "node_4",
+ "id" : 1,
+ "source_info" : {
+ "filename" : "default.p4",
+ "line" : 47,
+ "column" : 13,
+ "source_fragment" : "hdr.packet_out.isValid()"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "!=",
+ "left" : {
+ "type" : "field",
+ "value" : ["packet_out", "$valid$"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x01"
+ }
+ }
+ },
+ "true_next" : "table0",
+ "false_next" : "node_6"
+ },
+ {
+ "name" : "node_6",
+ "id" : 2,
+ "source_info" : {
"filename" : "include/port_counters.p4",
"line" : 10,
"column" : 12,
@@ -2634,7 +2908,7 @@
}
},
"false_next" : null,
- "true_next" : "tbl_act"
+ "true_next" : "tbl_act_0"
}
]
},
@@ -2643,14 +2917,88 @@
"id" : 1,
"source_info" : {
"filename" : "default.p4",
- "line" : 36,
+ "line" : 55,
"column" : 8,
"source_fragment" : "egress"
},
- "init_table" : null,
- "tables" : [],
+ "init_table" : "tbl_act_1",
+ "tables" : [
+ {
+ "name" : "tbl_act_1",
+ "id" : 3,
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [7],
+ "actions" : ["act_2"],
+ "base_default_next" : "node_11",
+ "next_tables" : {
+ "act_2" : "node_11"
+ },
+ "default_entry" : {
+ "action_id" : 7,
+ "action_const" : true,
+ "action_data" : [],
+ "action_entry_const" : true
+ }
+ },
+ {
+ "name" : "tbl_act_2",
+ "id" : 4,
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [6],
+ "actions" : ["act_1"],
+ "base_default_next" : null,
+ "next_tables" : {
+ "act_1" : null
+ },
+ "default_entry" : {
+ "action_id" : 6,
+ "action_const" : true,
+ "action_data" : [],
+ "action_entry_const" : true
+ }
+ }
+ ],
"action_profiles" : [],
- "conditionals" : []
+ "conditionals" : [
+ {
+ "name" : "node_11",
+ "id" : 3,
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 15,
+ "column" : 12,
+ "source_fragment" : "standard_metadata.egress_spec == 9w255"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "==",
+ "left" : {
+ "type" : "field",
+ "value" : ["standard_metadata", "egress_spec"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x00ff"
+ }
+ }
+ },
+ "false_next" : null,
+ "true_next" : "tbl_act_2"
+ }
+ ]
}
],
"checksums" : [],
diff --git a/apps/p4runtime-test/src/test/resources/default.p4info b/tools/test/p4src/p4-16/p4c-out/default.p4info
similarity index 91%
rename from apps/p4runtime-test/src/test/resources/default.p4info
rename to tools/test/p4src/p4-16/p4c-out/default.p4info
index b224b87..f898190 100644
--- a/apps/p4runtime-test/src/test/resources/default.p4info
+++ b/tools/test/p4src/p4-16/p4c-out/default.p4info
@@ -41,6 +41,7 @@
id: 16800567
annotations: "@defaultonly()"
}
+ implementation_id: 285227860
direct_resource_ids: 301990488
size: 1024
with_entry_timeout: true
@@ -78,6 +79,16 @@
alias: "NoAction"
}
}
+action_profiles {
+ preamble {
+ id: 285227860
+ name: "ecmp_selector"
+ alias: "ecmp_selector"
+ }
+ table_ids: 33617813
+ with_selector: true
+ size: 64
+}
counters {
preamble {
id: 302025528
@@ -122,11 +133,6 @@
name: "ingress_port"
bitwidth: 9
}
- metadata {
- id: 2
- name: "other1"
- bitwidth: 32
- }
}
controller_packet_metadata {
preamble {
@@ -139,9 +145,4 @@
name: "egress_port"
bitwidth: 9
}
- metadata {
- id: 2
- name: "other2"
- bitwidth: 32
- }
}