Closed anubhavnidhi closed 9 years ago
Hi,
I think you just forgot the quotes: h = HLIR("tests/stateful.p4")
Also, note that when you start in shell mode like this, the HLIR object h has already been built for you, as you can tell by the output: "HLIR successfully constructed, access with variable 'h'". Which means you can directly access the HLIR objects:
antonin@antonin-torpille:~/Documents/Barefoot/p4lang/p4-hlir$ p4-shell simple_router.p4
WARNING: No error rule is defined for exclusive state 'pragma'
WARNING: Token 'DIVIDE' defined, but not used
WARNING: Token 'PPHASH' defined, but not used
WARNING: Token 'MOD' defined, but not used
WARNING: There are 3 unused tokens
parsing successful
semantic checking successful
Header type standard_metadata_t not byte-aligned, adding padding
validating: True
validating: True
validating: True
validating: True
HLIR successfully constructed, access with variable 'h'
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> for header in h.p4_header_instances: print header
...
standard_metadata
ethernet
ipv4
routing_metadata
>>>
Hi, Thanks for the reply. Ihad a few more questions on p4
Thanks
Hi, I tried the instruction given in your README file and was able to do the steps till "h = HLIR()". But when I try this instruction I get a "NameError". I am attaching the output which I get when following the instruction below
Do you know what changes I need to do to make it work?
Thanks.