Skip to main content

Python based search utility to query multiple Cisco ACI fabrics at once.

Project description

Fabric Search

Quickly search endpoints and routing tables across a large number of APIC's and display the results in a table.

Endpoints can be searched using the following criteria:

  • MAC Address
  • IP Address
  • IP Network
  • Node

Route can be search using the following criteria:

  • Prefix
  • VRF

It is also possible to do searches based on partial data. for example the last 4 characters of a MAC address.

Installation

pip install bp-fabric-search

Usage

Inventory File

An simple inventory file is used to store a list of APIC's to search. This is a YAML file with a name and host key

---
- name: FABRIC-1
  host: https://10.1.0.1
- name: FABRIC-2
  host: https://10.2.0.1

Environment Variables

The following environment variables are required for the script to run, these can be set using the EXPORT command or loaded in at runtime from a .env file.

INVENTORY_USERNAME="USERNAME"
INVENTORY_PASSWORD="PASSWORD"

# Optional value for path to inventory file
# if not included it will default to inventory.yml

INVENTORY_PATH=path/to/my/inventory.yml

Endpoint Searches

Search by Node

fabric-search node --id 101

Search by MAC

fabric-search mac -m 00:50:56:85:6F:F9

Search by Network / IP

fabric-search ip --network 10.96.0.0/16
fabric-search ip --host 10.96.252.1

Result

Skipped Hosts:
Time taken: 0.20 seconds.


+----------+-------------------+---------------+---------------+-----+-------+------+-----------+---------+
|  Host    |        MAC        |       IP      |     Tenant    | EPG | Encap | Node | Interface |  Source |
+----------+-------------------+---------------+---------------+-----+-------+------+-----------+---------+
| FABRIC-1 | 00:50:56:85:EF:89 | 10.96.252.102 | CUST-TENANT-2 |     |  1411 | 101  |  eth1/10  | learned |
| FABRIC-1 | 00:50:56:85:EF:89 |  10.96.252.86 | CUST-NET-SVCS |     |  1413 | 101  |  eth1/10  | learned |
+----------+-------------------+---------------+---------------+-----+-------+------+-----------+---------+

Route Searches

Search by Prefix

fabric-search route --prefix 10.96.0.0/24

Search by Prefix and VRF

fabric-search route --prefix 10.96.0.0/24 --vrf FRASER-LAB:FRASER-LAB

Search by exact prefix

fabric-search route --prefix 10.96.0.0/24 --exact

Result

Skipped Hosts: FABRIC-2
Query Type: route
Time taken: 5.13 seconds.


+-----------+---------------+-------+--------+------+------------------+------+-------------+-----------------------+
|    Host   |     Route     |  Type | Metric | Pref |     Next Hop     | Node |  Interface  |          Vrf          |
+-----------+---------------+-------+--------+------+------------------+------+-------------+-----------------------+
| FABRIC-1  |   0.0.0.0/0   |  ebgp |   0    |  20  | 10.96.252.255/32 | 102  | unspecified | FRASER-LAB:FRASER-LAB |
| FABRIC-1  | 10.96.0.30/32 | local |   0    |  0   |  10.96.0.30/32   | 102  |    vlan25   | FRASER-LAB:FRASER-LAB |
| FABRIC-1  | 10.96.0.62/32 | local |   0    |  0   |  10.96.0.62/32   | 102  |    vlan23   | FRASER-LAB:FRASER-LAB |
| FABRIC-1  |   0.0.0.0/0   |  ebgp |   0    |  20  | 10.96.252.253/32 | 101  | unspecified | FRASER-LAB:FRASER-LAB |
| FABRIC-1  | 10.96.0.30/32 | local |   0    |  0   |  10.96.0.30/32   | 101  |    vlan23   | FRASER-LAB:FRASER-LAB |
| FABRIC-1  | 10.96.0.62/32 | local |   0    |  0   |  10.96.0.62/32   | 101  |    vlan29   | FRASER-LAB:FRASER-LAB |
+-----------+---------------+-------+--------+------+------------------+------+-------------+-----------------------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bp_fabric_search-0.1.3.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bp_fabric_search-0.1.3-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file bp_fabric_search-0.1.3.tar.gz.

File metadata

  • Download URL: bp_fabric_search-0.1.3.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for bp_fabric_search-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a2a51284e2f50c46c1f5a732a1201a2a6673c7a625dc032ede1385695106b122
MD5 a72b2c1603256b114c645d16b252f6fb
BLAKE2b-256 6adef1b2c2950225469fa571b6b13c5ad68523f3cc06d213031e181d8d4cc8a0

See more details on using hashes here.

File details

Details for the file bp_fabric_search-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bp_fabric_search-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for bp_fabric_search-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3eb1da9662eebd39205789767fc59f5399af58ea35467fa62b6bc1a500ab4b04
MD5 c30f25b6e413b6f0f1b62755eef545ff
BLAKE2b-256 a5e7b095ce1095c6d99908533184ad4443cbc04902a328668dba25c6f1018221

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page