From c0a1eacddc89d957bfaa84daea9c0d11688e89a3 Mon Sep 17 00:00:00 2001
From: Giacomo Bernini <g.bernini@nextworks.it>
Date: Wed, 13 Jan 2021 12:02:00 +0100
Subject: [PATCH] fixes to  NSLifecycleOperationGranting-API

---
 .../Grants.robot                                 | 12 ++++++------
 .../IndividualGrant.robot                        | 10 +++++-----
 .../NSLCOperationGrantingKeywords.robot          | 16 +++++++++++++++-
 3 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot
index 8b5cd238..55efdec9 100644
--- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot
+++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot
@@ -20,7 +20,7 @@ Requests a grant for a particular NS lifecycle operation
     Check HTTP Response Status Code Is    201
     Check HTTP Response Body Json Schema Is    Grant
     Check HTTP Response Header Contains  Location 
-    Check Resource URI existence  
+    Check Postcondition Grant Is Set 
 
 Requests a grant for a particular NS lifecycle operation - Forbidden 
     [Documentation]    Test ID: 9.3.3.1.2
@@ -38,7 +38,7 @@ Requests a grant for a particular NS lifecycle operation - Forbidden
 GET Grants - Method not implemented
     [Documentation]    Test ID: 9.3.3.1.3
     ...    Test title: GET Grants - Method not implemented
-    ...    Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting 
+    ...    Test objective: The objective is to test that GET method is not allowed for Lifecycle operation granting 
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -50,7 +50,7 @@ GET Grants - Method not implemented
 PUT Grants - Method not implemented
      [Documentation]    Test ID: 9.3.3.1.4
     ...    Test title: PUT Grants - Method not implemented
-    ...    Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting 
+    ...    Test objective: The objective is to test that PUT method is not allowed for Lifecycle operation granting 
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.3.3.3 - ETSI GS NFV-SOL 011 [6] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -62,7 +62,7 @@ PUT Grants - Method not implemented
 PATCH Grants - Method not implemented
     [Documentation]    Test ID: 9.3.3.1.5
     ...    Test title: PATCH Grants - Method not implemented
-    ...    Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting  
+    ...    Test objective: The objective is to test that PATCH method is not allowed for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.3.3.4 - ETSI GS NFV-SOL 011 [6] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -74,7 +74,7 @@ PATCH Grants - Method not implemented
 DELETE Grants - Method not implemented
     [Documentation]    Test ID: 9.3.3.1.6
     ...    Test title: DELETE Grants - Method not implemented
-    ...    Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting  
+    ...    Test objective: The objective is to test that DELETE method is not allowed for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -82,4 +82,4 @@ DELETE Grants - Method not implemented
     ...    Post-Conditions:  Resources are not deleted
     Delete Grants
     Check HTTP Response Status Code Is    405
-    Get an individual grant - Successful
\ No newline at end of file
+    Check Postcondition Grants Exist
\ No newline at end of file
diff --git a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot
index e85fd0df..3b05958c 100644
--- a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot
+++ b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot
@@ -13,7 +13,7 @@ Documentation    This resource represents an individual grant. The client can us
 POST Individual Grant - Method not implemented
     [Documentation]    Test ID: 9.3.3.2.1
     ...    Test title: POST Individual Grant - Method not implemented
-    ...    Test objective: The objective is to test that POST method is not allowed for Life cycle operation granting  
+    ...    Test objective: The objective is to test that POST method is not allowed for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.4.3.1 - ETSI GS NFV-SOL 011 [1] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -38,7 +38,7 @@ GET an individual grant - Successful
 PUT an individual grant - Method not implemented
     [Documentation]    Test ID: 9.3.3.2.3
     ...    Test title: PUT an individual grant - Method not implemented
-    ...    Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting  
+    ...    Test objective: The objective is to test that PUT method is not allowed to for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.4.3.3 - ETSI GS NFV-SOL 011 [1] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -50,7 +50,7 @@ PUT an individual grant - Method not implemented
 PATCH an individual grant - Method not implemented
     [Documentation]    Test ID: 9.3.3.2.4
     ...    Test title: PATCH an individual grant - Method not implemented
-    ...    Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting  
+    ...    Test objective: The objective is to test that PATCH method is not allowed to for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.4.3.4 - ETSI GS NFV-SOL 011 [1] v3.3.1
     ...    Config ID: Config_prod_NFVO
@@ -62,12 +62,12 @@ PATCH an individual grant - Method not implemented
 DELETE an individual grant - Method not implemented
     [Documentation]    Test ID: 9.3.3.2.5
     ...    Test title: DELETE an individual grant - Method not implemented
-    ...    Test objective: The objective is to test that DELETE method is not allowed to for Life cycle operation granting  
+    ...    Test objective: The objective is to test that DELETE method is not allowed to for Lifecycle operation granting  
     ...    Pre-conditions: none
     ...    Reference: Clause 7.5.4.3.5 - ETSI GS NFV-SOL 011 [1] v3.3.1
     ...    Config ID: Config_prod_NFVO
     ...    Applicability: none
-    ...    Post-Conditions: Grant is not deleted
+    ...    Post-Conditions: none
     Delete individual Grant
     Check HTTP Response Status Code Is    405
     
diff --git a/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot
index e3b36304..9d29ab9d 100644
--- a/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot
+++ b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot
@@ -125,4 +125,18 @@ Delete individual Grant
     Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
     Delete    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
     ${body}=    Output    response
-    Set Suite Variable    ${response}    ${body}
\ No newline at end of file
+    Set Suite Variable    ${response}    ${body}
+
+Check Postcondition Grants Exist
+    Log    Checking that grants exists
+    Get Grants 
+
+Check Postcondition Grant Is Set
+    Log    Check Postcondition subscription exist
+    Log    Trying to get the subscription
+    Set Headers    {"Accept": "${ACCEPT}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    GET    ${apiRoot}/${apiName}/${apiVersion}/grants/${response['body']['id']}
+    ${output}=    Output    response
+    Set Suite Variable    ${response}    ${output}
+    Check HTTP Response Status Code Is    200
\ No newline at end of file
-- 
GitLab