Add case to test Get Channel Info via IPMI
Command "Get Channel Info" is belongs to the IPMI Messaging
Support Commands in IPMI SPEC.
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
Change-Id: Ia6c5e2c9b1ec8904df5859e450863f32b49f2558
diff --git a/lib/bmc_network_utils.py b/lib/bmc_network_utils.py
index 93f932b..7e91604 100644
--- a/lib/bmc_network_utils.py
+++ b/lib/bmc_network_utils.py
@@ -176,3 +176,31 @@
"""
return vf.filter_struct(get_channel_config(), "[('medium_type', 'other-lan|lan-802.3')]", regex=1)
+
+
+def get_channel_access_config():
+ r"""
+ Get the channel access config data and return as a dictionary.
+
+ Example:
+
+ channel_access_config = get_channel_access_config()
+ print_vars(channel_access_config)
+
+ channel_access_config:
+ [1]:
+ [priv_limit]: priv-admin
+ [per_msg_auth_disabled]: False
+ [access_mode]: always_available
+ [alerting_disabled]: False
+ [user_auth_disabled]: False
+ [2]:
+ [priv_limit]: priv-admin
+ [per_msg_auth_disabled]: False
+ [access_mode]: always_available
+ [alerting_disabled]: False
+ [user_auth_disabled]: False
+ """
+ stdout, stderr, rc = bsu.bmc_execute_command("cat /usr/share/ipmi-providers/channel_access.json")
+
+ return json.loads(stdout)
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index 4bdf6ad..d8c9be7 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -622,3 +622,34 @@
result = vf.key_value_outbuf_to_dict(ret_values, process_indent=1)
return result
+
+
+def get_channel_info(channel_number=1):
+ r"""
+ Get the channel info and return as a dictionary.
+ Example:
+
+ channel_info:
+ [channel_0x2_info]:
+ [channel_medium_type]: 802.3 LAN
+ [channel_protocol_type]: IPMB-1.0
+ [session_support]: multi-session
+ [active_session_count]: 0
+ [protocol_vendor_id]: 7154
+ [volatile(active)_settings]:
+ [alerting]: enabled
+ [per-message_auth]: enabled
+ [user_level_auth]: enabled
+ [access_mode]: always available
+ [non-volatile_settings]:
+ [alerting]: enabled
+ [per-message_auth]: enabled
+ [user_level_auth]: enabled
+ [access_mode]: always available
+ """
+
+ status, ret_values = \
+ grk.run_key_u("Run IPMI Standard Command channel info " + str(channel_number))
+ result = vf.key_value_outbuf_to_dict(ret_values, process_indent=1)
+
+ return result