Create keyword for ecmd commands & sanity test cases corresponding to it

'Ecmd' keyword supports commands as shown below
 - getscom/putscom, getmemproc/putmemproc, getcfam/putcfam.

sanity tests cases for getscom, getmemproc, getcfam.

Change-Id: I62f6011198b1a41eea720ae89be63a38168b8bae
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/utils.py b/lib/utils.py
index 05bae08..72cb202 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -391,3 +391,23 @@
 
     stdout, stderr, rc = bsu.bmc_execute_command('pdbg ' + option_string, **bsu_options)
     return stdout
+
+
+def ecmd(option_string, **bsu_options):
+    r"""
+    Run ecmd command on the BMC with the caller's option string and return the output.
+
+    Description of argument(s):
+    option_string                   A string of options which are to be executed on BMC.
+                                    (e.g. getscom pu 20010a40 -all,
+                                          putscom pu 20010a40 4000000000000000 -p0).
+    bsu_options                     Options to be passed directly to bmc_execute_command.  See its prolog for
+                                    details.
+    """
+
+    # Default print_out to 1.
+    if 'print_out' not in bsu_options:
+        bsu_options['print_out'] = 1
+
+    stdout, stderr, rc = bsu.bmc_execute_command(option_string, **bsu_options)
+    return stdout
diff --git a/openpower/ras/test_sanity_ecmd.robot b/openpower/ras/test_sanity_ecmd.robot
new file mode 100644
index 0000000..762f0cf
--- /dev/null
+++ b/openpower/ras/test_sanity_ecmd.robot
@@ -0,0 +1,37 @@
+*** Settings ***
+Documentation    Test RAS sanity scenarios using ecmd commands.
+
+Resource        ../../lib/openbmc_ffdc.robot
+Resource        ../../lib/openbmc_ffdc_utils.robot
+Resource        ../../lib/openbmc_ffdc_methods.robot
+Resource        ../../lib/ras/host_utils.robot
+Library         ../../lib/utils.py
+Variables       ../../lib/ras/variables.py
+
+Suite Setup      Redfish Power On
+Test Setup       Printn
+Test Teardown    FFDC On Test Case Fail
+
+
+*** Variables ***
+
+# mention count to read system memory.
+${count}           128
+
+*** Test Cases ***
+
+Test Ecmd Getscom
+    [Documentation]  Do getscom operation through BMC.
+    [Tags]  Test_Ecmd_Getscom
+    ${value}=  Get From Dictionary  ${ERROR_INJECT_DICT}  COREFIR_RECV1
+    Ecmd  getscom pu ${value[0]} -all
+
+Test Ecmd Getcfam
+    [Documentation]  Do getcfam operation through BMC.
+    [Tags]  Test_Ecmd_Getcfam
+    Ecmd  getcfam pu ${cfam_address} -all
+
+Test Ecmd Getmemproc
+    [Documentation]  Do getmemproc operation through BMC.
+    [Tags]  Test_Ecmd_Getmemproc
+    Ecmd  getmemproc ${mem_address} ${count}