Add CSIT test: Delete CM Handle
- Add new csit test to ncmp inventory
Issue-ID: CPS-2073
Change-Id: Ie683f043b2dc1cc742945a4874f19688a8702009
Signed-off-by: halil.cakal <halil.cakal@est.tech>
diff --git a/csit/tests/cps-model-sync/cps-model-sync.robot b/csit/tests/cps-model-sync/cps-model-sync.robot
index 3e8551f..bb881f6 100644
--- a/csit/tests/cps-model-sync/cps-model-sync.robot
+++ b/csit/tests/cps-model-sync/cps-model-sync.robot
@@ -34,14 +34,15 @@
${ncmpInventoryBasePath} /ncmpInventory
${ncmpBasePath} /ncmp
${dmiUrl} http://${DMI_HOST}:${DMI_PORT}
-${jsonDataCreate} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","createdCmHandles":[{"cmHandle":"ietfYang-PNFDemo","cmHandleProperties":{"Book1":"Sci-Fi Book"},"publicCmHandleProperties":{"Contact":"storeemail@bookstore.com", "Contact2":"storeemail2@bookstore.com"}}]}
-${jsonDataUpdate} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","updatedCmHandles":[{"cmHandle":"ietfYang-PNFDemo","cmHandleProperties":{"Book1":"Romance Book"},"publicCmHandleProperties":{"Contact":"newemailforstore@bookstore.com"}}]}
+${createPayload} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","createdCmHandles":[{"cmHandle":"ietfYang-PNFDemo","cmHandleProperties":{"Book1":"Sci-Fi Book"},"publicCmHandleProperties":{"Contact":"storeemail@bookstore.com", "Contact2":"storeemail2@bookstore.com"}},{"cmHandle":"CmHandleForDelete"}]}
+${updatePayload} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","updatedCmHandles":[{"cmHandle":"ietfYang-PNFDemo","cmHandleProperties":{"Book1":"Romance Book"},"publicCmHandleProperties":{"Contact":"newemailforstore@bookstore.com"}}]}
+${deletePayload} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","removedCmHandles":["CmHandleForDelete"]}
*** Test Cases ***
Register data node and sync modules.
${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=${jsonDataCreate}
+ ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${createPayload}
Should Be Equal As Strings ${response.status_code} 200
Get CM Handle details and confirm it has been registered.
@@ -60,7 +61,7 @@
Update data node and sync modules.
${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=${jsonDataUpdate}
+ ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${updatePayload}
Should Be Equal As Strings ${response.status_code} 200
Get CM Handle details and confirm it has been updated.
@@ -76,6 +77,17 @@
END
END
+Delete cm handle
+ ${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=${deletePayload}
+ Should Be Equal As Strings ${response.status_code} 200
+
+Get cm handle details and confirm it has been deleted
+ ${uri}= Set Variable ${ncmpBasePath}/v1/ch/CmHandleForDelete
+ ${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}