Пример #1
0
 def mclic (self, switches, command):
     '''
     Runs a command on multiple switches (defined in the class variable
     multicli.switches). No values are returned
     '''
     output = []
     for switch in switches:
         target_url = "http://" + switch[1] + "/ins"
         myswitchname = switch[0]
         self.printdebug ("Running command " + command + " on " + myswitchname)
         myusername = switch[2]
         mypassword = switch[3]
         NXAPITransport.init(target_url=target_url, username=myusername, password=mypassword)
         try:
             NXAPITransport.clic (command)
         except:
             self.printdebug ("Error sending command " + command + " on " + myswitchname)
         pass
Пример #2
0
target_url = "http://10.30.14.8/ins"
username = "******"
password = "******"
NXAPITransport.init(target_url=target_url,
                    username=username,
                    password=password)
###################

###################
# cli/clip/clid are changed a bit, but largely the same
###################
print NXAPITransport.cli("show version")

NXAPITransport.clip("show interface brief")

NXAPITransport.clic("conf t ;interface eth4/1 ;no shut")

print NXAPITransport.clid("show version")

###################
# Below is exactly the same as the usage on the switch. Do whatever you
# are already doing on the switch right now!
###################
print Interface.interfaces()

i = Interface("Ethernet4/1")

print i.show(key="eth_mtu")

i.set_description(d="ifx4/1")
Пример #3
0
# NXAPI init block
###################
target_url = "http://10.30.14.8/ins"
username = "******"
password = "******"
NXAPITransport.init(target_url=target_url, username=username, password=password)
###################

################### 
# cli/clip/clid are changed a bit, but largely the same
###################
print NXAPITransport.cli("show version")

NXAPITransport.clip("show interface brief")

NXAPITransport.clic("conf t ;interface eth4/1 ;no shut")

print NXAPITransport.clid("show version")

################### 
# Below is exactly the same as the usage on the switch. Do whatever you
# are already doing on the switch right now!
###################
print Interface.interfaces()

i = Interface("Ethernet4/1")

print i.show(key="eth_mtu")

i.set_description(d="ifx4/1")