Add redfishtool utility library file and related changes

Change-Id: Ida402a7c8d188603f085f5a3740bdb3e0efea3a4
Signed-off-by: manashsarma <manashsarma@in.ibm.com>
diff --git a/redfish/dmtf_tools/test_redfishtool_certificate.robot b/redfish/dmtf_tools/test_redfishtool_certificate.robot
index e1c4dc1..5ec8437 100644
--- a/redfish/dmtf_tools/test_redfishtool_certificate.robot
+++ b/redfish/dmtf_tools/test_redfishtool_certificate.robot
@@ -11,7 +11,7 @@
 Resource          ../../lib/bmc_redfish_resource.robot
 Resource          ../../lib/openbmc_ffdc.robot
 Resource          ../../lib/certificate_utils.robot
-
+Resource          ../../lib/dmtf_redfishtool_utils.robot
 
 Suite Setup       Suite Setup Execution
 
@@ -101,19 +101,6 @@
 *** Keywords ***
 
 
-Is HTTP error Expected
-    [Documentation]  Check if the HTTP error is expected.
-    [Arguments]  ${cmd_output}  ${error_expected}
-
-    # Description of argument(s):
-    # cmd_output      Output of an HTTP operation.
-    # error_expected  Expected error.
-
-    @{words} =  Split String  ${error_expected}  ,
-    @{errorString}=  Split String  ${cmd_output}  ${SPACE}
-    Should Contain Any  ${errorString}  @{words}
-
-
 Verify Redfishtool Install Certificate
     [Documentation]  Install and verify certificate using Redfishtool.
     [Arguments]  ${cert_type}  ${cert_format}  ${expected_status}  ${delete_cert}=${True}
@@ -162,7 +149,7 @@
     ${json_object}=  To JSON  ${cmd_output}
     ${cert_list}=  Set Variable  ${json_object["Members"]}
     FOR  ${cert}  IN  @{cert_list}
-      Redfishtool Delete  ${cert["@odata.id"]}  ${root_cmd_args}  ${HTTP_NO_CONTENT}
+      Redfishtool Delete  ${cert["@odata.id"]}  ${root_cmd_args}
     END
 
 
@@ -270,22 +257,6 @@
     ...    Should Not Contain  ${cert_file_content}  ${bmc_cert_content}
 
 
-Redfishtool Get
-    [Documentation]  Execute redfishtool for GET operation.
-    [Arguments]  ${uri}  ${cmd_args}=${root_cmd_args}  ${expected_error}=""
-
-    # Description of argument(s):
-    # uri             URI for GET operation (e.g. /redfish/v1/AccountService/Accounts/).
-    # cmd_args        Commandline arguments.
-    # expected_error  Expected error optionally provided in testcase (e.g. 401 /
-    #                 authentication error, etc. ).
-
-    ${rc}  ${cmd_output}=  Run and Return RC and Output  ${cmd_args} GET ${uri}
-    Run Keyword If  ${rc} != 0  Is HTTP error Expected  ${cmd_output}  ${expected_error}
-
-    [Return]  ${cmd_output}
-
-
 Redfishtool GetAttribute
     [Documentation]  Execute redfishtool for GET operation.
     [Arguments]  ${uri}  ${Attribute}  ${cmd_args}=${root_cmd_args}  ${expected_error}=""
@@ -304,40 +275,6 @@
     [Return]  ${json_object["CertificateString"]}
 
 
-Redfishtool Post
-    [Documentation]  Execute redfishtool for  Post operation.
-    [Arguments]  ${payload}  ${uri}  ${cmd_args}=${root_cmd_args}  ${expected_error}=""
-
-    # Description of argument(s):
-    # payload         Payload with POST operation (e.g. data for user name, password, role,
-    #                 enabled attribute)
-    # uri             URI for POST operation (e.g. /redfish/v1/AccountService/Accounts/).
-    # cmd_args        Commandline arguments.
-    # expected_error  Expected error optionally provided in testcase (e.g. 401 /
-    #                 authentication error, etc. ).
-
-    ${rc}  ${cmd_output}=  Run and Return RC and Output  ${cmd_args} POST ${uri} --data=${payload}
-    Run Keyword If  ${rc} != 0  Is HTTP error Expected  ${cmd_output}  ${expected_error}
-
-    [Return]  ${cmd_output}
-
-
-Redfishtool Delete
-    [Documentation]  Execute redfishtool for  Post operation.
-    [Arguments]  ${uri}  ${cmd_args}=${root_cmd_args}  ${expected_error}=""
-
-    # Description of argument(s):
-    # uri             URI for DELETE operation.
-    # cmd_args        Commandline arguments.
-    # expected_error  Expected error optionally provided in testcase (e.g. 401 /
-    #                 authentication error, etc. ).
-
-    ${rc}  ${cmd_output}=  Run and Return RC and Output  ${cmd_args} DELETE ${uri}
-    Run Keyword If  ${rc} != 0  Is HTTP error Expected  ${cmd_output}  ${expected_error}
-
-    [Return]  ${cmd_output}
-
-
 Suite Setup Execution
     [Documentation]  Do suite setup execution.