コード例 #1
0
import json
from pyntc import ntc_device as NTC

SW = NTC(host='192.168.2.11',
         username='******',
         password='******',
         device_type='cisco_ios_ssh')
SW.open()

#print (json.dumps(SW.facts, indent=4))
SW.config('hostname pyntc_S1')
SW.config_list(['router ospf 1', 'network 192.168.2.0 0.0.0.255 area 0'])

SW.close()
コード例 #2
0
print(json.dumps(router6.facts,indent=2))



print(router6.show('show ip arp'))

print(router6.show_list(['show ip inte bri','sho clock','show ip arp']))


print(router6.running_config)







router6.config('hostname test-Router6')
router6.config_list(['interface loop 111','ip address 111.11.11.11 255.255.255.255','description test loopback','no shut'])

print(router6.show('show run | in hostname'))
print(router6.show('show run interface loop 111'))
router6.save()


router6.backup_running_config('Router6.cfg')

router6.close()

コード例 #3
0
#/python3

import scapy

import json
from pyntc import ntc_device as NTC

SW = NTC(host='192.168.27.111',
         username='******',
         password='******',
         device_type='cisco_ios_ssh')
SW.open()

# print(json.dumps(SW.facts, indent=4))

SW.config('hostname SWITCH1')
SW.config_list(['int lo3', 'ip add 4.4.4.4 255.255.255.255'])
SW.close()