Routing Protocols

BGP Session Compatibility

Returns the compatibility of configured BGP sessions.

Checks the settings of each configured BGP peering and reports any issue with those settings locally or incompatiblity with its remote counterparts. Each row represents one configured BGP peering on a node and contains information about the session it is meant to establish. For dynamic peers, there is one row per compatible remote peer. Statuses that indicate an independently misconfigured peerings include NO_LOCAL_AS, NO_REMOTE_AS, NO_LOCAL_IP (for eBGP single-hop peerings), LOCAL_IP_UNKNOWN_STATICALLY (for iBGP or eBGP multi-hop peerings), NO_REMOTE_IP (for point-to-point peerings), and NO_REMOTE_PREFIX (for dynamic peerings). INVALID_LOCAL_IP indicates that the peering’s configured local IP does not belong to any active interface on the node; UNKNOWN_REMOTE indicates that the configured remote IP is not present in the network. A locally valid point-to-point peering is deemed HALF_OPEN if it has no compatible remote peers, UNIQUE_MATCH if it has exactly one compatible remote peer, or MULTIPLE_REMOTES if it has multiple compatible remote peers. A locally valid dynamic peering is deemed NO_MATCH_FOUND if it has no compatible remote peers, or DYNAMIC_MATCH if it has at least one compatible remote peer.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include sessions whose first node matches this specifier.

NodeSpec

True

remoteNodes

Include sessions whose second node matches this specifier.

NodeSpec

True

status

Only include sessions for which compatibility status matches this specifier.

BgpSessionCompatStatusSpec

True

type

Only include sessions that match this specifier.

BgpSessionTypeSpec

True

Invocation

[6]:
result = bfq.bgpSessionCompatibility().answer().frame()

Return Value

Name

Description

Type

Node

The node where this session is configured

str

VRF

The VRF in which this session is configured

str

Local_AS

The local AS of the session

int

Local_Interface

Local interface of the session

Interface

Local_IP

The local IP of the session

str

Remote_AS

The remote AS or list of ASes of the session

str

Remote_Node

Remote node for this session

str

Remote_Interface

Remote interface for this session

Interface

Remote_IP

Remote IP or prefix for this session

str

Address_Families

Address Families participating in this session

Set of str

Session_Type

The type of this session

str

Configured_Status

Configured status

str

Print the first 5 rows of the returned Dataframe

[7]:
result.head(5)
[7]:
Node VRF Local_AS Local_Interface Local_IP Remote_AS Remote_Node Remote_Interface Remote_IP Address_Families Session_Type Configured_Status
0 as1border1 default 1 None 1.1.1.1 1 as1core1 None 1.10.1.1 ['IPV4_UNICAST'] IBGP UNIQUE_MATCH
1 as1border1 default 1 None None 666 None None 3.2.2.2 [] EBGP_SINGLEHOP NO_LOCAL_IP
2 as1border1 default 1 None None 555 None None 5.6.7.8 [] EBGP_SINGLEHOP NO_LOCAL_IP
3 as1border1 default 1 None 10.12.11.1 2 as2border1 None 10.12.11.2 ['IPV4_UNICAST'] EBGP_SINGLEHOP UNIQUE_MATCH
4 as1border2 default 1 None 1.2.2.2 1 as1core1 None 1.10.1.1 ['IPV4_UNICAST'] IBGP UNIQUE_MATCH

Print the first row of the returned Dataframe

[8]:
result.iloc[0]
[8]:
Node                 as1border1
VRF                  default
Local_AS             1
Local_Interface      None
Local_IP             1.1.1.1
Remote_AS            1
Remote_Node          as1core1
Remote_Interface     None
Remote_IP            1.10.1.1
Address_Families     ['IPV4_UNICAST']
Session_Type         IBGP
Configured_Status    UNIQUE_MATCH
Name: 0, dtype: object

BGP Session Status

Returns the dynamic status of configured BGP sessions.

Checks whether configured BGP peerings can be established. Each row represents one configured BGP peering and contains information about the session it is configured to establish. For dynamic peerings, one row is shown per compatible remote peer. Possible statuses for each session are NOT_COMPATIBLE, ESTABLISHED, and NOT_ESTABLISHED. NOT_COMPATIBLE sessions are those where one or both peers are misconfigured; the BgpSessionCompatibility question provides further insight into the nature of the configuration error. NOT_ESTABLISHED sessions are those that are configured compatibly but will not come up because peers cannot reach each other (e.g., due to being blocked by an ACL). ESTABLISHED sessions are those that are compatible and are expected to come up.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include sessions whose first node matches this specifier.

NodeSpec

True

remoteNodes

Include sessions whose second node matches this specifier.

NodeSpec

True

status

Only include sessions for which status matches this specifier.

BgpSessionStatusSpec

True

type

Only include sessions that match this specifier.

BgpSessionTypeSpec

True

Invocation

[11]:
result = bfq.bgpSessionStatus().answer().frame()

Return Value

Name

Description

Type

Node

The node where this session is configured

str

VRF

The VRF in which this session is configured

str

Local_AS

The local AS of the session

int

Local_Interface

Local interface of the session

Interface

Local_IP

The local IP of the session

str

Remote_AS

The remote AS or list of ASes of the session

str

Remote_Node

Remote node for this session

str

Remote_Interface

Remote interface for this session

Interface

Remote_IP

Remote IP or prefix for this session

str

Address_Families

Address Families participating in this session

Set of str

Session_Type

The type of this session

str

Established_Status

Established status

str

Print the first 5 rows of the returned Dataframe

[12]:
result.head(5)
[12]:
Node VRF Local_AS Local_Interface Local_IP Remote_AS Remote_Node Remote_Interface Remote_IP Address_Families Session_Type Established_Status
0 as1border1 default 1 None 1.1.1.1 1 as1core1 None 1.10.1.1 ['IPV4_UNICAST'] IBGP ESTABLISHED
1 as1border1 default 1 None None 666 None None 3.2.2.2 [] EBGP_SINGLEHOP NOT_COMPATIBLE
2 as1border1 default 1 None None 555 None None 5.6.7.8 [] EBGP_SINGLEHOP NOT_COMPATIBLE
3 as1border1 default 1 None 10.12.11.1 2 as2border1 None 10.12.11.2 ['IPV4_UNICAST'] EBGP_SINGLEHOP ESTABLISHED
4 as1border2 default 1 None 1.2.2.2 1 as1core1 None 1.10.1.1 ['IPV4_UNICAST'] IBGP ESTABLISHED

Print the first row of the returned Dataframe

[13]:
result.iloc[0]
[13]:
Node                  as1border1
VRF                   default
Local_AS              1
Local_Interface       None
Local_IP              1.1.1.1
Remote_AS             1
Remote_Node           as1core1
Remote_Interface      None
Remote_IP             1.10.1.1
Address_Families      ['IPV4_UNICAST']
Session_Type          IBGP
Established_Status    ESTABLISHED
Name: 0, dtype: object

BGP Edges

Returns BGP adjacencies.

Lists all BGP adjacencies in the network.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include adjacencies whose first node matches this name or regex.

NodeSpec

True

.*

remoteNodes

Include adjacencies whose second node matches this name or regex.

NodeSpec

True

.*

Invocation

[16]:
result = bfq.bgpEdges().answer().frame()

Return Value

Name

Description

Type

Node

Node from which the edge originates

str

IP

IP at the side of originator

str

Interface

Interface at which the edge originates

str

AS_Number

AS Number at the side of originator

str

Remote_Node

Node at which the edge terminates

str

Remote_IP

IP at the side of the responder

str

Remote_Interface

Interface at which the edge terminates

str

Remote_AS_Number

AS Number at the side of responder

str

Print the first 5 rows of the returned Dataframe

[17]:
result.head(5)
[17]:
Node IP Interface AS_Number Remote_Node Remote_IP Remote_Interface Remote_AS_Number
0 as1border2 1.2.2.2 None 1 as1core1 1.10.1.1 None 1
1 as1core1 1.10.1.1 None 1 as1border1 1.1.1.1 None 1
2 as2dist2 2.1.3.2 None 2 as2core2 2.1.2.2 None 2
3 as3border2 3.2.2.2 None 3 as3core1 3.10.1.1 None 3
4 as3border1 10.23.21.3 None 3 as2border2 10.23.21.2 None 2

Print the first row of the returned Dataframe

[18]:
result.iloc[0]
[18]:
Node                as1border2
IP                  1.2.2.2
Interface           None
AS_Number           1
Remote_Node         as1core1
Remote_IP           1.10.1.1
Remote_Interface    None
Remote_AS_Number    1
Name: 0, dtype: object

OSPF Session Compatibility

Returns compatible OSPF sessions.

Returns compatible OSPF sessions in the network. A session is compatible if the interfaces involved are not shutdown and do run OSPF, are not OSPF passive and are associated with the same OSPF area.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include nodes matching this name or regex.

NodeSpec

True

remoteNodes

Include remote nodes matching this name or regex.

NodeSpec

True

statuses

Only include sessions matching this status specifier.

OspfSessionStatusSpec

True

Invocation

[21]:
result = bfq.ospfSessionCompatibility().answer().frame()

Return Value

Name

Description

Type

Interface

Interface

Interface

VRF

VRF

str

IP

Ip

str

Area

Area

int

Remote_Interface

Remote Interface

Interface

Remote_VRF

Remote VRF

str

Remote_IP

Remote IP

str

Remote_Area

Remote Area

int

Session_Status

Status of the OSPF session

str

Print the first 5 rows of the returned Dataframe

[22]:
result.head(5)
[22]:
Interface VRF IP Area Remote_Interface Remote_VRF Remote_IP Remote_Area Session_Status
0 as2core2[GigabitEthernet0/0] default 2.12.22.2 1 as2border2[GigabitEthernet1/0] default 2.12.22.1 1 ESTABLISHED
1 as2core2[GigabitEthernet1/0] default 2.12.12.2 1 as2border1[GigabitEthernet2/0] default 2.12.12.1 1 ESTABLISHED
2 as2border1[GigabitEthernet1/0] default 2.12.11.1 1 as2core1[GigabitEthernet0/0] default 2.12.11.2 1 ESTABLISHED
3 as2border1[GigabitEthernet2/0] default 2.12.12.1 1 as2core2[GigabitEthernet1/0] default 2.12.12.2 1 ESTABLISHED
4 as2core2[GigabitEthernet3/0] default 2.23.21.2 1 as2dist1[GigabitEthernet1/0] default 2.23.21.3 1 ESTABLISHED

Print the first row of the returned Dataframe

[23]:
result.iloc[0]
[23]:
Interface           as2core2[GigabitEthernet0/0]
VRF                 default
IP                  2.12.22.2
Area                1
Remote_Interface    as2border2[GigabitEthernet1/0]
Remote_VRF          default
Remote_IP           2.12.22.1
Remote_Area         1
Session_Status      ESTABLISHED
Name: 0, dtype: object

OSPF Edges

Returns OSPF adjacencies.

Lists all OSPF adjacencies in the network.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include adjacencies whose first node matches this name or regex.

NodeSpec

True

.*

remoteNodes

Include edges whose second node matches this name or regex.

NodeSpec

True

.*

Invocation

[26]:
result = bfq.ospfEdges().answer().frame()

Return Value

Name

Description

Type

Interface

Interface from which the edge originates

Interface

Remote_Interface

Interface at which the edge terminates

Interface

Print the first 5 rows of the returned Dataframe

[27]:
result.head(5)
[27]:
Interface Remote_Interface
0 as1border1[GigabitEthernet0/0] as1core1[GigabitEthernet1/0]
1 as1core1[GigabitEthernet1/0] as1border1[GigabitEthernet0/0]
2 as1border2[GigabitEthernet1/0] as1core1[GigabitEthernet0/0]
3 as1core1[GigabitEthernet0/0] as1border2[GigabitEthernet1/0]
4 as2border1[GigabitEthernet1/0] as2core1[GigabitEthernet0/0]

Print the first row of the returned Dataframe

[28]:
result.iloc[0]
[28]:
Interface           as1border1[GigabitEthernet0/0]
Remote_Interface    as1core1[GigabitEthernet1/0]
Name: 0, dtype: object

Test Route Policies

Evaluates the processing of a route by a given policy.

Find how the specified route is processed through the specified routing policies.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Only examine filters on nodes matching this specifier.

NodeSpec

True

policies

Only consider policies that match this specifier.

RoutingPolicySpec

True

inputRoutes

The BGP route announcements to test the policy on.

List of BgpRoute

False

direction

The direction of the route, with respect to the device (IN/OUT).

str

False

Invocation

[31]:
result = bfq.testRoutePolicies(policies='/as1_to_/', direction='in', inputRoutes=list([BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp')])).answer().frame()

Return Value

Name

Description

Type

Node

The node that has the policy

str

Policy_Name

The name of this policy

str

Input_Route

The input route

BgpRoute

Action

The action of the policy on the input route

str

Output_Route

The output route, if any

BgpRoute

Difference

The difference between the input and output routes, if any

BgpRouteDiffs

Print the first 5 rows of the returned Dataframe

[32]:
result.head(5)
[32]:
Node Policy_Name Input_Route Action Output_Route Difference
0 as1border1 as1_to_as2 BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) DENY None None
1 as1border1 as1_to_as3 BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) DENY None None
2 as1border2 as1_to_as2 BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) DENY None None
3 as1border2 as1_to_as3 BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) DENY None None
4 as1border2 as1_to_as4 BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=['1:4'], localPreference=0, metric=50, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='communities', oldValue='[]', newValue='[1:4]'), BgpRouteDiff(fieldName='metric', oldValue='0', newValue='50')])

Print the first row of the returned Dataframe

[33]:
result.iloc[0]
[33]:
Node            as1border1
Policy_Name     as1_to_as2
Input_Route     BgpRoute(network='10.0.0.0/24', originatorIp='4.4.4.4', originType='egp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None)
Action          DENY
Output_Route    None
Difference      None
Name: 0, dtype: object

Search Route Policies

Finds route announcements for which a route policy has a particular behavior.

This question finds route announcements for which a route policy has a particular behavior. The behaviors can be: that the policy permits the route (permit) or that it denies the route (deny). Constraints can be imposed on the input route announcements of interest and, in the case of a permit action, also on the output route announcements of interest. Route policies are selected using node and policy specifiers, which might match multiple policies. In this case, a (possibly different) answer will be found for each policy. This question currently supports common forms of matching on prefixes, communities, and AS-paths, as well as common forms of setting communities, the local preference, and the metric. It does not support other routing policy constructs. The question throws an exception if a route policy uses an unsupported construct.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Only examine policies on nodes matching this specifier.

NodeSpec

True

policies

Only consider policies that match this specifier.

RoutingPolicySpec

True

inputConstraints

Constraints on the set of input BGP route announcements to consider.

BgpRouteConstraints

True

action

The behavior to be evaluated. Specify exactly one of permit or deny.

str

True

outputConstraints

Constraints on the set of output BGP route announcements to consider.

BgpRouteConstraints

True

Invocation

[36]:
result = bfq.searchRoutePolicies(policies='/as1_to_/', inputConstraints=BgpRouteConstraints(prefix=["10.0.0.0/8:8-32", "172.16.0.0/28:28-32", "192.168.0.0/16:16-32"]), action='permit').answer().frame()

Return Value

Name

Description

Type

Node

The node that has the policy

str

Policy_Name

The name of this policy

str

Input_Route

The input route

BgpRoute

Action

The action of the policy on the input route

str

Output_Route

The output route

BgpRoute

Difference

The difference between the input and output routes

BgpRouteDiffs

Print the first 5 rows of the returned Dataframe

[37]:
result.head(5)
[37]:
Node Policy_Name Input_Route Action Output_Route Difference
0 as1border2 as1_to_as4 BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:4'], localPreference=0, metric=50, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='communities', oldValue='[]', newValue='[1:4]'), BgpRouteDiff(fieldName='metric', oldValue='0', newValue='50')])
1 as2border1 as1_to_as2 BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0', '1:2'], localPreference=350, metric=0, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='communities', oldValue='[1:0]', newValue='[1:0, 1:2]'), BgpRouteDiff(fieldName='localPreference', oldValue='0', newValue='350')])
2 as2border2 as1_to_as2 BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0', '1:2'], localPreference=350, metric=0, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='communities', oldValue='[1:0]', newValue='[1:0, 1:2]'), BgpRouteDiff(fieldName='localPreference', oldValue='0', newValue='350')])
3 as3border1 as1_to_as3 BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=350, metric=0, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='localPreference', oldValue='0', newValue='350')])
4 as3border2 as1_to_as3 BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=0, metric=0, sourceProtocol=None) PERMIT BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:0'], localPreference=350, metric=0, sourceProtocol=None) BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='localPreference', oldValue='0', newValue='350')])

Print the first row of the returned Dataframe

[38]:
result.iloc[0]
[38]:
Node            as1border2
Policy_Name     as1_to_as4
Input_Route     BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=[], localPreference=0, metric=0, sourceProtocol=None)
Action          PERMIT
Output_Route    BgpRoute(network='10.0.0.0/32', originatorIp='0.0.0.0', originType='igp', protocol='bgp', asPath=[], communities=['1:4'], localPreference=0, metric=50, sourceProtocol=None)
Difference      BgpRouteDiffs(diffs=[BgpRouteDiff(fieldName='communities', oldValue='[]', newValue='[1:4]'), BgpRouteDiff(fieldName='metric', oldValue='0', newValue='50')])
Name: 0, dtype: object