Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 1 | #include <core.p4> |
| 2 | #include <v1model.p4> |
| 3 | |
| 4 | struct dummy_t { |
| 5 | bit<8> dummyField; |
| 6 | } |
| 7 | |
| 8 | struct metadata { |
| 9 | dummy_t dummy_metadata; |
| 10 | } |
| 11 | |
| 12 | struct headers { |
| 13 | } |
| 14 | |
| 15 | parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { |
| 16 | state start { |
| 17 | transition accept; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { |
| 22 | action dummy_action() { |
| 23 | meta.dummy_metadata.dummyField = 8w1; |
| 24 | } |
| 25 | table table0 { |
| 26 | actions = { |
| 27 | dummy_action; |
| 28 | } |
| 29 | key = { |
| 30 | meta.dummy_metadata.dummyField: exact; |
| 31 | } |
| 32 | } |
| 33 | apply { |
| 34 | table0.apply(); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { |
| 39 | apply { |
| 40 | // Nothing to do |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | control DeparserImpl(packet_out packet, in headers hdr) { |
| 45 | apply { |
| 46 | // Nothing to do |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | control verifyChecksum(in headers hdr, inout metadata meta) { |
| 51 | apply { |
| 52 | // Nothing to do |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | control computeChecksum(inout headers hdr, inout metadata meta) { |
| 57 | apply { |
| 58 | // Nothing to do |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main; |