From 02d8bf8c8a3469f75ef841c9d8c72349c51f3330 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Thu, 4 Jan 2024 17:01:27 +0000 Subject: Improve dmi plugin csit stub - Modified dmi plugin stub to return diff. modules based on cm handle id Issue-ID: CPS-2006 Change-Id: I61a0fd11b8f41ceb69dac296ad3570b91137cdcd Signed-off-by: sourabh_sourabh --- csit/tests/cm-handle-query/cm-handle-query.robot | 6 ++--- .../cps-data-operations/cps-data-operations.robot | 4 ++-- csit/tests/cps-data-sync/cps-data-sync.robot | 8 +++---- csit/tests/cps-model-sync/cps-model-sync.robot | 16 ++++++------- csit/tests/ncmp-passthrough/ncmp-passthrough.robot | 26 +++++++++++----------- 5 files changed, 30 insertions(+), 30 deletions(-) (limited to 'csit/tests') diff --git a/csit/tests/cm-handle-query/cm-handle-query.robot b/csit/tests/cm-handle-query/cm-handle-query.robot index 4941cde07..a16446a74 100644 --- a/csit/tests/cm-handle-query/cm-handle-query.robot +++ b/csit/tests/cm-handle-query/cm-handle-query.robot @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-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. @@ -42,14 +42,14 @@ Retrieve CM Handle ids where query parameters Match (module and property query) ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${jsonModuleAndPropertyQueryParameters} Should Be Equal As Strings ${response.status_code} 200 - Should Contain ${response.json()} PNFDemo + Should Contain ${response.json()} ietfYang-PNFDemo Retrieve CM Handle ids where query parameters Match (empty query) ${uri}= Set Variable ${ncmpBasePath}/ch/id-searches ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${jsonEmptyQueryParameters} Should Be Equal As Strings ${response.status_code} 200 - Should Contain ${response.json()} PNFDemo + Should Contain ${response.json()} ietfYang-PNFDemo Throw 400 when Structure of Request is Incorrect ${uri}= Set Variable ${ncmpBasePath}/ch/id-searches diff --git a/csit/tests/cps-data-operations/cps-data-operations.robot b/csit/tests/cps-data-operations/cps-data-operations.robot index d0206d19b..1f6611955 100644 --- a/csit/tests/cps-data-operations/cps-data-operations.robot +++ b/csit/tests/cps-data-operations/cps-data-operations.robot @@ -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. @@ -36,7 +36,7 @@ ${topic} data-operation-client-topic ${ncmpBasePath} /ncmp ${expectedRequestId} ${EMPTY} ${dmipluginCsitStubUrl} http://${DMI_CSIT_STUB_HOST}:${DMI_CSIT_STUB_PORT} -${newCmHandleRequestBody} {"dmiPlugin":"${dmipluginCsitStubUrl}","createdCmHandles":[{"cmHandle":"850117873c9a4936856a5081be96e6a8"}]} +${newCmHandleRequestBody} {"dmiPlugin":"${dmipluginCsitStubUrl}","createdCmHandles":[{"cmHandle":"CMHandle1"}]} *** Test Cases *** diff --git a/csit/tests/cps-data-sync/cps-data-sync.robot b/csit/tests/cps-data-sync/cps-data-sync.robot index e96e10a42..71de4be1f 100644 --- a/csit/tests/cps-data-sync/cps-data-sync.robot +++ b/csit/tests/cps-data-sync/cps-data-sync.robot @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-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. @@ -35,19 +35,19 @@ ${ncmpBasePath} /ncmp *** Test Cases *** Operational state goes to UNSYNCHRONIZED when data sync (flag) is enabled - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data-sync + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data-sync ${params}= Create Dictionary dataSyncEnabled=true ${headers}= Create Dictionary Authorization=${auth} ${response}= PUT On Session CPS_URL ${uri} params=${params} headers=${headers} Should Be Equal As Strings ${response.status_code} 200 - ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/state + ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state ${verifyHeaders}= Create Dictionary Authorization=${auth} ${verifyResponse}= GET On Session CPS_URL ${verifyUri} headers=${verifyHeaders} Should Be Equal As Strings ${verifyResponse.json()['state']['dataSyncState']['operational']['syncState']} UNSYNCHRONIZED Sleep 5 Operational state goes to SYNCHRONIZED after sometime when data sync (flag) is enabled - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/state + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state ${headers}= Create Dictionary Authorization=${auth} ${response}= GET On Session CPS_URL ${uri} headers=${headers} Should Be Equal As Strings ${response.json()['state']['dataSyncState']['operational']['syncState']} SYNCHRONIZED \ No newline at end of file diff --git a/csit/tests/cps-model-sync/cps-model-sync.robot b/csit/tests/cps-model-sync/cps-model-sync.robot index 519c7a727..704d02c4b 100644 --- a/csit/tests/cps-model-sync/cps-model-sync.robot +++ b/csit/tests/cps-model-sync/cps-model-sync.robot @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation + * Copyright (C) 2021-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. @@ -34,8 +34,8 @@ ${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE= ${ncmpInventoryBasePath} /ncmpInventory ${ncmpBasePath} /ncmp ${dmiUrl} http://${DMI_HOST}:${DMI_PORT} -${jsonDataCreate} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","createdCmHandles":[{"cmHandle":"PNFDemo","cmHandleProperties":{"Book1":"Sci-Fi Book"},"publicCmHandleProperties":{"Contact":"storeemail@bookstore.com", "Contact2":"storeemail2@bookstore.com"}}]} -${jsonDataUpdate} {"dmiPlugin":"${dmiUrl}","dmiDataPlugin":"","dmiModelPlugin":"","updatedCmHandles":[{"cmHandle":"PNFDemo","cmHandleProperties":{"Book1":"Romance Book"},"publicCmHandleProperties":{"Contact":"newemailforstore@bookstore.com"}}]} +${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"}}]} *** Test Cases *** Register data node and sync modules. @@ -45,13 +45,13 @@ Register data node and sync modules. Should Be Equal As Strings ${response.status_code} 200 Get CM Handle details and confirm it has been registered. - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo ${headers}= Create Dictionary Authorization=${auth} ${response}= GET On Session CPS_URL ${uri} headers=${headers} ${responseJson}= Set Variable ${response.json()} ${schemaCount}= Get length ${responseJson} Should Be Equal As Strings ${response.status_code} 200 - IF "${responseJson['cmHandle']}" == "PNFDemo" + IF "${responseJson['cmHandle']}" == "ietfYang-PNFDemo" FOR ${item} IN @{responseJson['publicCmHandleProperties']} Should Be Equal As Strings "${item['Contact']}" "storeemail@bookstore.com" END @@ -64,20 +64,20 @@ Update data node and sync modules. Should Be Equal As Strings ${response.status_code} 200 Get CM Handle details and confirm it has been updated. - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo ${headers}= Create Dictionary Authorization=${auth} ${response}= GET On Session CPS_URL ${uri} headers=${headers} ${responseJson}= Set Variable ${response.json()} ${schemaCount}= Get length ${responseJson} Should Be Equal As Strings ${response.status_code} 200 - IF "${responseJson['cmHandle']}" == "PNFDemo" + IF "${responseJson['cmHandle']}" == "ietfYang-PNFDemo" FOR ${item} IN @{responseJson['publicCmHandleProperties']} Should Be Equal As Strings "${item['Contact']}" "newemailforstore@bookstore.com" END END Get modules for registered data node - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/modules + ${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 diff --git a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot index 48af1cf85..02689f336 100644 --- a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot +++ b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-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,13 +37,13 @@ ${netconf} NETCONF *** Test Cases *** Get for Passthrough Operational (CF, RO) with fields & topic - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=ietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema)&topic=test-topic + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=ietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema)&topic=test-topic ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} expected_status=200 Should Be Equal As Strings ${response.status_code} 200 Get for Passthrough Operational (CF, RO) with fields - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=ietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema) + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=ietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema) ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} expected_status=200 ${responseJson}= Set Variable ${response.json()} @@ -52,14 +52,14 @@ Get for Passthrough Operational (CF, RO) with fields Should Contain ${responseJson['ietf-netconf-monitoring:netconf-state']['schemas']['schema'][0]['location']} ${netconf} Create to bookstore using passthrough-running - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} ${jsonData}= Get Binary File ${DATADIR_NCMP}${/}bookstoreCreateExample.json ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${jsonData} Should Be Equal As Strings ${response.status_code} 201 Verify create to bookstore using passthrough-running - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} Should Be Equal As Strings ${response.status_code} 200 @@ -75,14 +75,14 @@ Verify create to bookstore using passthrough-running END Update Bookstore using passthrough-running update Category 01 (replace category) - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} ${jsonData}= Get Binary File ${DATADIR_NCMP}${/}bookstoreUpdateExample.json ${response}= PUT On Session CPS_URL ${uri} headers=${headers} data=${jsonData} Should Be Equal As Strings ${response.status_code} 200 Verify update to bookstore using passthrough-running updated category 01 - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} Should Be Equal As Strings ${response.status_code} 200 @@ -93,7 +93,7 @@ Verify update to bookstore using passthrough-running updated category 01 END Verify update to bookstore using passthrough-running did not remove category 02 - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} Should Be Equal As Strings ${response.status_code} 200 @@ -101,13 +101,13 @@ Verify update to bookstore using passthrough-running did not remove category 02 Should Be Equal As Numbers ${schemaCount} 2 Delete Bookstore using passthrough-running for Category 01 - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01 ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth} ${response}= DELETE On Session CPS_URL ${uri} headers=${headers} Should Be Equal As Strings ${response.status_code} 204 Verify delete to bookstore using passthrough-running removed only category 01 - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore ${headers}= Create Dictionary Authorization=${auth} ${response}= Get On Session CPS_URL ${uri} headers=${headers} ${responseJson}= Set Variable ${response.json()['stores:bookstore']['categories']} @@ -121,12 +121,12 @@ Verify delete to bookstore using passthrough-running removed only category 01 END Patch will add new category with new book and add a new book to an existing category - ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore + ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore ${headers}= Create Dictionary Content-Type=application/yang.patch+json Authorization=${auth} ${jsonData}= Get Binary File ${DATADIR_NCMP}${/}bookstorePatchExample.json ${response}= PATCH On Session CPS_URL ${uri} headers=${headers} data=${jsonData} Should Be Equal As Strings ${response.status_code} 200 - ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=100 + ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=100 ${verifyHeaders}= Create Dictionary Authorization=${auth} ${verifyResponse}= Get On Session CPS_URL ${verifyUri} headers=${verifyHeaders} Should Be Equal As Strings ${verifyResponse.status_code} 200 @@ -135,6 +135,6 @@ Patch will add new category with new book and add a new book to an existing cate Should Be Equal As Strings "${item['name']}" "Category100" END END - ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=02/books=A%20New%20book%20in%20existing%20category + ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=02/books=A%20New%20book%20in%20existing%20category ${verifyResponse}= Get On Session CPS_URL ${verifyUri} headers=${verifyHeaders} Should Be Equal As Strings ${verifyResponse.status_code} 200 -- cgit 1.2.3-korg