Hi Ole,
On 06/12/2016, 10:25, "otr...@employees.org" <otr...@employees.org> wrote: >Neale, > >> What’s the best (i.e. least error prone) way to export enum values to the >> python API. >> >> For example; >> From l2/l2_vtr.h: >> >> /* VTR config options for API and CLI support */ >> typedef enum >> { >> … >> } l2_vtr_op_t; >> >> Is required for use in (from vpe.py) >> >> >> def l2_interface_vlan_tag_rewrite( >> sw_if_index, >> vtr_op, <<< >> <more args>): > > >I take it you want type checking? (otherwise you could just represent it as >u32). Type/value checking and more semantic meaning. So this; flags = VNET_GAME | VNET_SET | VNET_MATCH Not this; flags = 7 The latter is a bug, since VNET_MATCH = 8 ;) >vpe.py has gone by the way. > >Currently we got: > >.api definition file -> vppapigen -> .json >vpp_papi.py processes the .json file and dynamically creates new abstract data >types and function definitions. >currently only structs and function calls are supported. > >not a bad idea to add enums though. you want me to have a look at it, or would >you have a go? Could you please. I am a python n00b. Thanks, Neale > >Cheers, >Ole _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev