From dbb66408221e6dd96b2f69e0ae886c6e2ede7c63 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 Oct 2019 13:25:26 -0400 Subject: [PATCH] OpenBMC fixes for OP940 changes [Python] --- xCAT-openbmc-py/lib/python/agent/common/rest.py | 6 ++++-- xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/common/rest.py b/xCAT-openbmc-py/lib/python/agent/common/rest.py index e82485c6d..54fb5b4eb 100644 --- a/xCAT-openbmc-py/lib/python/agent/common/rest.py +++ b/xCAT-openbmc-py/lib/python/agent/common/rest.py @@ -15,10 +15,12 @@ from . import exceptions as xcat_exception class RestSession(object): - def __init__(self): + def __init__(self, auth=None): self.session = requests.Session() self.cookies = None - self.auth = None + # If userid and password were passed in, use them for basic authorization + # This is required to connect to BMC with OP940 level, ignored for lower OP levels + self.auth = auth def request(self, method, url, headers, data=None, timeout=30): diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py index 3f1565833..2ce1a547e 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py @@ -248,12 +248,12 @@ RSPCONFIG_APIS = { EVENTLOG_URLS = { "list": "/logging/enumerate", - "clear_all": "/logging/action/deleteAll", + "clear_all": "/logging/action/DeleteAll", "resolve": "/logging/entry/{}/attr/Resolved", } RAS_POLICY_TABLE = "/opt/ibm/ras/lib/policyTable.json" -RAS_POLICY_MSG = "Install the OpenBMC RAS package to obtain more details logging messages." +RAS_POLICY_MSG = "Install the OpenBMC RAS package to obtain more detailed logging messages." RAS_NOT_FOUND_MSG = " Not found in policy table: " RESULT_OK = 'ok' @@ -279,7 +279,7 @@ class OpenBMCRest(object): # print back to xcatd or just stdout self.messager = kwargs.get('messager') - self.session = rest.RestSession() + self.session = rest.RestSession((self.username,self.password)) self.root_url = HTTP_PROTOCOL + self.bmcip + PROJECT_URL self.download_root_url = HTTP_PROTOCOL + self.bmcip + '/'