Skip to main content

cisco devices SDK based on netmiko

Project description

cscmiko SDK

SDK for cisco devices build using Netmiko and ntc-templates,

Installing

  1. download templats folder and place it at ~/ntc-tempalates/templates
  2. pip install cscmiko

Getting Started

Example 1:

to sync interfaces from the device:

from cscmiko.devices.switches import CatSwitch
my_switch = CatSwitch(host='192.168.1.1', username='admin', password='admin')
my_switch.sync_interfaces()

for interface in my_switch.interfaces :
    print(interface.name , " is " , interface.link_status)

results :

GigabitEthernet1/1/1  is  administratively down
GigabitEthernet1/1/2  is  administratively down
GigabitEthernet1/1/3  is  administratively down
TenGigabitEthernet1/1/4  is  up
TenGigabitEthernet1/1/5  is  up
TenGigabitEthernet1/2/1  is  down
TenGigabitEthernet1/2/2  is  up

Example 2:

to add a Vlan to the device:

from cscmiko.devices.switches import CatSwitch
my_swicth = CatSwitch(host='192.168.1.1', username='admin', password='admin')
my_swicth.sync_vlans()
my_swicth.vlans.add(id='911', name="Vlan911")
is_ok, msgs = my_swicth.commit()
print(is_ok)

results:

True

Example 3:

Nexus switch

from cscmiko.devices.switches import NexusSwitch
my_swicth = NexusSwitch(host='192.168.1.2', username='admin', password='admin')
my_swicth.sync_vpc()

print("list of up VPCs :")
for vpc in my_swicth.vpcs:
    if vpc.is_up:
        print("id:",vpc.id,"- port: ",vpc.port)

results:

list of up VPCs :
id: 1 - port:  Po99

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

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

cscmiko-0.0.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

cscmiko-0.0.1-py3-none-any.whl (13.6 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