-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for new platform property annotations for P4Runtime. (#4611)
* Add tentative support for new platform property annotations. * Format fix. * Add a test for the platform property annotation. * Fix minor bug causing double processing of platform_property annotation. * Update annotations to actually change new proto fields. * Adding back . * Add -f to mv command * Now trying -n * Strip prefix is now supposed to be fixed, so trying that. * Address comments.
- Loading branch information
1 parent
9aaa4bc
commit cc3a4a0
Showing
12 changed files
with
288 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2019-present Barefoot Networks, Inc. | ||
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. | ||
*/ | ||
|
||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
struct H { }; | ||
struct M { }; | ||
|
||
parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
state start { transition accept; } | ||
} | ||
|
||
control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { } | ||
}; | ||
|
||
control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { } | ||
}; | ||
|
||
control DeparserI(packet_out pk, in H hdr) { | ||
apply { } | ||
} | ||
|
||
control VerifyChecksumI(inout H hdr, inout M meta) { | ||
apply { } | ||
} | ||
|
||
control ComputeChecksumI(inout H hdr, inout M meta) { | ||
apply { } | ||
} | ||
|
||
|
||
@pkginfo( | ||
name = "some_name", | ||
organization = "some_org", | ||
version = "some_version", | ||
contact = "some_contact", | ||
url = "some_url" | ||
) | ||
@platform_property( | ||
multicast_group_table_size = 10, | ||
multicast_group_table_total_replicas = 20, | ||
multicast_group_table_max_replicas_per_entry = 30 | ||
) | ||
V1Switch(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), | ||
ComputeChecksumI(), DeparserI()) main; |
42 changes: 42 additions & 0 deletions
42
testdata/p4_16_samples_outputs/pkginfo_annotation-first.p4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <core.p4> | ||
#define V1MODEL_VERSION 20180101 | ||
#include <v1model.p4> | ||
|
||
struct H { | ||
} | ||
|
||
struct M { | ||
} | ||
|
||
parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserI(packet_out pk, in H hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control VerifyChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control ComputeChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
@pkginfo(name="some_name", organization="some_org", version="some_version", contact="some_contact", url="some_url") @platform_property(multicast_group_table_size = 10 , multicast_group_table_total_replicas = 20 , multicast_group_table_max_replicas_per_entry = 30) V1Switch<H, M>(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), ComputeChecksumI(), DeparserI()) main; |
42 changes: 42 additions & 0 deletions
42
testdata/p4_16_samples_outputs/pkginfo_annotation-frontend.p4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <core.p4> | ||
#define V1MODEL_VERSION 20180101 | ||
#include <v1model.p4> | ||
|
||
struct H { | ||
} | ||
|
||
struct M { | ||
} | ||
|
||
parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserI(packet_out pk, in H hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control VerifyChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control ComputeChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
@pkginfo(name="some_name", organization="some_org", version="some_version", contact="some_contact", url="some_url") @platform_property(multicast_group_table_size = 10 , multicast_group_table_total_replicas = 20 , multicast_group_table_max_replicas_per_entry = 30) V1Switch<H, M>(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), ComputeChecksumI(), DeparserI()) main; |
42 changes: 42 additions & 0 deletions
42
testdata/p4_16_samples_outputs/pkginfo_annotation-midend.p4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <core.p4> | ||
#define V1MODEL_VERSION 20180101 | ||
#include <v1model.p4> | ||
|
||
struct H { | ||
} | ||
|
||
struct M { | ||
} | ||
|
||
parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserI(packet_out pk, in H hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control VerifyChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control ComputeChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
@pkginfo(name="some_name", organization="some_org", version="some_version", contact="some_contact", url="some_url") @platform_property(multicast_group_table_size = 10 , multicast_group_table_total_replicas = 20 , multicast_group_table_max_replicas_per_entry = 30) V1Switch<H, M>(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), ComputeChecksumI(), DeparserI()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <core.p4> | ||
#define V1MODEL_VERSION 20180101 | ||
#include <v1model.p4> | ||
|
||
struct H { | ||
} | ||
|
||
struct M { | ||
} | ||
|
||
parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserI(packet_out pk, in H hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control VerifyChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control ComputeChecksumI(inout H hdr, inout M meta) { | ||
apply { | ||
} | ||
} | ||
|
||
@pkginfo(name="some_name", organization="some_org", version="some_version", contact="some_contact", url="some_url") @platform_property(multicast_group_table_size = 10 , multicast_group_table_total_replicas = 20 , multicast_group_table_max_replicas_per_entry = 30) V1Switch(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), ComputeChecksumI(), DeparserI()) main; |
Empty file.
3 changes: 3 additions & 0 deletions
3
testdata/p4_16_samples_outputs/pkginfo_annotation.p4.entries.txtpb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# proto-file: p4/v1/p4runtime.proto | ||
# proto-message: p4.v1.WriteRequest | ||
|
16 changes: 16 additions & 0 deletions
16
testdata/p4_16_samples_outputs/pkginfo_annotation.p4.p4info.txtpb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# proto-file: p4/config/v1/p4info.proto | ||
# proto-message: p4.config.v1.P4Info | ||
|
||
pkg_info { | ||
name: "some_name" | ||
version: "some_version" | ||
arch: "v1model" | ||
organization: "some_org" | ||
contact: "some_contact" | ||
url: "some_url" | ||
platform_properties { | ||
multicast_group_table_size: 10 | ||
multicast_group_table_total_replicas: 20 | ||
multicast_group_table_max_replicas_per_entry: 30 | ||
} | ||
} |