Carmelo Cascone | c8d3486 | 2017-07-30 00:48:23 -0400 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Carmelo Cascone | c8d3486 | 2017-07-30 00:48:23 -0400 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 17 | #include <core.p4> |
| 18 | #include <v1model.p4> |
| 19 | |
| 20 | struct dummy_t { |
| 21 | bit<8> dummyField; |
| 22 | } |
| 23 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 24 | struct metadata_t { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 25 | dummy_t dummy_metadata; |
| 26 | } |
| 27 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 28 | struct headers_t { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 29 | } |
| 30 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 31 | parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 32 | state start { |
| 33 | transition accept; |
| 34 | } |
| 35 | } |
| 36 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 37 | control ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 38 | action dummy_action() { |
| 39 | meta.dummy_metadata.dummyField = 8w1; |
| 40 | } |
| 41 | table table0 { |
| 42 | actions = { |
| 43 | dummy_action; |
| 44 | } |
| 45 | key = { |
| 46 | meta.dummy_metadata.dummyField: exact; |
| 47 | } |
| 48 | } |
| 49 | apply { |
| 50 | table0.apply(); |
| 51 | } |
| 52 | } |
| 53 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 54 | control egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 55 | apply { |
| 56 | // Nothing to do |
| 57 | } |
| 58 | } |
| 59 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 60 | control DeparserImpl(packet_out packet, in headers_t hdr) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 61 | apply { |
| 62 | // Nothing to do |
| 63 | } |
| 64 | } |
| 65 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 66 | control verifyChecksum(in headers_t hdr, inout metadata_t meta) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 67 | apply { |
| 68 | // Nothing to do |
| 69 | } |
| 70 | } |
| 71 | |
Carmelo Cascone | 837e645 | 2017-07-19 20:35:22 -0400 | [diff] [blame] | 72 | control computeChecksum(inout headers_t hdr, inout metadata_t meta) { |
Yi Tseng | 2162993 | 2017-06-06 11:17:43 -0700 | [diff] [blame] | 73 | apply { |
| 74 | // Nothing to do |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main; |