4 changed files with 133 additions and 1 deletions
@ -0,0 +1,48 @@
|
||||
{ |
||||
"program": "../p4src/wraptest.p4", |
||||
"switch": "simple_switch", |
||||
"compiler": "p4c", |
||||
"options": "--target bmv2 --arch v1model --std p4-16", |
||||
"switch_cli": "simple_switch_CLI", |
||||
"cli": true, |
||||
"pcap_dump": true, |
||||
"enable_log": true, |
||||
"topo_module": { |
||||
"file_path": "", |
||||
"module_name": "p4utils.mininetlib.apptopo", |
||||
"object_name": "AppTopoStrategies" |
||||
}, |
||||
"controller_module": null, |
||||
"topodb_module": { |
||||
"file_path": "", |
||||
"module_name": "p4utils.utils.topology", |
||||
"object_name": "Topology" |
||||
}, |
||||
"mininet_module": { |
||||
"file_path": "", |
||||
"module_name": "p4utils.mininetlib.p4net", |
||||
"object_name": "P4Mininet" |
||||
}, |
||||
"topology": { |
||||
"assignment_strategy": "l2", |
||||
"auto_arp_tables": false, |
||||
"links": [["h1", "s1"], ["h2", "s1"], ["h3", "s1"], ["h4","s1"]], |
||||
"hosts": { |
||||
"h1": { |
||||
}, |
||||
"h2": { |
||||
} |
||||
, |
||||
"h3": { |
||||
} |
||||
, |
||||
"h4": { |
||||
} |
||||
}, |
||||
"switches": { |
||||
"s1": { |
||||
"cpu_port" : true |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
/* -*- P4_16 -*- */ |
||||
#include <core.p4> |
||||
#include <v1model.p4> |
||||
|
||||
#include "headers.p4" |
||||
#include "parsers.p4" |
||||
|
||||
control MyIngress(inout headers hdr, |
||||
inout metadata meta, |
||||
inout standard_metadata_t standard_metadata) { |
||||
|
||||
/********************** APPLYING TABLES ***********************************/ |
||||
apply { |
||||
if(hdr.tcp.isValid()) { |
||||
/* test wrap around */ |
||||
hdr.tcp.checksum = 0xffff; |
||||
hdr.tcp.checksum = checksum + 2; |
||||
} |
||||
standard_metadata.egress_spec = 1; |
||||
} |
||||
} |
||||
|
||||
control MyEgress(inout headers hdr, |
||||
inout metadata meta, |
||||
inout standard_metadata_t standard_metadata) { |
||||
apply { |
||||
} |
||||
} |
||||
|
||||
control MyVerifyChecksum(inout headers hdr, inout metadata meta) { |
||||
apply {} |
||||
} |
||||
|
||||
|
||||
control MyComputeChecksum(inout headers hdr, inout metadata meta) { |
||||
apply {} |
||||
} |
||||
|
||||
/************************************************************************* |
||||
*********************** S W I T C H ******************************* |
||||
*************************************************************************/ |
||||
|
||||
V1Switch( |
||||
MyParser(), |
||||
MyVerifyChecksum(), |
||||
MyIngress(), |
||||
MyEgress(), |
||||
MyComputeChecksum(), |
||||
MyDeparser() |
||||
) main; |
Loading…
Reference in new issue