VPP API file parser/generator
Project description
VPPAPIGEN
VPPAPIGEN is a Python library for processing the FD.io VPP API grammar. This is a FORK of vppapigen of the FDIO VPP project.
Differences
- Cisco decided to redefine the CRC value of each api method to a manifest identifier. To make matters worse, they include no sort of signal to indicate that the value is tainted. They mark this within the api as [backward_compatible] for enum flags, since the size of a flag value does not actually change. However, they are applying [backward_compatible] to true enums.
- Cisco decided to introduce a flag day event without providing a signal of any sort as to whether it is a pre or post flag day value.
# keep the CRCs of the existing types of messages compatible with the # old "erroneous" way of calculating the CRC. For that - make a pointed # adjustment of the CRC function. # This is the purpose of the first element of the per-message dictionary. # The second element is there to avoid weakening the duplicate-detecting # properties of crc32. This way, if the new way of calculating the CRC # happens to collide with the old (buggy) way - we will still get # a different result and fail the comparison. fixup_crc_dict = { "abf_policy_add_del": {0xc6131197: 0xee66f93e}, "abf_policy_details": {0xb7487fa4: 0x6769e504}, "acl_add_replace": {0xee5c2f18: 0x1cabdeab}, "acl_details": {0x95babae0: 0x7a97f21c}, "macip_acl_add": {0xce6fbad0: 0xd648fd0a}, ...
- This is a python package. Cisco prefers to not make changes to the build system. See how to install it below.
- This version adds the version of the generator and the plugin.
- This version adds a vendor tag so that a client can determine whether the crc information is true.
Installation
Use the package manager pip to install vppapigen.
python3 -m pip [--user] install vppapigen
To build VPP with true api definitions, see example:
# which vppapigen
/home/pvinci/.local/bin/vppapigen
# ln -s ln -s /home/pvinci/.local/bin/vppapigen /vpp/src/tools/vppapigen/vppapigen
# cd /vpp
# make test
Usage
The stock version of vppapigen is called by cmake for each .api file in the source tree. This version can be directly imported in a python runner.
vppapigen can be loaded directly from within python. The basic gist is as follows:
import vppapigen
args.output = open(file=p, mode='w', encoding='UTF-8')
args.output_module = 'JSON'
vppapigen.main(args)
Contributing
It is my goal for all code be made part of VPP. These changes were submitted to Gerrit and it is my hope that Cisco integrates these changes into VPP.
Contributions are welcome. VPP code is maintained using gerrit at https://gerrit.fd.io/r/c/vpp My preference is for contributions to be provided to VPP. Once it is clear that it is their intention to block your submission, let me know
Please make sure to update tests as appropriate.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for vppapigen-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c0bc53f62989891009496480c5eddbf717fbfd99c4c6bc200db789437c4d8aa |
|
MD5 | d1cb5efe7a27fc369a92a25404b65638 |
|
BLAKE2b-256 | 109c7a5d5ee4b58b5c65317fb371a8167d22fc7892715f8501063381868bf158 |