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

Uploaded Source

Built Distribution

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

Uploaded Python 3

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