Ejemplo n.º 1
0
from jnpr.junos.op.arp import ArpTable
#from jnpr.junos.op.ethport import EthernetSwitchingTable
from lxml import etree

host = raw_input('Enter Switch IP: ')
switch_user = raw_input('Enter switch username: '******'Enter switch password: '******'%s' % (host),
             user='******' % (switch_user),
             password='******' % (switch_password))
#eth = dev.rpc.get-ethernet-switching-table-information(normalize=True)
# dev = Device(host='192.168.140.240', user='******', password='******')
dev.open()

# Get arptable from switch
arp_table = dev.get_arp_table_information(normalize=True)
# Print response of device
print(etree.tostring(arp))

# Get EthernetSwitchingTable output working
#ethswitch = EthernetSwitchingTable(dev)
#ethswitch.get()

# Port Security Config
# Apply %s for script Mac address
'''config_script = """
edit ethernet-switching-options secure-access-port
set interface ge-0/0/46 allowed-mac 8C:AE:4C:F4:6B:50
""" '''
interface = raw_input("Enter port number (0-47): ")
mac = raw_input("Enter MAC Address to allow on the port: ")