Skip to main content

get Cisco routers configuration as Json

Project description

PyPI - Python Version

What it does ?

This return Cisco configuration and information like :

  • Sytem informations
  • Static routes
  • Interfaces
  • DHCP

Informations

bastion_ip and bastion_port are optional

Get system informations

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

system_information = router.getSystemInformation()

The Schema is :

{
    "serie": "C870",
    "version": "12.4(24)T4",
    "hostname": "HomeC871",
    "uptime": {
        "years": 0,
        "weeks": 0,
        "days": 2,
        "hours": 2,
        "minutes": 44
}

Disconnect from router

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

system_information = router.disconnect()

Get static routes

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

static_routes = router.getStaticRoutes()

The Schema is :

[
    {
        "subnet_address": "1.1.1.1",
        "mask": {
        "octets": "255.255.255.255",
        "cidr": 29
        },
        "vrf": "TEST",
        "gateway": "2.2.2.2",
        "metric": 250,
        "tag": 408,
        "permanent": "false",
        "name": "the description",
        "track": 20
    },
    ...
]

Get interfaces

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

interfaces = router.getInterfaces()

The Schema is :

{
    "switched": [
        {
          "name": "FastEthernet0",
          "switchport_mode": "access",
          "vlan": "1"
        },
        ...
    ],
    "routed": [
        {
          "name": "FastEthernet4",
          "description": "",
          "ip": "192.168.1.101",
          "mask": {
            "octets": "255.255.255.0",
            "cidr": 24
          },
          "vrf": ""
        },
        ...
    ]
},

Get DHCP

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

dhcp = router.getDhcp()

The Schema is :

[
    {
        "name": "DATA",
        "network": {
            "subnet_address": "10.0.0.0",
            "mask": {
                "octets": "10.0.0.0",
                "cidr": 24
            }
        },
        "default_router": "10.0.0.1",
        "dns_server": [
            "8.8.8.8",
            ...
        ],
        "option": [
            {
                "code": 2,
                "string_type": "ascii",
                "string": "opt2"
            },
            ...
        ]
    },
    ...
]

Get full configuration

from getRoutersConfig import setInformations

router = setInformations(host_ip: str='', host_port: str='22', host_snmp_community: str='public', user: str='', password: str='', bastion_ip: str='', bastion_port: str='')

config = router.getFullConfiguration()

The Schema is :

{
    "system": {},
    "ipv4StaticRoutes": [],
    "interfaces": [],
    "dhcp": []
}

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

getRoutersConfig-0.0.4.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

getRoutersConfig-0.0.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file getRoutersConfig-0.0.4.tar.gz.

File metadata

  • Download URL: getRoutersConfig-0.0.4.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for getRoutersConfig-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ddf1d026a96435d4e7026f018fb18b3a1a2c4ebacc350eba422475b73c401689
MD5 ad263eab7f079b25d44c53607d783602
BLAKE2b-256 07ca8b624255aedbaa280b36b59cbc7fc74d6c3c6713597fb999fe8e7fb04dcb

See more details on using hashes here.

File details

Details for the file getRoutersConfig-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for getRoutersConfig-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fca839ba163f882934ac47d59c4dd7c0e9134a2329a2915ce9d8d92a263a7d83
MD5 b8b848264c4256bb730591d161f0ee34
BLAKE2b-256 460d54d5d012623aec85b6bba051693a7d79f881e44d6393e0e777e05237bc6c

See more details on using hashes here.

Supported by

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