Merge "CPS 1824: Delta Between 2 Anchors release notes"
[cps.git] / csit / tests / cps-trust-level / cps-trust-level.robot
index 5a16a34..e4deeff 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2023 Nordix Foundation
+ *  Copyright (C) 2023-2024 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -37,20 +37,20 @@ ${dmiUrl}                                   http://${DMI_HOST}:${DMI_PORT}
 ${jsonCreateCmHandles}                      {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","createdCmHandles":[{"trustLevel":"COMPLETE","cmHandle":"CH-1"},{"trustLevel":"COMPLETE","cmHandle":"CH-2"},{"cmHandle":"CH-3"},{"trustLevel":"NONE","cmHandle":"CH-4"}]}
 ${jsonTrustLevelPropertyQueryParameters}    {"cmHandleQueryParameters": [{"conditionName": "cmHandleWithTrustLevel", "conditionParameters": [ {"trustLevel": "COMPLETE"} ] }]}
 ${jsonTrustLevelQueryResponse}              {"data":{"attributeValueChange":[{"attributeName":"trustLevel","newAttributeValue":"NONE"}]}}
-${partitionId}                              ${0}
 
 *** Test Cases ***
-Register data node and verify notification
-    ${group_id}=           Create Consumer
-    ${topic_partition}=    Create Topic Partition    cm-events      ${partitionId}
-    ${offset}=             Get Watermark Offsets     ${group_id}    ${topic_partition}
-    ${tp}=                 Create Topic Partition    cm-events      ${partitionId}    ${offset[1]}
-    Assign To Topic Partition  ${group_id}  ${tp}
-    Sleep  5sec
-    Register Data Nodes
-    ${result}=      Poll                    group_id=${group_id}  only_value=False  poll_attempts=5
-    ${headers}                      Set Variable                ${result[0].headers()}
-    ${payload}                      Set Variable                ${result[0].value()}
+Register data node
+    ${uri}=         Set Variable         ${ncmpInventoryBasePath}/v1/ch
+    ${headers}=     Create Dictionary    Content-Type=application/json    Authorization=${auth}
+    ${response}=    POST On Session      CPS_URL   ${uri}    headers=${headers}    data=${jsonCreateCmHandles}
+    Should Be Equal As Strings           ${response.status_code}    200
+
+Verify notification
+    ${group_id}=         Create Consumer     auto_offset_reset=earliest
+    Subscribe Topic      topics=cm-events    group_id=${group_id}
+    ${result}=           Poll                group_id=${group_id}  only_value=False  poll_attempts=5
+    ${headers}           Set Variable        ${result[0].headers()}
+    ${payload}           Set Variable        ${result[0].value()}
     FOR   ${header_key_value_pair}   IN  @{headers}
         Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_specversion"      "1.0"
         Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_source"           "NCMP"
@@ -72,11 +72,6 @@ Retrieve CM Handle ids where query parameters Match (trust level query)
     Should Not Contain   ${responseJson}    CH-4
 
 *** Keywords ***
-Register Data Nodes
-    ${uri}=         Set Variable         ${ncmpInventoryBasePath}/v1/ch
-    ${headers}=     Create Dictionary    Content-Type=application/json    Authorization=${auth}
-    ${response}=    POST On Session      CPS_URL   ${uri}    headers=${headers}    data=${jsonCreateCmHandles}
-    Should Be Equal As Strings           ${response.status_code}    200
 
 Compare Header Values
     [Arguments]    ${header_key}    ${header_value}    ${header_to_check}    ${expected_header_value}