How to use the pyeapi.load_config function in pyeapi

To help you get started, we’ve selected a few pyeapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arista-eosplus / pyeapi / examples / vlans_api.py View on Github external
#!/usr/bin/env python

# import the client library
import pyeapi

# load the conf file and connect to the node
pyeapi.load_config('nodes.conf')
node = pyeapi.connect_to('veos01')

# get the vlan api and enable autorefresh
vlans = node.api('vlans')
vlans.autorefresh = True

if vlans.get(123):
    print 'Vlan 123 already exists, deleting it'
    vlans.delete(1234)

print '\nCreating Vlan 123'
vlans.create(123)

print 'Setting Vlan 123 name to "test_vlan"'
vlans.set_name(123, 'test_vlan')
github arista-eosplus / pyeapi / examples / get_config.py View on Github external
#!/usr/bin/env python

import pyeapi

pyeapi.load_config('nodes.conf')
node = pyeapi.connect_to('veos01')

print 'Show running-config for veos01'
print '-'*30
print node.get_config('running-config')
print
print

print 'Show startup-config for veos01'
print '-'*30
print node.get_config('startup-config')
print
print

print 'Show config diffs'
print '-'*30
github arista-eosplus / pyeapi / examples / sysmac.py View on Github external
#!/usr/bin/env python

import pyeapi

pyeapi.load_config('nodes.conf')
node = pyeapi.connect_to('veos01')

output = node.enable('show version')

print 'My System MAC address is', output[0]['result']['systemMacAddress']
github arista-eosplus / pyeapi / examples / node.py View on Github external
#!/usr/bin/env python

import pyeapi

pyeapi.load_config('nodes.conf')
node = pyeapi.connect_to('veos01')

output = node.enable('show version')

print 'My System MAC address is', output[0]['systemMacAddress']