-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ospfd: Add Opaque LSA decoder for json output #15042
Conversation
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
ospfd/ospf_te.c
Outdated
vty_out(vty, " Maximum Reservable Bandwidth: %g (Bytes/sec)\n", | ||
fval); | ||
else | ||
json_object_double_add(json, "maxReservableBandwidth", |
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.
nit: maximumReservableBandwidth
, as we have maximumBandwidth
(or use maxXX for both).
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.
Done
ospfd/ospf_te.c
Outdated
vty_out(vty, " Resource class/color: 0x%x\n", | ||
(uint32_t)ntohl(top->value)); | ||
else | ||
json_object_string_addf(json, "resClassColor", "0x%x", |
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.
resourceClassColor
maybe? Don't see a reason to shorten here.
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.
Done
ospfd/ospf_ri.c
Outdated
" Node Maximum Stack Depth = %d\n", | ||
msd->value); | ||
else | ||
json_object_int_add(json, "nodeMaximumSIDdepth", |
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.
According to our JSON convention it should be more like nodeMaximumSidDepth
.
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.
Done
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.
looks good
@@ -1684,7 +1694,9 @@ def _test_opaque_link_local_lsa_crash(tgen, apibin): | |||
"linkStateId": "230.0.0.1", | |||
"advertisingRouter": "1.0.0.0", | |||
"lsaSeqNumber": "80000001", | |||
"opaqueData": "feedaceecafebeef", | |||
"opaqueData": { | |||
"opaqueData": "feedaceecafebeef", |
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.
Just noticed, that this is a new commit since the last review. Is this supposed to be double-named? I mean opaqueData->opaqueData? Are there more fields under the first opaqueData?
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.
Yes and no. I use the generic key "opaqueData" to enclose all TLV carried by the Opaque LSA. Then, I discover that ospf client api uses also the generic term opaqueData.
To avoid this double name, let me know what do you prefer:
- uses "opaqueTLV" as top key for the Opaque Data
- replace the "opaqueData" key by the simple "data" key in ospf api client
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.
To me personally the first sounds better because it clearly explains what's behind it. And keeping just data
is too generic. What others think?
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.
I like the first better, as well ...
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.
I finally change for TLV but a little bit different from what I originally proposed. There is already opaqueType
and opaqueDataLenght
. Thus, I change for opaqueValues
(the V of TLV) and change opaqueDataLength
by opaqueLength
. Thus, we got the Type, Length and Values of the TLV encoding of Opaque LSA. I hope it is fine for you.
Waiting on @ton31337 's comments to finish this one up. |
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.
Are these values covered by any existing IETF YANG draft or RFC?
CI:rerun Retest for new ASAN Memory Leaks |
6908188
to
9136fcb
Compare
There is RFC8795 https://www.rfc-editor.org/rfc/rfc8795 but honestly, it is too complicated for us. This RFC defines the yang model for the complete Traffic Engineering topology, which is a super set of out IP traffic engineering. In addition, there is many many missing information (from OSPF point of view). And, in FRR, we use the camelCase convention while IETF use '-' dash-case convention. Thus, I don't know if we should follow IETF yang model. |
Pleaes read this: https://docs.frrouting.org/projects/dev-guide/en/latest/workflow.html#json-output You don't have to use the entire IETF model, but use the key names for sure, map as indicated. Our JSON does need to be backed by a model though. |
Instead of output bulk of data with json output, prepare json context to decode opaque TLVs and sub-TLVs. Signed-off-by: Olivier Dugeon <[email protected]>
When dumping ospf database with json output, decode Traffic Engineering TLVs and sub-TLVs. Signed-off-by: Olivier Dugeon <[email protected]>
When dumping ospf database with json output, decode Router Information TLVs and sub-TLVs. Signed-off-by: Olivier Dugeon <[email protected]>
When dumping ospf database with json output, decode Extended Link and Extended Prefix TLVs and sub-TLVs. Signed-off-by: Olivier Dugeon <[email protected]>
Following new json decoder for Opaque LSA, this patch adapts the ospfapiclient test to the new json output. Signed-off-by: Olivier Dugeon <[email protected]>
I just update the PR with various yang models I could find (both RFC and draft). However, there are not covered all TE convey in OSPF Opaque LSA. So, in this case, I keep what I proposed previously. @choppsv1 Let me know if it is OK for you |
When dumping OSPF database with json output, this PR add decoder for the various TLVs and sub-TLVs instead of dumping bulk of data. Supported Opaque LSA are: