diff --git a/.jenkins.sh b/.jenkins.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea4251e443b9f2c64a64b2ce6164dbce2dcceea6 --- /dev/null +++ b/.jenkins.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright ETSI 2018 +# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt + +#set -vx +#set -e + +cd "$(dirname "$0")" + +run_dir="$(pwd)" + +./scripts/build-container.sh +./scripts/run-container.sh "${run_dir}" + +exit $? diff --git a/MEO/UEAPPCTX/SysUeAppsContext.robot b/MEO/UEAPPCTX/SysUeAppsContext.robot index 3793692f0e3f85c861f6d5e328cebf533eab8eb5..024723ffdc5684d8838e2b1eb6d453065c4ed512 100644 --- a/MEO/UEAPPCTX/SysUeAppsContext.robot +++ b/MEO/UEAPPCTX/SysUeAppsContext.robot @@ -1,16 +1,154 @@ -''[Documentation] robot --outputdir ../../outputs ./PlatBandwidthManager.robot +''[Documentation] robot --outputdir ../../outputs ./SysUeAppContext.robot ... Test Suite to validate Bandwidth Management API (BWA) operations. *** Settings *** Resource environment/variables.txt Resource ../../pics.txt Resource ../../GenericKeywords.robot -Resource resources/UEAppInterfaceAPI.robot +Resource resources/UeAppContextAPI.robot Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false *** Test Cases *** +Creation of the application context + [Documentation] TC_MEC_MEO_UEAPPCTX_001_OK + ... Check that the IUT acknowledges the creation of the application context when requested by an UE Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.4.3.4 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + Create application context ${CREATE_APP_CTX} + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is AppContext + Should Be True ${response['body']['appContext']['appInfo']['appName']} == ${APP_NAME} + # Postamble + Delete an application context ${APP_CTX_ID} + + +Creation of the application context with wrong parameters + [Documentation] TC_MEC_MEO_UEAPPCTX_001_BR + ... Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.4.3.4 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + Create application context ${CREATE_APP_CTX_BR} + Check HTTP Response Status Code Is 400 + Check ProblemDetails 400 + + +Update of the application context + [Documentation] TC_MEC_MEO_UEAPPCTX_002_OK + ... Check that the IUT updates the application callback reference when commanded by an UE Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.5.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + ${CREATE_APP_CTX['callbackReference']}= ${CALLBACK_REFERENCE_1} + Update application context ${APP_CTX_ID} ${CREATE_APP_CTX} + Check HTTP Response Status Code Is 204 + Check HTTP Response Body Json Schema Is AppContext + Should Be True ${response['body']['appContext']['callbackReference']} == ${CALLBACK_REFERENCE_1} + # Postamble + Delete an application context ${APP_CTX_ID} + + +Update of the application context with wrong parameters + [Documentation] TC_MEC_MEO_UEAPPCTX_002_BR + ... Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.5.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + ${CREATE_APP_CTX['callbackReference']}= '' # Empty string + Update application context ${APP_CTX_ID} ${CREATE_APP_CTX} + Check HTTP Response Status Code Is 400 + Check ProblemDetails 400 + # Postamble + Delete an application context ${APP_CTX_ID} + + +Update of the application context with unknown URI + [Documentation] TC_MEC_MEO_UEAPPCTX_002_NF + ... Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.5.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + ${CREATE_APP_CTX['callbackReference']}= ${CALLBACK_REFERENCE_1} + Update application context ${NON_EXISTENT_APP_CTX_ID} ${CREATE_APP_CTX} + Check HTTP Response Status Code Is 404 + Check ProblemDetails 404 + # Postamble + Delete an application context ${APP_CTX_ID} + + +Delete of the application context + [Documentation] TC_MEC_MEO_UEAPPCTX_003_OK + ... Check that the IUT deletes the application context when commanded by an UE Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.5.3.5 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + Delete application context ${APP_CTX_ID} + Check HTTP Response Status Code Is 204 + + +Delete of the application context + [Documentation] TC_MEC_MEO_UEAPPCTX_003_NF + ... Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.5.3.5 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/AppContext + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + # AppCtx not created! + # Test Body + Delete application context ${APP_CTX_ID} + Check HTTP Response Status Code Is 404 + Check ProblemDetails 404 *** Keywords *** +Create application context + [Arguments] ${content} + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Post /exampleAPI/mx2/v2/app_contexts ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Update application context + [Arguments] ${context_id} ${content} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Put /exampleAPI/mx2/v2/app_contexts/${context_id} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Delete application context + [Arguments] ${context_id} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Delete /exampleAPI/mx2/v2/app_contexts/${context_id} + ${output}= Output response + Set Suite Variable ${response} ${output} diff --git a/MEO/UEAPPCTX/environment/variables.txt b/MEO/UEAPPCTX/environment/variables.txt index 885de58c36946da94d8f9f9a290cdcc5251b378a..922a3e396463ee1af594dd806b5fd425f6f8eb25 100644 --- a/MEO/UEAPPCTX/environment/variables.txt +++ b/MEO/UEAPPCTX/environment/variables.txt @@ -4,3 +4,13 @@ ${MEC-APP_SCHEMA} http #${MEC-APP_HOST} 127.0.0.1 ${MEC-APP_HOST} 192.168.56.1 ${MEC-APP_PORT} 8081 +${APP_CTX_ID} appCtx01 +${NON_EXISTENT_APP_CTX_ID} appCtx99 +${UE_APP_ID} ueIdAppCtx01 +${APP_NAME} MyWornderfulApp +${WRONG_CREATE_APP_CTX} UnknownApp +${CALLBACK_REFERENCE} http://www.acme.com/MyWonderfulApp/v1 +${CALLBACK_REFERENCE_1} http://www.acme.com/MyWonderfulApp/v2 +${CREATE_APP_CTX} { "contextId": "${CREATE_APP_CTX}", "associateUeAppId": "${UE_APP_ID}", "callbackReference": "${CALLBACK_REFERENCE}", "appInfo": { "appName": "${APP_NAME}", "appProvider": "ACME & Co", "appSoftVersion": "1.0.0.1", "appDescription": "This is a wonderful test application", "referenceURL": "http://www.acme.com/MyWonderfulPackage", "appPackageSource": "MyWonderfulPackage" } } +${CREATE_APP_CTX_BR} { "context": "${CREATE_APP_CTX}", "associateUeAppId": "${UE_APP_ID}", "callbackReference": "${CALLBACK_REFERENCE}", "appInfo": { "appName": "${APP_NAME}", "appProvider": "ACME & Co", "appSoftVersion": "1.0.0.1", "appDescription": "This is a wonderful test application", "referenceURL": "http://www.acme.com/MyWonderfulPackage", "appPackageSource": "MyWonderfulPackage" } } +${SERVICE_CONT_BR} UnknownServiceCont diff --git a/MEO/UEAPPCTX/resources/UEAppInterfaceAPI.robot b/MEO/UEAPPCTX/resources/UEAppInterfaceAPI.robot deleted file mode 100644 index 0397c0489896f25f749b0eb839f4723e698aaab6..0000000000000000000000000000000000000000 --- a/MEO/UEAPPCTX/resources/UEAppInterfaceAPI.robot +++ /dev/null @@ -1,9 +0,0 @@ -*** Settings *** -Resource ../environment/variables.txt -Resource ../../../pics.txt -Resource ../../../GenericKeywords.robot -Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false -Library JSONSchemaLibrary schemas/ - - -*** Keywords *** diff --git a/MEO/UEAPPCTX/resources/UeAppsContextAPI.robot b/MEO/UEAPPCTX/resources/UeAppsContextAPI.robot new file mode 100644 index 0000000000000000000000000000000000000000..a8c94d0d451f1ef1b2e78e82668358a91b2e5a8f --- /dev/null +++ b/MEO/UEAPPCTX/resources/UeAppsContextAPI.robot @@ -0,0 +1,35 @@ +*** Settings *** +Resource ../environment/variables.txt +Resource ../../../pics.txt +Resource ../../../GenericKeywords.robot +Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false +Library JSONSchemaLibrary schemas/ + + +*** Keywords *** +Create an application context + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Post /exampleAPI/mx2/v2/app_contexts ${CREATE_APP_CTX} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is AppContext + Set Suite Variable ${APP_CTX_ID} ${response['body']['contextId'] + Should Not Be Empty ${APP_CTX_ID} + + +Delete an application context + [Arguments] ${context_id} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Delete /exampleAPI/mx2/v2/app_contexts/${context_id} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 204 diff --git a/MEO/UEAPPS/SysUeApplications.robot b/MEO/UEAPPS/SysUeApplications.robot new file mode 100644 index 0000000000000000000000000000000000000000..855b4e8cc2df3888a01fb35b7882a17c0e6788d8 --- /dev/null +++ b/MEO/UEAPPS/SysUeApplications.robot @@ -0,0 +1,88 @@ +''[Documentation] robot --outputdir ../../outputs ./SysUeApplications.robot +... Test Suite to validate Bandwidth Management API (BWA) operations. + +*** Settings *** +Resource ../UEAPPCTX/environment/variables.txt +Resource ../../pics.txt +Resource ../../GenericKeywords.robot +Resource ../UEAPPCTX/resources/UeAppContextAPI.robot +Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false + + + +*** Test Cases *** +Get the list of the application contexts + [Documentation] TC_MEC_MEO_UEAPPS_001_OK + ... Check that the IUT responds with the list of user applications available when requested by an UE Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.3.3.1 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/ApplicationList + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + Retrieve the application contexts list ${APP_NAME} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is AppInfo + Should Be True ${response['body']['appInfo']['appInfo'][0]['appName']} == ${APP_NAME} + # Postamble + Delete an application context ${APP_CTX_ID} + + +Get the list of the application contexts with wrong parameter + [Documentation] TC_MEC_MEO_UEAPPS_001_BR + ... Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.3.3.1 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/ApplicationList + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Create an application context + # Test Body + Retrieve the application contexts list with serviceCont ${SERVICE_CONT_BR} + Check HTTP Response Status Code Is 400 + Check ProblemDetails 400 + # Postamble + Delete an application context ${APP_CTX_ID} + + +Get the list of the application contexts with wrong parameter + [Documentation] TC_MEC_MEO_UEAPPS_001_NF + ... Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application + ... Reference ETSI GS MEC 016 V1.1.1, clause 7.3.3.1 + ... Reference https://forge.etsi.org/gitlab/mec/gs016-ue-app-api/blob/master/UEAppInterfaceApi.yaml#/definitions/ApplicationList + # Preamble + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + # AppInfo not created + # Test Body + Retrieve the application contexts list ${APP_NAME} + Check HTTP Response Status Code Is 404 + Check ProblemDetails 404 + + +*** Keywords *** +Retrieve the application contexts list + [Arguments] ${app_name} + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Post /exampleAPI/mx2/v2/app_list?appName=${app_name} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Retrieve the application contexts list with serviceCont + [Arguments] ${service_cont} + Should Be True ${PIC_MEC_SYSTEM} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Post /exampleAPI/mx2/v2/app_list?serviceCont=${service_cont} + ${output}= Output response + Set Suite Variable ${response} ${output} diff --git a/SRV/BWA/PlatBandwidthManager.robot b/SRV/BWA/PlatBandwidthManager.robot index b93883deb82842ee7ce860da895c8fbc31433634..315c5840a43d5bc39836c536d26d77b7fa5de632 100644 --- a/SRV/BWA/PlatBandwidthManager.robot +++ b/SRV/BWA/PlatBandwidthManager.robot @@ -9,7 +9,6 @@ Resource resources/BandwidthManagerAPI.robot Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false - *** Test Cases *** Request the list of configured bandwidth allocations [Documentation] TC_MEC_SRV_BWA_001_OK @@ -80,15 +79,15 @@ Updates the requested bandwidth requirements ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.2 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Update a bandwidth allocation ${allocation_id} ${REQUEST_FOR_BW_REQUIREMENTS} + Update a bandwidth allocation ${ALLOCATION_ID} ${REQUEST_FOR_BW_REQUIREMENTS} Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is bwInfo Check AppInstanceId ${APP_INSTANCE_ID} - Check Allocation ${allocation_id} + Check Allocation ${ALLOCATION_ID} # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Updates the requested bandwidth requirements using wrong allocationDirection @@ -97,13 +96,13 @@ Updates the requested bandwidth requirements using wrong allocationDirection ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.2 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Update a bandwidth allocation ${allocation_id} ${REQUEST_FOR_BW_REQUIREMENTS_BR} + Update a bandwidth allocation ${ALLOCATION_ID} ${REQUEST_FOR_BW_REQUIREMENTS_BR} Check HTTP Response Status Code Is 400 Check ProblemDetails 400 # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Updates the requested bandwidth requirements using wrong allocationId @@ -123,13 +122,13 @@ Updates the requested bandwidth requirements using wrong parameters ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # TODO Application doesn't comply with a required condition??? # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Update a bandwidth allocation with invalid ETAG ${allocation_id} ${REQUEST_FOR_BW_REQUIREMENTS} + Update a bandwidth allocation with invalid ETAG ${ALLOCATION_ID} ${REQUEST_FOR_BW_REQUIREMENTS} Check HTTP Response Status Code Is 412 Check ProblemDetails 412 # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Request for deltas changes @@ -138,15 +137,15 @@ Request for deltas changes ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.3 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Request a deltas changes ${allocation_id} ${REQUEST_FOR_DELTAS_CHANGES} + Request a deltas changes ${ALLOCATION_ID} ${REQUEST_FOR_DELTAS_CHANGES} Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is bwInfo Check AppInstanceId ${APP_INSTANCE_ID} - Check Allocation ${allocation_id} + Check Allocation ${ALLOCATION_ID} # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Request for deltas changes using invalid requestType @@ -155,13 +154,13 @@ Request for deltas changes using invalid requestType ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.3 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Request a deltas changes ${allocation_id} ${REQUEST_FOR_DELTAS_CHANGES_BR} + Request a deltas changes ${ALLOCATION_ID} ${REQUEST_FOR_DELTAS_CHANGES_BR} Check HTTP Response Status Code Is 400 Check ProblemDetails 400 # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Request for deltas changes using an unknown URI @@ -180,13 +179,13 @@ Request for deltas changes using wrong parameters ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.3 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body - Request a deltas changes with invalid ETAG ${allocation_id} ${REQUEST_FOR_DELTAS_CHANGES} + Request a deltas changes with invalid ETAG ${ALLOCATION_ID} ${REQUEST_FOR_DELTAS_CHANGES} Check HTTP Response Status Code Is 412 Check ProblemDetails 412 # Postamble - Unregister Bandwidth Management Service ${allocation_id} + Unregister Bandwidth Management Service Request to unregister bandwidth Management Service @@ -197,21 +196,21 @@ Request to unregister bandwidth Management Service # Preamble Should Be True ${PIC_MEC_PLAT} == 1 Should Be True ${PIC_SERVICES} == 1 - ${allocation_id} ${etag_value}= Register Bandwidth Management Service + Register Bandwidth Management Service # Test body Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} Set Headers {"Authorization":"${TOKEN}"} Set Headers {"Content-Length":"0"} - Delete /exampleAPI/bwm/v1/bw_allocations/${allocation_id} + Delete /exampleAPI/bwm/v1/bw_allocations/${ALLOCATION_ID} ${output}= Output response Set Suite Variable ${response} ${output} Check HTTP Response Status Code Is 204 Request to unregister bandwidth Management Service with wrong parameters - [Documentation] TC_MEC_SRV_BWA_006_OK - ... Check that the IUT unregisters from the Bandwidth Management Service when commanded by a MEC Application + [Documentation] TC_MEC_SRV_BWA_006_NF + ... Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application ... Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.5 ... Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json # Preamble @@ -230,97 +229,97 @@ Request to unregister bandwidth Management Service with wrong parameters *** Keywords *** - Retrieve the list of configured bandwidth allocations - [Arguments] ${app_instance_id} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"Content-Length":"0"} - Get /exampleAPI/bwm/v1/bw_allocations/${app_instance_id} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Registration for bandwidth services - [Arguments] ${app_instance_id} ${content} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"Content-Length":"0"} - log ${content} - Post /exampleAPI/bwm/v1/bw_allocations/${APP_INSTANCE_ID} ${content} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Get a bandwidth allocation - [Arguments] ${allocation_id} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"Content-Length":"0"} - Get /exampleAPI/bwm/v1/bw_allocations/${allocation_id} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Update a bandwidth allocation - [Arguments] ${allocation_id} ${content} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"${ETAG_LABEL}":"${ETAG}"} - Set Headers {"Content-Length":"0"} - Put /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Update a bandwidth allocation with invalid ETAG - [Arguments] ${allocation_id} ${content} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"${ETAG_LABEL}":"${INVALID_ETAG}"} - Set Headers {"Content-Length":"0"} - Put /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Request a deltas changes - [Arguments] ${allocation_id} ${content} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"${ETAG_LABEL}":"${ETAG}"} - Set Headers {"Content-Length":"0"} - Patch /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} - ${output}= Output response - Set Suite Variable ${response} ${output} - - - Request a deltas changes with invalid ETAG - [Arguments] ${allocation_id} ${content} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"${ETAG_LABEL}":"${INVALID_ETAG}"} - Set Headers {"Content-Length":"0"} - Patch /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} - ${output}= Output response - Set Suite Variable ${response} ${output} +Retrieve the list of configured bandwidth allocations + [Arguments] ${app_instance_id} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Get /exampleAPI/bwm/v1/bw_allocations/${app_instance_id} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Registration for bandwidth services + [Arguments] ${app_instance_id} ${content} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + log ${content} + Post /exampleAPI/bwm/v1/bw_allocations/${APP_INSTANCE_ID} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Get a bandwidth allocation + [Arguments] ${allocation_id} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Get /exampleAPI/bwm/v1/bw_allocations/${allocation_id} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Update a bandwidth allocation + [Arguments] ${allocation_id} ${content} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"ETag":"${ETAG_VALUE}"} + Set Headers {"Content-Length":"0"} + Put /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Update a bandwidth allocation with invalid ETAG + [Arguments] ${allocation_id} ${content} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"${ETAG_LABEL}":"${INVALID_ETAG}"} + Set Headers {"Content-Length":"0"} + Put /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Request a deltas changes + [Arguments] ${allocation_id} ${content} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"${ETAG_LABEL}":"${ETAG}"} + Set Headers {"Content-Length":"0"} + Patch /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Request a deltas changes with invalid ETAG + [Arguments] ${allocation_id} ${content} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"${ETAG_LABEL}":"${INVALID_ETAG}"} + Set Headers {"Content-Length":"0"} + Patch /exampleAPI/bwm/v1/bw_allocations/${allocation_id} ${content} + ${output}= Output response + Set Suite Variable ${response} ${output} diff --git a/SRV/BWA/environment/variables.txt b/SRV/BWA/environment/variables.txt index 8598e0695e0ecce0c940acc1dcd5632c4f722490..c3789a8a5221406daee9e1bb5bcf1f1c72d39bff 100644 --- a/SRV/BWA/environment/variables.txt +++ b/SRV/BWA/environment/variables.txt @@ -4,7 +4,6 @@ ${MEC-APP_SCHEMA} http #${MEC-APP_HOST} 127.0.0.1 ${MEC-APP_HOST} 192.168.56.1 ${MEC-APP_PORT} 8081 -${ETAG_LABEL} Location ${INVALID_ETAG} invalid_etag ${APP_INSTANCE_ID} appInst01 ${NON_EXISTENT_APP_INSTANCE_ID} appInst99 @@ -17,3 +16,5 @@ ${REQUEST_FOR_DELTAS_CHANGES} { "appInsId": "${APP_INSTANCE_ID}", "request ${REQUEST_FOR_DELTAS_CHANGES_BR} { "appInsId": "${APP_INSTANCE_ID}", "requestType": "UNKNOWN", "fixedBWPriority": "not defined in the present document", "fixedAllocation": "string", "allocationDirection": "00 = Downlink (towards the UE)"} ${response} {} ${TOKEN} Basic YWxhZGRpbjpvcGVuc2VzYW1l + +${ETAG_VALUE} diff --git a/SRV/BWA/resources/BandwidthManagerAPI.robot b/SRV/BWA/resources/BandwidthManagerAPI.robot index 59b0099d147cc677ea64727507ca372632ff0281..bf9d5b4fcfc21885c09e7afbef7b3e224c44c209 100644 --- a/SRV/BWA/resources/BandwidthManagerAPI.robot +++ b/SRV/BWA/resources/BandwidthManagerAPI.robot @@ -7,39 +7,40 @@ Library JSONSchemaLibrary schemas/ *** Keywords *** - Register Bandwidth Management Service +Register Bandwidth Management Service ... Register a Bandwidth Management Service - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"Content-Length":"0"} - Post /exampleAPI/bwm/v1/bw_allocations ${REQUEST_FOR_BW_REQUIREMENTS} - ${output}= Output response - Set Suite Variable ${response} ${output} - Check HTTP Response Status Code Is 201 - Check HTTP Response Body Json Schema Is bwInfo - # Extract ETAG_VALUE - ${etag_value}= ${response['status']['${etag_label}']} - # TODO Extract allocationId - ${allocation_id}= 'todo' - [return] ${allocation_id} ${etag_value} - - - Unregister Bandwidth Management Service - ... Unregister a Bandwidth Management Service - [Arguments] ${value} - Should Be True ${PIC_MEC_PLAT} == 1 - Should Be True ${PIC_SERVICES} == 1 - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"${TOKEN}"} - Set Headers {"Content-Length":"0"} - Delete /exampleAPI/bwm/v1/bw_allocations/${value} - ${output}= Output response - Set Suite Variable ${response} ${output} - Check HTTP Response Status Code Is 204 + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Post /exampleAPI/bwm/v1/bw_allocations ${REQUEST_FOR_BW_REQUIREMENTS} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is bwInfo + # Extract ETAG_VALUE + Set Suite Variable ${ETAG_VALUE} ${response['status']['ETag']} + Should Not Be Empty ${ETAG_VALUE} + # TODO Extract allocationId not possible, information is missing in the standard doc + Set Suite Variable ${ALLOCATION_ID} ${response['body']['bwInfo']['allocationId']} + Should Not Be Empty ${ALLOCATION_ID} + + +Unregister Bandwidth Management Service + ... Unregister a Bandwidth Management Service + [Arguments] ${value} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Delete /exampleAPI/bwm/v1/bw_allocations/${value} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 204 Check AppInstanceId diff --git a/scripts/build-container.sh b/scripts/build-container.sh new file mode 100755 index 0000000000000000000000000000000000000000..df57c1fd6f5674e0cdab446fb395dee5fcdd3865 --- /dev/null +++ b/scripts/build-container.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright ETSI 2019 +# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt + +#set -e +set -vx + +DOCKER_FILE=./scripts/docker/Dockerfile +if [ -f ${DOCKER_FILE} ] +then + #check and build stf569-rf image + DOCKER_ID=`docker ps -a | grep -e stf569-rf | awk '{ print $1 }'` + if [ ! -z "${DOCKER_ID}" ] + then + docker rm --force stf569-rf + fi + docker build --tag stf569-rf --force-rm -f ${DOCKER_FILE} . + if [ "$?" != "0" ] + then + echo "Docker build failed: $?" + exit -1 + fi + docker image ls -a + docker inspect stf569-rf:latest + if [ "$?" != "0" ] + then + echo "Docker inspect failed: $?" + exit -2 + fi +else + exit -3 +fi + +# That's all Floks +exit 0 + diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d770424edaa4e9b20430af79be2eecb33ada8c61 --- /dev/null +++ b/scripts/docker/Dockerfile @@ -0,0 +1,49 @@ +FROM ubuntu:16.04 + +MAINTAINER ETSI STF 569 + +LABEL description="SFT569 Robot Framework Docker Image" + +ENV TERM=xterm +ENV HOSTNAME docker-robot-STF569 + + +ARG ssh_prv_key + + + +RUN DEBIAN_FRONTEND=noninteractive apt update \ + && apt install python3 -y \ + && apt install python3-pip -y \ + && apt install openssh-server -y \ + && DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \ + && DEBIAN_FRONTEND=noninteractive apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* + + +RUN echo "docker-robot-STF569" > /etc/hostname \ + && echo "root:etsi" | chpasswd + +RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \ + && echo "etsi:etsi" | chpasswd \ + && adduser etsi sudo \ + && echo "etsi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + + +RUN DEBIAN_FRONTEND=noninteractive \ + && mkdir -p /home/etsi/dev/robot \ + && cd /home/etsi/dev/robot + + +ADD . /home/etsi/dev/robot + +RUN pip3 install robotframework + +RUN DEBIAN_FRONTEND=noninteractive \ + && cd /home/etsi/dev/robot \ + && pip3 install -r requirements.txt \ + && chmod +x /home/etsi/dev/robot/scripts/* + +CMD tail -f /dev/null + + diff --git a/scripts/launch-validation.sh b/scripts/launch-validation.sh old mode 100644 new mode 100755 diff --git a/scripts/run-all.bash b/scripts/run-all.bash old mode 100644 new mode 100755 index 310b9d41d1cf1dff8d2b17cbd16a050d229fd97f..38edbc4e6190888b7ebab02e43f62ca74551eadb --- a/scripts/run-all.bash +++ b/scripts/run-all.bash @@ -2,7 +2,9 @@ ## Launch robot tests validator -/bin/bash /scripts/launch-validation.sh > logs/robot_stdout.log 2> logs/robot_stderr.log +mkdir logs + +/bin/bash scripts/launch-validation.sh > logs/robot_stdout.log 2> logs/robot_stderr.log ## Filter failed Keywords grep -r10n "| FAIL |" logs/robot_stdout.log | grep -v "Output:" | grep -v "Log:" | grep -v "Report:" > logs/failures.log @@ -18,4 +20,19 @@ ERRORS=`awk 'END{print NR}' logs/errors.log logs/failures.log` if [ "${ERRORS}" -eq 0 ]; then rm -f logs/errors.log rm -f logs/failures.log -fi \ No newline at end of file +fi + + +if [ ! -z logs/errors.log ]; then + cat logs/errors.log +fi + +if [ ! -z logs/failures.log ]; then + cat logs/failures.log +fi + +if [ ! -z logs/erros.log ] || [ ! -z logs.failures.log ]; then + echo "Errors are found. Job failed" + exit 1 +fi + diff --git a/scripts/run-container.sh b/scripts/run-container.sh new file mode 100755 index 0000000000000000000000000000000000000000..72b31e053421d8ff67c3a1e6eecb9d1807fc01ff --- /dev/null +++ b/scripts/run-container.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright ETSI 2019 +# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt + +#set -e +#set -vx + +docker run stf569-rf:latest "/bin/bash" \ + -c "cd /home/etsi/dev/robot \ + && sh scripts/run-all.bash \ + && ls -ltr logs/" + +# That's all Floks +exit $? +