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

ListPath can filter VPNv4/v6 routes #2689

Merged
merged 3 commits into from
Sep 6, 2023

Conversation

horseinthesky
Copy link
Contributor

@horseinthesky horseinthesky commented Aug 24, 2023

  1. ListPath gRPC endpoint can now filter VPNv4/VPNv6 prefixes. All lookup options are supported.
  2. TableLookupPrefix proto message now has new rd (route distingusher) attribute. If empty it will look through all prefixes ignoring route distinguisher (see examples below).
  3. gobgp CLI can also use this feature.
  4. Tests for table.Select and new functions.

Examples
VPNv4 table

./gobgp global rib -a vpnv4
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.3/32   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 100:100:2.2.2.4/32   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 200:100:2.2.2.2/32   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 8732:2:3.3.3.3/32    [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 8732:2:2.2.2.6/32    [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 1.1.1.1:1:2.2.2.5/32 [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 300:100:2.2.2.2/32   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]
*> 100:100:2.2.2.2/32   [10]       0.0.0.0                                   00:33:14   [{Origin: ?}]

Lookup with RD
Exact

./gobgp global rib -a vpnv4 2.2.2.0/25 rd 100:100                 
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:34:56   [{Origin: ?}]

Longer

./gobgp global rib -a vpnv4 2.2.2.0/25 rd 100:100 longer-prefixes
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.3/32   [10]       0.0.0.0                                   00:35:09   [{Origin: ?}]
*> 100:100:2.2.2.4/32   [10]       0.0.0.0                                   00:35:09   [{Origin: ?}]
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:35:09   [{Origin: ?}]
*> 100:100:2.2.2.2/32   [10]       0.0.0.0                                   00:35:09   [{Origin: ?}]

Shorter

./gobgp global rib -a vpnv4 2.2.2.2/30 rd 100:100 shorter-prefixes
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:35:34   [{Origin: ?}]

Lookup without RD
Exact

./gobgp global rib -a vpnv4 2.2.2.2/32                            
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.2/32   [10]       0.0.0.0                                   00:35:54   [{Origin: ?}]
*> 200:100:2.2.2.2/32   [10]       0.0.0.0                                   00:35:54   [{Origin: ?}]
*> 300:100:2.2.2.2/32   [10]       0.0.0.0                                   00:35:54   [{Origin: ?}]

Longer

./gobgp global rib -a vpnv4 2.2.2.0/24 longer-prefixes            
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 1.1.1.1:1:2.2.2.5/32 [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 8732:2:2.2.2.6/32    [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 100:100:2.2.2.2/32   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 200:100:2.2.2.2/32   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 300:100:2.2.2.2/32   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 100:100:2.2.2.3/32   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]
*> 100:100:2.2.2.4/32   [10]       0.0.0.0                                   00:36:12   [{Origin: ?}]

Shorter

./gobgp global rib -a vpnv4 2.2.2.0/30 shorter-prefixes
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:2.2.2.0/25   [10]       0.0.0.0                                   00:36:31   [{Origin: ?}]

VPNv6 table

./gobgp global rib -a vpnv6                            
   Network                    Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100::/64           [10]       ::                                        00:37:02   [{Origin: ?}]
*> 100:100:100:1::/64         [10]       ::                                        00:37:02   [{Origin: ?}]
*> 100:100:100:2::/64         [10]       ::                                        00:37:02   [{Origin: ?}]
*> 200:100:100:2::/64         [10]       ::                                        00:37:02   [{Origin: ?}]
*> 300:100:100:2::/64         [10]       ::                                        00:37:02   [{Origin: ?}]
*> 100:100:100:3::/64         [10]       ::                                        00:37:02   [{Origin: ?}]
*> 100:100:100:3:100:100::/96 [10]       ::                                        00:37:02   [{Origin: ?}]

Lookup with RD
Exact

./gobgp global rib -a vpnv6 100:2::/64 rd 100:100   
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100:2::/64   [10]       ::                                        00:38:17   [{Origin: ?}]

Longer

./gobgp global rib -a vpnv6 100::/16 rd 100:100 longer-prefixes
   Network                    Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100:3::/64         [10]       ::                                        00:38:44   [{Origin: ?}]
*> 100:100:100:3:100:100::/96 [10]       ::                                        00:38:44   [{Origin: ?}]
*> 100:100:100::/64           [10]       ::                                        00:38:44   [{Origin: ?}]
*> 100:100:100:1::/64         [10]       ::                                        00:38:44   [{Origin: ?}]
*> 100:100:100:2::/64         [10]       ::                                        00:38:44   [{Origin: ?}]

Shorter

./gobgp global rib -a vpnv6 100:2::/96 rd 100:100 shorter-prefixes
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100:2::/64   [10]       ::                                        00:39:43   [{Origin: ?}]

Lookup without RD
Exact

./gobgp global rib -a vpnv6 100:2::/64                            
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 300:100:100:2::/64   [10]       ::                                        00:40:43   [{Origin: ?}]
*> 100:100:100:2::/64   [10]       ::                                        00:40:43   [{Origin: ?}]
*> 200:100:100:2::/64   [10]       ::                                        00:40:43   [{Origin: ?}]

Longer

./gobgp global rib -a vpnv6 100:3::/32 longer-prefixes
   Network                    Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100:3:100:100::/96 [10]       ::                                        00:41:36   [{Origin: ?}]
*> 100:100:100:3::/64         [10]       ::                                        00:41:36   [{Origin: ?}]

Shorter

./gobgp global rib -a vpnv6 100:2::/96 shorter-prefixes
   Network              Labels     Next Hop             AS_PATH              Age        Attrs
*> 100:100:100:2::/64   [10]       ::                                        00:42:25   [{Origin: ?}]
*> 200:100:100:2::/64   [10]       ::                                        00:42:25   [{Origin: ?}]
*> 300:100:100:2::/64   [10]       ::                                        00:42:25   [{Origin: ?}]

Invalid input
Using rd option with ipv4 family

./gobgp global rib -a ipv4 2.2.2.0/25 rd
route distinguisher is not applicable to "ipv4-unicast" family

Using rd options without a value

./gobgp global rib -a vpnv4 2.2.2.2/32 rd              
no route distinguisher value specified

Using rd option and invalid value

./gobgp global rib -a vpnv4 2.2.2.2/32 rd bla    
failed to parse RD "bla"

@horseinthesky
Copy link
Contributor Author

horseinthesky commented Sep 5, 2023

@fujita Hello. Could you pls take a look?

ListPath gRPC endpoint can filter VPNv4/VPNv6 prefixes. All lookup options are supported.
gobgp CLI can filter VPNv4/VPNv6 prefixes with or without rd.
@horseinthesky horseinthesky force-pushed the list-path-vpnv4/v6-filter branch from e17c143 to 155bc63 Compare September 6, 2023 08:16
@fujita fujita merged commit 155bc63 into osrg:master Sep 6, 2023
@fujita
Copy link
Member

fujita commented Sep 6, 2023

Thanks!

@horseinthesky horseinthesky deleted the list-path-vpnv4/v6-filter branch September 6, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants