ipmitool+python应用

bmc在ipmi基础上开发
ipmi版本: 中兴ipmi1.5  其他ipmi2
 惠普:lan set 2,华为:lan set 1 ,中兴:lan set 3
 
import os
import time
for i in open(r'c:\Users\Desktop\ip.txt'):
        ip=i.split("/")[1]
        newip=i.split("/")[2]
        print(ip)
        print(newip)
    #print("echo " + ip + " >> C:\\Users\\ffcs\\Desktop\\sn.txt")
        #os.system("echo " + ip + " >> C:\\Users\\ffcs\\Desktop\\sn.txt")
    #hp惠普服务器
        #print("ipmitool -I lanplus -H " + ip+" -U admin -P admin12345 lan set 2 ipaddr "+ newip)
    #os.system("ipmitool -I lanplus -H "+ ip + " -U admin -P admin12345 fru  | find \"Chassis Serial\" >> C:\\Users\\ffcs\\Desktop\\sn.txt")
    #os.system("ipmitool -I lanplus -H "+ ip + " -U admin -P password fru  | find \"Chassis Serial\" >> C:\\Users\\ffcs\\Desktop\\sn.txt")
        #os.system("ipmitool -I lanplus -H " + ip+" -U admin -P admin12345 lan set 2 netmask 255.255.254.0")
        #os.system("ipmitool -I lanplus -H " + ip+" -U admin -P admin12345 lan set 2 ipaddr "+ newip)
        #os.system("ipmitool -I lanplus -H " + ip+" -U admin -P admin12345 lan set 2 defgw ipaddr 10.241.40.1")
        os.system("ipmitool -I lanplus -H "+ip+" -U admin -P admin12345 mc reset cold")
        #huawei服务器
        #os.system("ipmitool -I lanplus -H "+ ip + " -U root -P Huawei12#$ fru  | find \"Product Serial\" >> C:\\Users\\ffcs\\Desktop\\sn.txt")
        #print("ipmitool -I lanplus -H " + ip+" -U root -P Huawei12#$ lan set 1 ipaddr "+ newip)
        #os.system("ipmitool -I lanplus -H " + ip+" -U root -P Huawei12#$ lan set 1 netmask 255.255.254.0")
        #os.system("ipmitool -I lanplus -H " + ip+" -U root -P Huawei12#$ lan set 1 ipaddr "+ newip)
time.sleep(100)

猜你喜欢

转载自www.cnblogs.com/lianyg/p/10237657.html