Question

How to find the routes adhering to a particular pattern?



Solution

Routes are attached with multiple community values.

This article provides examples to find the routes adhering to a particular pattern. 

 

Example Communities

100:1, 200:11, 400:11, 400:12, 400:10, 500:11, 500:12 


Case 1

Match all routes with any one of these communities:

400:11, 400:12, 500:11, 500:12


Following is the configuration:

% set routing-instances mgmt protocols bgp 1 routing-peer-policy p1 term t1 match community "(^|,)(([0-9]*:11)|([0-9]*:12))($|,)"

 OR

% set routing-instances mgmt protocols bgp 1 routing-peer-policy p1 term t1 match community "(^|,)(((400|500):11)|((400|500):12))($|,)"


Case 2

Match all routes with any one of these communities:

400:11, 400:12, 400:10


Following is the configuration:

% set routing-instances mgmt protocols bgp 1 routing-peer-policy p1 term t1 match community "(^|,)(400:(10|11|12))($|,)"