*** Settings ***
Resource   environment/variables.txt 
Resource   NSLCOperationGrantingKeywords.robot
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Documentation    This resource represents an individual grant. The client can use this resource to read the grant.
...    It is determined by means outside the scope of the present document, such as configuration or policy,
...    how long an individual grant is available.

*** Test Cases ***
POST Individual Grant - Method not implemented
    [Documentation]    Test ID: 9.3.1.2.1
    ...    Test title: POST Individual Grant - Method not implemented
    ...    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 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post individual Grant
    Check HTTP Response Status Code Is    405
    
GET an individual grant - Successful
    [Documentation]    Test ID: 9.3.1.2.2
    ...    Test title: GET an individual grant - Successful
    ...    Test objective: The objective is to retrieve a grant for a particular NS Lifecycle Operation.
    ...    Pre-conditions: The  grant information is available to the NFVO
    ...    Reference: Clause 7.5.4.3.2 - ETSI GS NFV-SOL 011 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get individual grant
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    Grant
    
PUT an individual grant - Method not implemented
    [Documentation]    Test ID: 9.3.1.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 Lifecycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: Clause 7.5.4.3.3 - ETSI GS NFV-SOL 011 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none 
    PUT individual Grant
    Check HTTP Response Status Code Is    405

PATCH an individual grant - Method not implemented
    [Documentation]    Test ID: 9.3.1.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 Lifecycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: Clause 7.5.4.3.4 - ETSI GS NFV-SOL 011 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Patch individual Grant
    Check HTTP Response Status Code Is    405
    
DELETE an individual grant - Method not implemented
    [Documentation]    Test ID: 9.3.1.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 Lifecycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: Clause 7.5.4.3.5 - ETSI GS NFV-SOL 011 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Delete individual Grant
    Check HTTP Response Status Code Is    405
    
GET an individual grant - NOT FOUND
    [Documentation]    Test ID: 9.3.1.2.6
    ...    Test title: GET an individual grant - NOT FOUND
    ...    Test objective: The objective is to test that the retrieval of individual grant for a particular Lifecycle operation fails when using an invalid resource identifier
    ...    Pre-conditions: The  grant information is available to the NFVO
    ...    Reference: Clause 7.5.4.3.2 - ETSI GS NFV-SOL 011 [8] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: Invalid resource identifier is used
    ...    Post-Conditions: none
    Get individual grant
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is    ProblemDetails