blob: f64592201d32070c1b681a68c89c6caa5a7ad3f6 [file] [log] [blame]
Carmelo Casconec8d34862017-07-30 00:48:23 -04001/*
2 * Copyright 2017-present Open Networking Laboratory
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 Tseng21629932017-06-06 11:17:43 -070017#include <core.p4>
18#include <v1model.p4>
19
20struct dummy_t {
21 bit<8> dummyField;
22}
23
Carmelo Cascone837e6452017-07-19 20:35:22 -040024struct metadata_t {
Yi Tseng21629932017-06-06 11:17:43 -070025 dummy_t dummy_metadata;
26}
27
Carmelo Cascone837e6452017-07-19 20:35:22 -040028struct headers_t {
Yi Tseng21629932017-06-06 11:17:43 -070029}
30
Carmelo Cascone837e6452017-07-19 20:35:22 -040031parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
Yi Tseng21629932017-06-06 11:17:43 -070032 state start {
33 transition accept;
34 }
35}
36
Carmelo Cascone837e6452017-07-19 20:35:22 -040037control ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
Yi Tseng21629932017-06-06 11:17:43 -070038 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 Cascone837e6452017-07-19 20:35:22 -040054control egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
Yi Tseng21629932017-06-06 11:17:43 -070055 apply {
56 // Nothing to do
57 }
58}
59
Carmelo Cascone837e6452017-07-19 20:35:22 -040060control DeparserImpl(packet_out packet, in headers_t hdr) {
Yi Tseng21629932017-06-06 11:17:43 -070061 apply {
62 // Nothing to do
63 }
64}
65
Carmelo Cascone837e6452017-07-19 20:35:22 -040066control verifyChecksum(in headers_t hdr, inout metadata_t meta) {
Yi Tseng21629932017-06-06 11:17:43 -070067 apply {
68 // Nothing to do
69 }
70}
71
Carmelo Cascone837e6452017-07-19 20:35:22 -040072control computeChecksum(inout headers_t hdr, inout metadata_t meta) {
Yi Tseng21629932017-06-06 11:17:43 -070073 apply {
74 // Nothing to do
75 }
76}
77
78V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;