Added new script to verify the IPMI KCS cmd.

created a testcase to run the IPMI KCS cmd overnight.

Created Resource file for KCS interface commands which
contains few of the IPMI commands to verify Kcs interface.

We can add other ipmi cmds in future.

Added IPMI raw commands in ipmi_raw_cmd_table.py

Added "Is BMC Operational" keyword instead of Sleep time,
to verify BMC is enabled via redfish.

Tested: Run robot /ipmi/test_ipmi_kcs.robot

Signed-off-by: Nagarjun B  <nagarjunb@ami.com>
Change-Id: I59f1515792ab99fb5d1f55566ea3c0fcfcc2942b
diff --git a/data/ipmi_raw_cmd_table.py b/data/ipmi_raw_cmd_table.py
index 1ddd58f..50b77f1 100644
--- a/data/ipmi_raw_cmd_table.py
+++ b/data/ipmi_raw_cmd_table.py
@@ -156,5 +156,63 @@
             "0x89",
             "error response byte when host is powered off"
         ]
-    }
+    },
+    'Device ID':
+    {
+        'Get':
+        [
+            # raw command
+            "0x06 0x01"
+        ]
+    },
+    'Cold Reset':
+    {
+        'reset':
+        [
+            # raw command
+            "0x06 0x02"
+        ]
+    },
+    'lan_parameters':
+    {
+        'get_ip':
+        [
+            # raw command
+            "0x0c 0x02 0x01 0x03 0 0"
+        ],
+        'get_ip_src':
+        [
+            # raw command
+            "0x0c 0x02 0x01 0x04 0 0"
+        ],
+        'get_dot1q':
+        [
+            # raw command
+            "0x0c 0x02 0x01 0x14 0 0"
+        ]
+    },
+    'SDR_Info':
+    {
+        'get':
+        [
+            # raw command
+            "0x04 0x20 1"
+        ]
+    },
+    'Chassis_status':
+    {
+        'get':
+        [
+            # raw command
+            "0x00 0x01"
+        ]
+    },
+    'SEL_Info':
+    {
+        'get':
+        [
+            # raw command
+            "0x0a 0x40"
+        ]
+    },
 }
diff --git a/ipmi/test_ipmi_kcs.robot b/ipmi/test_ipmi_kcs.robot
new file mode 100644
index 0000000..ddb9b6c
--- /dev/null
+++ b/ipmi/test_ipmi_kcs.robot
@@ -0,0 +1,41 @@
+*** Settings ***
+
+Documentation          To Verify KCS interface.
+
+Resource               ../lib/ipmi_client.robot
+Resource               ../lib/ipmi_utils.robot
+Variables              ../data/ipmi_raw_cmd_table.py
+Library                ../lib/ipmi_utils.py
+
+
+Suite Setup     Test Setup Execution
+
+
+*** Variables ***
+${LOOP_COUNT}          ${1}
+
+
+*** Test Cases ***
+
+Verify KCS interface
+    [Documentation]  Verify KCS interface.
+    [Tags]  Verify_KCS_interface
+
+    Verify KCS Interface Commands
+
+
+Verify KCS Raw IPMI Multiple Times
+    [Documentation]  Verify KCS interface raw ipmi command for multiple times.
+    [Tags]  Verify_KCS_Raw_IPMI_Multiple_Times
+
+    Repeat Keyword  ${LOOP_COUNT} times  Verify KCS Interface Commands
+
+
+*** Keywords ***
+
+Test Setup Execution
+   [Documentation]  Do suite setup tasks.
+
+    Should Not Be Empty  ${OS_HOST}
+    Should Not Be Empty  ${OS_USERNAME}
+    Should Not Be Empty  ${OS_PASSWORD}
diff --git a/lib/ipmi_utils.robot b/lib/ipmi_utils.robot
new file mode 100644
index 0000000..a4e7533
--- /dev/null
+++ b/lib/ipmi_utils.robot
@@ -0,0 +1,50 @@
+*** Settings ***
+
+Documentation          Keywords for KCS and Lanplus interface command.
+
+Resource               ../lib/ipmi_client.robot
+Resource               ../lib/state_manager.robot
+Resource               ../lib/common_utils.robot
+Variables              ../data/ipmi_raw_cmd_table.py
+Library                ../lib/ipmi_utils.py
+
+
+*** Keywords ***
+
+Verify KCS Interface Commands
+    [Documentation]  Execute set of IPMI raw KCS interface commands and verify it is
+    ...  executable from os host. Set of IPMI raw commands includes system interface
+    ...  command.
+
+    #### raw cmd for get device ID.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['Device ID']['Get'][0]}
+
+    #### Raw cmd for cold reset.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['Cold Reset']['reset'][0]}
+
+    Wait Until Keyword Succeeds  2 min  10 sec  Is BMC Unpingable
+    Wait Until Keyword Succeeds  3 min  10 sec  Is BMC Operational
+    ## Waiting time to get KCS interface enabled.
+    Wait Until Keyword Succeeds  3 min  10 sec
+    ...  Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['Device ID']['Get'][0]}
+
+    #### raw cmd for get device GUID.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['Device GUID']['Get'][0]}
+
+    #### raw cmd for get IP addr.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['lan_parameters']['get_ip'][0]}
+
+    #### raw cmd for get IP addr src.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['lan_parameters']['get_ip_src'][0]}
+
+    #### raw cmd for get Dot1Q details.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['lan_parameters']['get_dot1q'][0]}
+
+    #### raw cmd for get SDR Info.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['SDR_Info']['get'][0]}
+
+    #### raw cmd for get Chassis status.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['Chassis_status']['get'][0]}
+
+    #### raw cmd for get SEL INFO.
+    Run Inband IPMI Raw Command  ${IPMI_RAW_CMD['SEL_Info']['get'][0]}
diff --git a/lib/utils.robot b/lib/utils.robot
index 8f0ba80..c9ceccf 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1011,3 +1011,9 @@
     ${bios_attr_dict}=  Redfish.Get Attribute  ${systems[0]}/Bios  Attributes
 
     [Return]  ${bios_attr_dict}
+
+Is BMC Operational
+    [Documentation]  Check if BMC is enabled.
+
+    ${bmc_status} =  Redfish Get BMC State
+    Should Be Equal  ${bmc_status}  Enabled