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

[DOC] gRPC bad documentation examples #780

Closed
santos-j opened this issue Apr 4, 2023 · 2 comments
Closed

[DOC] gRPC bad documentation examples #780

santos-j opened this issue Apr 4, 2023 · 2 comments
Assignees

Comments

@santos-j
Copy link

santos-j commented Apr 4, 2023

Describe the bug
There seems to be an issue with the gRPC API wrapper in the latest version of CORE. More specifically, on the method that serializes Node objects to Protobuf.
The nodes wouldn't be correctly instantiated, so the sessions created via the gRPC API would be left hanging in the DEFINTION of CONFIGURATION states and didn't have links correctly set up. When following the CORE tutorials, I quickly faced this issue, and wasn' t able to run either the snippets online, or the available file examples.

To Reproduce
Steps to reproduce the behavior:

  1. Install CORE v9.0.2 from source on an Ubuntu 20.04
  2. Install protoc v3.19.0 (as per this link)
  3. Install EMANE v.1.3.3 from source
  4. Run the gRPC API CORE tutorials from the GitHub.IO page, e.g., the Switch example.

Expected behavior
Being able to run the example scripts and create sessions via the gRPC API -- the Python API was working flawlessly.

Screenshots
The first bug, when trying to serialize the node type to Protobuf:

screenshot_20230403_221222

Since the node type is an enum/integer, there no need for the .value method, so I dropped it and got a second error:

screenshot_20230403_221527

Weirdly enough, the Position object type should have a .to_proto method , but it wasn't being called. So I ... dropped the .to_proto(), et voila, everything working. I could verify this by opening the CORE GUI and being able to load the sessions created via gRPC:

screenshot_20230403_222022

I tested it with different Node types and positions... and everything seems to work perfectly. And without the aforementioned modifications, the sessions wouldn't be configured properly, the links between nodes wouldn't be correctly set up, and the sessions would be left in the DEFINITION or CONFIGURATION state. Whereas after my modifications, the gRPC API was able to start everything correctly and proceed to RUNTIME.

Desktop (please complete the following information):

  • OS: Ubuntu Server 20.04.5 LTS (cloud image)
  • CORE Version 9.0.2
  • EMANE Version 1.3.3

Additional context
You can find the diff of my changes here. If the CORE team confirms this is an issue, I can submit a PR with the fixes.

@santos-j santos-j added the bug label Apr 4, 2023
@santos-j
Copy link
Author

santos-j commented Apr 4, 2023

After testing other functions of CORE, it looks like the change in my previous comment does fix the gRPC API from Python, but then it breaks the CORE GUI. So please disregard it!

After investigating this matter a little more, it looks like the root cause of the problem were the gRPC examples incorrectly loading certain data classes and enums from the core_pb2 instead of the gRPC wrappers:

screenshot_20230404_105554

The first gRPC examples in the tutorial work great. But then, the following examples do this instead:

screenshot_20230404_105639

This import from NodeType and Position from the core_pb2 seem to evaluate the NodeType as an integer instead of an enum, and the Position as something that doesn't have the .to_proto method defined -- leading to the errors in my previous comment.

In short, gRPC API examples are not consistent, and over half of them will lead to the errors I found, due to the incorrect import of objects from the serialized protobuf object definition instead of the gRPC wrappers.

If the maintainers confirm this is a problem, I can submit fixes for both the GitHub.IO page and file examples.

@bharnden
Copy link
Contributor

Thanks for helping point out the documentation issues, I will take care of this.

@bharnden bharnden self-assigned this Apr 10, 2023
@bharnden bharnden changed the title [BUG] gRPC issue when serializing Nodes to Protobuf [DOC] gRPC bad documentation examples Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants