Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Copyright Notice:
# Copyright 2016-2019 DMTF. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/python-redfish-library/blob/master/LICENSE.md
import os
import sys
import json
import logging
from redfish import redfish_logger
from redfish.ris import RmcApp, JSONEncoder
#Config logger used by Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.ERROR)
LOGGER.info("Redfish API examples")
# When running remotely connect using the address, account name,
# and password to send https requests
login_host = "https://192.168.1.100"
login_account = "admin"
login_password = "password"
# Creating RMC object
RMCOBJ = RmcApp([])
# Create cache directory
config_dir = r'C:\DATA\redfish'
RMCOBJ.config.set_cachedir(os.path.join(config_dir, 'cache'))
cachedir = RMCOBJ.config.get_cachedir()
enabled: True
shared_nic: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
* URIs are case insensitive
* HTTP header names are case insensitive
* JSON Properties and Enum values are case sensitive
* A client should be tolerant of any set of HTTP headers the service returns
"""
import sys
import logging
import json
import redfish.ris.tpdefs
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.typepath = redfish.ris.tpdefs.Typesandpathdefines()
self.typepath.getgen(url=host, logger=LOGGER)
self.typepath.defs.redfishchange()
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
name: "Dump iLO nic"
enabled: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
new_username: 'user'
new_password: 'password'
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
name: "Get iLO IP"
enabled: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
name: "Dump IML"
enabled: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
tpm_flag: False
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
name: "Revert BIOS to default"
enabled: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try:
name: "Dump iLO Event Log"
enabled: True
'''
import sys
from redfish.rest.v1 import ServerDownOrUnreachableError
#import sys
import logging
import json
from redfish import AuthMethod, redfish_logger, redfish_client
#Config logger used by HPE Restful library
LOGGERFILE = "RedfishApiExamples.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.INFO)
LOGGER.info("HPE Redfish API examples")
class RedfishObject(object):
def __init__(self, host, login_account, login_password):
try:
self.redfish_client = redfish_client(base_url=host, \
username=login_account, password=login_password, \
default_prefix="/redfish/v1")
except:
raise
self.redfish_client.login(auth=AuthMethod.SESSION)
self.SYSTEMS_RESOURCES = self.ex1_get_resource_directory()
self.MESSAGE_REGISTRIES = self.ex2_get_base_registry()
def __del__(self):
try: