{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "import pandas as pd\n", "from pybatfish.client.session import Session\n", "from pybatfish.datamodel import *\n", "\n", "pd.set_option(\"display.width\", 300) \n", "pd.set_option(\"display.max_columns\", 30) \n", "pd.set_option(\"display.max_rows\", 1000) \n", "pd.set_option(\"display.max_colwidth\", None)\n", "\n", "# Configure all pybatfish loggers to use WARN level\n", "import logging\n", "logging.getLogger('pybatfish').setLevel(logging.WARN)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "bf = Session(host=\"localhost\")\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Configuration Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This category of questions enables you to retrieve and process the\n", "contents of device configurations in a vendor-agnostic manner\n", "(except where the question itself is vendor-specific). Batfish organizes\n", "configuration content into several sub-categories.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* [Node Properties](#Node-Properties)\n", "* [Interface Properties](#Interface-Properties)\n", "* [BGP Process Configuration](#BGP-Process-Configuration)\n", "* [BGP Peer Configuration](#BGP-Peer-Configuration)\n", "* [HSRP Properties](#HSRP-Properties)\n", "* [OSPF Process Configuration](#OSPF-Process-Configuration)\n", "* [OSPF Interface Configuration](#OSPF-Interface-Configuration)\n", "* [OSPF Area Configuration](#OSPF-Area-Configuration)\n", "* [Multi-chassis LAG](#Multi-chassis-LAG)\n", "* [IP Owners](#IP-Owners)\n", "* [Named Structures](#Named-Structures)\n", "* [Defined Structures](#Defined-Structures)\n", "* [Referenced Structures](#Referenced-Structures)\n", "* [Undefined References](#Undefined-References)\n", "* [Unused Structures](#Unused-Structures)\n", "* [VLAN Properties](#VLAN-Properties)\n", "* [VRRP Properties](#VRRP-Properties)\n", "* [A10 Virtual Server Configuration](#A10-Virtual-Server-Configuration)\n", "* [F5 BIG-IP VIP Configuration](#F5-BIG-IP-VIP-Configuration)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Node Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of nodes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists global settings of devices in the network. Settings that are specific to interfaces, routing protocols, etc. are available via other questions." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "properties | Include properties matching this regex. | [NodePropertySpec](../specifiers.md#node-property-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "result = bf.q.nodeProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "AS_Path_Access_Lists | Names of AS path access lists | Set of str\n", "Authentication_Key_Chains | Names of authentication keychains | Set of str\n", "Community_Match_Exprs | Names of expressions for matching a community | Set of str\n", "Community_Set_Exprs | Names of expressions representing a community-set | Set of str\n", "Community_Set_Match_Exprs | Names of expressions for matching a ommunity-set | Set of str\n", "Community_Sets | Names of community-sets | Set of str\n", "Configuration_Format | Configuration format of the node | str\n", "DNS_Servers | Configured DNS servers | Set of str\n", "DNS_Source_Interface | Source interface to use for communicating with DNS servers | str\n", "Default_Cross_Zone_Action | Default action (PERMIT, DENY) for traffic that traverses firewall zones (null for non-firewall nodes) | str\n", "Default_Inbound_Action | Default action (PERMIT, DENY) for traffic destined for this node | str\n", "Domain_Name | Domain name of the node | str\n", "Hostname | Hostname of the node | str\n", "IKE_Phase1_Keys | Names of IKE Phase 1 keys | Set of str\n", "IKE_Phase1_Policies | Names of IKE Phase 1 policies | Set of str\n", "IKE_Phase1_Proposals | Names of IKE Phase 1 proposals | Set of str\n", "IP6_Access_Lists | (Deprecated) Names of IPv6 filters (ACLs, firewall rule sets) | Set of str\n", "IP_Access_Lists | Names of IPv4 filters (ACLs, firewall rule sets) | Set of str\n", "IPsec_Peer_Configs | Names of IPSec peers | Set of str\n", "IPsec_Phase2_Policies | Names of IPSec Phase 2 policies | Set of str\n", "IPsec_Phase2_Proposals | Names of IPSec Phase 2 proposals | Set of str\n", "Interfaces | Names of interfaces | Set of str\n", "Logging_Servers | Configured logging servers | Set of str\n", "Logging_Source_Interface | Source interface for communicating with logging servers | str\n", "NTP_Servers | Configured NTP servers | Set of str\n", "NTP_Source_Interface | Source interface for communicating with NTP servers | str\n", "PBR_Policies | Names of policy-based routing (PBR) policies | Set of str\n", "Route6_Filter_Lists | (Deprecated) Names of structures that filter IPv6 routes (e.g., prefix lists) | Set of str\n", "Route_Filter_Lists | Names of structures that filter IPv4 routes (e.g., prefix lists) | Set of str\n", "Routing_Policies | Names of policies that manipulate routes (e.g., route maps) | Set of str\n", "SNMP_Source_Interface | Source interface to use for communicating with SNMP servers | str\n", "SNMP_Trap_Servers | Configured SNMP trap servers | Set of str\n", "TACACS_Servers | Configured TACACS servers | Set of str\n", "TACACS_Source_Interface | Source interface to use for communicating with TACACS servers | str\n", "VRFs | Names of VRFs present on the node | Set of str\n", "Zones | Names of firewall zones on the node | Set of str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeAS_Path_Access_ListsAuthentication_Key_ChainsCommunity_Match_ExprsCommunity_Set_ExprsCommunity_Set_Match_ExprsCommunity_SetsConfiguration_FormatDNS_ServersDNS_Source_InterfaceDefault_Cross_Zone_ActionDefault_Inbound_ActionDomain_NameHostnameIKE_Phase1_Keys...InterfacesLogging_ServersLogging_Source_InterfaceNTP_ServersNTP_Source_InterfacePBR_PoliciesRoute6_Filter_ListsRoute_Filter_ListsRouting_PoliciesSNMP_Source_InterfaceSNMP_Trap_ServersTACACS_ServersTACACS_Source_InterfaceVRFsZones
0as2border2[][]['as1_community', 'as2_community', 'as3_community'][]['as1_community', 'as2_community', 'as3_community'][]CISCO_IOS[]NonePERMITPERMITlab.localas2border2[]...['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'][]None['18.18.18.18']None[][]['101', '103', 'inbound_route_filter', 'outbound_routes', '~MATCH_SUPPRESSED_SUMMARY_ONLY:default~']['as1_to_as2', 'as2_to_as1', 'as2_to_as3', 'as3_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:10.23.21.3~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.1~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.2~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~', '~suppress~rp~summary-only~']None[][]None['default'][]
1as1border1[][]['as1_community', 'as2_community', 'as3_community'][]['as1_community', 'as2_community', 'as3_community'][]CISCO_IOS[]NonePERMITPERMITlab.localas1border1[]...['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'][]None[]None[][]['101', '102', '103', 'default_list', 'inbound_route_filter']['as1_to_as2', 'as1_to_as3', 'as2_to_as1', 'as3_to_as1', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:1.10.1.1~', '~BGP_PEER_EXPORT_POLICY:default:10.12.11.2~', '~BGP_PEER_EXPORT_POLICY:default:3.2.2.2~', '~BGP_PEER_EXPORT_POLICY:default:5.6.7.8~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~']None[][]None['default'][]
2as3border2[][]['as1_community', 'as2_community', 'as3_community'][]['as1_community', 'as2_community', 'as3_community'][]CISCO_IOS[]NonePERMITPERMITlab.localas3border2[]...['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'][]None['18.18.18.18', '23.23.23.23']None[][]['101', '102', '103', 'inbound_route_filter']['as1_to_as3', 'as2_to_as3', 'as3_to_as1', 'as3_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:10.13.22.1~', '~BGP_PEER_EXPORT_POLICY:default:3.10.1.1~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~']None[][]None['default'][]
3as1border2[][]['as1_community', 'as2_community', 'as3_community', 'as4_community'][]['as1_community', 'as2_community', 'as3_community', 'as4_community'][]CISCO_IOS[]NonePERMITPERMITlab.localas1border2[]...['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'][]None['18.18.18.18', '23.23.23.23']None[][]['101', '102', '103', 'as4-prefixes', 'inbound_route_filter']['as1_to_as2', 'as1_to_as3', 'as1_to_as4', 'as2_to_as1', 'as3_to_as1', 'as4_to_as1', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:1.10.1.1~', '~BGP_PEER_EXPORT_POLICY:default:10.13.22.3~', '~BGP_PEER_EXPORT_POLICY:default:10.14.22.4~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~']None[][]None['default'][]
4as2dept1[][]['as2_community'][]['as2_community'][]CISCO_IOS[]NonePERMITPERMITlab.localas2dept1[]...['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'GigabitEthernet3/0', 'Loopback0'][]None[]None[][]['102']['as2_to_dept', 'dept_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:2.34.101.3~', '~BGP_PEER_EXPORT_POLICY:default:2.34.201.3~', '~BGP_REDISTRIBUTION_POLICY:default~', '~RESOLUTION_POLICY~']None[][]None['default'][]
\n", "

5 rows × 37 columns

\n", "
" ], "text/plain": [ " Node AS_Path_Access_Lists Authentication_Key_Chains Community_Match_Exprs Community_Set_Exprs Community_Set_Match_Exprs Community_Sets Configuration_Format DNS_Servers DNS_Source_Interface \\\n", "0 as2border2 [] [] ['as1_community', 'as2_community', 'as3_community'] [] ['as1_community', 'as2_community', 'as3_community'] [] CISCO_IOS [] None \n", "1 as1border1 [] [] ['as1_community', 'as2_community', 'as3_community'] [] ['as1_community', 'as2_community', 'as3_community'] [] CISCO_IOS [] None \n", "2 as3border2 [] [] ['as1_community', 'as2_community', 'as3_community'] [] ['as1_community', 'as2_community', 'as3_community'] [] CISCO_IOS [] None \n", "3 as1border2 [] [] ['as1_community', 'as2_community', 'as3_community', 'as4_community'] [] ['as1_community', 'as2_community', 'as3_community', 'as4_community'] [] CISCO_IOS [] None \n", "4 as2dept1 [] [] ['as2_community'] [] ['as2_community'] [] CISCO_IOS [] None \n", "\n", " Default_Cross_Zone_Action Default_Inbound_Action Domain_Name Hostname IKE_Phase1_Keys ... Interfaces Logging_Servers Logging_Source_Interface NTP_Servers \\\n", "0 PERMIT PERMIT lab.local as2border2 [] ... ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'] [] None ['18.18.18.18'] \n", "1 PERMIT PERMIT lab.local as1border1 [] ... ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'] [] None [] \n", "2 PERMIT PERMIT lab.local as3border2 [] ... ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'] [] None ['18.18.18.18', '23.23.23.23'] \n", "3 PERMIT PERMIT lab.local as1border2 [] ... ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'] [] None ['18.18.18.18', '23.23.23.23'] \n", "4 PERMIT PERMIT lab.local as2dept1 [] ... ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'GigabitEthernet3/0', 'Loopback0'] [] None [] \n", "\n", " NTP_Source_Interface PBR_Policies Route6_Filter_Lists Route_Filter_Lists \\\n", "0 None [] [] ['101', '103', 'inbound_route_filter', 'outbound_routes', '~MATCH_SUPPRESSED_SUMMARY_ONLY:default~'] \n", "1 None [] [] ['101', '102', '103', 'default_list', 'inbound_route_filter'] \n", "2 None [] [] ['101', '102', '103', 'inbound_route_filter'] \n", "3 None [] [] ['101', '102', '103', 'as4-prefixes', 'inbound_route_filter'] \n", "4 None [] [] ['102'] \n", "\n", " Routing_Policies \\\n", "0 ['as1_to_as2', 'as2_to_as1', 'as2_to_as3', 'as3_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:10.23.21.3~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.1~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.2~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~', '~suppress~rp~summary-only~'] \n", "1 ['as1_to_as2', 'as1_to_as3', 'as2_to_as1', 'as3_to_as1', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:1.10.1.1~', '~BGP_PEER_EXPORT_POLICY:default:10.12.11.2~', '~BGP_PEER_EXPORT_POLICY:default:3.2.2.2~', '~BGP_PEER_EXPORT_POLICY:default:5.6.7.8~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~'] \n", "2 ['as1_to_as3', 'as2_to_as3', 'as3_to_as1', 'as3_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:10.13.22.1~', '~BGP_PEER_EXPORT_POLICY:default:3.10.1.1~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~'] \n", "3 ['as1_to_as2', 'as1_to_as3', 'as1_to_as4', 'as2_to_as1', 'as3_to_as1', 'as4_to_as1', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:1.10.1.1~', '~BGP_PEER_EXPORT_POLICY:default:10.13.22.3~', '~BGP_PEER_EXPORT_POLICY:default:10.14.22.4~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~'] \n", "4 ['as2_to_dept', 'dept_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:2.34.101.3~', '~BGP_PEER_EXPORT_POLICY:default:2.34.201.3~', '~BGP_REDISTRIBUTION_POLICY:default~', '~RESOLUTION_POLICY~'] \n", "\n", " SNMP_Source_Interface SNMP_Trap_Servers TACACS_Servers TACACS_Source_Interface VRFs Zones \n", "0 None [] [] None ['default'] [] \n", "1 None [] [] None ['default'] [] \n", "2 None [] [] None ['default'] [] \n", "3 None [] [] None ['default'] [] \n", "4 None [] [] None ['default'] [] \n", "\n", "[5 rows x 37 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as2border2\n", "AS_Path_Access_Lists []\n", "Authentication_Key_Chains []\n", "Community_Match_Exprs ['as1_community', 'as2_community', 'as3_community']\n", "Community_Set_Exprs []\n", "Community_Set_Match_Exprs ['as1_community', 'as2_community', 'as3_community']\n", "Community_Sets []\n", "Configuration_Format CISCO_IOS\n", "DNS_Servers []\n", "DNS_Source_Interface None\n", "Default_Cross_Zone_Action PERMIT\n", "Default_Inbound_Action PERMIT\n", "Domain_Name lab.local\n", "Hostname as2border2\n", "IKE_Phase1_Keys []\n", "IKE_Phase1_Policies []\n", "IKE_Phase1_Proposals []\n", "IP6_Access_Lists []\n", "IP_Access_Lists ['101', '103', 'INSIDE_TO_AS3', 'OUTSIDE_TO_INSIDE']\n", "IPsec_Peer_Configs []\n", "IPsec_Phase2_Policies []\n", "IPsec_Phase2_Proposals []\n", "Interfaces ['Ethernet0/0', 'GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0']\n", "Logging_Servers []\n", "Logging_Source_Interface None\n", "NTP_Servers ['18.18.18.18']\n", "NTP_Source_Interface None\n", "PBR_Policies []\n", "Route6_Filter_Lists []\n", "Route_Filter_Lists ['101', '103', 'inbound_route_filter', 'outbound_routes', '~MATCH_SUPPRESSED_SUMMARY_ONLY:default~']\n", "Routing_Policies ['as1_to_as2', 'as2_to_as1', 'as2_to_as3', 'as3_to_as2', '~BGP_COMMON_EXPORT_POLICY:default~', '~BGP_PEER_EXPORT_POLICY:default:10.23.21.3~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.1~', '~BGP_PEER_EXPORT_POLICY:default:2.1.2.2~', '~BGP_REDISTRIBUTION_POLICY:default~', '~OSPF_EXPORT_POLICY:default:1~', '~RESOLUTION_POLICY~', '~suppress~rp~summary-only~']\n", "SNMP_Source_Interface None\n", "SNMP_Trap_Servers []\n", "TACACS_Servers []\n", "TACACS_Source_Interface None\n", "VRFs ['default']\n", "Zones []\n", "Name: 0, dtype: object" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Interface Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of interfaces." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists interface-level settings of interfaces. Settings for routing protocols, VRFs, and zones etc. that are attached to interfaces are available via other questions." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "interfaces | Include interfaces matching this specifier. | [InterfaceSpec](../specifiers.md#interface-specifier) | True | \n", "properties | Include properties matching this specifier. | [InterfacePropertySpec](../specifiers.md#interface-property-specifier) | True | \n", "excludeShutInterfaces | Exclude interfaces that are shutdown. | bool | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "result = bf.q.interfaceProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Interface | Interface | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "Access_VLAN | VLAN number when the switchport mode is access (null otherwise) | int\n", "Active | Whether the interface is active | bool\n", "Admin_Up | Whether the interface is administratively enabled | bool\n", "All_Prefixes | All IPv4 addresses assigned to the interface | List of str\n", "Allowed_VLANs | Allowed VLAN numbers when the switchport mode is trunk | str\n", "Auto_State_VLAN | For VLAN interfaces, whether the operational status depends on member switchports | bool\n", "Bandwidth | Nominal bandwidth in bits/sec, used for protocol cost calculations | float\n", "Blacklisted | Whether the interface is considered down for maintenance | bool\n", "Channel_Group | Name of the aggregated interface (e.g., a port channel) to which this interface belongs | str\n", "Channel_Group_Members | For aggregated interfaces (e.g., a port channel), names of constituent interfaces | List of str\n", "DHCP_Relay_Addresses | IPv4 addresses to which incoming DHCP requests are relayed | List of str\n", "Declared_Names | Any aliases explicitly defined for this interface | List of str\n", "Description | Configured interface description | str\n", "Encapsulation_VLAN | Number for VLAN encapsulation | int\n", "HSRP_Groups | HSRP group identifiers | Set of str\n", "HSRP_Version | HSRP version that will be used | str\n", "Inactive_Reason | Reason why interface is inactive | str\n", "Incoming_Filter_Name | Name of the input IPv4 filter | str\n", "MLAG_ID | MLAG identifier of the interface | int\n", "MTU | Layer3 MTU of the interface | int\n", "Native_VLAN | Native VLAN when switchport mode is trunk | int\n", "Outgoing_Filter_Name | Name of the output IPv4 filter | str\n", "PBR_Policy_Name | Name of policy-based routing (PBR) policy | str\n", "Primary_Address | Primary IPv4 address along with the prefix length | str\n", "Primary_Network | Primary IPv4 subnet, in canonical form | str\n", "Proxy_ARP | Whether proxy ARP is enabled | bool\n", "Rip_Enabled | Whether RIP is enabled | bool\n", "Rip_Passive | Whether interface is in RIP passive mode | bool\n", "Spanning_Tree_Portfast | Whether spanning-tree portfast feature is enabled | bool\n", "Speed | Link speed in bits/sec | float\n", "Switchport | Whether the interface is configured as switchport | bool\n", "Switchport_Mode | Switchport mode (ACCESS, DOT1Q_TUNNEL, DYNAMIC_AUTO, DYNAMIC_DESIRABLE, FEX_FABRIC, MONITOR, NONE, TAP, TOOL, TRUNK) for switchport interfaces | str\n", "Switchport_Trunk_Encapsulation | Encapsulation type (DOT1Q, ISL, NEGOTIATE) for switchport trunk interfaces | str\n", "VRF | Name of the VRF to which the interface belongs | str\n", "VRRP_Groups | All VRRP groups to which the interface belongs | List of int\n", "Zone_Name | Name of the firewall zone to which the interface belongs | str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
InterfaceAccess_VLANActiveAdmin_UpAll_PrefixesAllowed_VLANsAuto_State_VLANBandwidthBlacklistedChannel_GroupChannel_Group_MembersDHCP_Relay_AddressesDeclared_NamesDescriptionEncapsulation_VLAN...Outgoing_Filter_NamePBR_Policy_NamePrimary_AddressPrimary_NetworkProxy_ARPRip_EnabledRip_PassiveSpanning_Tree_PortfastSpeedSwitchportSwitchport_ModeSwitchport_Trunk_EncapsulationVRFVRRP_GroupsZone_Name
0as1border1[Ethernet0/0]NoneFalseFalse[]True10000000.0FalseNone[][]['Ethernet0/0']NoneNone...NoneNoneNoneNoneTrueFalseFalseFalse10000000.0FalseNONEDOT1Qdefault[]None
1as1border1[GigabitEthernet0/0]NoneTrueTrue['1.0.1.1/24']True1000000000.0FalseNone[][]['GigabitEthernet0/0']NoneNone...NoneNone1.0.1.1/241.0.1.0/24TrueFalseFalseFalse1000000000.0FalseNONEDOT1Qdefault[123]None
2as1border1[GigabitEthernet1/0]NoneTrueTrue['10.12.11.1/24']True1000000000.0FalseNone[][]['GigabitEthernet1/0']NoneNone...NoneNone10.12.11.1/2410.12.11.0/24TrueFalseFalseFalse1000000000.0FalseNONEDOT1Qdefault[]None
3as1border1[Loopback0]NoneTrueTrue['1.1.1.1/32']True8000000000.0NoneNone[][]['Loopback0']NoneNone...NoneNone1.1.1.1/321.1.1.1/32TrueFalseFalseFalseNoneFalseNONEDOT1Qdefault[]None
4as1border2[Ethernet0/0]NoneFalseFalse[]True10000000.0FalseNone[][]['Ethernet0/0']NoneNone...NoneNoneNoneNoneTrueFalseFalseFalse10000000.0FalseNONEDOT1Qdefault[]None
\n", "

5 rows × 37 columns

\n", "
" ], "text/plain": [ " Interface Access_VLAN Active Admin_Up All_Prefixes Allowed_VLANs Auto_State_VLAN Bandwidth Blacklisted Channel_Group Channel_Group_Members DHCP_Relay_Addresses Declared_Names Description Encapsulation_VLAN ... Outgoing_Filter_Name PBR_Policy_Name \\\n", "0 as1border1[Ethernet0/0] None False False [] True 10000000.0 False None [] [] ['Ethernet0/0'] None None ... None None \n", "1 as1border1[GigabitEthernet0/0] None True True ['1.0.1.1/24'] True 1000000000.0 False None [] [] ['GigabitEthernet0/0'] None None ... None None \n", "2 as1border1[GigabitEthernet1/0] None True True ['10.12.11.1/24'] True 1000000000.0 False None [] [] ['GigabitEthernet1/0'] None None ... None None \n", "3 as1border1[Loopback0] None True True ['1.1.1.1/32'] True 8000000000.0 None None [] [] ['Loopback0'] None None ... None None \n", "4 as1border2[Ethernet0/0] None False False [] True 10000000.0 False None [] [] ['Ethernet0/0'] None None ... None None \n", "\n", " Primary_Address Primary_Network Proxy_ARP Rip_Enabled Rip_Passive Spanning_Tree_Portfast Speed Switchport Switchport_Mode Switchport_Trunk_Encapsulation VRF VRRP_Groups Zone_Name \n", "0 None None True False False False 10000000.0 False NONE DOT1Q default [] None \n", "1 1.0.1.1/24 1.0.1.0/24 True False False False 1000000000.0 False NONE DOT1Q default [123] None \n", "2 10.12.11.1/24 10.12.11.0/24 True False False False 1000000000.0 False NONE DOT1Q default [] None \n", "3 1.1.1.1/32 1.1.1.1/32 True False False False None False NONE DOT1Q default [] None \n", "4 None None True False False False 10000000.0 False NONE DOT1Q default [] None \n", "\n", "[5 rows x 37 columns]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Interface as1border1[Ethernet0/0]\n", "Access_VLAN None\n", "Active False\n", "Admin_Up False\n", "All_Prefixes []\n", "Allowed_VLANs \n", "Auto_State_VLAN True\n", "Bandwidth 10000000.0\n", "Blacklisted False\n", "Channel_Group None\n", "Channel_Group_Members []\n", "DHCP_Relay_Addresses []\n", "Declared_Names ['Ethernet0/0']\n", "Description None\n", "Encapsulation_VLAN None\n", "HSRP_Groups []\n", "HSRP_Version None\n", "Inactive_Reason Administratively down\n", "Incoming_Filter_Name None\n", "MLAG_ID None\n", "MTU 1500\n", "Native_VLAN None\n", "Outgoing_Filter_Name None\n", "PBR_Policy_Name None\n", "Primary_Address None\n", "Primary_Network None\n", "Proxy_ARP True\n", "Rip_Enabled False\n", "Rip_Passive False\n", "Spanning_Tree_Portfast False\n", "Speed 10000000.0\n", "Switchport False\n", "Switchport_Mode NONE\n", "Switchport_Trunk_Encapsulation DOT1Q\n", "VRF default\n", "VRRP_Groups []\n", "Zone_Name None\n", "Name: 0, dtype: object" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### BGP Process Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of BGP processes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Reports configuration settings for each BGP process on each node and VRF in the network. This question reports only process-wide settings. Peer-specific settings are reported by the bgpPeerConfiguration question." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "properties | Include properties matching this regex. | [BgpProcessPropertySpec](../specifiers.md#bgp-process-property-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "result = bf.q.bgpProcessConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VRF | VRF | str\n", "Router_ID | Router ID | str\n", "Confederation_ID | Externally visible autonomous system number for the confederation | int\n", "Confederation_Members | Set of autonomous system numbers visible only within this BGP confederation | str\n", "Multipath_EBGP | Whether multipath routing is enabled for EBGP | bool\n", "Multipath_IBGP | Whether multipath routing is enabled for IBGP | bool\n", "Multipath_Match_Mode | Which AS paths are considered equivalent (EXACT_PATH, FIRST_AS, PATH_LENGTH) when multipath BGP is enabled | str\n", "Neighbors | All peers configured on this process, identified by peer address (for active and dynamic peers) or peer interface (for BGP unnumbered peers) | Set of str\n", "Route_Reflector | Whether any BGP peer in this process is configured as a route reflector client, for ipv4 unicast address family | bool\n", "Tie_Breaker | Tie breaking mode (ARRIVAL_ORDER, CLUSTER_LIST_LENGTH, ROUTER_ID) | str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVRFRouter_IDConfederation_IDConfederation_MembersMultipath_EBGPMultipath_IBGPMultipath_Match_ModeNeighborsRoute_ReflectorTie_Breaker
0as1border1default1.1.1.1NoneNoneTrueTrueEXACT_PATH['3.2.2.2', '1.10.1.1', '5.6.7.8', '10.12.11.2']FalseARRIVAL_ORDER
1as1border2default1.2.2.2NoneNoneTrueTrueEXACT_PATH['10.14.22.4', '1.10.1.1', '10.13.22.3']FalseARRIVAL_ORDER
2as1core1default1.10.1.1NoneNoneTrueTrueEXACT_PATH['1.1.1.1', '1.2.2.2']TrueARRIVAL_ORDER
3as2border1default2.1.1.1NoneNoneTrueTrueEXACT_PATH['2.1.2.1', '2.1.2.2', '10.12.11.1']FalseARRIVAL_ORDER
4as2border2default2.1.1.2NoneNoneTrueTrueEXACT_PATH['2.1.2.1', '2.1.2.2', '10.23.21.3']FalseARRIVAL_ORDER
\n", "
" ], "text/plain": [ " Node VRF Router_ID Confederation_ID Confederation_Members Multipath_EBGP Multipath_IBGP Multipath_Match_Mode Neighbors Route_Reflector Tie_Breaker\n", "0 as1border1 default 1.1.1.1 None None True True EXACT_PATH ['3.2.2.2', '1.10.1.1', '5.6.7.8', '10.12.11.2'] False ARRIVAL_ORDER\n", "1 as1border2 default 1.2.2.2 None None True True EXACT_PATH ['10.14.22.4', '1.10.1.1', '10.13.22.3'] False ARRIVAL_ORDER\n", "2 as1core1 default 1.10.1.1 None None True True EXACT_PATH ['1.1.1.1', '1.2.2.2'] True ARRIVAL_ORDER\n", "3 as2border1 default 2.1.1.1 None None True True EXACT_PATH ['2.1.2.1', '2.1.2.2', '10.12.11.1'] False ARRIVAL_ORDER\n", "4 as2border2 default 2.1.1.2 None None True True EXACT_PATH ['2.1.2.1', '2.1.2.2', '10.23.21.3'] False ARRIVAL_ORDER" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as1border1\n", "VRF default\n", "Router_ID 1.1.1.1\n", "Confederation_ID None\n", "Confederation_Members None\n", "Multipath_EBGP True\n", "Multipath_IBGP True\n", "Multipath_Match_Mode EXACT_PATH\n", "Neighbors ['3.2.2.2', '1.10.1.1', '5.6.7.8', '10.12.11.2']\n", "Route_Reflector False\n", "Tie_Breaker ARRIVAL_ORDER\n", "Name: 0, dtype: object" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### BGP Peer Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings for BGP peerings." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Reports configuration settings for each configured BGP peering on each node in the network. This question reports peer-specific settings. Settings that are process-wide are reported by the bgpProcessConfiguration question." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "properties | Include properties matching this regex. | [BgpPeerPropertySpec](../specifiers.md#bgp-peer-property-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "result = bf.q.bgpPeerConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VRF | VRF | str\n", "Session_VRF | The VRF in which the BGP TCP session takes place, if different from VRF | str\n", "Local_AS | Local AS number | int\n", "Local_IP | Local IPv4 address (null for BGP unnumbered peers) | str\n", "Local_Interface | Local Interface | str\n", "Confederation | Confederation AS number | int\n", "Remote_AS | Remote AS numbers with which this peer may establish a session | str\n", "Remote_IP | Remote IP | str\n", "Description | Configured peer description | str\n", "Route_Reflector_Client | Whether this peer is a route reflector client | bool\n", "Cluster_ID | Cluster ID of this peer (null for peers that are not route reflector clients) | str\n", "Peer_Group | Name of the BGP peer group to which this peer belongs | str\n", "Import_Policy | Names of import policies to be applied to routes received by this peer | Set of str\n", "Export_Policy | Names of export policies to be applied to routes exported by this peer | Set of str\n", "Send_Community | Whether this peer propagates communities | bool\n", "Is_Passive | Whether this peer is passive | bool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVRFSession_VRFLocal_ASLocal_IPLocal_InterfaceConfederationRemote_ASRemote_IPDescriptionRoute_Reflector_ClientCluster_IDPeer_GroupImport_PolicyExport_PolicySend_CommunityIs_Passive
0as1border1defaultNone1NoneNoneNone6663.2.2.2NoneFalseNonebad-ebgp[][]FalseFalse
1as1border1defaultNone11.1.1.1NoneNone11.10.1.1NoneFalseNoneas1[][]TrueFalse
2as1border1defaultNone1NoneNoneNone5555.6.7.8NoneFalseNonexanadu[][]FalseFalse
3as1border1defaultNone110.12.11.1NoneNone210.12.11.2NoneFalseNoneas2['as2_to_as1']['as1_to_as2']TrueFalse
4as1border2defaultNone110.14.22.1NoneNone410.14.22.4NoneFalseNoneas4['as4_to_as1']['as1_to_as4']FalseFalse
\n", "
" ], "text/plain": [ " Node VRF Session_VRF Local_AS Local_IP Local_Interface Confederation Remote_AS Remote_IP Description Route_Reflector_Client Cluster_ID Peer_Group Import_Policy Export_Policy Send_Community Is_Passive\n", "0 as1border1 default None 1 None None None 666 3.2.2.2 None False None bad-ebgp [] [] False False\n", "1 as1border1 default None 1 1.1.1.1 None None 1 1.10.1.1 None False None as1 [] [] True False\n", "2 as1border1 default None 1 None None None 555 5.6.7.8 None False None xanadu [] [] False False\n", "3 as1border1 default None 1 10.12.11.1 None None 2 10.12.11.2 None False None as2 ['as2_to_as1'] ['as1_to_as2'] True False\n", "4 as1border2 default None 1 10.14.22.1 None None 4 10.14.22.4 None False None as4 ['as4_to_as1'] ['as1_to_as4'] False False" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as1border1\n", "VRF default\n", "Session_VRF None\n", "Local_AS 1\n", "Local_IP None\n", "Local_Interface None\n", "Confederation None\n", "Remote_AS 666\n", "Remote_IP 3.2.2.2\n", "Description None\n", "Route_Reflector_Client False\n", "Cluster_ID None\n", "Peer_Group bad-ebgp\n", "Import_Policy []\n", "Export_Policy []\n", "Send_Community False\n", "Is_Passive False\n", "Name: 0, dtype: object" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'ios_basic_hsrp'" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('ios_basic_hsrp')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### HSRP Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of HSRP groups." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists information about HSRP groups on interfaces." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "interfaces | Include interfaces matching this specifier. | [InterfaceSpec](../specifiers.md#interface-specifier) | True | \n", "virtualAddresses | Include only groups with at least one virtual address matching this specifier. | [IpSpec](../specifiers.md#ip-specifier) | True | \n", "excludeShutInterfaces | Exclude interfaces that are shutdown. | bool | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "result = bf.q.hsrpProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Interface | Interface | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "Group_Id | HSRP Group ID | int\n", "Virtual_Addresses | Virtual Addresses | Set of str\n", "Source_Address | Source Address used for HSRP messages | str\n", "Priority | HSRP router priority | int\n", "Preempt | Whether preemption is allowed | bool\n", "Active | Whether the interface is active | bool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
InterfaceGroup_IdVirtual_AddressesSource_AddressPriorityPreemptActive
0br2[GigabitEthernet0/2]12['192.168.1.254']192.168.1.2/24100FalseTrue
1br1[GigabitEthernet0/2]12['192.168.1.254']192.168.1.1/24110FalseTrue
\n", "
" ], "text/plain": [ " Interface Group_Id Virtual_Addresses Source_Address Priority Preempt Active\n", "0 br2[GigabitEthernet0/2] 12 ['192.168.1.254'] 192.168.1.2/24 100 False True\n", "1 br1[GigabitEthernet0/2] 12 ['192.168.1.254'] 192.168.1.1/24 110 False True" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Interface br2[GigabitEthernet0/2]\n", "Group_Id 12\n", "Virtual_Addresses ['192.168.1.254']\n", "Source_Address 192.168.1.2/24\n", "Priority 100\n", "Preempt False\n", "Active True\n", "Name: 0, dtype: object" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### OSPF Process Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration parameters for OSPF routing processes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns the values of important properties for all OSPF processes running across the network." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "properties | Include properties matching this specifier. | [OspfProcessPropertySpec](../specifiers.md#ospf-process-property-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "result = bf.q.ospfProcessConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VRF | VRF name | str\n", "Process_ID | Process ID | str\n", "Areas | All OSPF areas for this process | Set of str\n", "Reference_Bandwidth | Reference bandwidth in bits/sec used to calculate interface OSPF cost | float\n", "Router_ID | Router ID of the process | str\n", "Export_Policy_Sources | Names of policies that determine which routes are exported into OSPF | Set of str\n", "Area_Border_Router | Whether this process is at the area border (with at least one interface in Area 0 and one in another area) | bool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVRFProcess_IDAreasReference_BandwidthRouter_IDExport_Policy_SourcesArea_Border_Router
0as2border1default1['1']100000000.02.1.1.1[]False
1as2core1default1['1']100000000.02.1.2.1[]False
2as2dist1default1['1']100000000.02.1.3.1[]False
3as2dist2default1['1']100000000.02.1.3.2[]False
4as1border2default1['1']100000000.01.2.2.2[]False
\n", "
" ], "text/plain": [ " Node VRF Process_ID Areas Reference_Bandwidth Router_ID Export_Policy_Sources Area_Border_Router\n", "0 as2border1 default 1 ['1'] 100000000.0 2.1.1.1 [] False\n", "1 as2core1 default 1 ['1'] 100000000.0 2.1.2.1 [] False\n", "2 as2dist1 default 1 ['1'] 100000000.0 2.1.3.1 [] False\n", "3 as2dist2 default 1 ['1'] 100000000.0 2.1.3.2 [] False\n", "4 as1border2 default 1 ['1'] 100000000.0 1.2.2.2 [] False" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as2border1\n", "VRF default\n", "Process_ID 1\n", "Areas ['1']\n", "Reference_Bandwidth 100000000.0\n", "Router_ID 2.1.1.1\n", "Export_Policy_Sources []\n", "Area_Border_Router False\n", "Name: 0, dtype: object" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### OSPF Interface Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns OSPF configuration of interfaces." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns the interface level OSPF configuration details for the interfaces in the network which run OSPF." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "properties | Include properties matching this specifier. | [OspfInterfacePropertySpec](../specifiers.md#ospf-interface-property-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "result = bf.q.ospfInterfaceConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Interface | Interface | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "VRF | VRF name | str\n", "Process_ID | Process ID | str\n", "OSPF_Area_Name | OSPF area to which the interface belongs | int\n", "OSPF_Enabled | Whether OSPF is enabled | bool\n", "OSPF_Passive | Whether interface is in OSPF passive mode | bool\n", "OSPF_Cost | OSPF cost if explicitly configured | int\n", "OSPF_Network_Type | Type of OSPF network associated with the interface | str\n", "OSPF_Hello_Interval | Interval in seconds between sending OSPF hello messages | int\n", "OSPF_Dead_Interval | Interval in seconds before a silent OSPF neighbor is declared dead | int" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
InterfaceVRFProcess_IDOSPF_Area_NameOSPF_EnabledOSPF_PassiveOSPF_CostOSPF_Network_TypeOSPF_Hello_IntervalOSPF_Dead_Interval
0as1core1[GigabitEthernet1/0]default11TrueFalse1BROADCAST1040
1as1core1[GigabitEthernet0/0]default11TrueFalse1BROADCAST1040
2as2dist1[Loopback0]default11TrueFalse1BROADCAST1040
3as3core1[GigabitEthernet0/0]default11TrueFalse1BROADCAST1040
4as3core1[GigabitEthernet1/0]default11TrueFalse1BROADCAST1040
\n", "
" ], "text/plain": [ " Interface VRF Process_ID OSPF_Area_Name OSPF_Enabled OSPF_Passive OSPF_Cost OSPF_Network_Type OSPF_Hello_Interval OSPF_Dead_Interval\n", "0 as1core1[GigabitEthernet1/0] default 1 1 True False 1 BROADCAST 10 40\n", "1 as1core1[GigabitEthernet0/0] default 1 1 True False 1 BROADCAST 10 40\n", "2 as2dist1[Loopback0] default 1 1 True False 1 BROADCAST 10 40\n", "3 as3core1[GigabitEthernet0/0] default 1 1 True False 1 BROADCAST 10 40\n", "4 as3core1[GigabitEthernet1/0] default 1 1 True False 1 BROADCAST 10 40" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Interface as1core1[GigabitEthernet1/0]\n", "VRF default\n", "Process_ID 1\n", "OSPF_Area_Name 1\n", "OSPF_Enabled True\n", "OSPF_Passive False\n", "OSPF_Cost 1\n", "OSPF_Network_Type BROADCAST\n", "OSPF_Hello_Interval 10\n", "OSPF_Dead_Interval 40\n", "Name: 0, dtype: object" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### OSPF Area Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration parameters of OSPF areas." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns information about all OSPF areas defined across the network." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [], "source": [ "result = bf.q.ospfAreaConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VRF | VRF | str\n", "Process_ID | Process ID | str\n", "Area | Area number | str\n", "Area_Type | Area type | str\n", "Active_Interfaces | Names of active interfaces | Set of str\n", "Passive_Interfaces | Names of passive interfaces | Set of str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVRFProcess_IDAreaArea_TypeActive_InterfacesPassive_Interfaces
0as2dist2default11NONE['GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'][]
1as2border2default11NONE['GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'][]
2as3core1default11NONE['GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'][]
3as2core1default11NONE['GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'GigabitEthernet3/0', 'Loopback0'][]
4as1border2default11NONE['GigabitEthernet1/0', 'Loopback0'][]
\n", "
" ], "text/plain": [ " Node VRF Process_ID Area Area_Type Active_Interfaces Passive_Interfaces\n", "0 as2dist2 default 1 1 NONE ['GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'] []\n", "1 as2border2 default 1 1 NONE ['GigabitEthernet1/0', 'GigabitEthernet2/0', 'Loopback0'] []\n", "2 as3core1 default 1 1 NONE ['GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0'] []\n", "3 as2core1 default 1 1 NONE ['GigabitEthernet0/0', 'GigabitEthernet1/0', 'GigabitEthernet2/0', 'GigabitEthernet3/0', 'Loopback0'] []\n", "4 as1border2 default 1 1 NONE ['GigabitEthernet1/0', 'Loopback0'] []" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as2dist2\n", "VRF default\n", "Process_ID 1\n", "Area 1\n", "Area_Type NONE\n", "Active_Interfaces ['GigabitEthernet0/0', 'GigabitEthernet1/0', 'Loopback0']\n", "Passive_Interfaces []\n", "Name: 0, dtype: object" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'aristaevpn'" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('aristaevpn')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Multi-chassis LAG" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns MLAG configuration." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists the configuration settings for each MLAG domain in the network." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "mlagIds | Include MLAG IDs matching this specifier. | [MlagIdSpec](../specifiers.md#mlag-id-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [], "source": [ "result = bf.q.mlagProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node name | str\n", "MLAG_ID | MLAG domain ID | str\n", "Peer_Address | Peer's IP address | str\n", "Local_Interface | Local interface used for MLAG peering | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "Source_Interface | Local interface used as source-interface for MLAG peering | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeMLAG_IDPeer_AddressLocal_InterfaceSource_Interface
0dc1-bl1aDC1_BL110.255.252.11dc1-bl1a[Port-Channel3]dc1-bl1a[Vlan4094]
1dc1-bl1bDC1_BL110.255.252.10dc1-bl1b[Port-Channel3]dc1-bl1b[Vlan4094]
2dc1-l2leaf5aDC1_L2LEAF510.255.252.19dc1-l2leaf5a[Port-Channel3]dc1-l2leaf5a[Vlan4094]
3dc1-l2leaf5bDC1_L2LEAF510.255.252.18dc1-l2leaf5b[Port-Channel3]dc1-l2leaf5b[Vlan4094]
4dc1-l2leaf6aDC1_L2LEAF610.255.252.23dc1-l2leaf6a[Port-Channel3]dc1-l2leaf6a[Vlan4094]
\n", "
" ], "text/plain": [ " Node MLAG_ID Peer_Address Local_Interface Source_Interface\n", "0 dc1-bl1a DC1_BL1 10.255.252.11 dc1-bl1a[Port-Channel3] dc1-bl1a[Vlan4094]\n", "1 dc1-bl1b DC1_BL1 10.255.252.10 dc1-bl1b[Port-Channel3] dc1-bl1b[Vlan4094]\n", "2 dc1-l2leaf5a DC1_L2LEAF5 10.255.252.19 dc1-l2leaf5a[Port-Channel3] dc1-l2leaf5a[Vlan4094]\n", "3 dc1-l2leaf5b DC1_L2LEAF5 10.255.252.18 dc1-l2leaf5b[Port-Channel3] dc1-l2leaf5b[Vlan4094]\n", "4 dc1-l2leaf6a DC1_L2LEAF6 10.255.252.23 dc1-l2leaf6a[Port-Channel3] dc1-l2leaf6a[Vlan4094]" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node dc1-bl1a\n", "MLAG_ID DC1_BL1\n", "Peer_Address 10.255.252.11\n", "Local_Interface dc1-bl1a[Port-Channel3]\n", "Source_Interface dc1-bl1a[Vlan4094]\n", "Name: 0, dtype: object" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 48, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 49, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 49, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### IP Owners" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns where IP addresses are attached in the network." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For each device, lists the mapping from IPs to corresponding interface(s) and VRF(s)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "ips | Restrict output to only specified IP addresses. | [IpSpec](../specifiers.md#ip-specifier) | True | \n", "duplicatesOnly | Restrict output to only IP addresses that are duplicated (configured on a different node or VRF) in the snapshot. | bool | False | False" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [], "source": [ "result = bf.q.ipOwners().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node hostname | str\n", "VRF | VRF name | str\n", "Interface | Interface name | str\n", "IP | IP address | str\n", "Mask | Network mask length | int\n", "Active | Whether the interface is active | bool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVRFInterfaceIPMaskActive
0as2dist2defaultLoopback02.1.3.232True
1as2dist1defaultLoopback02.1.3.132True
2as2dept1defaultGigabitEthernet1/02.34.201.424True
3as2dept1defaultLoopback02.1.1.232True
4as3border2defaultGigabitEthernet1/03.0.2.124True
\n", "
" ], "text/plain": [ " Node VRF Interface IP Mask Active\n", "0 as2dist2 default Loopback0 2.1.3.2 32 True\n", "1 as2dist1 default Loopback0 2.1.3.1 32 True\n", "2 as2dept1 default GigabitEthernet1/0 2.34.201.4 24 True\n", "3 as2dept1 default Loopback0 2.1.1.2 32 True\n", "4 as3border2 default GigabitEthernet1/0 3.0.2.1 24 True" ] }, "execution_count": 51, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as2dist2\n", "VRF default\n", "Interface Loopback0\n", "IP 2.1.3.2\n", "Mask 32\n", "Active True\n", "Name: 0, dtype: object" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 53, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Named Structures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns named structure definitions." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Return structures defined in the configurations, represented in a vendor-independent JSON format." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "structureTypes | Include structures of this type. | [NamedStructureSpec](../specifiers.md#named-structure-specifier) | True | \n", "structureNames | Include structures matching this name or regex. | str | True | \n", "ignoreGenerated | Whether to ignore auto-generated structures. | bool | True | True\n", "indicatePresence | Output if the structure is present or absent. | bool | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [], "source": [ "result = bf.q.namedStructures().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "Structure_Type | Structure type | str\n", "Structure_Name | Structure name | str\n", "Structure_Definition | Structure definition | dict" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeStructure_TypeStructure_NameStructure_Definition
0as1border1Community_Set_Match_Expras1_community{'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}
1as1border2Community_Set_Match_Expras1_community{'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}
2as2border1Community_Set_Match_Expras1_community{'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}
3as2border2Community_Set_Match_Expras1_community{'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}
4as3border1Community_Set_Match_Expras1_community{'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}
\n", "
" ], "text/plain": [ " Node Structure_Type Structure_Name Structure_Definition\n", "0 as1border1 Community_Set_Match_Expr as1_community {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}\n", "1 as1border2 Community_Set_Match_Expr as1_community {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}\n", "2 as2border1 Community_Set_Match_Expr as1_community {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}\n", "3 as2border2 Community_Set_Match_Expr as1_community {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}\n", "4 as3border1 Community_Set_Match_Expr as1_community {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}" ] }, "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node as1border1\n", "Structure_Type Community_Set_Match_Expr\n", "Structure_Name as1_community\n", "Structure_Definition {'expr': {'class': 'org.batfish.datamodel.routing_policy.communities.CommunityMatchRegex', 'communityRendering': {'class': 'org.batfish.datamodel.routing_policy.communities.ColonSeparatedRendering'}, 'regex': '(,|\\{|\\}|^|$| )1:'}}\n", "Name: 0, dtype: object" ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 58, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 59, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Defined Structures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists the structures defined in the network." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists the structures defined in the network, along with the files and line numbers in which they are defined." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "filename | Include structures defined in the given file. | str | True | \n", "nodes | Include files used to generate nodes whose name matches this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | .*\n", "names | Include structures whose name matches this string or regex. | str | True | .*\n", "types | Include structures whose vendor-specific type matches this string or regex. | str | True | .*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 60, "metadata": {}, "outputs": [], "source": [ "result = bf.q.definedStructures().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Structure_Type | Vendor-specific type of the structure | str\n", "Structure_Name | Name of the structure | str\n", "Source_Lines | File and line numbers where the structure is defined | [FileLines](../datamodel.rst#pybatfish.datamodel.primitives.FileLines)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Structure_TypeStructure_NameSource_Lines
0extended ipv4 access-list lineOUTSIDE_TO_INSIDE: permit ip any anyconfigs/as2border1.cfg:[137]
1extended ipv4 access-list lineblocktelnet: deny tcp any any eq telnetconfigs/as2core1.cfg:[122]
2interfaceGigabitEthernet1/0configs/as1core1.cfg:[69, 70, 71]
3route-map-clauseas3_to_as2 1configs/as3border1.cfg:[146, 147, 148, 149]
4extended ipv4 access-list101configs/as2border2.cfg:[140, 141]
\n", "
" ], "text/plain": [ " Structure_Type Structure_Name Source_Lines\n", "0 extended ipv4 access-list line OUTSIDE_TO_INSIDE: permit ip any any configs/as2border1.cfg:[137]\n", "1 extended ipv4 access-list line blocktelnet: deny tcp any any eq telnet configs/as2core1.cfg:[122]\n", "2 interface GigabitEthernet1/0 configs/as1core1.cfg:[69, 70, 71]\n", "3 route-map-clause as3_to_as2 1 configs/as3border1.cfg:[146, 147, 148, 149]\n", "4 extended ipv4 access-list 101 configs/as2border2.cfg:[140, 141]" ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Structure_Type extended ipv4 access-list line\n", "Structure_Name OUTSIDE_TO_INSIDE: permit ip any any\n", "Source_Lines configs/as2border1.cfg:[137]\n", "Name: 0, dtype: object" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Referenced Structures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists the references in configuration files to vendor-specific structures." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists the references in configuration files to vendor-specific structures, along with the line number, the name and the type of the structure referenced, and configuration context in which each reference occurs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include files used to generate nodes whose name matches this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "names | Include structures whose name matches this string or regex. | str | True | \n", "types | Include structures whose vendor-specific type matches this string or regex. | str | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [], "source": [ "result = bf.q.referencedStructures().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Structure_Type | Type of structure referenced | str\n", "Structure_Name | The referenced structure | str\n", "Context | Configuration context in which the reference appears | str\n", "Source_Lines | Lines where reference appears | [FileLines](../datamodel.rst#pybatfish.datamodel.primitives.FileLines)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 66, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Structure_TypeStructure_NameContextSource_Lines
0bgp neighbor1.10.1.1 (VRF default)bgp neighbor self refconfigs/as1border1.cfg:[92, 111]
1bgp neighbor10.12.11.2 (VRF default)bgp neighbor self refconfigs/as1border1.cfg:[114]
2bgp neighbor3.2.2.2 (VRF default)bgp neighbor self refconfigs/as1border1.cfg:[112]
3bgp neighbor5.6.7.8 (VRF default)bgp neighbor self refconfigs/as1border1.cfg:[113]
4bgp peer-groupas1bgp neighbor peer-groupconfigs/as1border1.cfg:[91]
\n", "
" ], "text/plain": [ " Structure_Type Structure_Name Context Source_Lines\n", "0 bgp neighbor 1.10.1.1 (VRF default) bgp neighbor self ref configs/as1border1.cfg:[92, 111]\n", "1 bgp neighbor 10.12.11.2 (VRF default) bgp neighbor self ref configs/as1border1.cfg:[114]\n", "2 bgp neighbor 3.2.2.2 (VRF default) bgp neighbor self ref configs/as1border1.cfg:[112]\n", "3 bgp neighbor 5.6.7.8 (VRF default) bgp neighbor self ref configs/as1border1.cfg:[113]\n", "4 bgp peer-group as1 bgp neighbor peer-group configs/as1border1.cfg:[91]" ] }, "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 67, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Structure_Type bgp neighbor\n", "Structure_Name 1.10.1.1 (VRF default)\n", "Context bgp neighbor self ref\n", "Source_Lines configs/as1border1.cfg:[92, 111]\n", "Name: 0, dtype: object" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Undefined References" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Identifies undefined references in configuration." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finds configurations that have references to named structures (e.g., ACLs) that are not defined. Such occurrences indicate errors and can have serious consequences in some cases." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Look for undefined references on nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | .*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [], "source": [ "result = bf.q.undefinedReferences().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "File_Name | File containing reference | str\n", "Struct_Type | Type of struct reference is supposed to be | str\n", "Ref_Name | The undefined reference | str\n", "Context | Context of undefined reference | str\n", "Lines | Lines where reference appears | [FileLines](../datamodel.rst#pybatfish.datamodel.primitives.FileLines)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
File_NameStruct_TypeRef_NameContextLines
0configs/as2core2.cfgroute-mapfilter-bogonsbgp inbound route-mapconfigs/as2core2.cfg:[110]
\n", "
" ], "text/plain": [ " File_Name Struct_Type Ref_Name Context Lines\n", "0 configs/as2core2.cfg route-map filter-bogons bgp inbound route-map configs/as2core2.cfg:[110]" ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "File_Name configs/as2core2.cfg\n", "Struct_Type route-map\n", "Ref_Name filter-bogons\n", "Context bgp inbound route-map\n", "Lines configs/as2core2.cfg:[110]\n", "Name: 0, dtype: object" ] }, "execution_count": 72, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('generate_questions')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Unused Structures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns nodes with structures such as ACLs, routemaps, etc. that are defined but not used." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Return nodes with structures such as ACLs, routes, etc. that are defined but not used. This may represent a bug in the configuration, which may have occurred because a final step in a template or MOP was not completed. Or it could be harmless extra configuration generated from a master template that is not meant to be used on those nodes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Look for unused structures on nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | .*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 75, "metadata": {}, "outputs": [], "source": [ "result = bf.q.unusedStructures().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Structure_Type | Vendor-specific type of the structure | str\n", "Structure_Name | Name of the structure | str\n", "Source_Lines | File and line numbers where the structure is defined | [FileLines](../datamodel.rst#pybatfish.datamodel.primitives.FileLines)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Structure_TypeStructure_NameSource_Lines
0bgp peer-groupas3configs/as1border1.cfg:[85]
1expanded community-listas1_communityconfigs/as1border1.cfg:[121]
2ipv4 prefix-listinbound_route_filterconfigs/as1border1.cfg:[131, 132]
3bgp peer-groupas2configs/as1border2.cfg:[87]
4expanded community-listas1_communityconfigs/as1border2.cfg:[123]
\n", "
" ], "text/plain": [ " Structure_Type Structure_Name Source_Lines\n", "0 bgp peer-group as3 configs/as1border1.cfg:[85]\n", "1 expanded community-list as1_community configs/as1border1.cfg:[121]\n", "2 ipv4 prefix-list inbound_route_filter configs/as1border1.cfg:[131, 132]\n", "3 bgp peer-group as2 configs/as1border2.cfg:[87]\n", "4 expanded community-list as1_community configs/as1border2.cfg:[123]" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Structure_Type bgp peer-group\n", "Structure_Name as3\n", "Source_Lines configs/as1border1.cfg:[85]\n", "Name: 0, dtype: object" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 79, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'aristaevpn'" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('aristaevpn')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### VLAN Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of switched VLANs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists information about implicitly and explicitly configured switched VLANs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "interfaces | Include interfaces matching this specifier. | [InterfaceSpec](../specifiers.md#interface-specifier) | True | \n", "vlans | Include VLANs in this space. | str | True | \n", "excludeShutInterfaces | Exclude interfaces that are shutdown. | bool | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 80, "metadata": {}, "outputs": [], "source": [ "result = bf.q.switchedVlanProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VLAN_ID | VLAN_ID | int\n", "Interfaces | Switched interfaces carrying traffic for this VLAN | Set of [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "VXLAN_VNI | VXLAN VNI with which this VLAN is associated | int" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 81, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVLAN_IDInterfacesVXLAN_VNI
0dc1-bl1b250[dc1-bl1b[Port-Channel3], dc1-bl1b[Vlan250]]20250
1dc1-leaf1a210[dc1-leaf1a[Vlan210]]20210
2dc1-leaf1a211[dc1-leaf1a[Vlan211]]20211
3dc1-leaf2a3764[dc1-leaf2a[Port-Channel3]]None
4dc1-leaf2b3789[dc1-leaf2b[Port-Channel3]]None
\n", "
" ], "text/plain": [ " Node VLAN_ID Interfaces VXLAN_VNI\n", "0 dc1-bl1b 250 [dc1-bl1b[Port-Channel3], dc1-bl1b[Vlan250]] 20250\n", "1 dc1-leaf1a 210 [dc1-leaf1a[Vlan210]] 20210\n", "2 dc1-leaf1a 211 [dc1-leaf1a[Vlan211]] 20211\n", "3 dc1-leaf2a 3764 [dc1-leaf2a[Port-Channel3]] None\n", "4 dc1-leaf2b 3789 [dc1-leaf2b[Port-Channel3]] None" ] }, "execution_count": 81, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 82, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node dc1-bl1b\n", "VLAN_ID 250\n", "Interfaces [dc1-bl1b[Port-Channel3], dc1-bl1b[Vlan250]]\n", "VXLAN_VNI 20250\n", "Name: 0, dtype: object" ] }, "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 83, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 83, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 84, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'ios_basic_vrrp'" ] }, "execution_count": 84, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('ios_basic_vrrp')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### VRRP Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns configuration settings of VRRP groups." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists information about VRRP groups on interfaces." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this specifier. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "interfaces | Include interfaces matching this specifier. | [InterfaceSpec](../specifiers.md#interface-specifier) | True | \n", "virtualAddresses | Include only groups with at least one virtual address matching this specifier. | [IpSpec](../specifiers.md#ip-specifier) | True | \n", "excludeShutInterfaces | Exclude interfaces that are shutdown. | bool | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 85, "metadata": {}, "outputs": [], "source": [ "result = bf.q.vrrpProperties().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Interface | Interface | [Interface](../datamodel.rst#pybatfish.datamodel.primitives.Interface)\n", "Group_Id | VRRP Group ID | int\n", "Virtual_Addresses | Virtual Addresses | Set of str\n", "Source_Address | Source Address used for VRRP messages | str\n", "Priority | VRRP router priority | int\n", "Preempt | Whether preemption is allowed | bool\n", "Active | Whether the interface is active | bool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 86, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
InterfaceGroup_IdVirtual_AddressesSource_AddressPriorityPreemptActive
0br1[GigabitEthernet0/2]12['192.168.1.254']192.168.1.1/24110TrueTrue
1br2[GigabitEthernet0/2]12['192.168.1.254']192.168.1.2/24100TrueTrue
\n", "
" ], "text/plain": [ " Interface Group_Id Virtual_Addresses Source_Address Priority Preempt Active\n", "0 br1[GigabitEthernet0/2] 12 ['192.168.1.254'] 192.168.1.1/24 110 True True\n", "1 br2[GigabitEthernet0/2] 12 ['192.168.1.254'] 192.168.1.2/24 100 True True" ] }, "execution_count": 86, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 87, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Interface br1[GigabitEthernet0/2]\n", "Group_Id 12\n", "Virtual_Addresses ['192.168.1.254']\n", "Source_Address 192.168.1.1/24\n", "Priority 110\n", "Preempt True\n", "Active True\n", "Name: 0, dtype: object" ] }, "execution_count": 87, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 88, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 88, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 89, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'a10'" ] }, "execution_count": 89, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('a10')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### A10 Virtual Server Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns Virtual Server configuration of A10 devices." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists all the virtual-server to service-group to server mappings in A10 configurations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | \n", "virtualServerIps | Include virtual servers whose IP match this specifier. | [IpSpec](../specifiers.md#ip-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 90, "metadata": {}, "outputs": [], "source": [ "result = bf.q.a10VirtualServerConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "Virtual_Server_Name | Virtual Server Name | str\n", "Virtual_Server_Enabled | Virtual Server Enabled | bool\n", "Virtual_Server_IP | Virtual Server IP | str\n", "Virtual_Server_Port | Virtual Server Port | int\n", "Virtual_Server_Port_Enabled | Virtual Server Port Enabled | bool\n", "Virtual_Server_Type | Virtual Server Type | str\n", "Virtual_Server_Port_Type_Name | Virtual Server Port Type Name | str\n", "Service_Group_Name | Service Group Name | str\n", "Service_Group_Type | Service Group Type | str\n", "Servers | List of Servers. Each item is a 4-tuple: Server Name, Port, IP Address, and Active Status. | Set of List of str\n", "Source_NAT_Pool_Name | Source NAT Pool Name | str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 91, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVirtual_Server_NameVirtual_Server_EnabledVirtual_Server_IPVirtual_Server_PortVirtual_Server_Port_EnabledVirtual_Server_TypeVirtual_Server_Port_Type_NameService_Group_NameService_Group_TypeServersSource_NAT_Pool_Name
0lb42VS_TCP_80True10.0.0.180TrueTCPNoneSG_TCP_80TCP[['SERVER1', '80', '10.1.10.11', 'active'], ['SERVER2', '80', '10.1.10.12', 'inactive']]None
\n", "
" ], "text/plain": [ " Node Virtual_Server_Name Virtual_Server_Enabled Virtual_Server_IP Virtual_Server_Port Virtual_Server_Port_Enabled Virtual_Server_Type Virtual_Server_Port_Type_Name Service_Group_Name Service_Group_Type Servers \\\n", "0 lb42 VS_TCP_80 True 10.0.0.1 80 True TCP None SG_TCP_80 TCP [['SERVER1', '80', '10.1.10.11', 'active'], ['SERVER2', '80', '10.1.10.12', 'inactive']] \n", "\n", " Source_NAT_Pool_Name \n", "0 None " ] }, "execution_count": 91, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 92, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node lb42\n", "Virtual_Server_Name VS_TCP_80\n", "Virtual_Server_Enabled True\n", "Virtual_Server_IP 10.0.0.1\n", "Virtual_Server_Port 80\n", "Virtual_Server_Port_Enabled True\n", "Virtual_Server_Type TCP\n", "Virtual_Server_Port_Type_Name None\n", "Service_Group_Name SG_TCP_80\n", "Service_Group_Type TCP\n", "Servers [['SERVER1', '80', '10.1.10.11', 'active'], ['SERVER2', '80', '10.1.10.12', 'inactive']]\n", "Source_NAT_Pool_Name None\n", "Name: 0, dtype: object" ] }, "execution_count": 92, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] }, { "cell_type": "code", "execution_count": 93, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'generate_questions'" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_network('generate_questions')" ] }, { "cell_type": "code", "execution_count": 94, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "data": { "text/plain": [ "'f5'" ] }, "execution_count": 94, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bf.set_snapshot('f5')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### F5 BIG-IP VIP Configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Returns VIP configuration of F5 BIG-IP devices." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lists all the VIP to server IP mappings contained in F5 BIP-IP configurations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Inputs**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type | Optional | Default Value\n", "--- | --- | --- | --- | --- \n", "nodes | Include nodes matching this name or regex. | [NodeSpec](../specifiers.md#node-specifier) | True | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Invocation**" ] }, { "cell_type": "code", "execution_count": 95, "metadata": {}, "outputs": [], "source": [ "result = bf.q.f5BigipVipConfiguration().answer().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### **Return Value**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Name | Description | Type\n", "--- | --- | ---\n", "Node | Node | str\n", "VIP_Name | Virtual Service Name | str\n", "VIP_Endpoint | Virtual Service Endpoint | str\n", "Servers | Servers | Set of str\n", "Description | Description | str" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first 5 rows of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 96, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NodeVIP_NameVIP_EndpointServersDescription
0f5bigip/Common/virtual1192.0.2.1:80 TCP['10.0.0.1:80']virtual1 is cool
1f5bigip/Common/virtual2192.0.2.2:80 TCP['10.0.0.2:80']pool2 is lame
2f5bigip/Common/virtual3192.0.2.3:80 TCP['10.0.0.4:80', '10.0.0.3:80']
\n", "
" ], "text/plain": [ " Node VIP_Name VIP_Endpoint Servers Description\n", "0 f5bigip /Common/virtual1 192.0.2.1:80 TCP ['10.0.0.1:80'] virtual1 is cool\n", "1 f5bigip /Common/virtual2 192.0.2.2:80 TCP ['10.0.0.2:80'] pool2 is lame\n", "2 f5bigip /Common/virtual3 192.0.2.3:80 TCP ['10.0.0.4:80', '10.0.0.3:80'] " ] }, "execution_count": 96, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print the first row of the returned Dataframe" ] }, { "cell_type": "code", "execution_count": 97, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Node f5bigip\n", "VIP_Name /Common/virtual1\n", "VIP_Endpoint 192.0.2.1:80 TCP\n", "Servers ['10.0.0.1:80']\n", "Description virtual1 is cool\n", "Name: 0, dtype: object" ] }, "execution_count": 97, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.iloc[0]" ] } ], "metadata": { "celltoolbar": "Edit Metadata", "hide_input": false, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.17" } }, "nbformat": 4, "nbformat_minor": 2 }