BMC REST test update with new URI variables
What is fix:
- Updated /org/openbmc/ with appropriate new variables
- 80 chars guideline fixes
What is not fix:
- Test suite still needs more variables updates and planned to
update it with openbmc/openbmc-test-automation#237
- Documentation needs update
- Coding guidelines cleanup required intesively
Change-Id: I8a9cbd9c81821e9e934d5015339331fe5452b35e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_obmcrest.robot b/tests/test_obmcrest.robot
index 8edf35a..fb5d7c4 100644
--- a/tests/test_obmcrest.robot
+++ b/tests/test_obmcrest.robot
@@ -5,12 +5,11 @@
Resource ../lib/rest_client.robot
Resource ../lib/openbmc_ffdc.robot
+Resource ../lib/resource.txt
Test Teardown FFDC On Test Case Fail
-
*** Variables ***
-
*** Test Cases ***
Good connection for testing
[Tags] CI Good_connection_for_testing
@@ -19,37 +18,41 @@
Should Be Equal ${c} /org
Get an object with no properties
- ${content}= Read Properties /org/openbmc/inventory
+ ${content}= Read Properties ${INVENTORY_URI.rstrip("/")}
Should Be Empty ${content}
Get a Property
[Tags] Get_a_Property
- ${url_list}= Get Endpoint Paths ${OPENBMC_BASE_URI}inventory cpu
+ ${url_list}=
+ ... Get Endpoint Paths ${INVENTORY_URI.rstrip("/")} cpu
${url}= Get From List ${url_list} 0
${resp}= Read Attribute ${url} is_fru
Should Be Equal ${resp} ${1}
Get a null Property
- ${resp}= OpenBMC Get Request /org/openbmc/inventory/attr/is_fru
+ ${resp}= OpenBMC Get Request ${INVENTORY_URI}attr/is_fru
Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
${jsondata}= To Json ${resp.content}
- Should Be Equal ${jsondata['data']['description']} The specified property cannot be found: ''is_fru''
+ Should Be Equal
+ ... ${jsondata['data']['description']}
+ ... The specified property cannot be found: ''is_fru''
get directory listing /
[Tags] CI get_directory_listing
${resp}= openbmc get request /
- should be equal as strings ${resp.status_code} ${HTTP_OK}
+ should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org
- should be equal as strings ${json['status']} ok
+ list should contain value ${json['data']} /org
+ should be equal as strings ${json['status']} ok
get directory listing /org/
[Tags] CI
${resp}= openbmc get request /org/
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org/openbmc
- should be equal as strings ${json['status']} ok
+ list should contain value
+ ... ${json['data']} ${OPENBMC_BASE_URI.rstrip("/")}
+ should be equal as strings ${json['status']} ok
get invalid directory listing /i/dont/exist/
[Tags] CI
@@ -61,14 +64,16 @@
put directory listing /
[Tags] CI
${resp}= openbmc put request /
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
put directory listing /org/
[Tags] CI
${resp}= openbmc put request /org/
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -82,14 +87,16 @@
post directory listing /
[Tags] CI
${resp}= openbmc post request /
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
post directory listing /org/
[Tags] CI
${resp}= openbmc post request /org/
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -103,14 +110,16 @@
delete directory listing /
[Tags] CI
${resp}= openbmc delete request /
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
delete directory listing /org/
[Tags] CI
${resp}= openbmc delete request /
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -125,14 +134,16 @@
${resp}= openbmc get request /list
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org/openbmc/inventory
+ list should contain value
+ ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
should be equal as strings ${json['status']} ok
get list names /org/
${resp}= openbmc get request /org/list
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org/openbmc/inventory
+ list should contain value
+ ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
should be equal as strings ${json['status']} ok
get invalid list names /i/dont/exist/
@@ -145,14 +156,16 @@
put list names /
[Tags] CI
${resp}= openbmc put request /list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
put list names /org/
[Tags] CI
${resp}= openbmc put request /org/list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -166,14 +179,16 @@
post list names /
[Tags] CI
${resp}= openbmc post request /list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
post list names /org/
[Tags] CI
${resp}= openbmc post request /org/list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -187,14 +202,16 @@
delete list names /
[Tags] CI
${resp}= openbmc delete request /list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
delete list names /org/
[Tags] CI
${resp}= openbmc delete request /list
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -210,7 +227,8 @@
${resp}= openbmc get request /enumerate
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org/openbmc/inventory
+ list should contain value
+ ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
should be equal as strings ${json['status']} ok
get names /org/
@@ -218,7 +236,8 @@
${resp}= openbmc get request /org/enumerate
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
- list should contain value ${json['data']} /org/openbmc/inventory
+ list should contain value
+ ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
should be equal as strings ${json['status']} ok
get invalid names /i/dont/exist/
@@ -231,14 +250,16 @@
put names /
[Tags] CI
${resp}= openbmc put request /enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
put names /org/
[Tags] CI
${resp}= openbmc put request /org/enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -252,14 +273,16 @@
post names /
[Tags] CI
${resp}= openbmc post request /enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
post names /org/
[Tags] CI
${resp}= openbmc post request /org/enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -273,14 +296,16 @@
delete names /
[Tags] CI
${resp}= openbmc delete request /enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
delete names /org/
[Tags] CI
${resp}= openbmc delete request /enumerate
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -293,8 +318,10 @@
get method org/openbmc/records/events/action/acceptTestMessage
[Tags] CI
- ${resp}= openbmc get request org/openbmc/records/events/action/acceptTestMessage
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ ${resp}= openbmc get request
+ ... org/openbmc/records/events/action/acceptTestMessage
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -307,8 +334,10 @@
put method org/openbmc/records/events/action/acceptTestMessage
[Tags] CI
- ${resp}= openbmc put request org/openbmc/records/events/action/acceptTestMessage
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ ${resp}= openbmc put request
+ ... org/openbmc/records/events/action/acceptTestMessage
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -322,7 +351,8 @@
post method power/getPowerState no args
${fan_uri}= Get Power Control Interface
${data}= create dictionary data=@{EMPTY}
- ${resp}= openbmc post request ${fan_uri}/action/getPowerState data=${data}
+ ${resp}= openbmc post request
+ ... ${fan_uri}/action/getPowerState data=${data}
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} ok
@@ -330,13 +360,14 @@
post method org/openbmc/records/events/action/acceptTestMessage invalid args
[Tags] CI
${data}= create dictionary foo=bar
- ${resp}= openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
+ ${resp}= openbmc post request
+ ... org/openbmc/records/events/action/acceptTestMessage data=${data}
should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
post method org/openbmc/sensors/host/BootCount with args
- ${uri}= Set Variable /org/openbmc/sensors/host/BootCount
+ ${uri}= Set Variable ${SENSORS_URI}host/BootCount
${COUNT}= Set Variable ${3}
@{count_list}= Create List ${COUNT}
${data}= create dictionary data=@{count_list}
@@ -349,8 +380,10 @@
delete method org/openbmc/records/events/action/acceptTestMessage
[Tags] CI
- ${resp}= openbmc delete request org/openbmc/records/events/action/acceptTestMessage
- should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+ ${resp}= openbmc delete request
+ ... org/openbmc/records/events/action/acceptTestMessage
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} error
@@ -364,18 +397,21 @@
post method org/openbmc/records/events/action/acceptTestMessage no args
[Tags] CI
${data}= create dictionary data=@{EMPTY}
- ${resp}= openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
+ ${resp}= openbmc post request
+ ... org/openbmc/records/events/action/acceptTestMessage data=${data}
should be equal as strings ${resp.status_code} ${HTTP_OK}
${json}= to json ${resp.content}
should be equal as strings ${json['status']} ok
*** Keywords ***
Get Power Control Interface
- ${resp}= OpenBMC Get Request /org/openbmc/control/
- should be equal as strings ${resp.status_code} ${HTTP_OK} msg=Unable to get any controls - /org/openbmc/control/
+ ${resp}= OpenBMC Get Request ${CONTROL_URI}
+ should be equal as strings
+ ... ${resp.status_code} ${HTTP_OK}
+ ... msg=Unable to get any controls - ${CONTROL_URI}
${jsondata}= To Json ${resp.content}
log ${jsondata}
: FOR ${ELEMENT} IN @{jsondata["data"]}
\ log ${ELEMENT}
- \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
+ \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
\ Return From Keyword If '${found}' != '' ${found}