summaryrefslogtreecommitdiffstats
path: root/csit
diff options
context:
space:
mode:
authoraditya puthuparambil <aditya.puthuparambil@bell.ca>2022-01-21 12:23:11 +0000
committerGerrit Code Review <gerrit@onap.org>2022-01-21 12:23:11 +0000
commitdb1e983f40be1db7bca5acacf5a3369d74a29c95 (patch)
treeb552087409b305e12fce2844d7e994d30481b99e /csit
parent87b991eb6502c20f441d00faa953f82de04fe12d (diff)
parentecd7f5e418c17d8f0f3f12af4fd0a543084e8254 (diff)
Merge "patch operation for ncmp running"
Diffstat (limited to 'csit')
-rw-r--r--csit/data/bookstorePatchExample.json59
-rw-r--r--csit/tests/ncmp-passthrough/ncmp-passthrough.robot21
2 files changed, 80 insertions, 0 deletions
diff --git a/csit/data/bookstorePatchExample.json b/csit/data/bookstorePatchExample.json
new file mode 100644
index 0000000000..039ea4bcdd
--- /dev/null
+++ b/csit/data/bookstorePatchExample.json
@@ -0,0 +1,59 @@
+{
+ "ietf-restconf:yang-patch":{
+ "patch-id":"patch-1",
+ "edit":[
+ {
+ "edit-id":"edit1",
+ "operation":"merge",
+ "target":"/",
+ "value":{
+ "bookstore": {
+ "categories": [
+ {
+ "code": "100",
+ "books": [
+ {
+ "title": "A new book in a new category",
+ "pub_year": "2019",
+ "authors": [
+ "Rahul"
+ ],
+ "lang": "English",
+ "price": "2011"
+ }
+ ],
+ "name": "Category100"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "edit-id":"edit2",
+ "operation":"merge",
+ "target":"/",
+ "value":{
+ "bookstore": {
+ "categories": [
+ {
+ "code": "02",
+ "name": "Horror",
+ "books": [
+ {
+ "title": "A New book in existing category",
+ "lang": "English",
+ "authors": [
+ "Joe & Rahul"
+ ],
+ "pub_year": "2003",
+ "price": "2000"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
index 36350ad525..1d977b9d92 100644
--- a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
+++ b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
@@ -116,3 +116,24 @@ Verify delete to bookstore using passthrough-running removed only category 01
Should Be Equal As Strings "${item['name']}" "Horror"
END
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
+ ${headers}= Create Dictionary Content-Type=application/yang.patch+json Authorization=${auth}
+ ${jsonData}= Get Binary File ${DATADIR}${/}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
+ ${verifyHeaders}= Create Dictionary Authorization=${auth}
+ ${verifyResponse}= Get On Session CPS_URL ${verifyUri} headers=${verifyHeaders}
+ ${responseJson}= Set Variable ${verifyResponse.json()}
+ Should Be Equal As Strings ${verifyResponse.status_code} 200
+ FOR ${item} IN @{responseJson['stores:categories']}
+ IF "${item['code']}" == "100"
+ 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
+ ${verifyResponse}= Get On Session CPS_URL ${verifyUri} headers=${verifyHeaders}
+ ${responseJson}= Set Variable ${verifyResponse.json()}
+ Should Be Equal As Strings ${verifyResponse.status_code} 200 \ No newline at end of file