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

ospfd: Add Opaque LSA decoder for json output #15042

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

odd22
Copy link
Member

@odd22 odd22 commented Dec 19, 2023

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:

  • Traffic Engineering (Type 1)
  • Router Information (Type 4) including PCE and Segment Routing information
  • Inter-domain Link (Type 6)
  • Extended Prefix (Type 7)
  • Extended Link (Type 8)

Copy link
Member

@ton31337 ton31337 left a 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",
Copy link
Member

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).

Copy link
Member Author

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",
Copy link
Member

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.

Copy link
Member Author

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",
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@frrbot frrbot bot added the tests Topotests, make check, etc label Dec 21, 2023
Copy link
Member

@riw777 riw777 left a 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",
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member

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 ...

Copy link
Member Author

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.

@riw777
Copy link
Member

riw777 commented Jan 9, 2024

Waiting on @ton31337 's comments to finish this one up.

Copy link
Contributor

@choppsv1 choppsv1 left a 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?

@mwinter-osr
Copy link
Member

CI:rerun Retest for new ASAN Memory Leaks

@ton31337 ton31337 added this to the 10.0 milestone Jan 22, 2024
@odd22 odd22 force-pushed the ospf-te branch 2 times, most recently from 6908188 to 9136fcb Compare January 22, 2024 16:12
@github-actions github-actions bot added the rebase PR needs rebase label Jan 22, 2024
@odd22 odd22 removed size/XXL rebase PR needs rebase labels Jan 22, 2024
@odd22
Copy link
Member Author

odd22 commented Jan 22, 2024

Are these values covered by any existing IETF YANG draft or RFC?

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.

@choppsv1
Copy link
Contributor

choppsv1 commented Jan 22, 2024

Are these values covered by any existing IETF YANG draft or RFC?

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.

@donaldsharp donaldsharp self-assigned this Feb 6, 2024
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]>
@odd22
Copy link
Member Author

odd22 commented Feb 12, 2024

Are these values covered by any existing IETF YANG draft or RFC?

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.

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

@choppsv1 choppsv1 merged commit 7b94a92 into FRRouting:master Feb 13, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master ospf size/XXL tests Topotests, make check, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants