From 380dc2e67ea20716da9f2835983d7862bd3005d0 Mon Sep 17 00:00:00 2001
From: Mengxuan Zhao <mengxuan.zhao@eglobalmark.com>
Date: Mon, 22 Oct 2018 23:23:18 +0200
Subject: [PATCH] upd

---
 .../ChangeExternalVNFConnectivityTask.robot   | 82 ++++++++++++++++
 .../IndividualSubscription.robot              | 65 +++++++++++++
 .../NotificationEndpoint.robot                | 57 +++++++++++
 .../Subscriptions.robot                       | 95 +++++++++++++++++++
 .../variables.txt                             | 14 ++-
 TrackingStatus.txt                            |  2 +-
 6 files changed, 313 insertions(+), 2 deletions(-)
 create mode 100644 SOL003/VNFLifecycleManagement-API_egm/ChangeExternalVNFConnectivityTask.robot
 create mode 100644 SOL003/VNFLifecycleManagement-API_egm/IndividualSubscription.robot
 create mode 100644 SOL003/VNFLifecycleManagement-API_egm/NotificationEndpoint.robot
 create mode 100644 SOL003/VNFLifecycleManagement-API_egm/Subscriptions.robot

diff --git a/SOL003/VNFLifecycleManagement-API_egm/ChangeExternalVNFConnectivityTask.robot b/SOL003/VNFLifecycleManagement-API_egm/ChangeExternalVNFConnectivityTask.robot
new file mode 100644
index 00000000..18461a3a
--- /dev/null
+++ b/SOL003/VNFLifecycleManagement-API_egm/ChangeExternalVNFConnectivityTask.robot
@@ -0,0 +1,82 @@
+*** Settings ***
+Resource    variables.txt 
+Library    REST    http://${VNFM_HOST}:${VNFM_PORT} 
+...        spec=SOL003-VNFLifecycleManagement-API.yaml
+Library     DependencyLibrary
+Suite setup    Check resource existance
+
+*** Test Cases ***
+Change external VNF connectivity 
+    [Documentation]   The POST method changes the external connectivity of a VNF instance
+    Log    Trying to change the external connectivity of a VNF instance.
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    ${Change_Ext_Vnf_Connectivity_REQUEST}
+    Integer    response status    202
+    Log    Status code validated
+
+Change external VNF connectivity Conflict (parallel LCM operation)
+    # TODO: Need to set the pre-condition of the test
+    [Documentation]    Conflict
+    ...    The operation cannot be executed currently, due to a conflict with the state of the VNF instance resource. 
+    ...    Typically, this is due to the fact that another LCM operation is ongoing.
+    ...    The response body shall contain a ProblemDetails structure, in which the “detail” attribute should convey more information about the error.
+    [Setup]    Launch another LCM operation
+    log    Trying to change the deployment flavour of a VNF instance.
+    Set Headers    {"Accept":"${ACCEPT}"}  
+    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    ${Change_Ext_Vnf_Connectivity_REQUEST}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    409
+    [Teardown]    #We cannot know if the "scale" operation is finished easily because the 202 indicates only whether the operation has been accepted, not whether the operation has been finished
+       
+    
+GET Change external VNF connectivity - Method not implemented
+    log    Trying to perform a GET. This method should not be implemented
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Get    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+PUT Change external VNF connectivity - Method not implemented
+    log    Trying to perform a PUT. This method should not be implemented
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Put    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+PATCH Change external VNF connectivity - Method not implemented
+    log    Trying to perform a PATCH. This method should not be implemented
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Patch    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+    
+DELETE Change external VNF connectivity - Method not implemented
+    log    Trying to perform a DELETE. This method should not be implemented
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Delete    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_ext_conn    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+*** Key words ***
+Check resource existance
+    Set Headers    {"Accept":"${ACCEPT}"}  
+    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Get    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId} 
+    Integer    response status    200
+
+Launch another LCM operation
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/scale    ${Scale_Vnf_REQUEST}
+    Integer    response status    202
\ No newline at end of file
diff --git a/SOL003/VNFLifecycleManagement-API_egm/IndividualSubscription.robot b/SOL003/VNFLifecycleManagement-API_egm/IndividualSubscription.robot
new file mode 100644
index 00000000..94a774c3
--- /dev/null
+++ b/SOL003/VNFLifecycleManagement-API_egm/IndividualSubscription.robot
@@ -0,0 +1,65 @@
+*** Settings ***
+Resource    variables.txt 
+Library    REST    http://${VNFM_HOST}:${VNFM_PORT}    
+...    spec=SOL003-VNFLifecycleManagement-API.yaml
+Documentation    This resource represents an individual subscription. The client can use this resource to read and to terminate a
+...    subscription to notifications related to VNF lifecycle management
+Suite setup    Check resource existance
+
+*** Test Cases ***
+Post Individual Subscription - Method not implemented
+    log    Trying to perform a POST. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}  
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+Get Information about an individual subscription
+    log    Trying to get information about an individual subscription
+    Set Headers    {"Accept":"${ACCEPT}"}  
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    200
+
+PUT an individual subscription - Method not implemented
+    log    Trying to perform a PUT. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+PATCH an individual subscription - Method not implemented
+    log    Trying to perform a PATCH. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+    
+DELETE an individual subscription
+    log    Try to delete an individual subscription
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    204
+
+*** Key words ***   
+
+Check resource existance
+    Set Headers    {"Accept":"${ACCEPT}"}  
+    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
+    Integer    response status    200
\ No newline at end of file
diff --git a/SOL003/VNFLifecycleManagement-API_egm/NotificationEndpoint.robot b/SOL003/VNFLifecycleManagement-API_egm/NotificationEndpoint.robot
new file mode 100644
index 00000000..2e523e71
--- /dev/null
+++ b/SOL003/VNFLifecycleManagement-API_egm/NotificationEndpoint.robot
@@ -0,0 +1,57 @@
+*** Settings ***
+Resource    variables.txt 
+Library    REST    http://${NFVO_HOST}:${NFVO_PORT}   
+...    spec=SOL003-VNFLifecycleManagement-API.yaml
+
+*** Test Cases ***
+Deliver a notification - Operation Occurence
+    log    The POST method delivers a notification from the server to the client.
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Post    ${notification_ep}    ${VnfLcmOperationOccurrenceNotification}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    204
+
+Deliver a notification - Id Creation
+    log    The POST method delivers a notification from the server to the client.
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Post    ${notification_ep}    ${VnfIdentifierCreationNotification}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    204
+
+Deliver a notification - Id deletion
+    log    The POST method delivers a notification from the server to the client.
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Post    ${notification_ep}    ${VnfIdentifierDeletionNotification} 
+    Log    Validate Status code
+    Output    response
+    Integer    response status    204
+
+Test a notification end point
+    log    The GET method allows the server to test the notification endpoint
+    Get    ${notification_ep}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    204
+
+PUT notification - Method not implemented
+    log    Trying to perform a PUT. This method should not be implemented
+    Put    ${notification_ep}    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+PATCH subscriptions - Method not implemented
+    log    Trying to perform a PATCH. This method should not be implemented
+    Patch    ${notification_ep}    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+DELETE subscriptions - Method not implemented
+    log    Trying to perform a DELETE. This method should not be implemented
+    Delete    ${notification_ep}
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
\ No newline at end of file
diff --git a/SOL003/VNFLifecycleManagement-API_egm/Subscriptions.robot b/SOL003/VNFLifecycleManagement-API_egm/Subscriptions.robot
new file mode 100644
index 00000000..99f81604
--- /dev/null
+++ b/SOL003/VNFLifecycleManagement-API_egm/Subscriptions.robot
@@ -0,0 +1,95 @@
+*** Settings ***
+Resource    variables.txt 
+Library    REST    http://${VNFM_HOST}:${VNFM_PORT} 
+...        spec=SOL003-VNFLifecycleManagement-API.yaml
+
+*** Test Cases ***
+Create a new subscription
+    Log    Create VNF instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${LccnSubscriptionRequest}
+    Output    response
+    Integer    response status    201
+    Log    Status code validated
+
+Create a new Subscription - DUPLICATION
+    Log    Trying to create a subscription with an already created content
+    Pass Execution If    ${NVFM_DUPLICATION} == 0    VNFM is not permitting duplication. Skipping the test
+    Set Headers    {"Accept": "${ACCEPT}"}
+    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    POST    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${LccnSubscriptionRequest}
+    Output    response
+    Integer    response status    201
+    Log    Status code validated
+
+Create a new Subscription - NO-DUPLICATION
+    Log    Trying to create a subscription with an already created content
+    Pass Execution If    ${NVFM_DUPLICATION} == 1    VNFM permits duplication. Skipping the test
+    Set Headers    {"Accept": "${ACCEPT}"}
+    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    POST    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${LccnSubscriptionRequest}
+    Output    response
+    Integer    response status    303
+    Log    Status code validated
+
+GET Subscriptions
+    Log    Get the list of active subscriptions
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Log    Execute Query and validate response
+    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
+    Output    response
+    Log    Validate Status code
+    Integer    response status    200
+
+GET Subscription - Filter
+    Log    Get the list of active subscriptions using a filter
+    Set Headers    {"Accept": "${ACCEPT}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter}
+    Integer    response status    200
+    Log    Received a 200 OK as expected
+    
+GET subscriptions - Bad Request Invalid attribute-based filtering parameters
+    Log    Get the list of active subscriptions using an invalid filter
+    Set Headers    {"Accept": "${ACCEPT}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid}
+    Integer    response status    400
+    Log    Received a 400 Bad Request as expected
+    
+PUT subscriptions - Method not implemented
+    log    Trying to perform a PUT. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+PATCH subscriptions - Method not implemented
+    log    Trying to perform a PATCH. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+
+DELETE subscriptions - Method not implemented
+    log    Trying to perform a DELETE. This method should not be implemented
+    Set Headers  {"Accept":"${ACCEPT}"}  
+    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
+    Log    Validate Status code
+    Output    response
+    Integer    response status    405
+    
\ No newline at end of file
diff --git a/SOL003/VNFLifecycleManagement-API_egm/variables.txt b/SOL003/VNFLifecycleManagement-API_egm/variables.txt
index 36aacaed..2c109dad 100644
--- a/SOL003/VNFLifecycleManagement-API_egm/variables.txt
+++ b/SOL003/VNFLifecycleManagement-API_egm/variables.txt
@@ -33,4 +33,16 @@ ${Scale_Vnf_to_Level_REQUEST}    {}
 ${Change_Vnf_Flavour_REQUEST}    {}
 ${Terminate_Vnf_REQUEST}    {}
 ${Heal_Vnf_REQUEST}    {}
-${Operate_Vnf_REQUEST}    {}
\ No newline at end of file
+${Operate_Vnf_REQUEST}    {}
+${Change_Ext_Vnf_Connectivity_REQUEST}    {}
+${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
+${CancelMode}    GRACEFUL
+${LccnSubscriptionRequest}    {}
+${NVFM_DUPLICATION}    0
+${sub_filter}    filter
+${sub_filter_invalid}    filter_invalid
+${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
+${notification_ep}    notification
+${VnfLcmOperationOccurrenceNotification}    {}
+${VnfIdentifierCreationNotification}    {}
+${VnfIdentifierDeletionNotification}    {}
\ No newline at end of file
diff --git a/TrackingStatus.txt b/TrackingStatus.txt
index 2e6fbeba..5a94c82f 100644
--- a/TrackingStatus.txt
+++ b/TrackingStatus.txt
@@ -26,7 +26,7 @@ SOL003
     * TerminateVNFTask  ----------------------------> [DONE]
     * HealVNFTask  ----------------------------> [DONE]
     * OperateVNFTask  ----------------------------> [DONE]
-    * ChangeExternalVNFConnectivityTask  ----------------------------> [ONGOING]
+    * ChangeExternalVNFConnectivityTask  ----------------------------> [DONE]
     * VnfLcmOperationOccurences  ----------------------------> [ONGOING]
     * IndividualVnfLcmOperationOccurence  ----------------------------> [ONGOING]
     * RetryOperationTask  ----------------------------> [ONGOING]
-- 
GitLab