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

PIM: Implement AutoRP functionality #16634

Merged
merged 6 commits into from
Sep 24, 2024
Merged

Conversation

nabahr
Copy link
Contributor

@nabahr nabahr commented Aug 22, 2024

This adds most of the AutoRP functionality to PIMD for dynamic RP support using the AutoRP protocol.
RP Discovery is supported and is enabled by default. To disable AutoRP discovery:

router pim [vrf NAME]
  no autorp discovery

When discovery is enabled, we will listen for the AutoRP Discovery message sent by the AutoRP mapping agent and we will use the discovered RP information.

AutoRP announcement support is also implemented. To configure PIM to advertise a candidate RP via AutoRP:

router pim [vrf NAME]
  autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
  autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}

The RP advertisement can default to all multicast (224.0.0.0/4), a specific range (225.0.0.0/24), or specified in a prefix list.
The specifics of the announcement messages sent can be configured with the second command. The scope sets the TTL of the packet, the interval sets how often the packet is sent, and the hold time sets the hold time used in the packet, i.e. how long the information in the packet is considered valid (0=disabled).

The only part of AutoRP not yet implemented is the AutoRP mapping agent.

Show information available with:
show ip pim [vrf NAME] autorp [json]
This will display state of AutoRP discovery (enabled/disabled) and the configured candidate RP's for AutoRP.
The existing show ip rp-info command will display RP's learned via AutoRP.

Resources used for reference during development:
https://github.com/troglobit/pimd/blob/master/doc/pim-autorp-spec01.txt
https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipmulti_pim/configuration/imc-pim-xe-3e/imc_autorp.html
https://www.cisco.com/c/en/us/support/docs/ip/multicast/118405-config-rp-00.html

@frrbot frrbot bot added documentation pim tests Topotests, make check, etc yang labels Aug 22, 2024
@nabahr nabahr force-pushed the autorp branch 4 times, most recently from 1902f6d to e4a3784 Compare August 23, 2024 02:50
@nabahr nabahr force-pushed the autorp branch 3 times, most recently from f6bd605 to ff67de5 Compare August 27, 2024 13:27
@mobash-rasool mobash-rasool self-requested a review August 28, 2024 04:25
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

pimd/pim_autorp.c Outdated Show resolved Hide resolved
@donaldsharp
Copy link
Member

I'm a bit grumpy about the fact that we have basically 3k lines of diff in one big patch. What can be done to break this up into smaller logical commits? As it stands it is almost impossible to review given the way it is written.

@nabahr nabahr force-pushed the autorp branch 3 times, most recently from b4b9158 to 8a54168 Compare September 17, 2024 03:13
@nabahr
Copy link
Contributor Author

nabahr commented Sep 17, 2024

I'm a bit grumpy about the fact that we have basically 3k lines of diff in one big patch. What can be done to break this up into smaller logical commits? As it stands it is almost impossible to review given the way it is written.

The original PR split commits between the implementation of discovery and announcements, but the addition of announcements ended up rewriting parts of the discovery implementation making a review of each commit difficult so I've combined those separate commits and then split that up between the CLI/NB implementation and the actual feature implementation. This splits the size of the change roughly in half. I could try to further decompose the feature implementation but keeping each commit building error free and not adding potential runtime issues to the daemon more difficult.

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, just waiting on comments from other reviewers

pimd/pim_cmd.c Outdated Show resolved Hide resolved
pimd/pim_cmd.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
pimd/pim_autorp.c Outdated Show resolved Hide resolved
Copy link
Member

@donaldsharp donaldsharp left a comment

Choose a reason for hiding this comment

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

I'm not a fan of negative numbers for success and 0 for failure. Especially when all that is ever done is did this function succeed fail. In addition by not testing for negative numbers for success the if statements just looking at them in a vacumn really looks like the function failed. Please go through and use bool to indicate success/failure and have the functions test appropriately where used.

@nabahr
Copy link
Contributor Author

nabahr commented Sep 17, 2024

No argument on the failure checking. I've refactored it to make more sense.
I also fixed the PIM version checking TODO's that got overlooked.
@Jafaral also asked me to enable AutoRP discovery by default, which matches the behavior of Cisco. This caused a few problems with existing PIM tests so I fixed those in an extra commit.

@nabahr nabahr requested a review from donaldsharp September 18, 2024 02:14
@nabahr nabahr force-pushed the autorp branch 2 times, most recently from 656d150 to 5ac93a9 Compare September 18, 2024 19:44
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.

changes look good ... waiting on blockers to be cleared and ci to pass

@Jafaral
Copy link
Member

Jafaral commented Sep 24, 2024

changes look good ... waiting on blockers to be cleared and ci to pass

passed CI actually.

Perform AutoRP discovery and candidate RP announcements using the
AutoRP protocol.
Mapping agent is not yet implemented, but this feature is not
necessary for FRR to support AutoRP as we only need one AutoRP
mapping agent in the network.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
New CLI commands added:
router pim [vrf NAME]
  autorp discovery
  autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
  autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}

autorp discovery
  Enables Auto RP discovery for learning dynamic RP information using the
  AutoRP protocol.

autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
  Enable announcements of a candidate RP with the given group range, or
  prefix list of group ranges, to an AutoRP mapping agent.

autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}
  Configure the parameters of the AutoRP announcement messages.
  The scope sets the packet TTL.
  The interval sets the time between TX of announcements.
  The holdtime sets the hold time in the message, the time the mapping
  agent should wait before invalidating the candidate RP information.

debug pim autorp
  Enable debug logging of the AutoRP protocol

show ip pim [vrf NAME] autorp [json]
  Show details of the AutoRP protocol.
  To view learned RP info, use the existing command 'show ip pim rp-info'

Extend pim yang for new configuration:
  augment /frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/frr-pim:pim/frr-pim:address-family:
    +--rw rp
       +--rw auto-rp
          +--rw discovery-enabled?   boolean
          +--rw announce-scope?      uint8
          +--rw announce-interval?   uint16
          +--rw announce-holdtime?   uint16
          +--rw candidate-rp-list* [rp-address]
             +--rw rp-address           inet:ip-address
             +--rw (group-or-prefix-list)?
                +--:(group)
                |  +--rw group?         frr-route-types:ip-multicast-group-prefix
                +--:(prefix-list)
                   +--rw prefix-list?   plist-ref

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Document the CLI commands to configure AutoRP discovery
and candidate RP announcements.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Uses hardcoded sample AutoRP packets injected in to test
message parsing and proper application of AutoRP learned
RP info. Tests mix of AutoRP and static RP's.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
With AutoRP discovery running by default, that adds a new
IGMP group that needs to be accounted for in IGMP output.

For multicast_pim_sm_topo3:
  Ignore the total group number as it is unnecessary for the test.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
With AutoRP discovery running by default, that adds a new
IGMP group that needs to be accounted for in IGMP output.

For pim.py
  The clear IGMP interfaces function is in a broken state. It was
  already ignoring any errors and returned true always, but with
  the addition of the AutoRP discovery group, you could end up
  with a different group order in the json which would cause a key
  error making the test fail. For now I just added a check to
  avoid the key error.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
@donaldsharp
Copy link
Member

Why no testing of sending announcements? Basically in pim_autorp.c lines 531 - 890 are not even called. Pim code coverage actually goes down from 54.0% line coverage -> 53.3 % and function coverage is from 63.5% -> 63.0

Large swaths of cli that are added are not exercised at all as well.

@nabahr
Copy link
Contributor Author

nabahr commented Sep 24, 2024

Why no testing of sending announcements? Basically in pim_autorp.c lines 531 - 890 are not even called. Pim code coverage actually goes down from 54.0% line coverage -> 53.3 % and function coverage is from 63.5% -> 63.0

Large swaths of cli that are added are not exercised at all as well.

Manual testing of the announcement messages was done using packet dumps during topotest, but without an AutoRP mapping agent running in the test, the only other way to automate it in topotest would require raw captures to validate the packet data. I couldn't find any examples of other tests that do this or any documentation on how to do this in topotest.

Completing the AutoRP mapping agent is on the agenda and will be added soon but it is a lower priority at this moment.
Once that implementation is done, these tests will be fully flushed out.

@donaldsharp donaldsharp merged commit c0ccf38 into FRRouting:master Sep 24, 2024
11 checks passed
@nabahr nabahr deleted the autorp branch September 25, 2024 20:26
Jafaral added a commit that referenced this pull request Nov 12, 2024
New Features Highlight:

- PIM candidate BSR/RP [#16438]
- Static IGMP join without an IGMP report [1#6450]
- PIM AutoRP discovery/announcements [#16634]
- IGMP proxy [#16861]
- SRv6 SID Manager [#15604]
- Add `bgp ipv6-auto-ra` command [#16354]
- Implement `neighbor x remote-as auto` for BGP [#16345]
- Implement `bgp dual-as` for BGP [#16816]
- Implement BGP-wide configuration for graceful restart [#16099]
- Handle kernel routes appropriately (should fix recent NOPREFIXROUTE issue) [#16300]
- Add `cisco-authentication` password support for NHRP [#16172]

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants