[P4-dev] p4_parse_states and branch_on with HLIR

hemant at mnkcg.com hemant at mnkcg.com
Thu Dec 8 19:07:03 EST 2016


This is the P4 code being tested in the p4-shell with the HLIR. 

 

header_type ethernet_t {

    fields {

        dstAddr : 48;

        srcAddr : 48;

        etherType : 16;

    }

}

 

header ethernet_t ethernet;

 

parser parse_ethernet {

    extract(ethernet);

    return select(latest.etherType) {

        0x800 : parse_ipv4;

        default: ingress;

    }

}

 

 

I see the code in p4_hlir/hlir/p4_parser.py related to branch_on.

 

For a parse_ethernet, I see the field_ref in the p4_parser.py code as
ethernet.etherType.   Why can't we make this field_ref available to the HLIR
user?  When I used the following in the p4-shell, I get a reference value
which gives me no clue that I have Ethernet.etherType.

 

>>> h.p4_parse_states.items()[1][1].branch_on

[<p4_hlir.hlir.p4_headers.p4_field object at 0x7f998d2854d0>]

 

Thanks,

 

Hemant

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161208/ff6d7b4e/attachment-0002.html>


More information about the P4-dev mailing list