1 /* Sample P4 program */ 2 header_type ethernet_t { 3 fields { 4 dstAddr : 48; 5 srcAddr : 48; 6 etherType : 16; 7 } 8 } 9 10 parser start { 11 return parse_ethernet; 12 } 13 14 header ethernet_t ethernet; 15 16 parser parse_ethernet { 17 extract(ethernet); 18 return ingress; 19 } 20 21 action action_0(){ 22 no_op(); 23 } 24 25 table table_0 { 26 reads { 27 ethernet.etherType : exact; 28 } 29 actions { 30 action_0; 31 } 32 } 33 34 control ingress { 35 apply(table_0); 36 } 37