Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix binary type representation #297

Merged

Conversation

fperrin
Copy link
Contributor

@fperrin fperrin commented Jul 9, 2023

Hi @xavier-contreras ; @JoseIgnacioTamayo

It's fantastic you've picked up maintenance for pyangbind! Thank you for stepping up. Now that pyangbind has a new lease of life, I'll submit a series of fixes as and when I clean them up for public consumption. If I can submit those changes in a way that make it easier for you to review, please tell me.

This first set included here fixes representation of the binary built-in type. It also fixes the unit-tests by pinning the version of YANG models to a known passing version. (In fact, my opinion is that the YANG models we use should be committed to the repo, instead of fetching them over the network on every run. I can make that change if you agree.) The UT pass on python3.9. I removed python2.7 as I'm pretty sure my usage of super() won't work there; I didn't actually run tox with python3.4 to 3.7

If there is interest, I can add GitHub actions to run the existing unit-tests on every PR.

@fperrin fperrin force-pushed the fred/fix-binary-type-representation branch from 10172ec to aa36926 Compare July 9, 2023 22:25
@JoseIgnacioTamayo
Copy link
Collaborator

Hi Frederic

Thanks for your contribution! Those unit tests needed a fix, by chance I also started taking a look last weekend.

I would suggest we keep this PR exclusively to fixing the tests, not changing Python versions. We are in the process of setting up GitHub Actions, which will take care of running the tests in several python versions.

@JoseIgnacioTamayo
Copy link
Collaborator

After a look at the changes files, I think we need to split it:

  • One PR would propose changes to the dealing with binary YANG (changes both the library and tests). I see we would be base64 encoding the binary.
  • A separate PR would take care of updating the OC models. I can take care of that. I think it is fine to track the latest OC models from the master branch (I cannot give a rational reason, it just feels itchy to let the code attached to some old branch of the OC repo).

Could you please reduce the scope of the PR to proposing changes to the way Binary values are treated?

@fperrin fperrin force-pushed the fred/fix-binary-type-representation branch from aa36926 to 3c8601c Compare July 11, 2023 09:49
@fperrin fperrin changed the title Fix unit-tests; fix binary type representation Fix binary type representation Jul 11, 2023
@fperrin
Copy link
Contributor Author

fperrin commented Jul 11, 2023

Hi,

Reduced the size of the MR to have only the fix to binary type representation

@fperrin
Copy link
Contributor Author

fperrin commented Jul 22, 2023

Hi,

Rebased after the recent improvements to the UT (good work @JoseIgnacioTamayo !).

Copy link
Collaborator

@xavier-contreras xavier-contreras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a couple of minor comments.

pyangbind/lib/serialise.py Show resolved Hide resolved
tests/base.py Outdated Show resolved Hide resolved
As described in RFC7959, section 9.8.2, values of the ``binary``
built-in type are represented with the base64 encoding scheme.
Encode / decode from that scheme on serialise/deserialise, and
use native ``bytes`` type for Python representation.
@fperrin fperrin force-pushed the fred/fix-binary-type-representation branch from 1ebca46 to 3ffe88e Compare July 24, 2023 09:41
@xavier-contreras xavier-contreras merged commit 9b5fb1e into robshakir:master Jul 27, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants