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/ipmi/test_ipmi_general.robot b/ipmi/test_ipmi_general.robot
index 59033a3..0c28039 100644
--- a/ipmi/test_ipmi_general.robot
+++ b/ipmi/test_ipmi_general.robot
@@ -4,6 +4,9 @@
 Resource         ../lib/ipmi_client.robot
 Resource         ../lib/openbmc_ffdc.robot
 Variables        ../data/ipmi_raw_cmd_table.py
+Variables        ../data/ipmi_variable.py
+Library          ../lib/bmc_network_utils.py
+Library          ../lib/ipmi_utils.py
 
 Test Teardown    FFDC On Test Case Fail
 
@@ -68,3 +71,56 @@
 
     Rprint Vars  guids  uuid
     Valid Value  uuid  ['${guids}']
+
+
+Verify Get Channel Info via IPMI
+    [Documentation]  Verify get channel info via IPMI.
+    [Tags]  Verify_Get_Channel_Info_via_IPMI
+
+    # Get channel info via ipmi command "ipmitool channel info [channel number]".
+    # Verify channel info with files "channel_access.json" and "channel_config.json" in BMC.
+
+    # Example output from 'Get Channel Info':
+    # 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
+
+    ${channel_info_ipmi}=  Get Channel Info  ${CHANNEL_NUMBER}
+    ${active_channel_config}=  Get Active Channel Config
+    ${channel_access_config}=  Get Channel Access Config
+    Rprint Vars  channel_info_ipmi  active_channel_config  channel_access_config
+
+    Valid Value  medium_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_medium_type']}']
+    ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['medium_type']}']
+
+    Valid Value  protocol_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_protocol_type']}']
+    ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['protocol_type']}']
+
+    Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['session_support']
+    ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['session_supported']}']
+
+    Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['active_session_count']
+    ...  ['${active_channel_config['${CHANNEL_NUMBER}']['active_sessions']}']
+    # IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal)
+    Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['protocol_vendor_id']  ['7154']
+
+    Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['alerting']}']
+    ...  ['${channel_access_config['${CHANNEL_NUMBER}']['alerting_disabled']}']
+
+    Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['per-message_auth']}']
+    ...  ['${channel_access_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}']
+
+    Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['user_level_auth']}']
+    ...  ['${channel_access_config['${CHANNEL_NUMBER}']['user_auth_disabled']}']
+
+    Valid Value  access_mode_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['access_mode']}']
+    ...  ['${channel_access_config['${CHANNEL_NUMBER}']['access_mode']}']