-
Notifications
You must be signed in to change notification settings - Fork 92
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
lldp: Simplify rust structs and serde #2479
Conversation
Skipping CI for Draft Pull Request. |
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
f4a3008
to
8983852
Compare
@cathay4t @ffmancera this is ready, the idea os to remove the serializer functions to make it more declarative and easier to the future golang generator to visit the AST. |
8983852
to
210cbfb
Compare
@cathay4t Maybe it make more sense to keep common attributes at a base struct ? like type, subtype and oui, it may also help with the ast parsin and golang generator. |
210cbfb
to
572a062
Compare
Since we are open to change the schema of LLDP query, I would like to propose: interfaces:
- name: eth2
type: ethernet
lldp:
enabled: true
neighbors:
- system-name: Summit300-48
system-description: Summit300-48 - Version 7.4e.1 (Build 5)
system-capabilities:
- MAC Bridge component
- Router
mac-address: 00:01:30:F9:AD:A0
interface-name: 1/1
vlans:
- name: v2-0488-03-0505
id: 488
mac-phy-conf:
autogeg: true
# TODO: https://www.iana.org/assignments/ianamau-mib/ianamau-mib
operational-mau-type: 100BASE-TX full duplex mode
# TODO: Convert this to human string base on IEEE 802.3ap
pmd-autoneg-cap: 27648
port-vlan-ids:
- 0
management-address:
- address: 00:01:30:F9:AD:A0
interface-number: 1001
max-frame-size: 1522 This means we are fully parsing LLDP into human friendly data. No more raw integer data in our schema. |
That's way better we don't need the enum either is a plain it can be struct with fields instead of a [][] of enum, that's way simpler. |
Is it worth it to apart from human readable forman have those as number, they are faster to compare and process in case of automation. |
@cathay4t @ffmancera I will put a different PR with proposed schema, we have more or less an ACK from k-nmstate users. |
@cathay4t @ffmancera at the end looks like we have big customers already consuming lldp neighbor as it is, so we cannot break it, let's just keep it and review this PR. |
acd6da5
to
1cf8d80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a typo on the commit message Currently the serialization/deserialization of LLDP attributes is done are serialization and deserialization functions.
1cf8d80
to
6ba7ef6
Compare
@ffmancera, fixed comments, can you review ? |
6ba7ef6
to
6628c06
Compare
Currently the serialization/deserialization of LLDP attributes is done using serialization and deserialization functions. This change move that to a more declarative way using some structs. This effort make easier to parse and understand the rust nmstate AST tree of the interface. Signed-off-by: Enrique Llorente <ellorent@redhat.com>
6628c06
to
06a9116
Compare
Currently the serialization/deserialization of LLDP attributes is done
using serialization and deserialization functions. This change move that
to a more declarative way using some structs.
This effort make easier to parse and understand the rust nmstate AST
tree of the interface.