Hi Ole, Currently I have below issue as describe in your https://gerrit.fd.io/r/#/c/19389/,
""" An IPv4 or IPv6 address was previously defined like: ``` u8 is_ip6; u8 address[16]; ``` Which made it hard for language bindings to represent the address as anything but a byte string. The new explicit address types are shown above. """ I bumped into ip address defined like above, then what is the correct way to pass ip address to python api ? I tried below way, but it seems that is not corrent, vip_addr = ''.join(list(inet_pton(AF_INET, '90.1.2.1'))) pass `vip_addr` to a python api that need ip address, I can not get the correct result. Best Regards Yulong Pei -----Original Message----- From: vpp-dev@lists.fd.io [mailto:vpp-dev@lists.fd.io] On Behalf Of Ole Troan Sent: Wednesday, May 8, 2019 4:45 PM To: Pei, Yulong <yulong....@intel.com> Cc: vpp-dev@lists.fd.io; csit-...@lists.fd.io; Ni, Hongjun <hongjun...@intel.com>; Liu, Yu Y <yu.y....@intel.com>; Kinsella, Ray <ray.kinse...@intel.com> Subject: Re: [vpp-dev] [csit-dev] how to know data type mapping between *.api.json with PYTHON API ? Hi again, > Thanks for you kindly help. Now I know the data type mapping, and I > have another question, When I pass parameters to a python api, the api > excuted successfully, no error reported, but the final result is not > what I want to get, So I want to debug to know where the issue existed, Does > python api have debug mode to step in an python api internal to know the > parameter that pass to the api is valid ? You can enable logging in the Python mode that gives quite a bit of information. Feel free to add to that btw. There is also API tracing on the VPP side you can enable. And of course you can run both the Python side and the VPP side in debuggers. But yes, any suggestions for how debuggability of developing new API messages are welcome. Cheers, Ole > -----Original Message----- > From: vpp-dev@lists.fd.io [mailto:vpp-dev@lists.fd.io] On Behalf Of > Ole Troan > Sent: Tuesday, May 7, 2019 3:20 PM > To: Pei, Yulong <yulong....@intel.com> > Cc: vpp-dev@lists.fd.io; csit-...@lists.fd.io; Ni, Hongjun > <hongjun...@intel.com>; Liu, Yu Y <yu.y....@intel.com>; Kinsella, Ray > <ray.kinse...@intel.com> > Subject: Re: [vpp-dev] [csit-dev] how to know data type mapping between > *.api.json with PYTHON API ? > > Hi Yulong, > > Good question. That has been on my list of things to document for a while. > Does > https://gerrit.fd.io/r/#/c/19389/ > > answer your question? > Please suggest improvements and improve the text as you notice gaps. > > Best regards, > Ole > > >> On 7 May 2019, at 07:49, Pei, Yulong <yulong....@intel.com> wrote: >> >> Hello vpp-dev & csit-dev, >> >> I have a question about how to know data type mapping between *.api.json >> with PYTHON API ? >> >> Let me use “./src/vnet/ip/ip.api” as example, as I know, vppapigen will >> autogenerate “ip.api.json” from “ip.api” >> >> And then vpp_papi can autogenerate its python api from “ip.api.json”, is >> there any way to know data type mapping between *.api.json with PYTHON API ? >> >> For example: >> >> In “./src/vnet/ip/ip.api”, >> >> define ip6_fib_details >> { >> u32 context; >> u32 table_id; >> u8 table_name[64]; >> u8 address_length; >> u8 address[16]; >> u32 count; >> u32 stats_index; >> vl_api_fib_path_t path[count]; >> }; >> >> Then in “ip.api.json”, I got, >> >> [ >> "ip6_fib_details", >> [ >> "u16", >> "_vl_msg_id" >> ], >> [ >> "u32", >> "context" >> ], >> [ >> "u32", >> "table_id" >> ], >> [ >> "u8", >> "table_name", >> 64 >> ], >> [ >> "u8", >> "address_length" >> ], >> [ >> "u8", >> "address", >> 16 >> ], >> [ >> "u32", >> "count" >> ], >> [ >> "u32", >> "stats_index" >> ], >> [ >> "vl_api_fib_path_t", >> "path", >> 0, >> "count" >> ], >> { >> "crc": "0xef11e94d" >> } >> ], >> >> My question is that which kind of python data type can be used to map below >> json types ? >> [ >> "u8", >> "table_name", >> 64 >> ], >> >> [ >> "u8", >> "address", >> 16 >> ], >> >> [ >> "vl_api_fib_path_t", >> "path", >> 0, >> "count" >> ], >> >> Best Regards >> Yulong Pei >> >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> >> View/Reply Online (#3484): >> https://lists.fd.io/g/csit-dev/message/3484 >> Mute This Topic: https://lists.fd.io/mt/31529209/675193 >> Group Owner: csit-dev+ow...@lists.fd.io >> Unsubscribe: https://lists.fd.io/g/csit-dev/unsub >> [otr...@employees.org] >> -=-=-=-=-=-=-=-=-=-=-=- >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12962): https://lists.fd.io/g/vpp-dev/message/12962 Mute This Topic: https://lists.fd.io/mt/31529576/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-