P4 Developer Day May 2019 (#252)

* Update user-bootstrap to use latest version (#251)

* p4c tests are failing in latest version. So, let's skip it during vagrant provisioning

* Update tutorial to use latest version of P4 tools

Modify switch.py to handle setting default_action
Use --p4runtime-files instead of deprecated --p4runtime-file and
--p4runtime-format flags
Provide standard_metadata for mark_to_drop

* Fix path for ECN exercise
This commit is contained in:
Nate Foster
2019-04-25 21:21:47 -04:00
committed by GitHub
parent 201fcf59a8
commit 01fc378076
50 changed files with 59 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -75,7 +75,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic.p4info",
"p4info": "build/basic.p4.p4info.txt",
"bmv2_json": "build/basic.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic.p4info",
"p4info": "build/basic.p4.p4info.txt",
"bmv2_json": "build/basic.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic.p4info",
"p4info": "build/basic.p4.p4info.txt",
"bmv2_json": "build/basic.json",
"table_entries": [
{

View File

@@ -87,7 +87,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -99,7 +99,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic_tunnel.p4info",
"p4info": "build/basic_tunnel.p4.p4info.txt",
"bmv2_json": "build/basic_tunnel.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic_tunnel.p4info",
"p4info": "build/basic_tunnel.p4.p4info.txt",
"bmv2_json": "build/basic_tunnel.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/basic_tunnel.p4info",
"p4info": "build/basic_tunnel.p4.p4info.txt",
"bmv2_json": "build/basic_tunnel.json",
"table_entries": [
{

View File

@@ -103,7 +103,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -91,7 +91,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/ecn.p4info",
"p4info": "build/ecn.p4.p4info.txt",
"bmv2_json": "build/ecn.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/ecn.p4info",
"p4info": "build/ecn.p4.p4info.txt",
"bmv2_json": "build/ecn.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/ecn.p4info",
"p4info": "build/ecn.p4.p4info.txt",
"bmv2_json": "build/ecn.json",
"table_entries": [
{

View File

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

View File

@@ -89,7 +89,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -99,7 +99,7 @@ control MyIngress(inout headers hdr,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action set_ecmp_select(bit<16> ecmp_base, bit<32> ecmp_count) {
/* TODO: hash on 5-tuple and save the hash result in meta.ecmp_select
@@ -151,7 +151,7 @@ control MyEgress(inout headers hdr,
hdr.ethernet.srcAddr = smac;
}
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
table send_frame {
key = {

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/load_balance.p4info",
"p4info": "build/load_balance.p4.p4info.txt",
"bmv2_json": "build/load_balance.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/load_balance.p4info",
"p4info": "build/load_balance.p4.p4info.txt",
"bmv2_json": "build/load_balance.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/load_balance.p4info",
"p4info": "build/load_balance.p4.p4info.txt",
"bmv2_json": "build/load_balance.json",
"table_entries": [
{

View File

@@ -99,7 +99,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action set_ecmp_select(bit<16> ecmp_base, bit<32> ecmp_count) {
hash(meta.ecmp_select,
@@ -158,7 +158,7 @@ control MyEgress(inout headers hdr,
hdr.ethernet.srcAddr = smac;
}
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
table send_frame {
key = {

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -161,7 +161,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/mri.p4info",
"p4info": "build/mri.p4.p4info.txt",
"bmv2_json": "build/mri.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/mri.p4info",
"p4info": "build/mri.p4.p4info.txt",
"bmv2_json": "build/mri.json",
"table_entries": [
{

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/mri.p4info",
"p4info": "build/mri.p4.p4info.txt",
"bmv2_json": "build/mri.json",
"table_entries": [
{

View File

@@ -153,7 +153,7 @@ control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -108,7 +108,7 @@ control MyIngress(inout headers hdr,
counter(MAX_TUNNEL_ID, CounterType.packets_and_bytes) egressTunnelCounter;
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {

View File

@@ -190,7 +190,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description='P4Runtime Controller')
parser.add_argument('--p4info', help='p4info proto in text format from p4c',
type=str, action="store", required=False,
default='./build/advanced_tunnel.p4info')
default='./build/advanced_tunnel.p4.p4info.txt')
parser.add_argument('--bmv2-json', help='BMv2 JSON file from p4c',
type=str, action="store", required=False,
default='./build/advanced_tunnel.json')

View File

@@ -215,7 +215,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description='P4Runtime Controller')
parser.add_argument('--p4info', help='p4info proto in text format from p4c',
type=str, action="store", required=False,
default='./build/advanced_tunnel.p4info')
default='./build/advanced_tunnel.p4.p4info.txt')
parser.add_argument('--bmv2-json', help='BMv2 JSON file from p4c',
type=str, action="store", required=False,
default='./build/advanced_tunnel.json')

View File

@@ -1,5 +1,5 @@
BMV2_SWITCH_EXE = simple_switch_grpc
NO_P4 = true
P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
P4C_ARGS = --p4runtime-files $(basename $@).p4.p4info.txt
include ../../utils/Makefile

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/source_routing.p4info",
"p4info": "build/source_routing.p4.p4info.txt",
"bmv2_json": "build/source_routing.json",
"table_entries": [ ]
}

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/source_routing.p4info",
"p4info": "build/source_routing.p4.p4info.txt",
"bmv2_json": "build/source_routing.json",
"table_entries": [ ]
}

View File

@@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/source_routing.p4info",
"p4info": "build/source_routing.p4.p4info.txt",
"bmv2_json": "build/source_routing.json",
"table_entries": [ ]
}

View File

@@ -106,7 +106,7 @@ control MyIngress(inout headers hdr,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action srcRoute_nhop() {

View File

@@ -110,7 +110,7 @@ control MyIngress(inout headers hdr,
inout standard_metadata_t standard_metadata) {
action drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
action srcRoute_nhop() {