Skip to main content

get Cisco and Huawei 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
  • ACL

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()

router.disconnect()

The Schema is :

{
    "serie": "C800",
    "model": "C891F-K9",
    "version": "15.4(3)M6",
    "hostname": "THE_ROUTER",
    "uptime": {
        "years": 0,
        "weeks": 1,
        "days": 1,
        "hours": 11,
        "minutes": 25
    },
    "system_image": "c800-universalk9-mz.SPA.154-3.M6.bin",
    "serial_number": "FCZ1234A5BC"
}

Get Ipv4 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.getIpv4StaticRoutes()

router.disconnect()

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()

router.disconnect()

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()

router.disconnect()

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 ACL

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='')

acl = router.getIpv4Acl()

router.disconnect()

The Schema is :

[
    {
        "type": "Extended",
        "name": "acl-premium",
        "rule": [
            {
                "sequence_number": 10,
                "pass": "permit",
                "protocol": "udp",
                "source": "any",
                "source_port": "all",
                "destination": "host 192.168.10.3",
                "destination_port": "snmp",
                "macthes": 2417837
            },
            ...
        ]
    },
    ...
]

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()

router.disconnect()

The Schema is :

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

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.7.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

getRoutersConfig-0.0.7-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: getRoutersConfig-0.0.7.tar.gz
  • Upload date:
  • Size: 9.5 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.7.tar.gz
Algorithm Hash digest
SHA256 9ea75a407bbb2749360a3004fc0c59bde7f33bb60f63c42e32eae051a697f48b
MD5 b88a39fd7cb7b71c8eed01db6e7dadda
BLAKE2b-256 a8c9ea7f36478d1409f1d1a91934157bf47eaafad2ca172c157096d8417cee54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for getRoutersConfig-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3ccd4e8f27429cabb10a277ab9109a512614da0af1bba8e45e605131903d8592
MD5 2f8b2703fa6ff27644a132d9418ee248
BLAKE2b-256 c52251ff21251f407d7ea1571e03f59a586751fd06110f980790b176b0721772

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