Topology

This caterogy of questions is intended to retrieve the network topology used by Batfish. This topology is a combination of information in the snapshot and inference logic (e.g., which interfaces are layer3 neighbors). Currently, Layer 3 topology can be retrieved.

User Provided Layer 1 Topology

Returns normalized Layer 1 edges that were input to Batfish.

Lists Layer 1 edges after potentially normalizing node and interface names. All node names are lower-cased, and for nodes that appear in the snapshot, interface names are canonicalized based on the vendor. All input edges are in the output, including nodes and interfaces that do not appear in the snapshot.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include edges whose first node matches this name or regex.

NodeSpec

True

.*

remoteNodes

Include edges whose second node matches this name or regex.

NodeSpec

True

.*

Invocation

[5]:
result = bf.q.userProvidedLayer1Edges().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

[6]:
result.head(5)
[6]:
Interface Remote_Interface
0 dc1-leaf2a[Ethernet1] dc1-spine1[Ethernet2]
1 dc1-leaf2b[Ethernet1] dc1-spine1[Ethernet3]
2 dc1-leaf2b[Ethernet2] dc1-spine2[Ethernet3]
3 dc1-svc3b[Ethernet6] dc1-l2leaf5b[Ethernet2]
4 dc1-leaf2a[Ethernet4] dc1-leaf2b[Ethernet4]

Print the first row of the returned Dataframe

[7]:
result.iloc[0]
[7]:
Interface           dc1-leaf2a[Ethernet1]
Remote_Interface    dc1-spine1[Ethernet2]
Name: 0, dtype: object

Layer 3 Topology

Returns Layer 3 links.

Lists all Layer 3 edges in the network.

Inputs

Name

Description

Type

Optional

Default Value

nodes

Include edges whose first node matches this name or regex.

NodeSpec

True

.*

remoteNodes

Include edges whose second node matches this name or regex.

NodeSpec

True

.*

Invocation

[10]:
result = bf.q.layer3Edges().answer().frame()

Return Value

Name

Description

Type

Interface

Interface from which the edge originates

Interface

IPs

IPs

Set of str

Remote_Interface

Interface at which the edge terminates

Interface

Remote_IPs

Remote IPs

Set of str

Print the first 5 rows of the returned Dataframe

[11]:
result.head(5)
[11]:
Interface IPs Remote_Interface Remote_IPs
0 as1border1[GigabitEthernet0/0] ['1.0.1.1'] as1core1[GigabitEthernet1/0] ['1.0.1.2']
1 as1border1[GigabitEthernet1/0] ['10.12.11.1'] as2border1[GigabitEthernet0/0] ['10.12.11.2']
2 as1border2[GigabitEthernet0/0] ['10.13.22.1'] as3border2[GigabitEthernet0/0] ['10.13.22.3']
3 as1border2[GigabitEthernet1/0] ['1.0.2.1'] as1core1[GigabitEthernet0/0] ['1.0.2.2']
4 as1core1[GigabitEthernet0/0] ['1.0.2.2'] as1border2[GigabitEthernet1/0] ['1.0.2.1']

Print the first row of the returned Dataframe

[12]:
result.iloc[0]
[12]:
Interface           as1border1[GigabitEthernet0/0]
IPs                                    ['1.0.1.1']
Remote_Interface      as1core1[GigabitEthernet1/0]
Remote_IPs                             ['1.0.1.2']
Name: 0, dtype: object