diff options
Diffstat (limited to 'csit/tests/cps-model-sync/cps-model-sync.robot')
-rw-r--r-- | csit/tests/cps-model-sync/cps-model-sync.robot | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/csit/tests/cps-model-sync/cps-model-sync.robot b/csit/tests/cps-model-sync/cps-model-sync.robot index bb881f6a67..b4e61b30d8 100644 --- a/csit/tests/cps-model-sync/cps-model-sync.robot +++ b/csit/tests/cps-model-sync/cps-model-sync.robot @@ -25,6 +25,7 @@ Library Collections Library OperatingSystem Library RequestsLibrary Library BuiltIn +Library String Suite Setup Create Session CPS_URL http://${CPS_CORE_HOST}:${CPS_CORE_PORT} @@ -77,6 +78,24 @@ Get CM Handle details and confirm it has been updated. END END +Check if ietfYang-PNFDemo is READY + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo + ${headers}= Create Dictionary Authorization=${auth} + Wait Until Keyword Succeeds 20sec 200ms Is CM Handle READY ${uri} ${headers} ietfYang-PNFDemo + +Get modules for registered data node + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/modules + ${headers}= Create Dictionary Authorization=${auth} + ${response}= GET On Session CPS_URL ${uri} headers=${headers} + Should Be Equal As Strings ${response.status_code} 200 + ${number_of_items}= Count Items In JSON Response ${response} + Should Be True ${number_of_items} > 0 + FOR ${item} IN @{response.json()} + IF "${item['moduleName']}" == "stores" + Should Be Equal As Strings "${item['revision']}" "2020-09-15" + END + END + Delete cm handle ${uri}= Set Variable ${ncmpInventoryBasePath}/v1/ch ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} @@ -88,13 +107,22 @@ Get cm handle details and confirm it has been deleted ${headers}= Create Dictionary Authorization=${auth} ${response}= GET On Session CPS_URL ${uri} headers=${headers} expected_status=404 -Get modules for registered data node - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/modules - ${headers}= Create Dictionary Authorization=${auth} - ${response}= GET On Session CPS_URL ${uri} headers=${headers} - Should Be Equal As Strings ${response.status_code} 200 - FOR ${item} IN @{response.json()} - IF "${item['moduleName']}" == "stores" - Should Be Equal As Strings "${item['revision']}" "2020-09-15" +*** Keywords *** + +Is CM Handle READY + [Arguments] ${uri} ${headers} ${cmHandle} + ${response}= GET On Session CPS_URL ${uri} headers=${headers} + Should Be Equal As Strings ${response.status_code} 200 + ${number_of_items}= Count Items In JSON Response ${response} + Should Be True ${number_of_items} > 0 + FOR ${item} IN ${response.json()} + IF "${item['cmHandle']}" == "${cmHandle}" + Should Be Equal As Strings ${item['state']['cmHandleState']} READY END - END
\ No newline at end of file + END + +Count Items In JSON Response + [Arguments] ${response} + ${json_data}= Evaluate json.loads('${response.content.decode("utf-8")}') json + ${number_of_items}= Get Length ${json_data} + RETURN ${number_of_items} |