mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-05 20:26:16 +02:00
Bumped supported revisions of P4 tools
Includes: - Use new P4Runtime "v1" package names - Removed VALID match - New table entry priority spec (1 is min priority, not 0) - Fixed p4c-bm2-ss to include arch flag - Re-compiled P4 programs with more recent p4c (with updated p4info) Change-Id: I05908f40eda0f0c755009268fd261fb8bcc9be35
This commit is contained in:
parent
25747d88f7
commit
6af4e17c53
@ -49,8 +49,8 @@ import org.onosproject.p4runtime.ctl.P4RuntimeClientImpl;
|
||||
import org.onosproject.p4runtime.ctl.P4RuntimeControllerImpl;
|
||||
import org.onosproject.pipelines.basic.PipeconfLoader;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4RuntimeGrpc;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeGrpc;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@ -62,7 +62,7 @@ import static org.onlab.util.ImmutableByteSequence.ofZeros;
|
||||
import static org.onosproject.net.pi.model.PiPacketOperationType.PACKET_OUT;
|
||||
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.BMV2_JSON;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.P4RuntimeOuterClass.Update.Type.INSERT;
|
||||
import static p4.v1.P4RuntimeOuterClass.Update.Type.INSERT;
|
||||
|
||||
/**
|
||||
* Class used for quick testing of P4Runtime with real devices. To be removed before release.
|
||||
|
||||
@ -25,7 +25,6 @@ import org.onosproject.net.pi.runtime.PiFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
@ -273,18 +272,6 @@ public final class PiCriterion implements Criterion {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a valid field match for the given fieldId and flag.
|
||||
*
|
||||
* @param fieldId protocol-independent header field Id
|
||||
* @param flag a boolean value
|
||||
* @return this
|
||||
*/
|
||||
public Builder matchValid(PiMatchFieldId fieldId, boolean flag) {
|
||||
fieldMatchMapBuilder.put(fieldId, new PiValidFieldMatch(fieldId, flag));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a range field match for the given fieldId, low and high.
|
||||
*
|
||||
|
||||
@ -39,11 +39,6 @@ public enum PiMatchType {
|
||||
*/
|
||||
LPM,
|
||||
|
||||
/**
|
||||
* Valid match type.
|
||||
*/
|
||||
VALID,
|
||||
|
||||
/**
|
||||
* Range match type.
|
||||
*/
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-present Open Networking Foundation
|
||||
*
|
||||
* 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.Objects;
|
||||
import org.onosproject.net.pi.model.PiMatchFieldId;
|
||||
import org.onosproject.net.pi.model.PiMatchType;
|
||||
|
||||
/**
|
||||
* Instance of a valid field match in a protocol-independent pipeline.
|
||||
*/
|
||||
@Beta
|
||||
public final class PiValidFieldMatch extends PiFieldMatch {
|
||||
|
||||
private final boolean isValid;
|
||||
|
||||
/**
|
||||
* Creates a new valid field match.
|
||||
*
|
||||
* @param fieldId field identifier
|
||||
* @param isValid validity flag
|
||||
*/
|
||||
public PiValidFieldMatch(PiMatchFieldId fieldId, boolean isValid) {
|
||||
super(fieldId);
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final PiMatchType type() {
|
||||
return PiMatchType.VALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boolean flag of this valid match parameter.
|
||||
*
|
||||
* @return valid match flag
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
PiValidFieldMatch that = (PiValidFieldMatch) o;
|
||||
return Objects.equal(this.fieldId(), that.fieldId()) &&
|
||||
isValid == that.isValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.fieldId(), isValid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.fieldId().toString() + '=' + (isValid ? "VALID" : "NOT_VALID");
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,6 @@ import org.onosproject.net.pi.runtime.PiFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -154,10 +153,6 @@ public class PiCriteriaTest {
|
||||
private Criterion matchPiTernaryLong2 = PiCriterion.builder()
|
||||
.matchTernary(ipv4MatchFieldId, matchTernaryLong2, matchTernaryMaskLong).build();
|
||||
|
||||
private Criterion matchPiValid1 = PiCriterion.builder().matchValid(ipv4MatchFieldId, false).build();
|
||||
private Criterion sameAsMatchPiValid1 = PiCriterion.builder().matchValid(ipv4MatchFieldId, false).build();
|
||||
private Criterion matchPiValid2 = PiCriterion.builder().matchValid(ipv4MatchFieldId, true).build();
|
||||
|
||||
private byte[] matchRangeBytes1 = {0x10};
|
||||
private byte[] matchRangeBytes2 = {0x20};
|
||||
private byte[] matchRangeHighBytes = {0x30};
|
||||
@ -320,19 +315,6 @@ public class PiCriteriaTest {
|
||||
assertThat(piCriterionLong.fieldMatches().iterator().next(), is(expectedMatchLong));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the ValidMatchPi method.
|
||||
*/
|
||||
@Test
|
||||
public void testValidMatchPiMethod() {
|
||||
|
||||
Criterion matchPiBytes = PiCriterion.builder().matchValid(ipv4MatchFieldId, true).build();
|
||||
PiCriterion piCriterionBytes = checkAndConvert(matchPiBytes, Criterion.Type.PROTOCOL_INDEPENDENT,
|
||||
PiCriterion.class);
|
||||
PiFieldMatch expectedMatch = new PiValidFieldMatch(ipv4MatchFieldId, true);
|
||||
assertThat(piCriterionBytes.fieldMatches().iterator().next(), is(expectedMatch));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the RangeMatchPi method.
|
||||
*/
|
||||
@ -454,17 +436,6 @@ public class PiCriteriaTest {
|
||||
.testEquals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the equals() method of the PiCriterion class.
|
||||
*/
|
||||
@Test
|
||||
public void testPiValidCriterionEquals() {
|
||||
new EqualsTester()
|
||||
.addEqualityGroup(matchPiValid1, sameAsMatchPiValid1)
|
||||
.addEqualityGroup(matchPiValid2)
|
||||
.testEquals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the equals() method of the PiCriterion class.
|
||||
*/
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-present Open Networking Foundation
|
||||
*
|
||||
* 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.testing.EqualsTester;
|
||||
import org.junit.Test;
|
||||
import org.onosproject.net.pi.model.PiMatchFieldId;
|
||||
import org.onosproject.net.pi.model.PiMatchType;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
|
||||
import static org.onosproject.net.pi.runtime.PiConstantsTest.DOT;
|
||||
import static org.onosproject.net.pi.runtime.PiConstantsTest.VID;
|
||||
import static org.onosproject.net.pi.runtime.PiConstantsTest.VLAN_HEADER_NAME;
|
||||
|
||||
/**
|
||||
* Unit tests for PiValidFieldMatch class.
|
||||
*/
|
||||
public class PiValidFieldMatchTest {
|
||||
private final boolean isValid1 = true;
|
||||
private final boolean isValid2 = false;
|
||||
private final PiMatchFieldId piMatchField = PiMatchFieldId.of(VLAN_HEADER_NAME + DOT + VID);
|
||||
private PiValidFieldMatch piValidFieldMatch1 = new PiValidFieldMatch(piMatchField, isValid1);
|
||||
private PiValidFieldMatch sameAsPiValidFieldMatch1 = new PiValidFieldMatch(piMatchField, isValid1);
|
||||
private PiValidFieldMatch piValidFieldMatch2 = new PiValidFieldMatch(piMatchField, isValid2);
|
||||
|
||||
/**
|
||||
* Checks that the PiValidFieldMatch class is immutable.
|
||||
*/
|
||||
@Test
|
||||
public void testImmutability() {
|
||||
assertThatClassIsImmutable(PiValidFieldMatch.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the operation of equals(), hashCode() and toString() methods.
|
||||
*/
|
||||
@Test
|
||||
public void testEquals() {
|
||||
new EqualsTester()
|
||||
.addEqualityGroup(piValidFieldMatch1, sameAsPiValidFieldMatch1)
|
||||
.addEqualityGroup(piValidFieldMatch2)
|
||||
.testEquals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the construction of a PiValidFieldMatch object.
|
||||
*/
|
||||
@Test
|
||||
public void testConstruction() {
|
||||
assertThat(piValidFieldMatch1, is(notNullValue()));
|
||||
assertThat(piValidFieldMatch1.isValid(), is(isValid1));
|
||||
assertThat(piValidFieldMatch1.type(), is(PiMatchType.VALID));
|
||||
}
|
||||
}
|
||||
@ -647,16 +647,6 @@ public final class DecodeCriterionCodecHelper {
|
||||
MISSING_MEMBER_MESSAGE).asText(), null)
|
||||
);
|
||||
break;
|
||||
case VALID:
|
||||
builder.matchValid(
|
||||
PiMatchFieldId.of(
|
||||
nullIsIllegal(node.get(CriterionCodec.PI_MATCH_FIELD_ID),
|
||||
CriterionCodec.PI_MATCH_FIELD_ID +
|
||||
MISSING_MEMBER_MESSAGE).asText()),
|
||||
nullIsIllegal(node.get(CriterionCodec.PI_MATCH_VALUE),
|
||||
CriterionCodec.PI_MATCH_VALUE +
|
||||
MISSING_MEMBER_MESSAGE).asBoolean());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Type " + type + " is unsupported");
|
||||
}
|
||||
|
||||
@ -57,7 +57,6 @@ import org.onosproject.net.pi.runtime.PiFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
@ -542,16 +541,6 @@ public final class EncodeCriterionCodecHelper {
|
||||
return matchRangeNode;
|
||||
}
|
||||
|
||||
private ObjectNode parsePiMatchValid(PiValidFieldMatch validFieldMatch) {
|
||||
|
||||
ObjectNode matchValidNode = context.mapper().createObjectNode();
|
||||
matchValidNode.put(CriterionCodec.PI_MATCH_FIELD_ID, validFieldMatch.fieldId().id());
|
||||
matchValidNode.put(CriterionCodec.PI_MATCH_TYPE, PiMatchType.VALID.name().toLowerCase());
|
||||
matchValidNode.put(CriterionCodec.PI_MATCH_VALUE, validFieldMatch.isValid());
|
||||
|
||||
return matchValidNode;
|
||||
}
|
||||
|
||||
private class FormatProtocolIndependent implements CriterionTypeFormatter {
|
||||
@Override
|
||||
public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
|
||||
@ -569,13 +558,8 @@ public final class EncodeCriterionCodecHelper {
|
||||
matchNodes.add(parsePiMatchTernary((PiTernaryFieldMatch) fieldMatch));
|
||||
break;
|
||||
case RANGE:
|
||||
|
||||
matchNodes.add(parsePiMatchRange((PiRangeFieldMatch) fieldMatch));
|
||||
break;
|
||||
case VALID:
|
||||
|
||||
matchNodes.add(parsePiMatchValid((PiValidFieldMatch) fieldMatch));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Type " + fieldMatch.type().name() + " is unsupported");
|
||||
}
|
||||
|
||||
@ -51,7 +51,6 @@ import org.onosproject.net.pi.runtime.PiFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
@ -508,10 +507,6 @@ public class CriterionCodecTest {
|
||||
.matchRange(ipv4MatchFieldId, matchRangeBytes1, matchRangeHighBytes).build();
|
||||
ObjectNode rangeResult = criterionCodec.encode(rangeBytesCriterion, context);
|
||||
assertThat(rangeResult, matchesCriterion(rangeBytesCriterion));
|
||||
|
||||
Criterion validCriterion = PiCriterion.builder().matchValid(ipv4MatchFieldId, false).build();
|
||||
ObjectNode validResult = criterionCodec.encode(validCriterion, context);
|
||||
assertThat(validResult, matchesCriterion(validCriterion));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,12 +544,8 @@ public class CriterionCodecTest {
|
||||
Assert.assertThat(((PiRangeFieldMatch) piFieldMatch).lowValue(),
|
||||
is(copyFrom((byte) 0x10)));
|
||||
break;
|
||||
case VALID:
|
||||
Assert.assertThat(piFieldMatch.fieldId().id(), is("ethernet_t.etherType"));
|
||||
Assert.assertThat(((PiValidFieldMatch) piFieldMatch).isValid(), is(true));
|
||||
break;
|
||||
default:
|
||||
Assert.assertTrue(false);
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ import org.onosproject.net.pi.runtime.PiFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
|
||||
import static org.onlab.util.ImmutableByteSequence.copyFrom;
|
||||
|
||||
@ -626,13 +625,6 @@ public final class CriterionJsonMatcher extends
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case VALID:
|
||||
if (!Objects.equals(matchNode.get("value").asBoolean(),
|
||||
((PiValidFieldMatch) fieldMatch).isValid())) {
|
||||
description.appendText("match value was " + ((PiValidFieldMatch) fieldMatch).isValid());
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
description.appendText("match type was " + fieldMatch.type().name().toLowerCase());
|
||||
return false;
|
||||
|
||||
@ -23,11 +23,6 @@
|
||||
"match": "range",
|
||||
"highValue": "20",
|
||||
"lowValue": "10"
|
||||
},
|
||||
{
|
||||
"field": "ethernet_t.etherType",
|
||||
"match": "valid",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,7 @@ import static org.onosproject.net.pi.impl.PiUtils.translateTableId;
|
||||
final class PiFlowRuleTranslatorImpl {
|
||||
|
||||
public static final int MAX_PI_PRIORITY = (int) Math.pow(2, 24);
|
||||
public static final int MIN_PI_PRIORITY = 1;
|
||||
private static final Logger log = LoggerFactory.getLogger(PiFlowRuleTranslatorImpl.class);
|
||||
|
||||
private PiFlowRuleTranslatorImpl() {
|
||||
@ -129,15 +130,14 @@ final class PiFlowRuleTranslatorImpl {
|
||||
}
|
||||
|
||||
if (needPriority) {
|
||||
// In the P4 world 0 is the highest priority, in ONOS the lowest one.
|
||||
// FIXME: move priority conversion to the P4Runtime driver
|
||||
// FIXME: move priority check to P4Runtime driver.
|
||||
final int newPriority;
|
||||
if (rule.priority() > MAX_PI_PRIORITY) {
|
||||
log.warn("Flow rule priority too big, setting translated priority to max value {}: {}",
|
||||
MAX_PI_PRIORITY, rule);
|
||||
newPriority = 0;
|
||||
newPriority = MAX_PI_PRIORITY;
|
||||
} else {
|
||||
newPriority = MAX_PI_PRIORITY - rule.priority();
|
||||
newPriority = MIN_PI_PRIORITY + rule.priority();
|
||||
}
|
||||
tableEntryBuilder.withPriority(newPriority);
|
||||
}
|
||||
@ -441,8 +441,6 @@ final class PiFlowRuleTranslatorImpl {
|
||||
return new PiRangeFieldMatch(fieldMatch.fieldId(),
|
||||
((PiRangeFieldMatch) fieldMatch).lowValue().fit(modelBitWidth),
|
||||
((PiRangeFieldMatch) fieldMatch).highValue().fit(modelBitWidth));
|
||||
case VALID:
|
||||
return fieldMatch;
|
||||
default:
|
||||
// Should never be here.
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@ -244,7 +244,6 @@ import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTableAction;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntry;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntryHandle;
|
||||
import org.onosproject.net.pi.service.PiTranslatable;
|
||||
import org.onosproject.net.pi.service.PiTranslatedEntity;
|
||||
@ -696,7 +695,6 @@ public final class KryoNamespaces {
|
||||
PiTableAction.class,
|
||||
PiTableEntry.class,
|
||||
PiTernaryFieldMatch.class,
|
||||
PiValidFieldMatch.class,
|
||||
// PI service
|
||||
PiTableEntryHandle.class,
|
||||
PiTranslatedEntity.class,
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
all: basic int
|
||||
|
||||
basic: basic.p4
|
||||
p4c-bm2-ss -o p4c-out/bmv2/basic.json \
|
||||
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/basic.json \
|
||||
--p4runtime-file p4c-out/bmv2/basic.p4info \
|
||||
--p4runtime-format text basic.p4
|
||||
|
||||
int: int.p4
|
||||
p4c-bm2-ss -o p4c-out/bmv2/int.json \
|
||||
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/int.json \
|
||||
--p4runtime-file p4c-out/bmv2/int.p4info \
|
||||
--p4runtime-format text int.p4
|
||||
|
||||
clean:
|
||||
rm -rf p4c-out/bmv2/*.json
|
||||
rm -rf p4c-out/bmv2/*.p4info
|
||||
rm -rf p4c-out/bmv2/*
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
{
|
||||
"program" : "basic.p4",
|
||||
"__meta__" : {
|
||||
"version" : [2, 7],
|
||||
"compiler" : "https://github.com/p4lang/p4c"
|
||||
},
|
||||
"header_types" : [
|
||||
{
|
||||
"name" : "scalars_0",
|
||||
@ -21,80 +16,9 @@
|
||||
["local_metadata_t.next_hop_id", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_out_header_t",
|
||||
"id" : 1,
|
||||
"fields" : [
|
||||
["egress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_in_header_t",
|
||||
"id" : 2,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ethernet_t",
|
||||
"id" : 3,
|
||||
"fields" : [
|
||||
["dst_addr", 48, false],
|
||||
["src_addr", 48, false],
|
||||
["ether_type", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ipv4_t",
|
||||
"id" : 4,
|
||||
"fields" : [
|
||||
["version", 4, false],
|
||||
["ihl", 4, false],
|
||||
["dscp", 6, false],
|
||||
["ecn", 2, false],
|
||||
["len", 16, false],
|
||||
["identification", 16, false],
|
||||
["flags", 3, false],
|
||||
["frag_offset", 13, false],
|
||||
["ttl", 8, false],
|
||||
["protocol", 8, false],
|
||||
["hdr_checksum", 16, false],
|
||||
["src_addr", 32, false],
|
||||
["dst_addr", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "tcp_t",
|
||||
"id" : 5,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["seq_no", 32, false],
|
||||
["ack_no", 32, false],
|
||||
["data_offset", 4, false],
|
||||
["res", 3, false],
|
||||
["ecn", 3, false],
|
||||
["ctrl", 6, false],
|
||||
["window", 16, false],
|
||||
["checksum", 16, false],
|
||||
["urgent_ptr", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "udp_t",
|
||||
"id" : 6,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["length_", 16, false],
|
||||
["checksum", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "standard_metadata",
|
||||
"id" : 7,
|
||||
"id" : 1,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["egress_spec", 9, false],
|
||||
@ -118,6 +42,77 @@
|
||||
["recirculate_flag", 32, false],
|
||||
["_padding_0", 5, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_out_header_t",
|
||||
"id" : 2,
|
||||
"fields" : [
|
||||
["egress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_in_header_t",
|
||||
"id" : 3,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ethernet_t",
|
||||
"id" : 4,
|
||||
"fields" : [
|
||||
["dst_addr", 48, false],
|
||||
["src_addr", 48, false],
|
||||
["ether_type", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ipv4_t",
|
||||
"id" : 5,
|
||||
"fields" : [
|
||||
["version", 4, false],
|
||||
["ihl", 4, false],
|
||||
["dscp", 6, false],
|
||||
["ecn", 2, false],
|
||||
["len", 16, false],
|
||||
["identification", 16, false],
|
||||
["flags", 3, false],
|
||||
["frag_offset", 13, false],
|
||||
["ttl", 8, false],
|
||||
["protocol", 8, false],
|
||||
["hdr_checksum", 16, false],
|
||||
["src_addr", 32, false],
|
||||
["dst_addr", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "tcp_t",
|
||||
"id" : 6,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["seq_no", 32, false],
|
||||
["ack_no", 32, false],
|
||||
["data_offset", 4, false],
|
||||
["res", 3, false],
|
||||
["ecn", 3, false],
|
||||
["ctrl", 6, false],
|
||||
["window", 16, false],
|
||||
["checksum", 16, false],
|
||||
["urgent_ptr", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "udp_t",
|
||||
"id" : 7,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["length_", 16, false],
|
||||
["checksum", 16, false]
|
||||
]
|
||||
}
|
||||
],
|
||||
"headers" : [
|
||||
@ -183,14 +178,7 @@
|
||||
"header_unions" : [],
|
||||
"header_union_stacks" : [],
|
||||
"field_lists" : [],
|
||||
"errors" : [
|
||||
["NoError", 1],
|
||||
["PacketTooShort", 2],
|
||||
["NoMatch", 3],
|
||||
["StackOutOfBounds", 4],
|
||||
["HeaderTooShort", 5],
|
||||
["ParserTimeout", 6]
|
||||
],
|
||||
"errors" : [],
|
||||
"enums" : [],
|
||||
"parsers" : [
|
||||
{
|
||||
@ -722,7 +710,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_counters.p4",
|
||||
"line" : 29,
|
||||
"column" : 35,
|
||||
"source_fragment" : "(bit<32>) standard_metadata.ingress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "count",
|
||||
@ -767,7 +761,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_meters.p4",
|
||||
"line" : 27,
|
||||
"column" : 53,
|
||||
"source_fragment" : "(bit<32>)standard_metadata.ingress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "execute_meter",
|
||||
@ -924,7 +924,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_counters.p4",
|
||||
"line" : 39,
|
||||
"column" : 34,
|
||||
"source_fragment" : "(bit<32>) standard_metadata.egress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "count",
|
||||
@ -969,7 +975,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_meters.p4",
|
||||
"line" : 41,
|
||||
"column" : 52,
|
||||
"source_fragment" : "(bit<32>)standard_metadata.egress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "execute_meter",
|
||||
@ -1647,5 +1659,10 @@
|
||||
"intrinsic_metadata.recirculate_flag",
|
||||
["standard_metadata", "recirculate_flag"]
|
||||
]
|
||||
]
|
||||
],
|
||||
"program" : "basic.p4",
|
||||
"__meta__" : {
|
||||
"version" : [2, 18],
|
||||
"compiler" : "https://github.com/p4lang/p4c"
|
||||
}
|
||||
}
|
||||
@ -71,8 +71,9 @@ tables {
|
||||
id: 16784184
|
||||
}
|
||||
const_default_action_id: 16784184
|
||||
direct_resource_ids: 302038973
|
||||
direct_resource_ids: 318816189
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -92,8 +93,9 @@ tables {
|
||||
action_refs {
|
||||
id: 16800567
|
||||
}
|
||||
direct_resource_ids: 318783457
|
||||
direct_resource_ids: 352337889
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -115,8 +117,9 @@ tables {
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
implementation_id: 285253634
|
||||
direct_resource_ids: 302034578
|
||||
direct_resource_ids: 318811794
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
@ -216,7 +219,7 @@ counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038973
|
||||
id: 318816189
|
||||
name: "ingress.table0_control.table0_counter"
|
||||
alias: "table0_counter"
|
||||
}
|
||||
@ -227,7 +230,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302034578
|
||||
id: 318811794
|
||||
name: "ingress.wcmp_control.wcmp_table_counter"
|
||||
alias: "wcmp_table_counter"
|
||||
}
|
||||
@ -238,7 +241,7 @@ direct_counters {
|
||||
}
|
||||
meters {
|
||||
preamble {
|
||||
id: 318803935
|
||||
id: 335581151
|
||||
name: "ingress.port_meters_ingress.ingress_port_meter"
|
||||
alias: "ingress_port_meter"
|
||||
}
|
||||
@ -249,7 +252,7 @@ meters {
|
||||
}
|
||||
meters {
|
||||
preamble {
|
||||
id: 318792425
|
||||
id: 335569641
|
||||
name: "egress.port_meters_egress.egress_port_meter"
|
||||
alias: "egress_port_meter"
|
||||
}
|
||||
@ -260,7 +263,7 @@ meters {
|
||||
}
|
||||
direct_meters {
|
||||
preamble {
|
||||
id: 318783457
|
||||
id: 352337889
|
||||
name: "ingress.host_meter_control.host_meter"
|
||||
alias: "host_meter"
|
||||
}
|
||||
@ -271,7 +274,7 @@ direct_meters {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868941301
|
||||
id: 67146229
|
||||
name: "packet_in"
|
||||
annotations: "@controller_header(\"packet_in\")"
|
||||
}
|
||||
@ -288,7 +291,7 @@ controller_packet_metadata {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868916615
|
||||
id: 67121543
|
||||
name: "packet_out"
|
||||
annotations: "@controller_header(\"packet_out\")"
|
||||
}
|
||||
@ -303,3 +306,5 @@ controller_packet_metadata {
|
||||
bitwidth: 7
|
||||
}
|
||||
}
|
||||
type_info {
|
||||
}
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
{
|
||||
"program" : "int.p4",
|
||||
"__meta__" : {
|
||||
"version" : [2, 7],
|
||||
"compiler" : "https://github.com/p4lang/p4c"
|
||||
},
|
||||
"header_types" : [
|
||||
{
|
||||
"name" : "scalars_0",
|
||||
@ -21,199 +16,9 @@
|
||||
["_padding_2", 6, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_out_header_t",
|
||||
"id" : 1,
|
||||
"fields" : [
|
||||
["egress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_in_header_t",
|
||||
"id" : 2,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ethernet_t",
|
||||
"id" : 3,
|
||||
"fields" : [
|
||||
["dst_addr", 48, false],
|
||||
["src_addr", 48, false],
|
||||
["ether_type", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ipv4_t",
|
||||
"id" : 4,
|
||||
"fields" : [
|
||||
["version", 4, false],
|
||||
["ihl", 4, false],
|
||||
["dscp", 6, false],
|
||||
["ecn", 2, false],
|
||||
["len", 16, false],
|
||||
["identification", 16, false],
|
||||
["flags", 3, false],
|
||||
["frag_offset", 13, false],
|
||||
["ttl", 8, false],
|
||||
["protocol", 8, false],
|
||||
["hdr_checksum", 16, false],
|
||||
["src_addr", 32, false],
|
||||
["dst_addr", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "tcp_t",
|
||||
"id" : 5,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["seq_no", 32, false],
|
||||
["ack_no", 32, false],
|
||||
["data_offset", 4, false],
|
||||
["res", 3, false],
|
||||
["ecn", 3, false],
|
||||
["ctrl", 6, false],
|
||||
["window", 16, false],
|
||||
["checksum", 16, false],
|
||||
["urgent_ptr", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "udp_t",
|
||||
"id" : 6,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["length_", 16, false],
|
||||
["checksum", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "intl4_shim_t",
|
||||
"id" : 7,
|
||||
"fields" : [
|
||||
["int_type", 8, false],
|
||||
["rsvd1", 8, false],
|
||||
["len", 8, false],
|
||||
["rsvd2", 8, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_header_t",
|
||||
"id" : 8,
|
||||
"fields" : [
|
||||
["ver", 2, false],
|
||||
["rep", 2, false],
|
||||
["c", 1, false],
|
||||
["e", 1, false],
|
||||
["rsvd1", 5, false],
|
||||
["ins_cnt", 5, false],
|
||||
["max_hop_cnt", 8, false],
|
||||
["total_hop_cnt", 8, false],
|
||||
["instruction_mask_0003", 4, false],
|
||||
["instruction_mask_0407", 4, false],
|
||||
["instruction_mask_0811", 4, false],
|
||||
["instruction_mask_1215", 4, false],
|
||||
["rsvd2", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_data_t",
|
||||
"id" : 9,
|
||||
"fields" : [
|
||||
["data", "*"]
|
||||
],
|
||||
"max_length" : 1004
|
||||
},
|
||||
{
|
||||
"name" : "int_switch_id_t",
|
||||
"id" : 10,
|
||||
"fields" : [
|
||||
["switch_id", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_port_ids_t",
|
||||
"id" : 11,
|
||||
"fields" : [
|
||||
["ingress_port_id", 16, false],
|
||||
["egress_port_id", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_hop_latency_t",
|
||||
"id" : 12,
|
||||
"fields" : [
|
||||
["hop_latency", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_q_occupancy_t",
|
||||
"id" : 13,
|
||||
"fields" : [
|
||||
["q_id", 8, false],
|
||||
["q_occupancy", 24, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_ingress_tstamp_t",
|
||||
"id" : 14,
|
||||
"fields" : [
|
||||
["ingress_tstamp", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_egress_tstamp_t",
|
||||
"id" : 15,
|
||||
"fields" : [
|
||||
["egress_tstamp", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_q_congestion_t",
|
||||
"id" : 16,
|
||||
"fields" : [
|
||||
["q_id", 8, false],
|
||||
["q_congestion", 24, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_egress_port_tx_util_t",
|
||||
"id" : 17,
|
||||
"fields" : [
|
||||
["egress_port_tx_util", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "intl4_tail_t",
|
||||
"id" : 18,
|
||||
"fields" : [
|
||||
["next_proto", 8, false],
|
||||
["dest_port", 16, false],
|
||||
["dscp", 8, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_metadata_t",
|
||||
"id" : 19,
|
||||
"fields" : [
|
||||
["switch_id", 32, false],
|
||||
["insert_byte_cnt", 16, false],
|
||||
["source", 1, false],
|
||||
["sink", 1, false],
|
||||
["mirror_id", 8, false],
|
||||
["flow_id", 16, false],
|
||||
["metadata_len", 8, false],
|
||||
["_padding_0", 6, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "standard_metadata",
|
||||
"id" : 20,
|
||||
"id" : 1,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["egress_spec", 9, false],
|
||||
@ -235,7 +40,197 @@
|
||||
["egress_rid", 16, false],
|
||||
["checksum_error", 1, false],
|
||||
["recirculate_flag", 32, false],
|
||||
["_padding_1", 5, false]
|
||||
["_padding_0", 5, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_out_header_t",
|
||||
"id" : 2,
|
||||
"fields" : [
|
||||
["egress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "packet_in_header_t",
|
||||
"id" : 3,
|
||||
"fields" : [
|
||||
["ingress_port", 9, false],
|
||||
["_padding", 7, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ethernet_t",
|
||||
"id" : 4,
|
||||
"fields" : [
|
||||
["dst_addr", 48, false],
|
||||
["src_addr", 48, false],
|
||||
["ether_type", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ipv4_t",
|
||||
"id" : 5,
|
||||
"fields" : [
|
||||
["version", 4, false],
|
||||
["ihl", 4, false],
|
||||
["dscp", 6, false],
|
||||
["ecn", 2, false],
|
||||
["len", 16, false],
|
||||
["identification", 16, false],
|
||||
["flags", 3, false],
|
||||
["frag_offset", 13, false],
|
||||
["ttl", 8, false],
|
||||
["protocol", 8, false],
|
||||
["hdr_checksum", 16, false],
|
||||
["src_addr", 32, false],
|
||||
["dst_addr", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "tcp_t",
|
||||
"id" : 6,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["seq_no", 32, false],
|
||||
["ack_no", 32, false],
|
||||
["data_offset", 4, false],
|
||||
["res", 3, false],
|
||||
["ecn", 3, false],
|
||||
["ctrl", 6, false],
|
||||
["window", 16, false],
|
||||
["checksum", 16, false],
|
||||
["urgent_ptr", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "udp_t",
|
||||
"id" : 7,
|
||||
"fields" : [
|
||||
["src_port", 16, false],
|
||||
["dst_port", 16, false],
|
||||
["length_", 16, false],
|
||||
["checksum", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "intl4_shim_t",
|
||||
"id" : 8,
|
||||
"fields" : [
|
||||
["int_type", 8, false],
|
||||
["rsvd1", 8, false],
|
||||
["len", 8, false],
|
||||
["rsvd2", 8, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_header_t",
|
||||
"id" : 9,
|
||||
"fields" : [
|
||||
["ver", 2, false],
|
||||
["rep", 2, false],
|
||||
["c", 1, false],
|
||||
["e", 1, false],
|
||||
["rsvd1", 5, false],
|
||||
["ins_cnt", 5, false],
|
||||
["max_hop_cnt", 8, false],
|
||||
["total_hop_cnt", 8, false],
|
||||
["instruction_mask_0003", 4, false],
|
||||
["instruction_mask_0407", 4, false],
|
||||
["instruction_mask_0811", 4, false],
|
||||
["instruction_mask_1215", 4, false],
|
||||
["rsvd2", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_data_t",
|
||||
"id" : 10,
|
||||
"fields" : [
|
||||
["data", "*"]
|
||||
],
|
||||
"max_length" : 1004
|
||||
},
|
||||
{
|
||||
"name" : "int_switch_id_t",
|
||||
"id" : 11,
|
||||
"fields" : [
|
||||
["switch_id", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_port_ids_t",
|
||||
"id" : 12,
|
||||
"fields" : [
|
||||
["ingress_port_id", 16, false],
|
||||
["egress_port_id", 16, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_hop_latency_t",
|
||||
"id" : 13,
|
||||
"fields" : [
|
||||
["hop_latency", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_q_occupancy_t",
|
||||
"id" : 14,
|
||||
"fields" : [
|
||||
["q_id", 8, false],
|
||||
["q_occupancy", 24, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_ingress_tstamp_t",
|
||||
"id" : 15,
|
||||
"fields" : [
|
||||
["ingress_tstamp", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_egress_tstamp_t",
|
||||
"id" : 16,
|
||||
"fields" : [
|
||||
["egress_tstamp", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_q_congestion_t",
|
||||
"id" : 17,
|
||||
"fields" : [
|
||||
["q_id", 8, false],
|
||||
["q_congestion", 24, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_egress_port_tx_util_t",
|
||||
"id" : 18,
|
||||
"fields" : [
|
||||
["egress_port_tx_util", 32, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "intl4_tail_t",
|
||||
"id" : 19,
|
||||
"fields" : [
|
||||
["next_proto", 8, false],
|
||||
["dest_port", 16, false],
|
||||
["dscp", 8, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "int_metadata_t",
|
||||
"id" : 20,
|
||||
"fields" : [
|
||||
["switch_id", 32, false],
|
||||
["insert_byte_cnt", 16, false],
|
||||
["source", 1, false],
|
||||
["sink", 1, false],
|
||||
["mirror_id", 8, false],
|
||||
["flow_id", 16, false],
|
||||
["metadata_len", 8, false],
|
||||
["_padding_1", 6, false]
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -393,14 +388,7 @@
|
||||
"header_unions" : [],
|
||||
"header_union_stacks" : [],
|
||||
"field_lists" : [],
|
||||
"errors" : [
|
||||
["NoError", 1],
|
||||
["PacketTooShort", 2],
|
||||
["NoMatch", 3],
|
||||
["StackOutOfBounds", 4],
|
||||
["HeaderTooShort", 5],
|
||||
["ParserTimeout", 6]
|
||||
],
|
||||
"errors" : [],
|
||||
"enums" : [],
|
||||
"parsers" : [
|
||||
{
|
||||
@ -1212,7 +1200,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_counters.p4",
|
||||
"line" : 29,
|
||||
"column" : 35,
|
||||
"source_fragment" : "(bit<32>) standard_metadata.ingress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "count",
|
||||
@ -5989,7 +5983,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_info" : {
|
||||
"filename" : "include/port_counters.p4",
|
||||
"line" : 39,
|
||||
"column" : 34,
|
||||
"source_fragment" : "(bit<32>) standard_metadata.egress_port"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op" : "count",
|
||||
@ -6951,5 +6951,10 @@
|
||||
"intrinsic_metadata.recirculate_flag",
|
||||
["standard_metadata", "recirculate_flag"]
|
||||
]
|
||||
]
|
||||
],
|
||||
"program" : "int.p4",
|
||||
"__meta__" : {
|
||||
"version" : [2, 18],
|
||||
"compiler" : "https://github.com/p4lang/p4c"
|
||||
}
|
||||
}
|
||||
@ -71,8 +71,9 @@ tables {
|
||||
id: 16784184
|
||||
}
|
||||
const_default_action_id: 16784184
|
||||
direct_resource_ids: 302038973
|
||||
direct_resource_ids: 318816189
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -93,8 +94,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302052612
|
||||
direct_resource_ids: 318829828
|
||||
size: 256
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -115,8 +117,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302033970
|
||||
direct_resource_ids: 318811186
|
||||
size: 256
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -155,8 +158,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302019133
|
||||
direct_resource_ids: 318796349
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -171,8 +175,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302026169
|
||||
direct_resource_ids: 318803385
|
||||
size: 2
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -238,8 +243,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302027886
|
||||
direct_resource_ids: 318805102
|
||||
size: 16
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -305,8 +311,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301998415
|
||||
direct_resource_ids: 318775631
|
||||
size: 16
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
@ -696,7 +703,7 @@ counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038973
|
||||
id: 318816189
|
||||
name: "ingress.table0_control.table0_counter"
|
||||
alias: "table0_counter"
|
||||
}
|
||||
@ -707,7 +714,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302052612
|
||||
id: 318829828
|
||||
name: "egress.process_set_source_sink.counter_set_source"
|
||||
alias: "counter_set_source"
|
||||
}
|
||||
@ -718,7 +725,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302033970
|
||||
id: 318811186
|
||||
name: "egress.process_set_source_sink.counter_set_sink"
|
||||
alias: "counter_set_sink"
|
||||
}
|
||||
@ -729,7 +736,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302019133
|
||||
id: 318796349
|
||||
name: "egress.process_int_source.counter_int_source"
|
||||
alias: "counter_int_source"
|
||||
}
|
||||
@ -740,7 +747,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302026169
|
||||
id: 318803385
|
||||
name: "egress.process_int_transit.counter_int_insert"
|
||||
alias: "counter_int_insert"
|
||||
}
|
||||
@ -751,7 +758,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302027886
|
||||
id: 318805102
|
||||
name: "egress.process_int_transit.counter_int_inst_0003"
|
||||
alias: "counter_int_inst_0003"
|
||||
}
|
||||
@ -762,7 +769,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301998415
|
||||
id: 318775631
|
||||
name: "egress.process_int_transit.counter_int_inst_0407"
|
||||
alias: "counter_int_inst_0407"
|
||||
}
|
||||
@ -773,7 +780,7 @@ direct_counters {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868941301
|
||||
id: 67146229
|
||||
name: "packet_in"
|
||||
annotations: "@controller_header(\"packet_in\")"
|
||||
}
|
||||
@ -790,7 +797,7 @@ controller_packet_metadata {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868916615
|
||||
id: 67121543
|
||||
name: "packet_out"
|
||||
annotations: "@controller_header(\"packet_out\")"
|
||||
}
|
||||
@ -805,3 +812,5 @@ controller_packet_metadata {
|
||||
bitwidth: 7
|
||||
}
|
||||
}
|
||||
type_info {
|
||||
}
|
||||
|
||||
@ -4,19 +4,20 @@ BMV2_OPTIONS=-DTARGET_BMV2 -DCPU_PORT=$(BMV2_CPU_PORT)
|
||||
|
||||
all: bmv2 bmv2-spgw
|
||||
|
||||
bmv2:
|
||||
p4c -v -x p4-16 -b bmv2-v1model \
|
||||
$(BMV2_OPTIONS) -o p4c-out/bmv2 \
|
||||
--p4runtime-file p4c-out/bmv2/fabric.p4info \
|
||||
--p4runtime-format text fabric.p4
|
||||
mv p4c-out/bmv2/fabric.p4rt p4c-out/bmv2/fabric.p4info
|
||||
rm -f p4c-out/bmv2/fabric.p4i
|
||||
bmv2: makedir
|
||||
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/fabric.json \
|
||||
$(BMV2_OPTIONS) \
|
||||
--p4runtime-file p4c-out/bmv2/fabric.p4info \
|
||||
--p4runtime-format text fabric.p4
|
||||
|
||||
bmv2-spgw:
|
||||
p4c-bm2-ss -o p4c-out/bmv2/fabric-spgw.json \
|
||||
$(BMV2_OPTIONS) -DWITH_SPGW \
|
||||
--p4runtime-file p4c-out/bmv2/fabric-spgw.p4info \
|
||||
--p4runtime-format text fabric.p4
|
||||
bmv2-spgw: makedir
|
||||
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/fabric-spgw.json \
|
||||
$(BMV2_OPTIONS) -DWITH_SPGW \
|
||||
--p4runtime-file p4c-out/bmv2/fabric-spgw.p4info \
|
||||
--p4runtime-format text fabric.p4
|
||||
|
||||
makedir:
|
||||
mkdir -p p4c-out/bmv2
|
||||
|
||||
clean:
|
||||
rm -rf p4c-out/*
|
||||
rm -rf p4c-out/bmv2/*
|
||||
|
||||
|
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 538 B |
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ tables {
|
||||
id: 16800567
|
||||
}
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -31,6 +32,7 @@ tables {
|
||||
id: 16800567
|
||||
}
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -52,6 +54,7 @@ tables {
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -72,8 +75,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302004306
|
||||
direct_resource_ids: 318781522
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -112,8 +116,9 @@ tables {
|
||||
id: 16798734
|
||||
}
|
||||
const_default_action_id: 16819938
|
||||
direct_resource_ids: 302038285
|
||||
direct_resource_ids: 318815501
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -143,8 +148,9 @@ tables {
|
||||
id: 16840921
|
||||
}
|
||||
const_default_action_id: 16840921
|
||||
direct_resource_ids: 302050110
|
||||
direct_resource_ids: 318827326
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -171,8 +177,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301993073
|
||||
direct_resource_ids: 318770289
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -193,8 +200,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302053291
|
||||
direct_resource_ids: 318830507
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -215,86 +223,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301991276
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33578363
|
||||
name: "FabricIngress.forwarding.multicast_v4"
|
||||
alias: "multicast_v4"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.vlan_tag.vlan_id"
|
||||
bitwidth: 12
|
||||
match_type: EXACT
|
||||
}
|
||||
match_fields {
|
||||
id: 2
|
||||
name: "hdr.ipv4.dst_addr"
|
||||
bitwidth: 32
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302020680
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33568751
|
||||
name: "FabricIngress.forwarding.unicast_v6"
|
||||
alias: "unicast_v6"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.ipv6.dst_addr"
|
||||
bitwidth: 128
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302043649
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33581295
|
||||
name: "FabricIngress.forwarding.multicast_v6"
|
||||
alias: "multicast_v6"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.vlan_tag.vlan_id"
|
||||
bitwidth: 12
|
||||
match_type: EXACT
|
||||
}
|
||||
match_fields {
|
||||
id: 2
|
||||
name: "hdr.ipv6.dst_addr"
|
||||
bitwidth: 128
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302038094
|
||||
direct_resource_ids: 318768492
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -387,8 +318,9 @@ tables {
|
||||
id: 16819938
|
||||
}
|
||||
const_default_action_id: 16819938
|
||||
direct_resource_ids: 301995056
|
||||
direct_resource_ids: 318772272
|
||||
size: 256
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -408,8 +340,9 @@ tables {
|
||||
action_refs {
|
||||
id: 16819938
|
||||
}
|
||||
direct_resource_ids: 302008112
|
||||
direct_resource_ids: 318785328
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -442,8 +375,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301991880
|
||||
direct_resource_ids: 318769096
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -471,30 +405,9 @@ tables {
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
implementation_id: 285233747
|
||||
direct_resource_ids: 302023316
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33606828
|
||||
name: "FabricIngress.next.multicast"
|
||||
alias: "multicast"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "fabric_metadata.next_id"
|
||||
bitwidth: 32
|
||||
match_type: EXACT
|
||||
}
|
||||
action_refs {
|
||||
id: 16789575
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302024536
|
||||
direct_resource_ids: 318800532
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -521,6 +434,7 @@ tables {
|
||||
id: 16819938
|
||||
}
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
@ -804,23 +718,6 @@ actions {
|
||||
bitwidth: 20
|
||||
}
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
id: 16789575
|
||||
name: "FabricIngress.next.set_mcast_group"
|
||||
alias: "set_mcast_group"
|
||||
}
|
||||
params {
|
||||
id: 1
|
||||
name: "gid"
|
||||
bitwidth: 16
|
||||
}
|
||||
params {
|
||||
id: 2
|
||||
name: "smac"
|
||||
bitwidth: 48
|
||||
}
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
id: 16829135
|
||||
@ -876,7 +773,7 @@ counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302004306
|
||||
id: 318781522
|
||||
name: "FabricIngress.spgw_ingress.ue_counter"
|
||||
alias: "ue_counter"
|
||||
}
|
||||
@ -887,7 +784,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038285
|
||||
id: 318815501
|
||||
name: "FabricIngress.filtering.ingress_port_vlan_counter"
|
||||
alias: "ingress_port_vlan_counter"
|
||||
}
|
||||
@ -898,7 +795,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302050110
|
||||
id: 318827326
|
||||
name: "FabricIngress.filtering.fwd_classifier_counter"
|
||||
alias: "fwd_classifier_counter"
|
||||
}
|
||||
@ -909,7 +806,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301993073
|
||||
id: 318770289
|
||||
name: "FabricIngress.forwarding.bridging_counter"
|
||||
alias: "bridging_counter"
|
||||
}
|
||||
@ -920,7 +817,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302053291
|
||||
id: 318830507
|
||||
name: "FabricIngress.forwarding.mpls_counter"
|
||||
alias: "mpls_counter"
|
||||
}
|
||||
@ -931,7 +828,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301991276
|
||||
id: 318768492
|
||||
name: "FabricIngress.forwarding.unicast_v4_counter"
|
||||
alias: "unicast_v4_counter"
|
||||
}
|
||||
@ -942,40 +839,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302020680
|
||||
name: "FabricIngress.forwarding.multicast_v4_counter"
|
||||
alias: "multicast_v4_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33578363
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302043649
|
||||
name: "FabricIngress.forwarding.unicast_v6_counter"
|
||||
alias: "unicast_v6_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33568751
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038094
|
||||
name: "FabricIngress.forwarding.multicast_v6_counter"
|
||||
alias: "multicast_v6_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33581295
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301995056
|
||||
id: 318772272
|
||||
name: "FabricIngress.forwarding.acl_counter"
|
||||
alias: "acl_counter"
|
||||
}
|
||||
@ -986,7 +850,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302008112
|
||||
id: 318785328
|
||||
name: "FabricIngress.next.vlan_meta_counter"
|
||||
alias: "vlan_meta_counter"
|
||||
}
|
||||
@ -997,7 +861,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301991880
|
||||
id: 318769096
|
||||
name: "FabricIngress.next.simple_counter"
|
||||
alias: "simple_counter"
|
||||
}
|
||||
@ -1008,7 +872,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302023316
|
||||
id: 318800532
|
||||
name: "FabricIngress.next.hashed_counter"
|
||||
alias: "hashed_counter"
|
||||
}
|
||||
@ -1017,20 +881,9 @@ direct_counters {
|
||||
}
|
||||
direct_table_id: 33608588
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302024536
|
||||
name: "FabricIngress.next.multicast_counter"
|
||||
alias: "multicast_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33606828
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868941301
|
||||
id: 67146229
|
||||
name: "packet_in"
|
||||
annotations: "@controller_header(\"packet_in\")"
|
||||
}
|
||||
@ -1047,7 +900,7 @@ controller_packet_metadata {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868916615
|
||||
id: 67121543
|
||||
name: "packet_out"
|
||||
annotations: "@controller_header(\"packet_out\")"
|
||||
}
|
||||
@ -1062,3 +915,5 @@ controller_packet_metadata {
|
||||
bitwidth: 7
|
||||
}
|
||||
}
|
||||
type_info {
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,8 +35,9 @@ tables {
|
||||
id: 16798734
|
||||
}
|
||||
const_default_action_id: 16819938
|
||||
direct_resource_ids: 302038285
|
||||
direct_resource_ids: 318815501
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -66,8 +67,9 @@ tables {
|
||||
id: 16840921
|
||||
}
|
||||
const_default_action_id: 16840921
|
||||
direct_resource_ids: 302050110
|
||||
direct_resource_ids: 318827326
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -94,8 +96,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301993073
|
||||
direct_resource_ids: 318770289
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -116,8 +119,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302053291
|
||||
direct_resource_ids: 318830507
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -138,86 +142,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301991276
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33578363
|
||||
name: "FabricIngress.forwarding.multicast_v4"
|
||||
alias: "multicast_v4"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.vlan_tag.vlan_id"
|
||||
bitwidth: 12
|
||||
match_type: EXACT
|
||||
}
|
||||
match_fields {
|
||||
id: 2
|
||||
name: "hdr.ipv4.dst_addr"
|
||||
bitwidth: 32
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302020680
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33568751
|
||||
name: "FabricIngress.forwarding.unicast_v6"
|
||||
alias: "unicast_v6"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.ipv6.dst_addr"
|
||||
bitwidth: 128
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302043649
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33581295
|
||||
name: "FabricIngress.forwarding.multicast_v6"
|
||||
alias: "multicast_v6"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "hdr.vlan_tag.vlan_id"
|
||||
bitwidth: 12
|
||||
match_type: EXACT
|
||||
}
|
||||
match_fields {
|
||||
id: 2
|
||||
name: "hdr.ipv6.dst_addr"
|
||||
bitwidth: 128
|
||||
match_type: LPM
|
||||
}
|
||||
action_refs {
|
||||
id: 16839692
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302038094
|
||||
direct_resource_ids: 318768492
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -310,8 +237,9 @@ tables {
|
||||
id: 16819938
|
||||
}
|
||||
const_default_action_id: 16819938
|
||||
direct_resource_ids: 301995056
|
||||
direct_resource_ids: 318772272
|
||||
size: 256
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -331,8 +259,9 @@ tables {
|
||||
action_refs {
|
||||
id: 16819938
|
||||
}
|
||||
direct_resource_ids: 302008112
|
||||
direct_resource_ids: 318785328
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -365,8 +294,9 @@ tables {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 301991880
|
||||
direct_resource_ids: 318769096
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -394,30 +324,9 @@ tables {
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
implementation_id: 285233747
|
||||
direct_resource_ids: 302023316
|
||||
size: 1024
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
id: 33606828
|
||||
name: "FabricIngress.next.multicast"
|
||||
alias: "multicast"
|
||||
}
|
||||
match_fields {
|
||||
id: 1
|
||||
name: "fabric_metadata.next_id"
|
||||
bitwidth: 32
|
||||
match_type: EXACT
|
||||
}
|
||||
action_refs {
|
||||
id: 16789575
|
||||
}
|
||||
action_refs {
|
||||
id: 16800567
|
||||
annotations: "@defaultonly()"
|
||||
}
|
||||
direct_resource_ids: 302024536
|
||||
direct_resource_ids: 318800532
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
tables {
|
||||
preamble {
|
||||
@ -444,6 +353,7 @@ tables {
|
||||
id: 16819938
|
||||
}
|
||||
size: 1024
|
||||
idle_timeout_behavior: NO_TIMEOUT
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
@ -684,23 +594,6 @@ actions {
|
||||
bitwidth: 20
|
||||
}
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
id: 16789575
|
||||
name: "FabricIngress.next.set_mcast_group"
|
||||
alias: "set_mcast_group"
|
||||
}
|
||||
params {
|
||||
id: 1
|
||||
name: "gid"
|
||||
bitwidth: 16
|
||||
}
|
||||
params {
|
||||
id: 2
|
||||
name: "smac"
|
||||
bitwidth: 48
|
||||
}
|
||||
}
|
||||
actions {
|
||||
preamble {
|
||||
id: 16801047
|
||||
@ -749,7 +642,7 @@ counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038285
|
||||
id: 318815501
|
||||
name: "FabricIngress.filtering.ingress_port_vlan_counter"
|
||||
alias: "ingress_port_vlan_counter"
|
||||
}
|
||||
@ -760,7 +653,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302050110
|
||||
id: 318827326
|
||||
name: "FabricIngress.filtering.fwd_classifier_counter"
|
||||
alias: "fwd_classifier_counter"
|
||||
}
|
||||
@ -771,7 +664,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301993073
|
||||
id: 318770289
|
||||
name: "FabricIngress.forwarding.bridging_counter"
|
||||
alias: "bridging_counter"
|
||||
}
|
||||
@ -782,7 +675,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302053291
|
||||
id: 318830507
|
||||
name: "FabricIngress.forwarding.mpls_counter"
|
||||
alias: "mpls_counter"
|
||||
}
|
||||
@ -793,7 +686,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301991276
|
||||
id: 318768492
|
||||
name: "FabricIngress.forwarding.unicast_v4_counter"
|
||||
alias: "unicast_v4_counter"
|
||||
}
|
||||
@ -804,40 +697,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302020680
|
||||
name: "FabricIngress.forwarding.multicast_v4_counter"
|
||||
alias: "multicast_v4_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33578363
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302043649
|
||||
name: "FabricIngress.forwarding.unicast_v6_counter"
|
||||
alias: "unicast_v6_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33568751
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302038094
|
||||
name: "FabricIngress.forwarding.multicast_v6_counter"
|
||||
alias: "multicast_v6_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33581295
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301995056
|
||||
id: 318772272
|
||||
name: "FabricIngress.forwarding.acl_counter"
|
||||
alias: "acl_counter"
|
||||
}
|
||||
@ -848,7 +708,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302008112
|
||||
id: 318785328
|
||||
name: "FabricIngress.next.vlan_meta_counter"
|
||||
alias: "vlan_meta_counter"
|
||||
}
|
||||
@ -859,7 +719,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 301991880
|
||||
id: 318769096
|
||||
name: "FabricIngress.next.simple_counter"
|
||||
alias: "simple_counter"
|
||||
}
|
||||
@ -870,7 +730,7 @@ direct_counters {
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302023316
|
||||
id: 318800532
|
||||
name: "FabricIngress.next.hashed_counter"
|
||||
alias: "hashed_counter"
|
||||
}
|
||||
@ -879,20 +739,9 @@ direct_counters {
|
||||
}
|
||||
direct_table_id: 33608588
|
||||
}
|
||||
direct_counters {
|
||||
preamble {
|
||||
id: 302024536
|
||||
name: "FabricIngress.next.multicast_counter"
|
||||
alias: "multicast_counter"
|
||||
}
|
||||
spec {
|
||||
unit: BOTH
|
||||
}
|
||||
direct_table_id: 33606828
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868941301
|
||||
id: 67146229
|
||||
name: "packet_in"
|
||||
annotations: "@controller_header(\"packet_in\")"
|
||||
}
|
||||
@ -909,7 +758,7 @@ controller_packet_metadata {
|
||||
}
|
||||
controller_packet_metadata {
|
||||
preamble {
|
||||
id: 2868916615
|
||||
id: 67121543
|
||||
name: "packet_out"
|
||||
annotations: "@controller_header(\"packet_out\")"
|
||||
}
|
||||
@ -924,3 +773,5 @@ controller_packet_metadata {
|
||||
bitwidth: 7
|
||||
}
|
||||
}
|
||||
type_info {
|
||||
}
|
||||
|
||||
@ -21,10 +21,10 @@ import org.onosproject.net.pi.model.PiActionProfileId;
|
||||
import org.onosproject.net.pi.model.PiPipeconf;
|
||||
import org.onosproject.net.pi.runtime.PiActionGroup;
|
||||
import org.onosproject.net.pi.runtime.PiActionGroupId;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileGroup.Member;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.config.P4InfoOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup.Member;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.config.v1.P4InfoOuterClass;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
@ -34,7 +34,8 @@ import static java.lang.String.format;
|
||||
/**
|
||||
* Encoder/Decoder for action profile group.
|
||||
*/
|
||||
public final class ActionProfileGroupEncoder {
|
||||
final class ActionProfileGroupEncoder {
|
||||
|
||||
private ActionProfileGroupEncoder() {
|
||||
// hide default constructor
|
||||
}
|
||||
|
||||
@ -20,9 +20,9 @@ import org.onosproject.net.pi.model.PiActionProfileId;
|
||||
import org.onosproject.net.pi.model.PiPipeconf;
|
||||
import org.onosproject.net.pi.runtime.PiActionGroupMember;
|
||||
import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.config.P4InfoOuterClass;
|
||||
import p4.config.v1.P4InfoOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static org.onosproject.p4runtime.ctl.TableEntryEncoder.decodeActionMsg;
|
||||
@ -36,23 +36,16 @@ public final class ActionProfileMemberEncoder {
|
||||
// Hide default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a PiActionGroupMember to a ActionProfileMember.
|
||||
*
|
||||
* @param group the PI action group of members
|
||||
* @param member the member to encode
|
||||
* @param pipeconf the pipeconf
|
||||
* @return encoded member
|
||||
*/
|
||||
/**
|
||||
* Encode a PiActionGroupMember to a ActionProfileMember.
|
||||
*
|
||||
* @param profileId the PI action group profile ID of members
|
||||
* @param member the member to encode
|
||||
* @param pipeconf the pipeconf, as encode spec
|
||||
* @param member the member to encode
|
||||
* @param pipeconf the pipeconf, as encode spec
|
||||
* @return encoded member
|
||||
* @throws P4InfoBrowser.NotFoundException can't find action profile from P4Info browser
|
||||
* @throws EncodeException can't find P4Info from pipeconf
|
||||
* @throws P4InfoBrowser.NotFoundException can't find action profile from
|
||||
* P4Info browser
|
||||
* @throws EncodeException can't find P4Info from pipeconf
|
||||
*/
|
||||
static ActionProfileMember encode(PiActionProfileId profileId,
|
||||
PiActionGroupMember member,
|
||||
@ -88,12 +81,14 @@ public final class ActionProfileMemberEncoder {
|
||||
/**
|
||||
* Decode an action profile member to PI action group member.
|
||||
*
|
||||
* @param member the action profile member
|
||||
* @param weight the weight of the member
|
||||
* @param member the action profile member
|
||||
* @param weight the weight of the member
|
||||
* @param pipeconf the pipeconf, as decode spec
|
||||
* @return decoded PI action group member
|
||||
* @throws P4InfoBrowser.NotFoundException can't find definition of action from P4 info
|
||||
* @throws EncodeException can't get P4 info browser from pipeconf
|
||||
* @throws P4InfoBrowser.NotFoundException can't find definition of action
|
||||
* from P4 info
|
||||
* @throws EncodeException can't get P4 info browser from
|
||||
* pipeconf
|
||||
*/
|
||||
static PiActionGroupMember decode(ActionProfileMember member,
|
||||
int weight,
|
||||
|
||||
@ -24,11 +24,11 @@ import org.onosproject.net.pi.runtime.PiCounterCellData;
|
||||
import org.onosproject.net.pi.runtime.PiCounterCellId;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntry;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.P4RuntimeOuterClass.CounterData;
|
||||
import p4.P4RuntimeOuterClass.CounterEntry;
|
||||
import p4.P4RuntimeOuterClass.DirectCounterEntry;
|
||||
import p4.P4RuntimeOuterClass.Entity;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.CounterData;
|
||||
import p4.v1.P4RuntimeOuterClass.CounterEntry;
|
||||
import p4.v1.P4RuntimeOuterClass.DirectCounterEntry;
|
||||
import p4.v1.P4RuntimeOuterClass.Entity;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -38,8 +38,8 @@ import java.util.stream.Collectors;
|
||||
import static java.lang.String.format;
|
||||
import static org.onosproject.p4runtime.ctl.P4RuntimeUtils.indexMsg;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.COUNTER_ENTRY;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_COUNTER_ENTRY;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.COUNTER_ENTRY;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_COUNTER_ENTRY;
|
||||
|
||||
/**
|
||||
* Encoder/decoder of PI counter IDs to counter entry protobuf messages, and
|
||||
|
||||
@ -19,7 +19,7 @@ package org.onosproject.p4runtime.ctl;
|
||||
import org.onosproject.net.DeviceId;
|
||||
import org.onosproject.net.MastershipRole;
|
||||
import org.onosproject.p4runtime.api.P4RuntimeEventSubject;
|
||||
import p4.P4RuntimeOuterClass.Uint128;
|
||||
import p4.v1.P4RuntimeOuterClass.Uint128;
|
||||
|
||||
/**
|
||||
* Default implementation of arbitration in P4Runtime.
|
||||
@ -36,7 +36,7 @@ public class DefaultArbitration implements P4RuntimeEventSubject {
|
||||
* @param role the role
|
||||
* @param electionId the election id
|
||||
*/
|
||||
public DefaultArbitration(DeviceId deviceId, MastershipRole role, Uint128 electionId) {
|
||||
DefaultArbitration(DeviceId deviceId, MastershipRole role, Uint128 electionId) {
|
||||
this.deviceId = deviceId;
|
||||
this.role = role;
|
||||
this.electionId = electionId;
|
||||
|
||||
@ -25,11 +25,11 @@ import org.onosproject.net.pi.runtime.PiMeterCellConfig;
|
||||
import org.onosproject.net.pi.runtime.PiMeterCellId;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntry;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.P4RuntimeOuterClass.DirectMeterEntry;
|
||||
import p4.P4RuntimeOuterClass.Entity;
|
||||
import p4.P4RuntimeOuterClass.MeterConfig;
|
||||
import p4.P4RuntimeOuterClass.MeterEntry;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.DirectMeterEntry;
|
||||
import p4.v1.P4RuntimeOuterClass.Entity;
|
||||
import p4.v1.P4RuntimeOuterClass.MeterConfig;
|
||||
import p4.v1.P4RuntimeOuterClass.MeterEntry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -39,8 +39,8 @@ import java.util.stream.Collectors;
|
||||
import static java.lang.String.format;
|
||||
import static org.onosproject.p4runtime.ctl.P4RuntimeUtils.indexMsg;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_METER_ENTRY;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.METER_ENTRY;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_METER_ENTRY;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.METER_ENTRY;
|
||||
|
||||
/**
|
||||
* Encoder/decoder of PI meter cell configurations to meter entry protobuf
|
||||
|
||||
@ -18,9 +18,9 @@ package org.onosproject.p4runtime.ctl;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import org.onlab.util.ImmutableByteSequence;
|
||||
import org.onosproject.net.pi.model.PiData;
|
||||
import org.onosproject.net.pi.runtime.data.PiBitString;
|
||||
import org.onosproject.net.pi.runtime.data.PiBool;
|
||||
import org.onosproject.net.pi.model.PiData;
|
||||
import org.onosproject.net.pi.runtime.data.PiEnumString;
|
||||
import org.onosproject.net.pi.runtime.data.PiErrorString;
|
||||
import org.onosproject.net.pi.runtime.data.PiHeader;
|
||||
@ -29,13 +29,16 @@ import org.onosproject.net.pi.runtime.data.PiHeaderUnion;
|
||||
import org.onosproject.net.pi.runtime.data.PiHeaderUnionStack;
|
||||
import org.onosproject.net.pi.runtime.data.PiStruct;
|
||||
import org.onosproject.net.pi.runtime.data.PiTuple;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4Types;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.v1.P4DataOuterClass.P4Data;
|
||||
import static p4.v1.P4DataOuterClass.P4Header;
|
||||
import static p4.v1.P4DataOuterClass.P4HeaderStack;
|
||||
import static p4.v1.P4DataOuterClass.P4HeaderUnion;
|
||||
import static p4.v1.P4DataOuterClass.P4HeaderUnionStack;
|
||||
import static p4.v1.P4DataOuterClass.P4StructLike;
|
||||
|
||||
/**
|
||||
* Encoder/decoder of PI Data entry to P4 Data entry protobuf
|
||||
@ -43,14 +46,12 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
*/
|
||||
final class P4DataCodec {
|
||||
|
||||
private static final Logger log = getLogger(P4DataCodec.class);
|
||||
|
||||
private P4DataCodec() {
|
||||
// Hides constructor.
|
||||
}
|
||||
|
||||
private static P4Types.P4Header encodeHeader(PiHeader piHeader) {
|
||||
P4Types.P4Header.Builder builder = P4Types.P4Header.newBuilder();
|
||||
private static P4Header encodeHeader(PiHeader piHeader) {
|
||||
P4Header.Builder builder = P4Header.newBuilder();
|
||||
int i = 0;
|
||||
for (ImmutableByteSequence bitString : piHeader.bitStrings()) {
|
||||
builder.setBitstrings(i, ByteString.copyFrom(bitString.asArray()));
|
||||
@ -59,7 +60,7 @@ final class P4DataCodec {
|
||||
return builder.setIsValid(piHeader.isValid()).build();
|
||||
}
|
||||
|
||||
private static PiHeader decodeHeader(P4Types.P4Header p4Header) {
|
||||
private static PiHeader decodeHeader(P4Header p4Header) {
|
||||
List<ImmutableByteSequence> bitStrings = p4Header.getBitstringsList().stream()
|
||||
.map(bit -> ImmutableByteSequence.copyFrom(bit.asReadOnlyByteBuffer()))
|
||||
.collect(Collectors.toList());
|
||||
@ -67,9 +68,9 @@ final class P4DataCodec {
|
||||
return PiHeader.of(p4Header.getIsValid(), bitStrings);
|
||||
}
|
||||
|
||||
private static P4Types.P4HeaderUnion encodeHeaderUnion(PiHeaderUnion headerUnion) {
|
||||
private static P4HeaderUnion encodeHeaderUnion(PiHeaderUnion headerUnion) {
|
||||
|
||||
P4Types.P4HeaderUnion.Builder builder = P4Types.P4HeaderUnion.newBuilder();
|
||||
P4HeaderUnion.Builder builder = P4HeaderUnion.newBuilder();
|
||||
if (headerUnion.isValid()) {
|
||||
builder.setValidHeader(encodeHeader(headerUnion.header()));
|
||||
builder.setValidHeaderName(headerUnion.headerName());
|
||||
@ -82,45 +83,45 @@ final class P4DataCodec {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static PiHeaderUnion decodeHeaderUnion(P4Types.P4HeaderUnion p4HeaderUnion) {
|
||||
private static PiHeaderUnion decodeHeaderUnion(P4HeaderUnion p4HeaderUnion) {
|
||||
|
||||
return PiHeaderUnion.of(p4HeaderUnion.getValidHeaderName(),
|
||||
decodeHeader(p4HeaderUnion.getValidHeader()));
|
||||
}
|
||||
|
||||
private static P4Types.P4StructLike encodeStruct(PiStruct piStruct) {
|
||||
P4Types.P4StructLike.Builder builder = P4Types.P4StructLike.newBuilder();
|
||||
private static P4StructLike encodeStruct(PiStruct piStruct) {
|
||||
P4StructLike.Builder builder = P4StructLike.newBuilder();
|
||||
builder.addAllMembers(piStruct.struct().stream()
|
||||
.map(piData -> encodeP4Data(piData))
|
||||
.map(P4DataCodec::encodeP4Data)
|
||||
.collect(Collectors.toList()));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static PiStruct decodeStruct(P4Types.P4StructLike p4StructLike) {
|
||||
private static PiStruct decodeStruct(P4StructLike p4StructLike) {
|
||||
|
||||
return PiStruct.of(p4StructLike.getMembersList().stream()
|
||||
.map(p4Data -> decodeP4Data(p4Data))
|
||||
.map(P4DataCodec::decodeP4Data)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private static P4Types.P4StructLike encodeTuple(PiTuple piTuple) {
|
||||
P4Types.P4StructLike.Builder builder = P4Types.P4StructLike.newBuilder();
|
||||
private static P4StructLike encodeTuple(PiTuple piTuple) {
|
||||
P4StructLike.Builder builder = P4StructLike.newBuilder();
|
||||
builder.addAllMembers(piTuple.tuple().stream()
|
||||
.map(piData -> encodeP4Data(piData))
|
||||
.map(P4DataCodec::encodeP4Data)
|
||||
.collect(Collectors.toList()));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static PiTuple decodeTuple(P4Types.P4StructLike p4StructLike) {
|
||||
private static PiTuple decodeTuple(P4StructLike p4StructLike) {
|
||||
|
||||
return PiTuple.of(p4StructLike.getMembersList().stream()
|
||||
.map(p4Data -> decodeP4Data(p4Data))
|
||||
.map(P4DataCodec::decodeP4Data)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
static P4Types.P4Data encodeP4Data(PiData piData) {
|
||||
static P4Data encodeP4Data(PiData piData) {
|
||||
|
||||
P4Types.P4Data.Builder builder = P4Types.P4Data.newBuilder();
|
||||
P4Data.Builder builder = P4Data.newBuilder();
|
||||
switch (piData.type()) {
|
||||
case BITSTRING:
|
||||
builder.setBitstring(ByteString.copyFrom(((PiBitString) piData).bitString().asArray()));
|
||||
@ -144,7 +145,7 @@ final class P4DataCodec {
|
||||
builder.setHeader(encodeHeader((PiHeader) piData));
|
||||
break;
|
||||
case HEADERSTACK:
|
||||
P4Types.P4HeaderStack.Builder headerStack = P4Types.P4HeaderStack.newBuilder();
|
||||
P4HeaderStack.Builder headerStack = P4HeaderStack.newBuilder();
|
||||
int i = 0;
|
||||
for (PiHeader header : ((PiHeaderStack) piData).headers()) {
|
||||
headerStack.setEntries(i, encodeHeader(header));
|
||||
@ -156,7 +157,7 @@ final class P4DataCodec {
|
||||
builder.setHeaderUnion(encodeHeaderUnion((PiHeaderUnion) piData));
|
||||
break;
|
||||
case HEADERUNIONSTACK:
|
||||
P4Types.P4HeaderUnionStack.Builder headerUnionStack = P4Types.P4HeaderUnionStack.newBuilder();
|
||||
P4HeaderUnionStack.Builder headerUnionStack = P4HeaderUnionStack.newBuilder();
|
||||
int j = 0;
|
||||
for (PiHeaderUnion headerUnion : ((PiHeaderUnionStack) piData).headerUnions()) {
|
||||
headerUnionStack.setEntries(j, encodeHeaderUnion(headerUnion));
|
||||
@ -171,7 +172,7 @@ final class P4DataCodec {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
static PiData decodeP4Data(P4Types.P4Data p4Data) {
|
||||
static PiData decodeP4Data(P4Data p4Data) {
|
||||
PiData piData = null;
|
||||
|
||||
switch (p4Data.getDataCase()) {
|
||||
@ -195,13 +196,13 @@ final class P4DataCodec {
|
||||
break;
|
||||
case HEADER_STACK:
|
||||
piData = PiHeaderStack.of(p4Data.getHeaderStack().getEntriesList().stream()
|
||||
.map(p4header -> decodeHeader(p4header))
|
||||
.map(P4DataCodec::decodeHeader)
|
||||
.collect(Collectors.toList()));
|
||||
break;
|
||||
case HEADER_UNION_STACK:
|
||||
piData = PiHeaderUnionStack.of(p4Data.getHeaderUnionStack()
|
||||
.getEntriesList().stream()
|
||||
.map(p4HeaderUnion -> decodeHeaderUnion(p4HeaderUnion))
|
||||
.map(P4DataCodec::decodeHeaderUnion)
|
||||
.collect(Collectors.toList()));
|
||||
break;
|
||||
case ENUM:
|
||||
@ -218,4 +219,4 @@ final class P4DataCodec {
|
||||
|
||||
return piData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,17 +19,17 @@ package org.onosproject.p4runtime.ctl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.protobuf.Message;
|
||||
import p4.config.P4InfoOuterClass.Action;
|
||||
import p4.config.P4InfoOuterClass.ActionProfile;
|
||||
import p4.config.P4InfoOuterClass.ControllerPacketMetadata;
|
||||
import p4.config.P4InfoOuterClass.Counter;
|
||||
import p4.config.P4InfoOuterClass.DirectCounter;
|
||||
import p4.config.P4InfoOuterClass.DirectMeter;
|
||||
import p4.config.P4InfoOuterClass.MatchField;
|
||||
import p4.config.P4InfoOuterClass.Meter;
|
||||
import p4.config.P4InfoOuterClass.P4Info;
|
||||
import p4.config.P4InfoOuterClass.Preamble;
|
||||
import p4.config.P4InfoOuterClass.Table;
|
||||
import p4.config.v1.P4InfoOuterClass.Action;
|
||||
import p4.config.v1.P4InfoOuterClass.ActionProfile;
|
||||
import p4.config.v1.P4InfoOuterClass.ControllerPacketMetadata;
|
||||
import p4.config.v1.P4InfoOuterClass.Counter;
|
||||
import p4.config.v1.P4InfoOuterClass.DirectCounter;
|
||||
import p4.config.v1.P4InfoOuterClass.DirectMeter;
|
||||
import p4.config.v1.P4InfoOuterClass.MatchField;
|
||||
import p4.config.v1.P4InfoOuterClass.Meter;
|
||||
import p4.config.v1.P4InfoOuterClass.P4Info;
|
||||
import p4.config.v1.P4InfoOuterClass.Preamble;
|
||||
import p4.config.v1.P4InfoOuterClass.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -52,24 +52,24 @@ import org.onosproject.net.pi.service.PiPipeconfService;
|
||||
import org.onosproject.p4runtime.api.P4RuntimeClient;
|
||||
import org.onosproject.p4runtime.api.P4RuntimeEvent;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4RuntimeGrpc;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.P4RuntimeOuterClass.Entity;
|
||||
import p4.P4RuntimeOuterClass.ForwardingPipelineConfig;
|
||||
import p4.P4RuntimeOuterClass.MasterArbitrationUpdate;
|
||||
import p4.P4RuntimeOuterClass.PacketIn;
|
||||
import p4.P4RuntimeOuterClass.ReadRequest;
|
||||
import p4.P4RuntimeOuterClass.ReadResponse;
|
||||
import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
|
||||
import p4.P4RuntimeOuterClass.StreamMessageRequest;
|
||||
import p4.P4RuntimeOuterClass.StreamMessageResponse;
|
||||
import p4.P4RuntimeOuterClass.TableEntry;
|
||||
import p4.P4RuntimeOuterClass.Uint128;
|
||||
import p4.P4RuntimeOuterClass.Update;
|
||||
import p4.P4RuntimeOuterClass.WriteRequest;
|
||||
import p4.config.P4InfoOuterClass.P4Info;
|
||||
import p4.v1.P4RuntimeGrpc;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.v1.P4RuntimeOuterClass.Entity;
|
||||
import p4.v1.P4RuntimeOuterClass.ForwardingPipelineConfig;
|
||||
import p4.v1.P4RuntimeOuterClass.MasterArbitrationUpdate;
|
||||
import p4.v1.P4RuntimeOuterClass.PacketIn;
|
||||
import p4.v1.P4RuntimeOuterClass.ReadRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.ReadResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.StreamMessageRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.StreamMessageResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.TableEntry;
|
||||
import p4.v1.P4RuntimeOuterClass.Uint128;
|
||||
import p4.v1.P4RuntimeOuterClass.Update;
|
||||
import p4.v1.P4RuntimeOuterClass.WriteRequest;
|
||||
import p4.config.v1.P4InfoOuterClass.P4Info;
|
||||
import p4.tmp.P4Config;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@ -96,11 +96,11 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.lang.String.format;
|
||||
import static org.onlab.util.Tools.groupedThreads;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_GROUP;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_MEMBER;
|
||||
import static p4.P4RuntimeOuterClass.Entity.EntityCase.TABLE_ENTRY;
|
||||
import static p4.P4RuntimeOuterClass.PacketOut;
|
||||
import static p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest.Action.VERIFY_AND_COMMIT;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_GROUP;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_MEMBER;
|
||||
import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.TABLE_ENTRY;
|
||||
import static p4.v1.P4RuntimeOuterClass.PacketOut;
|
||||
import static p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest.Action.VERIFY_AND_COMMIT;
|
||||
|
||||
/**
|
||||
* Implementation of a P4Runtime client.
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
package org.onosproject.p4runtime.ctl;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
/**
|
||||
* Utilities for P4 runtime control.
|
||||
*/
|
||||
public final class P4RuntimeUtils {
|
||||
final class P4RuntimeUtils {
|
||||
|
||||
private P4RuntimeUtils() {
|
||||
// Hide default construction
|
||||
|
||||
@ -25,7 +25,7 @@ import org.onosproject.net.pi.model.PiPipeconf;
|
||||
import org.onosproject.net.pi.runtime.PiControlMetadata;
|
||||
import org.onosproject.net.pi.runtime.PiPacketOperation;
|
||||
import org.slf4j.Logger;
|
||||
import p4.config.P4InfoOuterClass;
|
||||
import p4.config.v1.P4InfoOuterClass;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -35,9 +35,9 @@ import java.util.stream.Collectors;
|
||||
import static org.onlab.util.ImmutableByteSequence.copyFrom;
|
||||
import static org.onosproject.p4runtime.ctl.P4InfoBrowser.NotFoundException;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static p4.P4RuntimeOuterClass.PacketIn;
|
||||
import static p4.P4RuntimeOuterClass.PacketMetadata;
|
||||
import static p4.P4RuntimeOuterClass.PacketOut;
|
||||
import static p4.v1.P4RuntimeOuterClass.PacketIn;
|
||||
import static p4.v1.P4RuntimeOuterClass.PacketMetadata;
|
||||
import static p4.v1.P4RuntimeOuterClass.PacketOut;
|
||||
|
||||
/**
|
||||
* Encoder of packet metadata, from ONOS Pi* format, to P4Runtime protobuf messages, and vice versa.
|
||||
|
||||
@ -24,7 +24,7 @@ import com.google.protobuf.TextFormat;
|
||||
import org.onosproject.net.pi.model.PiPipeconf;
|
||||
import org.onosproject.net.pi.model.PiPipeconfId;
|
||||
import org.slf4j.Logger;
|
||||
import p4.config.P4InfoOuterClass.P4Info;
|
||||
import p4.config.v1.P4InfoOuterClass.P4Info;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -37,13 +37,12 @@ import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiTableAction;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntry;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiValidFieldMatch;
|
||||
import org.slf4j.Logger;
|
||||
import p4.P4RuntimeOuterClass.Action;
|
||||
import p4.P4RuntimeOuterClass.FieldMatch;
|
||||
import p4.P4RuntimeOuterClass.TableAction;
|
||||
import p4.P4RuntimeOuterClass.TableEntry;
|
||||
import p4.config.P4InfoOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.Action;
|
||||
import p4.v1.P4RuntimeOuterClass.FieldMatch;
|
||||
import p4.v1.P4RuntimeOuterClass.TableAction;
|
||||
import p4.v1.P4RuntimeOuterClass.TableEntry;
|
||||
import p4.config.v1.P4InfoOuterClass;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -348,13 +347,6 @@ final class TableEntryEncoder {
|
||||
.setLow(rangeLowValue)
|
||||
.build())
|
||||
.build();
|
||||
case VALID:
|
||||
PiValidFieldMatch validMatch = (PiValidFieldMatch) piFieldMatch;
|
||||
return fieldMatchMsgBuilder.setValid(
|
||||
FieldMatch.Valid.newBuilder()
|
||||
.setValue(validMatch.isValid())
|
||||
.build())
|
||||
.build();
|
||||
default:
|
||||
throw new EncodeException(format(
|
||||
"Building of match type %s not implemented", piFieldMatch.type()));
|
||||
@ -422,9 +414,6 @@ final class TableEntryEncoder {
|
||||
ImmutableByteSequence rangeHighValue = copyFrom(rangeFieldMatch.getHigh().asReadOnlyByteBuffer());
|
||||
ImmutableByteSequence rangeLowValue = copyFrom(rangeFieldMatch.getLow().asReadOnlyByteBuffer());
|
||||
return new PiRangeFieldMatch(headerFieldId, rangeLowValue, rangeHighValue);
|
||||
case VALID:
|
||||
FieldMatch.Valid validFieldMatch = fieldMatchMsg.getValid();
|
||||
return new PiValidFieldMatch(headerFieldId, validFieldMatch.getValue());
|
||||
default:
|
||||
throw new EncodeException(format(
|
||||
"Decoding of field match type '%s' not implemented", typeCase.name()));
|
||||
|
||||
@ -18,17 +18,17 @@ package org.onosproject.p4runtime.ctl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import p4.P4RuntimeGrpc;
|
||||
import p4.P4RuntimeOuterClass;
|
||||
import p4.P4RuntimeOuterClass.GetForwardingPipelineConfigRequest;
|
||||
import p4.P4RuntimeOuterClass.GetForwardingPipelineConfigResponse;
|
||||
import p4.P4RuntimeOuterClass.ReadRequest;
|
||||
import p4.P4RuntimeOuterClass.ReadResponse;
|
||||
import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
|
||||
import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigResponse;
|
||||
import p4.P4RuntimeOuterClass.StreamMessageResponse;
|
||||
import p4.P4RuntimeOuterClass.WriteRequest;
|
||||
import p4.P4RuntimeOuterClass.WriteResponse;
|
||||
import p4.v1.P4RuntimeGrpc;
|
||||
import p4.v1.P4RuntimeOuterClass;
|
||||
import p4.v1.P4RuntimeOuterClass.GetForwardingPipelineConfigRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.GetForwardingPipelineConfigResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.ReadRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.ReadResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.StreamMessageResponse;
|
||||
import p4.v1.P4RuntimeOuterClass.WriteRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.WriteResponse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -45,12 +45,12 @@ 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.PiActionParam;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.P4RuntimeOuterClass.Entity;
|
||||
import p4.P4RuntimeOuterClass.Uint128;
|
||||
import p4.P4RuntimeOuterClass.Update;
|
||||
import p4.P4RuntimeOuterClass.WriteRequest;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
|
||||
import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
|
||||
import p4.v1.P4RuntimeOuterClass.Entity;
|
||||
import p4.v1.P4RuntimeOuterClass.Uint128;
|
||||
import p4.v1.P4RuntimeOuterClass.Update;
|
||||
import p4.v1.P4RuntimeOuterClass.WriteRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -66,8 +66,8 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
|
||||
import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.INSERT;
|
||||
import static p4.P4RuntimeOuterClass.Action;
|
||||
import static p4.P4RuntimeOuterClass.ReadResponse;
|
||||
import static p4.v1.P4RuntimeOuterClass.Action;
|
||||
import static p4.v1.P4RuntimeOuterClass.ReadResponse;
|
||||
|
||||
/**
|
||||
* Tests for P4 Runtime Action Profile Group support.
|
||||
|
||||
@ -36,8 +36,8 @@ import org.onosproject.net.pi.runtime.PiExactFieldMatch;
|
||||
import org.onosproject.net.pi.runtime.PiMatchKey;
|
||||
import org.onosproject.net.pi.runtime.PiTableEntry;
|
||||
import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
|
||||
import p4.P4RuntimeOuterClass.Action;
|
||||
import p4.P4RuntimeOuterClass.TableEntry;
|
||||
import p4.v1.P4RuntimeOuterClass.Action;
|
||||
import p4.v1.P4RuntimeOuterClass.TableEntry;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@ -71,7 +71,6 @@ public class TableEntryEncoderTest {
|
||||
private static final String INGRESS_PORT = "ingress_port";
|
||||
private static final String ETHER_TYPE = "etherType";
|
||||
private static final String ECMP_GROUP_ID = "ecmp_group_id";
|
||||
private static final String ECMP_ACT_PROFILE = "ecmp_selector";
|
||||
|
||||
private final Random rand = new Random();
|
||||
private final URL p4InfoUrl = this.getClass().getResource("/test.p4info");
|
||||
|
||||
@ -47,20 +47,20 @@ import org.onosproject.net.pi.model.PiRegisterModel;
|
||||
import org.onosproject.net.pi.model.PiTableId;
|
||||
import org.onosproject.net.pi.model.PiTableModel;
|
||||
import org.onosproject.net.pi.model.PiTableType;
|
||||
import p4.config.P4InfoOuterClass;
|
||||
import p4.config.P4InfoOuterClass.Action;
|
||||
import p4.config.P4InfoOuterClass.ActionProfile;
|
||||
import p4.config.P4InfoOuterClass.ActionRef;
|
||||
import p4.config.P4InfoOuterClass.ControllerPacketMetadata;
|
||||
import p4.config.P4InfoOuterClass.Counter;
|
||||
import p4.config.P4InfoOuterClass.CounterSpec;
|
||||
import p4.config.P4InfoOuterClass.DirectCounter;
|
||||
import p4.config.P4InfoOuterClass.DirectMeter;
|
||||
import p4.config.P4InfoOuterClass.MatchField;
|
||||
import p4.config.P4InfoOuterClass.Meter;
|
||||
import p4.config.P4InfoOuterClass.MeterSpec;
|
||||
import p4.config.P4InfoOuterClass.P4Info;
|
||||
import p4.config.P4InfoOuterClass.Table;
|
||||
import p4.config.v1.P4InfoOuterClass;
|
||||
import p4.config.v1.P4InfoOuterClass.Action;
|
||||
import p4.config.v1.P4InfoOuterClass.ActionProfile;
|
||||
import p4.config.v1.P4InfoOuterClass.ActionRef;
|
||||
import p4.config.v1.P4InfoOuterClass.ControllerPacketMetadata;
|
||||
import p4.config.v1.P4InfoOuterClass.Counter;
|
||||
import p4.config.v1.P4InfoOuterClass.CounterSpec;
|
||||
import p4.config.v1.P4InfoOuterClass.DirectCounter;
|
||||
import p4.config.v1.P4InfoOuterClass.DirectMeter;
|
||||
import p4.config.v1.P4InfoOuterClass.MatchField;
|
||||
import p4.config.v1.P4InfoOuterClass.Meter;
|
||||
import p4.config.v1.P4InfoOuterClass.MeterSpec;
|
||||
import p4.config.v1.P4InfoOuterClass.P4Info;
|
||||
import p4.config.v1.P4InfoOuterClass.Table;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -103,7 +103,6 @@ public final class P4InfoParser {
|
||||
|
||||
private static final Map<MatchField.MatchType, PiMatchType> MATCH_TYPE_MAP =
|
||||
new ImmutableMap.Builder<MatchField.MatchType, PiMatchType>()
|
||||
.put(MatchField.MatchType.VALID, PiMatchType.VALID)
|
||||
.put(MatchField.MatchType.EXACT, PiMatchType.EXACT)
|
||||
.put(MatchField.MatchType.LPM, PiMatchType.LPM)
|
||||
.put(MatchField.MatchType.TERNARY, PiMatchType.TERNARY)
|
||||
@ -211,7 +210,8 @@ public final class P4InfoParser {
|
||||
tableMsg.getSize(),
|
||||
tableCounterMapBuilder.build(),
|
||||
tableMeterMapBuilder.build(),
|
||||
tableMsg.getWithEntryTimeout(),
|
||||
!tableMsg.getIdleTimeoutBehavior()
|
||||
.equals(Table.IdleTimeoutBehavior.NO_TIMEOUT),
|
||||
tableFieldMapBuilder.build(),
|
||||
tableActionMapBuilder.build(),
|
||||
actionMap.get(tableMsg.getConstDefaultActionId()),
|
||||
@ -307,8 +307,7 @@ public final class P4InfoParser {
|
||||
return meterMap;
|
||||
}
|
||||
|
||||
private static Map<Integer, PiRegisterModel> parseRegisters(P4Info p4info)
|
||||
throws P4InfoParserException {
|
||||
private static Map<Integer, PiRegisterModel> parseRegisters(P4Info p4info) {
|
||||
final Map<Integer, PiRegisterModel> registerMap = Maps.newHashMap();
|
||||
for (P4InfoOuterClass.Register registerMsg : p4info.getRegistersList()) {
|
||||
registerMap.put(registerMsg.getPreamble().getId(),
|
||||
|
||||
@ -22,6 +22,7 @@ import com.google.protobuf.ExtensionRegistry;
|
||||
import com.google.protobuf.TextFormat;
|
||||
import org.hamcrest.collection.IsIterableContainingInAnyOrder;
|
||||
import org.hamcrest.collection.IsIterableContainingInOrder;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.onosproject.net.pi.model.PiActionId;
|
||||
import org.onosproject.net.pi.model.PiActionModel;
|
||||
@ -40,22 +41,23 @@ import org.onosproject.net.pi.model.PiPacketOperationType;
|
||||
import org.onosproject.net.pi.model.PiPipelineModel;
|
||||
import org.onosproject.net.pi.model.PiTableId;
|
||||
import org.onosproject.net.pi.model.PiTableModel;
|
||||
import p4.config.P4InfoOuterClass.Table;
|
||||
import p4.config.P4InfoOuterClass.P4Info;
|
||||
import p4.config.P4InfoOuterClass.MatchField;
|
||||
import p4.config.P4InfoOuterClass.ActionRef;
|
||||
import p4.config.v1.P4InfoOuterClass.ActionRef;
|
||||
import p4.config.v1.P4InfoOuterClass.MatchField;
|
||||
import p4.config.v1.P4InfoOuterClass.P4Info;
|
||||
import p4.config.v1.P4InfoOuterClass.Table;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
||||
/**
|
||||
@ -69,8 +71,6 @@ public class P4InfoParserTest {
|
||||
private static final Long DEFAULT_MAX_TABLE_SIZE = 1024L;
|
||||
private static final Long DEFAULT_MAX_ACTION_PROFILE_SIZE = 64L;
|
||||
|
||||
public P4InfoParserTest() throws MalformedURLException { }
|
||||
|
||||
/**
|
||||
* Tests parse method.
|
||||
* @throws Exception if equality group objects dose not match as expected
|
||||
@ -116,15 +116,14 @@ public class P4InfoParserTest {
|
||||
List<PiMatchFieldModel> piMatchFieldList = new ArrayList<>();
|
||||
|
||||
for (MatchField matchFieldIter : matchFieldList) {
|
||||
int matchTypeNumber = matchFieldIter.getMatchType().getNumber();
|
||||
PiMatchType piMatchType = PiMatchType.VALID;
|
||||
switch (matchTypeNumber) {
|
||||
case 1: piMatchType = PiMatchType.VALID; break;
|
||||
case 2: piMatchType = PiMatchType.EXACT; break;
|
||||
case 3: piMatchType = PiMatchType.LPM; break;
|
||||
case 4: piMatchType = piMatchType.TERNARY; break;
|
||||
case 5: piMatchType = piMatchType.RANGE; break;
|
||||
default: piMatchType = PiMatchType.VALID; break;
|
||||
MatchField.MatchType matchType = matchFieldIter.getMatchType();
|
||||
PiMatchType piMatchType;
|
||||
switch (matchType) {
|
||||
case EXACT: piMatchType = PiMatchType.EXACT; break;
|
||||
case LPM: piMatchType = PiMatchType.LPM; break;
|
||||
case TERNARY: piMatchType = PiMatchType.TERNARY; break;
|
||||
case RANGE: piMatchType = PiMatchType.RANGE; break;
|
||||
default: Assert.fail(); return;
|
||||
}
|
||||
piMatchFieldList.add(new P4MatchFieldModel(PiMatchFieldId.of(matchFieldIter.getName()),
|
||||
matchFieldIter.getBitwidth(), piMatchType));
|
||||
|
||||
@ -5,18 +5,19 @@ include_defs(
|
||||
PROTOBUF_VER = '3.2.0'
|
||||
GRPC_VER = '1.3.1'
|
||||
|
||||
PI_COMMIT = '219b3d67299ec09b49f433d7341049256ab5f512'
|
||||
PI_COMMIT = '59c940916b4f5b182f33b4788d8c410972eaecce'
|
||||
PI_BASEURL = 'https://github.com/p4lang/PI.git'
|
||||
|
||||
# Wondering which .proto files to build? Check p4runtime's Makefile:
|
||||
# https://github.com/p4lang/PI/blob/master/proto/Makefile.am
|
||||
PROTO_SRCS = [
|
||||
'/proto/p4/p4types.proto',
|
||||
'/proto/p4/p4runtime.proto',
|
||||
'/proto/p4/config/p4info.proto',
|
||||
'/proto/p4/v1/p4runtime.proto',
|
||||
'/proto/p4/v1/p4data.proto',
|
||||
'/proto/p4/config/v1/p4info.proto',
|
||||
'/proto/p4/config/v1/p4types.proto',
|
||||
'/proto/p4/tmp/p4config.proto',
|
||||
'/proto/google/rpc/status.proto',
|
||||
'/proto/google/rpc/code.proto',
|
||||
'/proto/p4/tmp/p4config.proto',
|
||||
]
|
||||
|
||||
COMPILE_DEPS =[
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
set -e
|
||||
|
||||
BUILD_DIR=~/p4tools
|
||||
BMV2_COMMIT="7e25eeb19d01eee1a8e982dc7ee90ee438c10a05"
|
||||
PI_COMMIT="219b3d67299ec09b49f433d7341049256ab5f512"
|
||||
P4C_COMMIT="48a57a6ae4f96961b74bd13f6bdeac5add7bb815"
|
||||
BMV2_COMMIT="ed130d01be985d814c17de949839d484e76400b1"
|
||||
PI_COMMIT="59c940916b4f5b182f33b4788d8c410972eaecce"
|
||||
P4C_COMMIT="618d15155dcc2d784cc14a8e83131b407cf893e2"
|
||||
PROTOBUF_COMMIT="tags/v3.2.0"
|
||||
GRPC_COMMIT="tags/v1.3.2"
|
||||
LIBYANG_COMMIT="v0.14-r1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user