Exemple #1
0
    def __init__(self, ecme_ip, aggressive=False, verbosity=0, **kwargs):
        """Initializes the IPRetriever class. The IPRetriever needs the
           only the first node to know where to start.
        """
        super(IPRetriever, self).__init__()
        self.daemon = True

        if hasattr(ecme_ip, 'ip_address'):
            self.ecme_ip = ecme_ip.ip_address
        else:
            self.ecme_ip = ecme_ip

        self.aggressive = aggressive
        self.verbosity = verbosity

        # Everything here is optional
        self.timeout = kwargs.get('timeout', 120)
        self.retry = kwargs.get('retry', 0)

        self.ecme_user = kwargs.get('ecme_user', 'admin')
        self.ecme_password = kwargs.get('ecme_password', 'admin')

        self.server_user = kwargs.get('server_user', 'user1')
        self.server_password = kwargs.get('server_password', '1Password')

        if '_inet_pattern' in kwargs and '_ip_pattern' in kwargs:
            self.interface = kwargs.get('interface', None)
            self._inet_pattern = kwargs['_inet_pattern']
            self._ip_pattern = kwargs['_ip_pattern']

        else:
            self.set_interface(kwargs.get('interface', None),
                               kwargs.get('ipv6', False))

        if 'bmc' in kwargs:
            self._bmc = kwargs['bmc']
        else:
            self._bmc = make_bmc(LanBMC,
                                 verbose=(self.verbosity > 1),
                                 hostname=self.ecme_ip,
                                 username=self.ecme_user,
                                 password=self.ecme_password)

        if 'config_path' in kwargs:
            self.read_config(kwargs['config_path'])
Exemple #2
0
    def __init__(self, ecme_ip, aggressive=False, verbosity=0, **kwargs):
        """Initializes the IPRetriever class. The IPRetriever needs the
           only the first node to know where to start.
        """
        super(IPRetriever, self).__init__()
        self.daemon = True

        if hasattr(ecme_ip, 'ip_address'):
            self.ecme_ip = ecme_ip.ip_address
        else:
            self.ecme_ip = ecme_ip

        self.aggressive = aggressive
        self.verbosity = verbosity

        # Everything here is optional
        self.timeout = kwargs.get('timeout', 120)
        self.retry = kwargs.get('retry', 0)

        self.ecme_user = kwargs.get('ecme_user', 'admin')
        self.ecme_password = kwargs.get('ecme_password', 'admin')

        self.server_user = kwargs.get('server_user', 'user1')
        self.server_password = kwargs.get('server_password', '1Password')

        if '_inet_pattern' in kwargs and '_ip_pattern' in kwargs:
            self.interface = kwargs.get('interface', None)
            self._inet_pattern = kwargs['_inet_pattern']
            self._ip_pattern = kwargs['_ip_pattern']

        else:
            self.set_interface(kwargs.get('interface', None),
                               kwargs.get('ipv6', False))

        if 'bmc' in kwargs:
            self._bmc = kwargs['bmc']
        else:
            self._bmc = make_bmc(LanBMC, verbose=(self.verbosity > 1),
                                 hostname=self.ecme_ip,
                                 username=self.ecme_user,
                                 password=self.ecme_password)

        if 'config_path' in kwargs:
            self.read_config(kwargs['config_path'])
Exemple #3
0
 def __init__(self):
     self.bmc = make_bmc(LanBMC, hostname=g.machine.fqdn,
                         username=g.machine.username,
                         password=g.machine.password)
     super(IPMIResource, self).__init__()
Exemple #4
0
  -m MODE, --mode=MODE  power mode: on/off
"""
 
parser = OptionParser()
parser.add_option( "-H", "--host", dest="host", type=str, default="1.1.1.1",
                  help="IP address of the BMC server" )
parser.add_option( "-u", "--username", type=str, dest="username", default="default",
                  help="username" )
parser.add_option( "-p", "--password", type=str, dest="password", default="password",
                  help="password" )
parser.add_option( "-m", "--mode", type=str, dest="mode", default="on",
                  help="power mode: on/off" )
 
( args, op ) = parser.parse_args()
 
bmc = make_bmc( LanBMC, hostname=args.host, username=args.username, password=args.password, interface='lanplus' )

output = bmc.lan_print()
#print type(output)
info = tools.responseparser.ResponseParserMixIn.response_parser(output)
print info
#print type(info)
#print bmc.get_chassis_status()
#server = Server( bmc )
#if args.mode == "on":
#    print "Powering on the server."
#    server.power_on()
#    sleep(10)
#else:
#    print "Powering off the server."
#    server.power_off()
Exemple #5
0
__author__ = 'ibm001'

import pyipmi
from pyipmi import make_bmc
from pyipmi.bmc import LanBMC
from pyipmi.server import Server
from pyipmi.chassis import Chassis

bmc=make_bmc(LanBMC,hostname='50.1.169.42',username='******',password='******')
#print type(bmc)
'''
chass=Chassis(bmc)
m=chass.status()
print(m)
'''
server=Server(bmc)
n=server.is_powered
#print(n)