From bfb22f31d763b898ee9a09dd6622a4971874ab05 Mon Sep 17 00:00:00 2001 From: Umair Zafar Date: Thu, 8 May 2025 10:50:29 +0500 Subject: [PATCH 1/5] add json request bodies for MEC048 --- MEC048/MEO/CSE/jsons/ResourceQuotaInfo.json | 3 +++ .../MEO/CSE/jsons/ResourceQuotaInfoUpdate.json | 5 +++++ MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json | 6 ++++++ MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json | 6 ++++++ MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json | 6 ++++++ MEC048/MEO/CSE/jsons/TenantInfo.json | 5 +++++ MEC048/MEO/CSE/jsons/TenantInfo2.json | 5 +++++ MEC048/MEO/CSE/jsons/TenantInfo3.json | 5 +++++ MEC048/MEO/CSE/jsons/TenantInfoBR.json | 16 ++++++++++++++++ MEC048/MEO/CSE/jsons/TenantInfoUpdate.json | 5 +++++ 10 files changed, 62 insertions(+) create mode 100644 MEC048/MEO/CSE/jsons/ResourceQuotaInfo.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json create mode 100644 MEC048/MEO/CSE/jsons/TenantInfo.json create mode 100644 MEC048/MEO/CSE/jsons/TenantInfo2.json create mode 100644 MEC048/MEO/CSE/jsons/TenantInfo3.json create mode 100644 MEC048/MEO/CSE/jsons/TenantInfoBR.json create mode 100644 MEC048/MEO/CSE/jsons/TenantInfoUpdate.json diff --git a/MEC048/MEO/CSE/jsons/ResourceQuotaInfo.json b/MEC048/MEO/CSE/jsons/ResourceQuotaInfo.json new file mode 100644 index 0000000..fc360ad --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceQuotaInfo.json @@ -0,0 +1,3 @@ +{ + "cpuQuota": "CPU_QUOTA" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json b/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json new file mode 100644 index 0000000..76275d1 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json @@ -0,0 +1,5 @@ +{ + "cpuQuota": "NUMBER_OF_CPUS", + "memoryQuota": "MEMORY_IN_MB", + "diskQuota": "AMOUNT_OF_DISK_IN_GB" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json new file mode 100644 index 0000000..775807b --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json @@ -0,0 +1,6 @@ +{ + "siteId": "SITE_ID", + "cpuQuota": "CPU_QUOTA", + "memoryQuota": "MEMORY_QUOTA", + "diskQuota": "DISK_QUOTA" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json new file mode 100644 index 0000000..916067e --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json @@ -0,0 +1,6 @@ +{ + "siteId": "SITE_ID_2", + "cpuQuota": "CPU_QUOTA_2", + "memoryQuota": "MEMORY_QUOTA_2", + "diskQuota": "DISK_QUOTA_2" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json new file mode 100644 index 0000000..6a91864 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json @@ -0,0 +1,6 @@ +{ + "siteId": "SITE_ID_3", + "cpuQuota": "CPU_QUOTA_3", + "memoryQuota": "MEMORY_QUOTA_3", + "diskQuota": "DISK_QUOTA_3" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/TenantInfo.json b/MEC048/MEO/CSE/jsons/TenantInfo.json new file mode 100644 index 0000000..167b324 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/TenantInfo.json @@ -0,0 +1,5 @@ +{ + "customerId": "customerId", + "customerName": "customerName", + "tenantName": "tenantName" +} diff --git a/MEC048/MEO/CSE/jsons/TenantInfo2.json b/MEC048/MEO/CSE/jsons/TenantInfo2.json new file mode 100644 index 0000000..660ea32 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/TenantInfo2.json @@ -0,0 +1,5 @@ +{ + "customerId": "customerId2", + "customerName": "customerName2", + "tenantName": "tenantName2" +} diff --git a/MEC048/MEO/CSE/jsons/TenantInfo3.json b/MEC048/MEO/CSE/jsons/TenantInfo3.json new file mode 100644 index 0000000..5116f15 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/TenantInfo3.json @@ -0,0 +1,5 @@ +{ + "customerId": "customerId3", + "customerName": "customerName3", + "tenantName": "tenantName3" +} diff --git a/MEC048/MEO/CSE/jsons/TenantInfoBR.json b/MEC048/MEO/CSE/jsons/TenantInfoBR.json new file mode 100644 index 0000000..052e6b1 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/TenantInfoBR.json @@ -0,0 +1,16 @@ +{ + "customerId": "customerId", + "customerName": "customerName", + "tenantName": "tenantName", + "resourceUseInfo": { + "cpuQuota": 100 + }, + "siteList": [ + { + "siteId": "siteId", + "resourceInfo": { + "cpuQuota": 50 + } + } + ] +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/TenantInfoUpdate.json b/MEC048/MEO/CSE/jsons/TenantInfoUpdate.json new file mode 100644 index 0000000..e5d4088 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/TenantInfoUpdate.json @@ -0,0 +1,5 @@ +{ + "customerId": "NEW_CUSTOMER_ID", + "customerName": "NEW_CUSTOMER_NAME_1", + "tenantName": "NEW_TENANT_NAME" +} \ No newline at end of file -- GitLab From b36f6d2a19688c6d03afcae649ec643c331ceb7d Mon Sep 17 00:00:00 2001 From: Umair Zafar Date: Thu, 8 May 2025 10:54:12 +0500 Subject: [PATCH 2/5] add schemas response body validations for MEC048 --- .../CSE/schemas/ResourceQuotaInfo.schema.json | 15 +++++ .../schemas/SiteResourceQuotaInfo.schema.json | 21 +++++++ .../SiteResourceQuotaInfoList.schema.json | 24 ++++++++ MEC048/MEO/CSE/schemas/TenantInfo.schema.json | 58 ++++++++++++++++++ .../CSE/schemas/TenantInfoList.schema.json | 61 +++++++++++++++++++ 5 files changed, 179 insertions(+) create mode 100644 MEC048/MEO/CSE/schemas/ResourceQuotaInfo.schema.json create mode 100644 MEC048/MEO/CSE/schemas/SiteResourceQuotaInfo.schema.json create mode 100644 MEC048/MEO/CSE/schemas/SiteResourceQuotaInfoList.schema.json create mode 100644 MEC048/MEO/CSE/schemas/TenantInfo.schema.json create mode 100644 MEC048/MEO/CSE/schemas/TenantInfoList.schema.json diff --git a/MEC048/MEO/CSE/schemas/ResourceQuotaInfo.schema.json b/MEC048/MEO/CSE/schemas/ResourceQuotaInfo.schema.json new file mode 100644 index 0000000..a053304 --- /dev/null +++ b/MEC048/MEO/CSE/schemas/ResourceQuotaInfo.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "cpuQuota": { + "type": "integer" + }, + "memoryQuota": { + "type": "integer" + }, + "diskQuota": { + "type": "integer" + } + } +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfo.schema.json b/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfo.schema.json new file mode 100644 index 0000000..dd8201f --- /dev/null +++ b/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfo.schema.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "siteId": { + "type": "string" + }, + "cpuQuota": { + "type": "integer" + }, + "memoryQuota": { + "type": "integer" + }, + "diskQuota": { + "type": "integer" + } + }, + "required": [ + "siteId" + ] +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfoList.schema.json b/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfoList.schema.json new file mode 100644 index 0000000..581dc86 --- /dev/null +++ b/MEC048/MEO/CSE/schemas/SiteResourceQuotaInfoList.schema.json @@ -0,0 +1,24 @@ +{ + "type": "array", + "items": { + "title": "SiteResourceQuotaInfo", + "type": "object", + "properties": { + "siteId": { + "type": "string" + }, + "cpuQuota": { + "type": "integer" + }, + "memoryQuota": { + "type": "integer" + }, + "diskQuota": { + "type": "integer" + } + }, + "required": [ + "siteId" + ] + } +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/TenantInfo.schema.json b/MEC048/MEO/CSE/schemas/TenantInfo.schema.json new file mode 100644 index 0000000..9e7c240 --- /dev/null +++ b/MEC048/MEO/CSE/schemas/TenantInfo.schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "customerId": { + "type": "string" + }, + "customerName": { + "type": "string" + }, + "customerCategory": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "tenantName": { + "type": "string" + }, + "resourceUseInfo": { + "type": "object", + "properties": { + "cpuQuota": { + "type": "integer" + }, + "cpuUsed": { + "type": "integer" + }, + "cpuRemain": { + "type": "integer" + }, + "memoryQuota": { + "type": "integer" + }, + "memoryUsed": { + "type": "integer" + }, + "memoryRemain": { + "type": "integer" + }, + "diskQuota": { + "type": "integer" + }, + "diskUsed": { + "type": "integer" + }, + "diskRemain": { + "type": "integer" + } + } + } + }, + "required": [ + "customerId", + "customerName", + "tenantName" + ] + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/TenantInfoList.schema.json b/MEC048/MEO/CSE/schemas/TenantInfoList.schema.json new file mode 100644 index 0000000..9c67d3a --- /dev/null +++ b/MEC048/MEO/CSE/schemas/TenantInfoList.schema.json @@ -0,0 +1,61 @@ +{ + "type": "array", + "items": { + "title": "TenantInfo", + "type": "object", + "properties": { + "customerId": { + "type": "string" + }, + "customerName": { + "type": "string" + }, + "customerCategory": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "tenantName": { + "type": "string" + }, + "resourceUseInfo": { + "type": "object", + "properties": { + "cpuQuota": { + "type": "integer" + }, + "cpuUsed": { + "type": "integer" + }, + "cpuRemain": { + "type": "integer" + }, + "memoryQuota": { + "type": "integer" + }, + "memoryUsed": { + "type": "integer" + }, + "memoryRemain": { + "type": "integer" + }, + "diskQuota": { + "type": "integer" + }, + "diskUsed": { + "type": "integer" + }, + "diskRemain": { + "type": "integer" + } + } + } + }, + "required": [ + "customerId", + "customerName", + "tenantName" + ] + } +} \ No newline at end of file -- GitLab From 12eea29b845758759ad8cc881d1b772dff436e62 Mon Sep 17 00:00:00 2001 From: Umair Zafar Date: Thu, 8 May 2025 11:03:26 +0500 Subject: [PATCH 3/5] add environmental variables for MEC048 test suite --- MEC048/MEO/CSE/environment/variables.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 MEC048/MEO/CSE/environment/variables.txt diff --git a/MEC048/MEO/CSE/environment/variables.txt b/MEC048/MEO/CSE/environment/variables.txt new file mode 100644 index 0000000..385a44c --- /dev/null +++ b/MEC048/MEO/CSE/environment/variables.txt @@ -0,0 +1,18 @@ +*** Variables *** +# Generic variables +${SCHEMA} http +${HOST} 127.0.0.1 +#${HOST} 10.192.2.172 +${PORT} 8081 +${response} {} +${TOKEN} Basic YWxhZGRpbjpvcGVuc2VzYW1l +${apiRoot} +${apiName} cse +${apiVersion} v1 + + +${REGISTER_ACTION} REGISTER +${REMOVE_ACTION} REMOVE +${NO_ACTION} NO_ACTION +${TENANT_ID_PLACEHOLDER} TENANT_ID_PLACEHOLDER +${NOT_EXISTING_TENANT_ID} NOT_EXISTING_TENANT_ID \ No newline at end of file -- GitLab From f09801d319815070e191aa21511cc831c93a04af Mon Sep 17 00:00:00 2001 From: Umair Zafar Date: Thu, 8 May 2025 11:53:58 +0500 Subject: [PATCH 4/5] add first 22 test cases to MEC048 test suite --- .../CSE/CustomerSelfServiceEnablement.robot | 481 ++++++++++++++++++ 1 file changed, 481 insertions(+) create mode 100644 MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot diff --git a/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot b/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot new file mode 100644 index 0000000..831448a --- /dev/null +++ b/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot @@ -0,0 +1,481 @@ +Y''[Documentation] robot --outputdir ../../../outputs ./V2XInformationService.robot +... Test Suite to validate V2X Information Service API (VIS) operations. + +*** Settings *** +Resource environment/variables.txt +Resource ../../../pics.txt +Resource ../../../GenericKeywords.robot +Library REST ${SCHEMA}://${HOST}:${PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary + +*** Test Cases *** +TC_MEC_MEC048_MEO_CSE_001_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_001_OK + ... Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - No query parameters + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.1 + ... ETSI GS MEC 048 v3.1.1, clause 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + [Setup] Register mutiple tenant Info and get tenant Ids TenantInfo TenantInfo2 TenantInfo3 + Retrieve all tenant Info resources + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is TenantInfoList + [Teardown] Remove mutiple tenant Info ${TENANT_ID_1} ${TENANT_ID_2} ${TENANT_ID_3} + +TC_MEC_MEC048_MEO_CSE_001_OK_02 + [Documentation] TP_MEC_MEC048_MEO_CSE_001_OK_02 + ... Check that the IUT responds with a list of tenantInfo when queried with customerId as query parameter + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.1 + ... ETSI GS MEC 048 v3.1.1, clause 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + [Setup] Register mutiple tenant Info and get tenant Ids TenantInfo TenantInfo2 TenantInfo3 + Retrieve all tenant info resources with query parameters customerId=${CUSTOMER_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is TenantInfoList + FOR ${tenant} IN @{response['body']} + Should Be Equal As Strings ${tenant}[tenantId] ${TENANT_ID_1} + END + [Teardown] Remove mutiple tenant Info ${TENANT_ID_1} ${TENANT_ID_2} ${TENANT_ID_3} + +TC_MEC_MEC048_MEO_CSE_001_OK_03 + [Documentation] TP_MEC_MEC048_MEO_CSE_001_OK_03 + ... Check that the IUT responds with a list of tenantInfo when queried with customerName as query parameter + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.1 + ... ETSI GS MEC 048 v3.1.1, clause 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + [Setup] Register mutiple tenant Info and get tenant Ids TenantInfo TenantInfo2 TenantInfo3 + Retrieve all tenant info resources with query parameters customerName=${CUSTOMER_NAME_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is TenantInfoList + FOR ${tenant} IN @{response['body']} + Should Be Equal As Strings ${tenant}[customerName] ${CUSTOMER_NAME_1} + END + [Teardown] Remove mutiple tenant Info ${TENANT_ID_1} ${TENANT_ID_2} ${TENANT_ID_3} + +TC_MEC_MEC048_MEO_CSE_002_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_002_OK + ... Check that the IUT creates a new tenantInfo when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.4 + ... ETSI GS MEC 048 v3.1.1, clause 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + ##No test setup needed because the tenantId is generated by IUT + Register Tenant Info TenantInfo + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is TenantInfo + ${CUSTOMER_ID_VALUE} Get value entry from JSON file TenantInfo customerId + ${TENANT_NAME_VALUE} Get value entry from JSON file TenantInfo tenantName + + Should Be Equal As Strings ${response['body']['customerId']} ${CUSTOMER_ID_VALUE} + Should Be Equal As Strings ${response['body']['tenantName']} ${TENANT_NAME_VALUE} + + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_002_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_002_BR + ... Check that the IUT responds with an error on creating a tenantInfo with both resourceUseInfo and siteList + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.4 and 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + Register Tenant Info TenantInfoBR + Check HTTP Response Status Code Is 400 + +TC_MEC_MEC048_MEO_CSE_003_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_003_OK + ... Check that the IUT responds with a specific tenantInfo when requested to a MEC Consumer + ... ETSI GS MEC 048 v3.1.1, clause 7.3.3.1 and 6.2.2 (TenantInfo) + [Tags] PIC_SERVICES + [Setup] Register Tenant Info TenantInfo + Retrieve specific tenant info resource ${TENANT_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is TenantInfo + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_003_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_003_NF + ... Check that the IUT returns an error when requesting a non-existing tenantInfo to a MEC Consumer + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.1 and 6.2.2 + [Tags] PIC_SERVICES + Retrieve specific tenant info resource ${NOT_EXISTING_TENANT_ID} + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_004_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_004_OK + ... Check that the IUT updates an existing tenantInfo when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.5 and 6.2.2 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Update tenant Info ${TENANT_ID_1} TenantInfoUpdate + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is TenantInfo + ${CUSTOMER_ID_VALUE} Get value entry from JSON file TenantInfoUpdate customerId + ${TENANT_NAME_VALUE} Get value entry from JSON file TenantInfoUpdate tenantName + ${CUSTOMER_NAME_VALUE} Get value entry from JSON file TenantInfoUpdate customerName + + Should Be Equal As Strings ${response['body']['customerId']} ${CUSTOMER_ID_VALUE} + Should Be Equal As Strings ${response['body']['tenantName']} ${TENANT_NAME_VALUE} + Should Be Equal As Strings ${response['body']['customerName']} ${CUSTOMER_NAME_VALUE} + + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_004_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_004_NF + ... Check that the IUT returns an error on updating a not existing tenantInfo requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.5 and 6.2.2 + [Tags] PIC_SERVICES + Update tenant Info ${NOT_EXISTING_TENANT_ID} TenantInfoUpdate + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_004_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_004_BR + ... Check that the IUT returns an error on updating with invalid values tenantInfo requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.2 and 6.2.2 + [Setup] Register tenant Info TenantInfo + Update tenant Info ${TENANT_ID_1} TenantInfoBR + Check HTTP Response Status Code Is 400 + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_005_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_005_OK + ... Check that the IUT removes a tenantInfo when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.5 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Remove specific tenant info resource ${TENANT_ID_1} + Check HTTP Response Status Code Is 204 + +TC_MEC_MEC048_MEO_CSE_005_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_005_NF + ... Check that the IUT returns an error on deleting a not existing tenantInfo when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.4.3.5 + [Tags] PIC_SERVICES + Remove specific tenant info resource ${NOT_EXISTING_TENANT_ID} + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_006_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_006_OK + ... Check that the IUT returns a resourceQuotaInfo for a specific tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.1, clause 6.2.3 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register resource quota Info ${TENANT_ID_1} ResourceQuotaInfo + Retrieve specific resource quota info resource ${TENANT_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is ResourceQuotaInfo + Remove specific resource quota info resource ${TENANT_ID_1} + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_006_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_006_NF + ... Check that the IUT returns an error on retrieving resourceQuotaInfo for a not existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.1, clause 6.2.3 + [Tags] PIC_SERVICES + Retrieve specific resource quota info resource ${NOT_EXISTING_TENANT_ID} + Check HTTP Response Status Code Is 404 + +# TO DO +TC_MEC_MEC048_MEO_CSE_007_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_007_OK + ... Check that the IUT updates the resourceQuotaInfo for an existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.2, clause 6.2.3 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register resource quota Info ${TENANT_ID_1} ResourceQuotaInfo + Update resource quota Info ${TENANT_ID_1} ResourceQuotaInfoUpdate + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is ResourceQuotaInfo + + ${CPU_QUOTA_VALUE} Get value entry from JSON file ResourceQuotaInfoUpdate cpuQuota + ${MEMORY_QUOTA_VALUE} Get value entry from JSON file ResourceQuotaInfoUpdate memoryQuota + ${DISK_QUOTA_VALUE} Get value entry from JSON file ResourceQuotaInfoUpdate diskQuota + + Should Be Equal As Strings ${response['body']['cpuQuota']} ${CPU_QUOTA_VALUE} + Should Be Equal As Strings ${response['body']['memoryQuota']} ${MEMORY_QUOTA_VALUE} + Should Be Equal As Strings ${response['body']['diskQuota']} ${DISK_QUOTA_VALUE} + + Remove specific resource quota info resource ${TENANT_ID_1} + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +# TO DO +TC_MEC_MEC048_MEO_CSE_007_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_007_NF + ... Check that the IUT returns an error on updating the resourceQuotaInfo for a not existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.2, clause 6.2.3 + [Tags] PIC_SERVICES + Update resource quota Info ${NOT_EXISTING_TENANT_ID} ResourceQuotaInfoUpdate + Check HTTP Response Status Code Is 404 +TC_MEC_MEC048_MEO_CSE_008_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_008_OK + ... Check that the IUT creates the resourceQuotaInfo for an existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.4, clause 6.2.3 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register resource quota Info ${TENANT_ID_1} ResourceQuotaInfo + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is ResourceQuotaInfo + Remove specific resource quota info resource ${TENANT_ID_1} + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_008_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_008_NF + ... Check that the IUT returns an error on creating the resourceQuotaInfo for a not existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.5.3.4, clause 6.2.3 + [Tags] PIC_SERVICES + Register resource quota Info ${NOT_EXISTING_TENANT_ID} ResourceQuotaInfo + Check HTTP Response Status Code Is 404 + +# MISATKE IN URL (TEST PURPOSE) ,TO DO +TC_MEC_MEC048_MEO_CSE_009_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_009_OK + ... Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - No filter + ... ETSI GS MEC 048 v3.1.1, clause 7.6.3.1, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register mutiple site resource quota Info and get site Ids ${TENANT_ID_1} SiteResourceQuotaInfo SiteResourceQuotaInfo2 SiteResourceQuotaInfo3 + Retrieve all resource quota info resource ${TENANT_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SiteResourceQuotaInfoList + FOR ${element} IN @{response['body']} + Should Be Equal As Strings ${element}[siteId] ${SITE_ID_1} + END + Remove mutiple site resource quota Info ${TENANT_ID_1} ${SITE_ID_1} ${SITE_ID_2} ${SITE_ID_3} + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_009_OK_01 + [Documentation] TP_MEC_MEC048_MEO_CSE_009_OK_01 + ... Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - siteId filter + ... ETSI GS MEC 048 v3.1.1, clause 7.6.3.1, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register mutiple site resource quota Info and get site Ids ${TENANT_ID_1} SiteResourceQuotaInfo SiteResourceQuotaInfo2 SKIP + Retrieve all site resource quota info resource with query parameters ${TENANT_ID_1} siteId=${SITE_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SiteResourceQuotaInfoList + FOR ${element} IN @{response['body']} + Should Be Equal As Strings ${element}[siteId] ${SITE_ID_1} + END + Remove mutiple site resource quota Info ${TENANT_ID_1} ${SITE_ID_1} ${SITE_ID_2} SKIP + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_009_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_009_NF + ... Check that the IUT returns an error on requesting site resource quota info on a not existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.6.3.1, clause 6.2.4 + [Tags] PIC_SERVICES + Retrieve all site resource quota info resource ${NOT_EXISTING_TENANT_ID} + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_010_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_010_OK + ... Check that the IUT creates a site resource quota info for an existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.6.3.4, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfo + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is SiteResourceQuotaInfo + Remove specific site resource quota info resource ${TENANT_ID_1} ${response}[body][siteId] + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +*** Keywords *** + +Retrieve all tenant info resources + Log Getting all Tenant Info + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + Get ${apiRoot}/${apiName}/${apiVersion}/tenants + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve specific tenant info resource + [Arguments] ${TEANNT_ID} + Log Getting Specific Tenant Info Resource + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${TEANNT_ID} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve all tenant info resources with query parameters + [Arguments] ${query_params} + Log Getting all Tenant Info with query parameter + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants?${query_params} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Register tenant Info + [Arguments] ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + POST ${apiRoot}/${apiName}/${apiVersion}/tenants ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + Set Suite Variable ${TENANT_ID_1} ${response}[body][tenantId] + +Update tenant Info + [Arguments] ${tenantId} ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + PUT ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId} + ${output}= Output response + Set Suite Variable ${response} ${output} + Set Suite Variable ${TENANT_ID} ${response}[body][tenantId] + +Update resource quota Info + [Arguments] ${tenantId} ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + PUT ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_system + ${output}= Output response + Set Suite Variable ${response} ${output} + Set Suite Variable ${TENANT_ID} ${response}[body][tenantId] + +Register mutiple tenant Info and get tenant Ids + [Arguments] ${content_01} ${content_02} ${content_03} + Register tenant Info ${content_01} + Set Suite Variable ${TENANT_ID_1} ${response}[body][tenantId] + Set Suite Variable ${CUSTOMER_ID_1} ${response}[body][customerId] + Set Suite Variable ${CUSTOMER_NAME_1} ${response}[body][customerName] + Register tenant Info ${content_02} + Set Suite Variable ${TENANT_ID_2} ${response}[body][tenantId] + Set Suite Variable ${CUSTOMER_ID_2} ${response}[body][customerId] + Set Suite Variable ${CUSTOMER_NAME_2} ${response}[body][customerName] + Register tenant Info ${content_03} + Set Suite Variable ${TENANT_ID_3} ${response}[body][tenantId] + Set Suite Variable ${CUSTOMER_ID_3} ${response}[body][customerId] + Set Suite Variable ${CUSTOMER_NAME_3} ${response}[body][customerName] + +Remove mutiple tenant Info + [Arguments] ${tenant_id_1} ${tenant_id_2} ${tenant_id_3} + Run Keyword If '${tenant_id_1}' != 'SKIP' Remove specific tenant info resource ${tenant_id_1} + Remove specific tenant info resource ${tenant_id_2} + Remove specific tenant info resource ${tenant_id_3} + +Remove specific tenant info resource + [Arguments] ${tenantId} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + DELETE ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve specific resource quota info resource + [Arguments] ${TEANNT_ID} + Log Getting Specific Resource Quota Info + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${TEANNT_ID}/resources/quota_in_system + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve all resource quota info resource + [Arguments] ${TEANNT_ID} + Log Getting All Resource Quota Info + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${TEANNT_ID}/resources/quota_in_system + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve all site resource quota info resource + [Arguments] ${TEANNT_ID} + Log Getting All Site Resource Quota Info + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${TEANNT_ID}/resources/quota_in_sites + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve all site resource quota info resource with query parameters + [Arguments] ${TEANNT_ID} ${query_params} + Log Getting All Site Resource Quota Info with query parameters + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${TEANNT_ID}/resources/quota_in_sites?${query_params} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Register mutiple site resource quota Info and get site Ids + [Arguments] ${tenantId} ${content_01} ${content_02} ${content_03} + Register site resource quota Info ${tenantId} ${content_01} + Set Suite Variable ${SITE_ID_1} ${response}[body][siteId] + Register site resource quota Info ${tenantId} ${content_02} + Set Suite Variable ${SITE_ID_2} ${response}[body][siteId] + Run Keyword If '${content_03}' != 'SKIP' Register site resource quota Info ${tenantId} ${content_03} + Run Keyword If '${content_03}' != 'SKIP' Set Suite Variable ${SITE_ID_3} ${response}[body][siteId] + +Register resource quota Info + [Arguments] ${tenantId} ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + POST ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_system ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Register site resource quota Info + [Arguments] ${tenantId} ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + POST ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_sites ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Remove mutiple site resource quota Info + [Arguments] ${tenant_id_1} ${site_id_1} ${site_id_2} ${site_id_3} + Run Keyword If '${tenant_id_1}' != 'SKIP' Remove specific site resource quota info resource ${tenant_id_1} ${site_id_1} + Remove specific site resource quota info resource ${tenant_id_1} ${site_id_2} + Run Keyword If '${site_id_3}' != 'SKIP' Remove specific site resource quota info resource ${tenant_id_1} ${site_id_3} + +Remove specific resource quota info resource + [Arguments] ${tenantId} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + DELETE ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_system + ${output}= Output response + Set Suite Variable ${response} ${output} + +Remove specific site resource quota info resource + [Arguments] ${tenantId} ${siteId} + Should Be True ${PIC_MEC_PLAT} == 1 + Should Be True ${PIC_SERVICES} == 1 + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + DELETE ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_sites/${siteId} + ${output}= Output response + Set Suite Variable ${response} ${output} \ No newline at end of file -- GitLab From 4f086f94ef9de4384ed2a3315ccb8b8372415f63 Mon Sep 17 00:00:00 2001 From: Ikram Ul Haq Date: Fri, 23 May 2025 11:20:04 +0500 Subject: [PATCH 5/5] Add Remaining TestCases For MEC048 Test Suite --- .../CSE/CustomerSelfServiceEnablement.robot | 846 +++++++++++++++++- MEC048/MEO/CSE/environment/variables.txt | 10 +- MEC048/MEO/CSE/jsons/ExpiryNotification.json | 9 + .../CSE/jsons/ResourceQuotaInfoUpdate.json | 6 +- .../CSE/jsons/ResourceUsageSubscription.json | 11 + .../CSE/jsons/ResourceUsageSubscription1.json | 11 + .../CSE/jsons/ResourceUsageSubscription2.json | 11 + .../jsons/ResourceUsageSubscriptionBR.json | 10 + .../ResourceUsageSubscriptionWithExpiry.json | 12 + .../MEO/CSE/jsons/SiteResourceQuotaInfo.json | 10 +- .../MEO/CSE/jsons/SiteResourceQuotaInfo2.json | 10 +- .../MEO/CSE/jsons/SiteResourceQuotaInfo3.json | 10 +- .../CSE/jsons/SiteResourceQuotaInfoBR.json | 3 + .../jsons/SiteResourceUsageSubscription.json | 12 + .../jsons/SiteResourceUsageSubscription1.json | 12 + .../SiteResourceUsageSubscriptionBR.json | 11 + .../SiteResourceUsageSubscriptionUpdate.json | 12 + MEC048/MEO/CSE/libraries/Server.py | 52 ++ MEC048/MEO/CSE/libraries/StressGenerator.py | 37 + .../__pycache__/Server.cpython-312.pyc | Bin 0 -> 3527 bytes .../StressGenerator.cpython-312.pyc | Bin 0 -> 1896 bytes .../schemas/ExpiryNotification.schema.json | 9 + .../ResourceUsageNotification.schema.json | 14 + .../ResourceUsageSubscription.schema.json | 60 ++ .../SiteResourceUsageNotification.schema.json | 56 ++ .../SiteResourceUsageSubscription.schema.json | 67 ++ .../schemas/SubscriptionLinkList.schema.json | 38 + 27 files changed, 1317 insertions(+), 22 deletions(-) create mode 100644 MEC048/MEO/CSE/jsons/ExpiryNotification.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceUsageSubscription.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceUsageSubscription1.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceUsageSubscription2.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionBR.json create mode 100644 MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionWithExpiry.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceQuotaInfoBR.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription1.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionBR.json create mode 100644 MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionUpdate.json create mode 100644 MEC048/MEO/CSE/libraries/Server.py create mode 100644 MEC048/MEO/CSE/libraries/StressGenerator.py create mode 100644 MEC048/MEO/CSE/libraries/__pycache__/Server.cpython-312.pyc create mode 100644 MEC048/MEO/CSE/libraries/__pycache__/StressGenerator.cpython-312.pyc create mode 100644 MEC048/MEO/CSE/schemas/ExpiryNotification.schema.json create mode 100644 MEC048/MEO/CSE/schemas/ResourceUsageNotification.schema.json create mode 100644 MEC048/MEO/CSE/schemas/ResourceUsageSubscription.schema.json create mode 100644 MEC048/MEO/CSE/schemas/SiteResourceUsageNotification.schema.json create mode 100644 MEC048/MEO/CSE/schemas/SiteResourceUsageSubscription.schema.json create mode 100644 MEC048/MEO/CSE/schemas/SubscriptionLinkList.schema.json diff --git a/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot b/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot index 831448a..cee7386 100644 --- a/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot +++ b/MEC048/MEO/CSE/CustomerSelfServiceEnablement.robot @@ -1,5 +1,5 @@ -Y''[Documentation] robot --outputdir ../../../outputs ./V2XInformationService.robot -... Test Suite to validate V2X Information Service API (VIS) operations. +Y''[Documentation] robot --outputdir ../../../outputs ./CustomerSelfServiceEnablement.robot +... Test Suite to validate CustomerSelfServiceEnablement Service API operations. *** Settings *** Resource environment/variables.txt @@ -7,7 +7,12 @@ Resource ../../../pics.txt Resource ../../../GenericKeywords.robot Library REST ${SCHEMA}://${HOST}:${PORT} ssl_verify=false Library OperatingSystem -Library JSONLibrary +Library libraries/Server.py +Library libraries/StressGenerator.py +Library JSONLibrary +Library String +Library Collections +Library DateTime *** Test Cases *** TC_MEC_MEC048_MEO_CSE_001_OK @@ -275,8 +280,843 @@ TC_MEC_MEC048_MEO_CSE_010_OK Remove specific site resource quota info resource ${TENANT_ID_1} ${response}[body][siteId] [Teardown] Remove specific tenant info resource ${TENANT_ID_1} +TC_MEC_MEC048_MEO_CSE_010_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_010_BR + ... Check that the IUT returns an error on creating a site resource quota with wrong parameters + ... ETSI GS MEC 048 v3.1.1, clause 7.6.3.4, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfoBR + Check HTTP Response Status Code Is 400 + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_011_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_011_OK + ... Check that the IUT returns the site resource quota for a specific tenant and site identifier when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.7.3.1, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register multiple site resource quotas for tenant + Retrieve specific site resource quota info resource ${TENANT_ID_1} ${SITE_ID_1} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SiteResourceQuotaInfo + Should Be Equal As Strings ${response['body']['siteId']} ${SITE_ID_1} + Should Be Equal As Integers ${response['body']['cpuQuota']} ${CPU_QUOTA_1} + Should Be Equal As Integers ${response['body']['memoryQuota']} ${MEMORY_QUOTA_1} + Should Be Equal As Integers ${response['body']['diskQuota']} ${DISK_QUOTA_1} + [Teardown] Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_011_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_011_NF + ... Check that the IUT returns an error on requesting the site resource quota for a specific tenant and a not existing site identifier when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.7.3.1, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register tenant Info TenantInfo + Retrieve specific site resource quota info resource ${TENANT_ID_1} ${NOT_EXISTING_TENANT_ID} + Check HTTP Response Status Code Is 404 + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_012_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_012_OK + ... Check that the IUT updates a site resource quota info for an existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.7.3.2, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register site resource quota for tenant + # Update the site resource quota with new values + Update site resource quota Info ${TENANT_ID_1} ${SITE_ID_1} SiteResourceQuotaInfoUpdate + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SiteResourceQuotaInfo + + # Verify the updated values match what we sent + ${CPU_QUOTA_VALUE} Get value entry from JSON file SiteResourceQuotaInfoUpdate cpuQuota + ${MEMORY_QUOTA_VALUE} Get value entry from JSON file SiteResourceQuotaInfoUpdate memoryQuota + ${DISK_QUOTA_VALUE} Get value entry from JSON file SiteResourceQuotaInfoUpdate diskQuota + + Should Be Equal As Strings ${response['body']['siteId']} ${SITE_ID_1} + Should Be Equal As Integers ${response['body']['cpuQuota']} ${CPU_QUOTA_VALUE} + Should Be Equal As Integers ${response['body']['memoryQuota']} ${MEMORY_QUOTA_VALUE} + Should Be Equal As Integers ${response['body']['diskQuota']} ${DISK_QUOTA_VALUE} + + [Teardown] Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_012_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_012_BR + ... Check that the IUT returns an error updating a site resource quota info for an existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.7.3.2, clause 6.2.4 + [Tags] PIC_SERVICES + [Setup] Register site resource quota for tenant + # Attempt to update the site resource quota with invalid data + Update site resource quota Info ${TENANT_ID_1} ${SITE_ID_1} SiteResourceQuotaInfoBR + Check HTTP Response Status Code Is 400 + [Teardown] Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_012_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_012_NF + ... Check that the IUT returns an error updating a site resource quota info for a not existing tenant when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.7.3.2, clause 6.2.4 + [Tags] PIC_SERVICES + # No setup needed as we're testing with a non-existing tenant + Update site resource quota Info ${NOT_EXISTING_TENANT_ID} ${NOT_EXISTING_SITE_ID} SiteResourceQuotaInfoUpdate + Check HTTP Response Status Code Is 404 + # No teardown needed as no resources were created + +TC_MEC_MEC048_MEO_CSE_013_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_013_OK + ... Check that the IUT returns the list of subscriptions when requested to a CSE - no filter + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.1, clause 6.3.4 + [Tags] PIC_SERVICES + [Setup] Create test subscriptions + Retrieve all subscriptions + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SubscriptionLinkList + # Verify _links.self is present and correct + Should Be Equal As Strings ${response['body']['_links']['self']['href']} ${apiRoot}/${apiName}/${apiVersion}/subscriptions + # Verify subscription items exist + ${subscriptions}= Get From Dictionary ${response['body']} subscription + ${subscription_count}= Get Length ${subscriptions} + Should Be True ${subscription_count} >= 3 + # Verify the subscription types are as expected - at least one of each type + ${resource_type_count}= Count Subscriptions Of Type ${subscriptions} ResourceUsageSubscription + ${site_resource_type_count}= Count Subscriptions Of Type ${subscriptions} SiteResourceUsageSubscription + Should Be True ${resource_type_count} >= 2 Found only ${resource_type_count} ResourceUsageSubscription, expected at least 2 + Should Be True ${site_resource_type_count} >= 1 Found only ${site_resource_type_count} SiteResourceUsageSubscription, expected at least 1 + [Teardown] Remove test subscriptions + +TC_MEC_MEC048_MEO_CSE_013_OK_02 + [Documentation] TP_MEC_MEC048_MEO_CSE_013_OK_02 + ... Check that the IUT returns the list of subscriptions when requested to a CSE - subscription_type filter + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.1, clause 6.3.4 + [Tags] PIC_SERVICES + [Setup] Create test subscriptions + # Retrieve subscriptions with subscription_type filter + Retrieve subscriptions with filter subscription_type=ResourceUsageSubscription + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is SubscriptionLinkList + # Verify _links.self is present and includes the query parameter + Should Be Equal As Strings ${response['body']['_links']['self']['href']} ${apiRoot}/${apiName}/${apiVersion}/subscriptions?subscription_type=ResourceUsageSubscription + # Verify subscription items exist + ${subscriptions}= Get From Dictionary ${response['body']} subscription + ${subscription_count}= Get Length ${subscriptions} + # Should have at least the ResourceUsageSubscription types we created + Should Be True ${subscription_count} >= 2 + # Verify ONLY ResourceUsageSubscription types are returned (no SiteResourceUsageSubscription) + FOR ${subscription} IN @{subscriptions} + Should Be Equal As Strings ${subscription['subscriptionType']} ResourceUsageSubscription + END + [Teardown] Remove test subscriptions + +TC_MEC_MEC048_MEO_CSE_014_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_014_OK + ... Check that the IUT creates a new subscription when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant to use for the subscription + [Setup] Register tenant Info TenantInfo + Set Suite Variable ${TENANT_ID_1} ${response['body']['tenantId']} + Set Suite Variable ${CUSTOMER_ID_1} ${response['body']['customerId']} + + # Create a new ResourceUsageSubscription + Create ResourceUsageSubscription ResourceUsageSubscription + + # Verify response status code + Check HTTP Response Status Code Is 201 + + # Verify response body schema + Check HTTP Response Body Json Schema Is ResourceUsageSubscription + + # Verify Location header (should contain the URI of the created subscription) + ${location_header}= Get From Dictionary ${response['headers']} Location + Should Not Be Empty ${location_header} + Should Match Regexp ${location_header} ${apiRoot}/${apiName}/${apiVersion}/subscriptions/\\w+ + + # Store subscription ID for cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Verify response body content + Should Be Equal As Strings ${response['body']['subscriptionType']} ResourceUsageSubscription + Should Be Equal As Strings ${response['body']['customerId']} ${CUSTOMER_ID_1} + Should Be Equal As Strings ${response['body']['tenantId']} ${TENANT_ID_1} + Should Be Equal As Strings ${response['body']['callbackReference']} some/uri + + # Verify notification trigger details + Should Be Equal As Integers ${response['body']['notificationTrigger']['triggerType']} 10 + Should Be Equal As Integers ${response['body']['notificationTrigger']['threshold']} 4 + # In the schema, greaterOrLess is a boolean, but in the specification it's 0/1 + # This could be handled either way depending on your implementation + Should Be Equal ${response['body']['notificationTrigger']['greaterOrLess']} ${FALSE} + + # Verify self-link in response + Should Not Be Empty ${response['body']['_links']['self']['href']} + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_014_OK_02 + [Documentation] TP_MEC_MEC048_MEO_CSE_014_OK_02 + ... Check that the IUT creates a new subscription when requested to a CSE - SiteResourceUsageSubscription + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant and site resources to use for the subscription + [Setup] Register site resource quota for tenant + + # Create a new SiteResourceUsageSubscription + Register subscription SiteResourceUsageSubscription1 + + # Verify response status code + Check HTTP Response Status Code Is 201 + + # Verify response body schema + Check HTTP Response Body Json Schema Is SiteResourceUsageSubscription + + # Verify Location header (should contain the URI of the created subscription) + ${location_header}= Get From Dictionary ${response['headers']} Location + Should Not Be Empty ${location_header} + Should Match Regexp ${location_header} ${apiRoot}/${apiName}/${apiVersion}/subscriptions/\\w+ + + # Store subscription ID for cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Verify response body content + Should Be Equal As Strings ${response['body']['subscriptionType']} SiteResourceUsageSubscription + Should Be Equal As Strings ${response['body']['customerId']} ${CUSTOMER_ID_1} + Should Be Equal As Strings ${response['body']['tenantId']} ${TENANT_ID_1} + Should Be Equal As Strings ${response['body']['callbackReference']} some/uri + + # Verify siteList contains our test site + ${siteList}= Get From Dictionary ${response['body']} siteList + List Should Contain Value ${siteList} ${SITE_ID_1} + + # Verify notification trigger details + Should Be Equal As Integers ${response['body']['notificationTrigger']['triggerType']} 10 + Should Be Equal As Integers ${response['body']['notificationTrigger']['threshold']} 4 + Should Be Equal ${response['body']['notificationTrigger']['greaterOrLess']} ${FALSE} + + # Verify self-link in response + Should Not Be Empty ${response['body']['_links']['self']['href']} + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_014_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_014_BR + ... Check that the IUT returns an error on creating a new subscription when requested to a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant to use for the subscription + [Setup] Register tenant Info TenantInfo + Set Suite Variable ${TENANT_ID_1} ${response['body']['tenantId']} + Set Suite Variable ${CUSTOMER_ID_1} ${response['body']['customerId']} + + # Attempt to create a subscription with missing required parameters + Register subscription ResourceUsageSubscriptionBR + + # Verify that a 400 Bad Request error is returned + Check HTTP Response Status Code Is 400 + + # Teardown - clean up the created tenant + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_015_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_015_OK + ... Check that the IUT returns a subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.1, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant, site resources, and subscription + [Setup] Register site resource quota for tenant + + # Create a SiteResourceUsageSubscription + Register subscription SiteResourceUsageSubscription + + # Save the subscription ID for later retrieval and cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Retrieve the specific subscription + Retrieve specific subscription ${subscription_id} + + # Verify response status code + Check HTTP Response Status Code Is 200 + + # Verify response body schema + Check HTTP Response Body Json Schema Is SiteResourceUsageSubscription + + # Verify response body content + Should Be Equal As Strings ${response['body']['subscriptionType']} SiteResourceUsageSubscription + Should Be Equal As Strings ${response['body']['customerId']} ${CUSTOMER_ID_1} + Should Be Equal As Strings ${response['body']['tenantId']} ${TENANT_ID_1} + Should Be Equal As Strings ${response['body']['callbackReference']} some/uri + + # Verify siteList contains our test site + ${siteList}= Get From Dictionary ${response['body']} siteList + List Should Contain Value ${siteList} ${SITE_ID_1} + + # Verify notification trigger details + Should Be Equal As Integers ${response['body']['notificationTrigger']['triggerType']} 10 + Should Be Equal As Integers ${response['body']['notificationTrigger']['threshold']} 4 + Should Be Equal ${response['body']['notificationTrigger']['greaterOrLess']} ${FALSE} + + # Verify self-link in response + Should Not Be Empty ${response['body']['_links']['self']['href']} + Should Be Equal As Strings ${response['body']['_links']['self']['href']} ${subscription_uri} + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_015_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_015_NF + ... Check that the IUT returns an error on requesting a not existing subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.1, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Attempt to retrieve a non-existent subscription + Retrieve specific subscription ${NOT_EXISTING_SUBSCRIPTION_ID} + + # Verify response status code is 404 Not Found + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_016_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_016_OK + ... Check that the IUT updates an existing subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.2, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant, site resources, and subscription + [Setup] Register site resource quota for tenant + + # Create a SiteResourceUsageSubscription to be updated later + Register subscription SiteResourceUsageSubscription + + # Save the subscription ID for update and cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + Set Suite Variable ${OLD_CUSTOMER_ID} ${response['body']['customerId']} + + # Create another tenant to get a new customer ID + Register tenant Info TenantInfo2 + Set Suite Variable ${NEW_CUSTOMER_ID} ${response['body']['customerId']} + Set Suite Variable ${TENANT_ID_2} ${response['body']['tenantId']} + + # Update the subscription with the new customer ID + Update subscription ${subscription_id} SiteResourceUsageSubscriptionUpdate + + # Verify response status code + Check HTTP Response Status Code Is 200 + + # Verify response body schema + Check HTTP Response Body Json Schema Is SiteResourceUsageSubscription + + # Verify response body content - specifically that the customerId has been updated + Should Be Equal As Strings ${response['body']['subscriptionType']} SiteResourceUsageSubscription + Should Be Equal As Strings ${response['body']['customerId']} ${NEW_CUSTOMER_ID} + Should Not Be Equal As Strings ${response['body']['customerId']} ${OLD_CUSTOMER_ID} + Should Be Equal As Strings ${response['body']['tenantId']} ${TENANT_ID_1} + Should Be Equal As Strings ${response['body']['callbackReference']} some/uri/updated + + # Verify siteList contains our test site + ${siteList}= Get From Dictionary ${response['body']} siteList + List Should Contain Value ${siteList} ${SITE_ID_1} + + # Verify notification trigger details + Should Be Equal As Integers ${response['body']['notificationTrigger']['triggerType']} 10 + Should Be Equal As Integers ${response['body']['notificationTrigger']['threshold']} 4 + Should Be Equal ${response['body']['notificationTrigger']['greaterOrLess']} ${FALSE} + + # Verify self-link in response + Should Not Be Empty ${response['body']['_links']['self']['href']} + Should Be Equal As Strings ${response['body']['_links']['self']['href']} ${subscription_uri} + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove tenant and site resources AND + ... Remove specific tenant info resource ${TENANT_ID_2} + +TC_MEC_MEC048_MEO_CSE_016_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_016_NF + ... Check that the IUT returns an error updating an not existing subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.2, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant and site resources for the update request + [Setup] Register site resource quota for tenant + + # Create a JSON template for another tenant to get a customer ID + Register tenant Info TenantInfo2 + Set Suite Variable ${NEW_CUSTOMER_ID} ${response['body']['customerId']} + Set Suite Variable ${TENANT_ID_2} ${response['body']['tenantId']} + + # Attempt to update a non-existent subscription + Update subscription ${NOT_EXISTING_SUBSCRIPTION_ID} SiteResourceUsageSubscriptionUpdate + + # Verify response status code is 404 Not Found + Check HTTP Response Status Code Is 404 + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Remove tenant and site resources AND + ... Remove specific tenant info resource ${TENANT_ID_2} + +TC_MEC_MEC048_MEO_CSE_016_BR + [Documentation] TP_MEC_MEC048_MEO_CSE_016_BR + ... Check that the IUT returns an error updating an existing subscription with wrong parameters when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.2, clause 6.3.2, clause 6.3.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant, site resources, and a valid subscription + [Setup] Register site resource quota for tenant + + # Create a SiteResourceUsageSubscription to be updated later + Register subscription SiteResourceUsageSubscription + + # Save the subscription ID for update and cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Create another tenant to get a new customer ID for the update + Register tenant Info TenantInfo2 + Set Suite Variable ${NEW_CUSTOMER_ID} ${response['body']['customerId']} + Set Suite Variable ${TENANT_ID_2} ${response['body']['tenantId']} + + # Attempt to update the subscription with invalid parameters (missing both callbackReference and websockNotifConfig) + Update subscription ${subscription_id} SiteResourceUsageSubscriptionBR + + # Verify response status code is 400 Bad Request + Check HTTP Response Status Code Is 400 + + # Teardown - clean up the created resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove tenant and site resources AND + ... Remove specific tenant info resource ${TENANT_ID_2} + +TC_MEC_MEC048_MEO_CSE_017_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_017_OK + ... Check that the IUT deletes an existing subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.2 + [Tags] PIC_SERVICES + + # Setup - Create a tenant, site resources, and subscription + [Setup] Register site resource quota for tenant + + # Create a SiteResourceUsageSubscription to be deleted + Register subscription SiteResourceUsageSubscription + + # Save the subscription ID for deletion + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + + # Delete the subscription + Delete subscription ${subscription_id} + + # Verify response status code is 204 No Content + Check HTTP Response Status Code Is 204 + + # Verify the subscription no longer exists (optional) + Retrieve specific subscription ${subscription_id} + Check HTTP Response Status Code Is 404 + + # Teardown - clean up the created resources (only tenant and site as subscription is deleted) + [Teardown] Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_017_NF + [Documentation] TP_MEC_MEC048_MEO_CSE_017_NF + ... Check that the IUT returns an error on a deletion of a not existing subscription when requested by a CSE + ... ETSI GS MEC 048 v3.1.1, clause 7.9.3.2 + [Tags] PIC_SERVICES + + # Attempt to delete a non-existent subscription + Delete subscription ${NOT_EXISTING_SUBSCRIPTION_ID} + + # Verify response status code is 404 Not Found + Check HTTP Response Status Code Is 404 + +TC_MEC_MEC048_MEO_CSE_018_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_018_OK + ... Check that the CSE sends a site resource usage notification if the CSE has an associated subscription and the event is generated + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.4.3 + [Tags] PIC_SERVICES + + # Setup - Create a tenant and site resources + [Setup] Register site resource quota for tenant + + # Create a SiteResourceUsageSubscription with callback to our notification server + ${subscription_json}= Get File jsons/SiteResourceUsageSubscription.json + ${callback_url}= Set Variable http://${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT}${NOTIFICATION_SERVER_URI} + ${subscription_json}= Replace String ${subscription_json} "some/uri" "${callback_url}" + ${subscription_json}= Replace String ${subscription_json} "placeholder-tenant" "${TENANT_ID_1}" + ${subscription_json}= Replace String ${subscription_json} "placeholder-customer" "${CUSTOMER_ID_1}" + ${subscription_json}= Replace String ${subscription_json} ["placeholder-site"] ["${SITE_ID_1}"] + + # Register the subscription with our callback URL + Post Raw Subscription ${subscription_json} + Check HTTP Response Status Code Is 201 + + # Save the subscription ID for cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Generate load to trigger the notification + Log Generating CPU load to trigger notification + ${result}= Generate CPU Load 60 4 + Log ${result} + + # Start the notification server to wait for and capture the notification + ${notification}= Spawn Notification Server + # Verify notification exists + Should Not Be Empty ${notification} + + # Verify notification content + Should Be Equal As Strings ${notification['notificationType']} SiteResourceUsageNotification + Should Be Equal As Strings ${notification['customerId']} ${CUSTOMER_ID_1} + Should Be Equal As Strings ${notification['tenantId']} ${TENANT_ID_1} + + # Verify resource usage information + ${site_info}= Get From List ${notification['resourceUseInfo']} 0 + Should Be Equal As Strings ${site_info['siteId']} ${SITE_ID_1} + Should Be Equal As Integers ${site_info['cpuUsed']} 5 + + # Teardown - clean up resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove tenant and site resources + +TC_MEC_MEC048_MEO_CSE_019_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_019_OK + ... Check that the CSE sends a resource usage notification if the CSE has an associated subscription and the event is generated + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.4.2 + [Tags] PIC_SERVICES + + # Setup - Create a tenant for the subscription + [Setup] Register tenant Info TenantInfo + + # Create a ResourceUsageSubscription with callback to our notification server + ${subscription_json}= Get File jsons/ResourceUsageSubscription.json + ${callback_url}= Set Variable http://${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT}${NOTIFICATION_SERVER_URI} + ${subscription_json}= Replace String ${subscription_json} "some/uri" "${callback_url}" + ${subscription_json}= Replace String ${subscription_json} "tenant-123" "${TENANT_ID_1}" + ${subscription_json}= Replace String ${subscription_json} "customer-123" "${CUSTOMER_ID_1}" + + # Register the subscription with our callback URL + Post Raw Subscription ${subscription_json} + Check HTTP Response Status Code Is 201 + + # Save the subscription ID for cleanup + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_uri} + + # Generate load to trigger the notification + Log Generating CPU load to trigger notification + ${result}= Generate CPU Load 60 4 + Log ${result} + + # Start the notification server to wait for and capture the notification + ${notification}= Spawn Resource Notification Server + + # Verify notification exists + Should Not Be Empty ${notification} + + # Verify notification content + Should Be Equal As Strings ${notification['notificationType']} ResourceUsageNotification + Should Be Equal As Strings ${notification['customerId']} ${CUSTOMER_ID_1} + Should Be Equal As Strings ${notification['tenantId']} ${TENANT_ID_1} + + # Verify resource usage information + Should Be Equal As Integers ${notification['resourceUseInfo']['cpuUsed']} 5 + + # Teardown - clean up resources + [Teardown] Run Keywords + ... Delete Created Subscription AND + ... Remove specific tenant info resource ${TENANT_ID_1} + +TC_MEC_MEC048_MEO_CSE_020_OK + [Documentation] TP_MEC_MEC048_MEO_CSE_020_OK + ... Check that the CSE sends a notification on subscription expiration if the CSE has an associated subscription and the event is generated + ... ETSI GS MEC 048 v3.1.1, clause 7.8.3.4, clause 6.4.4 + [Tags] PIC_SERVICES + + # Setup - Create a tenant for the subscription + [Setup] Register tenant Info TenantInfo + + # Get the current time and add a short time for expiry deadline (10 seconds in the future) + ${current_time}= Get Current Date + ${expiry_time}= Add Time To Date ${current_time} 10 seconds + ${expiry_time_iso}= Convert Date ${expiry_time} result_format=%Y-%m-%dT%H:%M:%SZ + Set Suite Variable ${EXPIRY_DEADLINE} ${expiry_time_iso} + + # Create a ResourceUsageSubscription with a short expiry time and callback to our notification server + ${subscription_json}= Get File jsons/ResourceUsageSubscriptionWithExpiry.json + ${callback_url}= Set Variable http://${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT}${NOTIFICATION_SERVER_URI} + ${subscription_json}= Replace String ${subscription_json} "some/uri" "${callback_url}" + ${subscription_json}= Replace String ${subscription_json} "tenant-123" "${TENANT_ID_1}" + ${subscription_json}= Replace String ${subscription_json} "customer-123" "${CUSTOMER_ID_1}" + ${subscription_json}= Replace String ${subscription_json} "2099-12-31T23:59:59Z" "${EXPIRY_DEADLINE}" + + # Register the subscription with our callback URL + Post Raw Subscription ${subscription_json} + Check HTTP Response Status Code Is 201 + + # Save the subscription ID and HREF for verification + ${subscription_uri}= Set Variable ${response['body']['_links']['self']['href']} + ${subscription_id}= Fetch From Right ${subscription_uri} /subscriptions/ + Set Suite Variable ${SUBSCRIPTION_ID} ${subscription_id} + Set Suite Variable ${SUBSCRIPTION_HREF} ${subscription_uri} + + # Start the notification server to wait for and capture the expiry notification + # Need to wait for the subscription to expire (a bit longer than our expiry time) + ${notification}= Spawn Expiry Notification Server + + # Verify notification exists + Should Not Be Empty ${notification} + + # Verify notification content + Should Be Equal As Strings ${notification['notificationType']} ExpiryNotification + + # Verify subscription link in the notification + Should Be Equal As Strings ${notification['_links']['subscription']['href']} ${SUBSCRIPTION_HREF} + + # Verify expiry deadline matches what we set + Should Be Equal As Strings ${notification['expiryDeadline']} ${EXPIRY_DEADLINE} + + # Verify the subscription no longer exists/is expired + Retrieve specific subscription ${SUBSCRIPTION_ID} + Check HTTP Response Status Code Is 404 + + # Teardown - clean up tenant (subscription should be auto-removed after expiry) + [Teardown] Remove specific tenant info resource ${TENANT_ID_1} + *** Keywords *** +Spawn Expiry Notification Server + Log Starting notification server on ${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT} for expiry notification + ${notification}= Spawn Web Server ${NOTIFICATION_SERVER_IP} ${NOTIFICATION_SERVER_PORT} ${NOTIFICATION_SERVER_TIMEOUT} ${NOTIFICATION_SERVER_HTTP_METHOD} ${NOTIFICATION_SERVER_URI} ResourceUsageSubscription + [Return] ${notification} + +Spawn Resource Notification Server + Log Starting notification server on ${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT} + ${notification}= Spawn Web Server ${NOTIFICATION_SERVER_IP} ${NOTIFICATION_SERVER_PORT} ${NOTIFICATION_SERVER_TIMEOUT} ${NOTIFICATION_SERVER_HTTP_METHOD} ${NOTIFICATION_SERVER_URI} ResourceUsageSubscription + [Return] ${notification} + +Spawn Notification Server + Log Starting notification server on ${NOTIFICATION_SERVER_IP}:${NOTIFICATION_SERVER_PORT} + ${notification}= Spawn Web Server ${NOTIFICATION_SERVER_IP} ${NOTIFICATION_SERVER_PORT} ${NOTIFICATION_SERVER_TIMEOUT} ${NOTIFICATION_SERVER_HTTP_METHOD} ${NOTIFICATION_SERVER_URI} SiteResourceUsageSubscription + [Return] ${notification} + +Post Raw Subscription + [Arguments] ${subscription_json} + 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}"} + POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${subscription_json} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Update subscription + [Arguments] ${subscription_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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + # Replace placeholder values in the JSON with actual test values + ${body}= Replace String ${body} "tenant-123" "${TENANT_ID_1}" + ${body}= Replace String ${body} "customer-new" "${NEW_CUSTOMER_ID}" + ${body}= Replace String ${body} "site-placeholder" "${SITE_ID_1}" + PUT ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscription_id} ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve specific subscription + [Arguments] ${subscription_id} + Log Getting specific subscription: ${subscription_id} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscription_id} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Create ResourceUsageSubscription + [Arguments] ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + # Replace placeholder values in the JSON with actual test values + ${body}= Replace String ${body} "placeholder" "${TENANT_ID_1}" count=1 + ${body}= Replace String ${body} "placeholder" "${CUSTOMER_ID_1}" count=1 + POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Delete Created Subscription + ${sub_id}= Fetch From Right ${SUBSCRIPTION_ID} /subscriptions/ + Delete subscription ${sub_id} +Retrieve subscriptions with filter + [Arguments] ${query_params} + Log Getting subscriptions with filter: ${query_params} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${query_params} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Register subscription + [Arguments] ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + # Replace placeholder values in the JSON with actual test values + ${body}= Replace String ${body} "tenant-123" "${TENANT_ID_1}" + ${body}= Replace String ${body} "customer-123" "${CUSTOMER_ID_1}" + POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Retrieve all subscriptions + Log Getting all subscriptions + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions + ${output}= Output response + Set Suite Variable ${response} ${output} + +Remove test subscriptions + # Extract subscription IDs from the hrefs + ${sub_id_1}= Fetch From Right ${SUBSCRIPTION_ID_1} /subscriptions/ + ${sub_id_2}= Fetch From Right ${SUBSCRIPTION_ID_2} /subscriptions/ + ${sub_id_3}= Fetch From Right ${SUBSCRIPTION_ID_3} /subscriptions/ + + # Delete the created subscriptions + Delete subscription ${sub_id_1} + Delete subscription ${sub_id_2} + Delete subscription ${sub_id_3} + + # Remove the tenant + Remove specific tenant info resource ${TENANT_ID_1} + +Delete subscription + [Arguments] ${subscription_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}"} + DELETE ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscription_id} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Count Subscriptions Of Type + [Arguments] ${subscriptions} ${subscription_type} + ${count}= Set Variable ${0} + FOR ${subscription} IN @{subscriptions} + ${type}= Get From Dictionary ${subscription} subscriptionType + ${count}= Run Keyword If '${type}' == '${subscription_type}' Evaluate ${count} + 1 ELSE Set Variable ${count} + END + [Return] ${count} + +Create test subscriptions + # First create a tenant for the subscriptions + Register tenant Info TenantInfo + Set Suite Variable ${TENANT_ID_1} ${response['body']['tenantId']} + Set Suite Variable ${CUSTOMER_ID_1} ${response['body']['customerId']} + + # Create ResourceUsageSubscription subscriptions + Register subscription ResourceUsageSubscription1 + Set Suite Variable ${SUBSCRIPTION_ID_1} ${response['body']['_links']['self']['href']} + Register subscription ResourceUsageSubscription2 + Set Suite Variable ${SUBSCRIPTION_ID_2} ${response['body']['_links']['self']['href']} + + # Create SiteResourceUsageSubscription subscription + Register subscription SiteResourceUsageSubscription + Set Suite Variable ${SUBSCRIPTION_ID_3} ${response['body']['_links']['self']['href']} + + +Register site resource quota for tenant + # Create tenant + Register tenant Info TenantInfo + Set Suite Variable ${TENANT_ID_1} ${response['body']['tenantId']} + # Create site resource quota + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfo + Set Suite Variable ${SITE_ID_1} ${response['body']['siteId']} + +Update site resource quota Info + [Arguments] ${tenantId} ${siteId} ${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}"} + ${file}= Catenate SEPARATOR= jsons/ ${content} .json + ${body}= Get File ${file} + PUT ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_sites/${siteId} ${body} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Register multiple site resource quotas for tenant + # Create tenant + Register tenant Info TenantInfo + Set Suite Variable ${TENANT_ID_1} ${response['body']['tenantId']} + # Create three site resource quotas + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfo + Set Suite Variable ${SITE_ID_1} ${response['body']['siteId']} + ${CPU_QUOTA}= Convert To Integer ${response['body']['cpuQuota']} + ${MEMORY_QUOTA}= Convert To Integer ${response['body']['memoryQuota']} + ${DISK_QUOTA}= Convert To Integer ${response['body']['diskQuota']} + Set Suite Variable ${CPU_QUOTA_1} ${CPU_QUOTA} + Set Suite Variable ${MEMORY_QUOTA_1} ${MEMORY_QUOTA} + Set Suite Variable ${DISK_QUOTA_1} ${DISK_QUOTA} + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfo2 + Set Suite Variable ${SITE_ID_2} ${response['body']['siteId']} + Register site resource quota Info ${TENANT_ID_1} SiteResourceQuotaInfo3 + Set Suite Variable ${SITE_ID_3} ${response['body']['siteId']} + +Retrieve specific site resource quota info resource + [Arguments] ${tenantId} ${siteId} + Log Getting specific site resource quota for tenant ${tenantId} and site ${siteId} + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"*/*"} + Set Headers {"Authorization":"${TOKEN}"} + GET ${apiRoot}/${apiName}/${apiVersion}/tenants/${tenantId}/resources/quota_in_sites/${siteId} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Remove tenant and site resources + # Remove site resource quotas + Remove specific site resource quota info resource ${TENANT_ID_1} ${SITE_ID_1} + Remove specific site resource quota info resource ${TENANT_ID_1} ${SITE_ID_2} + Remove specific site resource quota info resource ${TENANT_ID_1} ${SITE_ID_3} + # Remove tenant + Remove specific tenant info resource ${TENANT_ID_1} + Retrieve all tenant info resources Log Getting all Tenant Info Set Headers {"Accept":"application/json"} diff --git a/MEC048/MEO/CSE/environment/variables.txt b/MEC048/MEO/CSE/environment/variables.txt index 385a44c..d66e161 100644 --- a/MEC048/MEO/CSE/environment/variables.txt +++ b/MEC048/MEO/CSE/environment/variables.txt @@ -15,4 +15,12 @@ ${REGISTER_ACTION} REGISTER ${REMOVE_ACTION} REMOVE ${NO_ACTION} NO_ACTION ${TENANT_ID_PLACEHOLDER} TENANT_ID_PLACEHOLDER -${NOT_EXISTING_TENANT_ID} NOT_EXISTING_TENANT_ID \ No newline at end of file +${NOT_EXISTING_TENANT_ID} NOT_EXISTING_TENANT_ID +${NOT_EXISTING_SITE_ID} NOT_EXISTING_SITE_ID +${NOT_EXISTING_SUBSCRIPTION_ID} NOT_EXISTING_SUBSCRIPTION_ID +# Notification Server variables +${NOTIFICATION_SERVER_IP} 127.0.0.1 +${NOTIFICATION_SERVER_PORT} 8888 +${NOTIFICATION_SERVER_TIMEOUT} 60 +${NOTIFICATION_SERVER_HTTP_METHOD} POST +${NOTIFICATION_SERVER_URI} /callback_url \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ExpiryNotification.json b/MEC048/MEO/CSE/jsons/ExpiryNotification.json new file mode 100644 index 0000000..8599a0e --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ExpiryNotification.json @@ -0,0 +1,9 @@ +{ + "notificationType": "ExpiryNotification", + "_links": { + "subscription": { + "href": "http://example.com/cse/v1/subscriptions/subscription-123" + } + }, + "expiryDeadline": "2099-12-31T23:59:59Z" + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json b/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json index 76275d1..7765cdc 100644 --- a/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json +++ b/MEC048/MEO/CSE/jsons/ResourceQuotaInfoUpdate.json @@ -1,5 +1,5 @@ { - "cpuQuota": "NUMBER_OF_CPUS", - "memoryQuota": "MEMORY_IN_MB", - "diskQuota": "AMOUNT_OF_DISK_IN_GB" + "cpuQuota": 5, + "memoryQuota": 2192, + "diskQuota": 70 } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceUsageSubscription.json b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription.json new file mode 100644 index 0000000..3a34bb5 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription.json @@ -0,0 +1,11 @@ +{ + "subscriptionType": "ResourceUsageSubscription", + "callbackReference": "some/uri", + "customerId": "placeholder", + "tenantId": "placeholder", + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceUsageSubscription1.json b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription1.json new file mode 100644 index 0000000..3d14b06 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription1.json @@ -0,0 +1,11 @@ +{ + "subscriptionType": "ResourceUsageSubscription", + "callbackReference": "http://example.org/callback1", + "customerId": "customer-123", + "tenantId": "tenant-123", + "notificationTrigger": { + "triggerType": 10, + "threshold": 80, + "greaterOrLess": true + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceUsageSubscription2.json b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription2.json new file mode 100644 index 0000000..ee45945 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceUsageSubscription2.json @@ -0,0 +1,11 @@ +{ + "subscriptionType": "ResourceUsageSubscription", + "callbackReference": "http://example.org/callback2", + "customerId": "customer-123", + "tenantId": "tenant-123", + "notificationTrigger": { + "triggerType": 20, + "threshold": 75, + "greaterOrLess": true + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionBR.json b/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionBR.json new file mode 100644 index 0000000..bc1b74d --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionBR.json @@ -0,0 +1,10 @@ +{ + "subscriptionType": "ResourceUsageSubscription", + "customerId": "placeholder-customer", + "tenantId": "placeholder-tenant", + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionWithExpiry.json b/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionWithExpiry.json new file mode 100644 index 0000000..80a6eca --- /dev/null +++ b/MEC048/MEO/CSE/jsons/ResourceUsageSubscriptionWithExpiry.json @@ -0,0 +1,12 @@ +{ + "subscriptionType": "ResourceUsageSubscription", + "callbackReference": "some/uri", + "customerId": "customer-123", + "tenantId": "tenant-123", + "expiryDeadline": "2099-12-31T23:59:59Z", + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json index 775807b..fb08665 100644 --- a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo.json @@ -1,6 +1,6 @@ { - "siteId": "SITE_ID", - "cpuQuota": "CPU_QUOTA", - "memoryQuota": "MEMORY_QUOTA", - "diskQuota": "DISK_QUOTA" -} \ No newline at end of file + "siteId": "site-12", + "cpuQuota": 2, + "memoryQuota": 7191, + "diskQuota": 91 + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json index 916067e..75f34c3 100644 --- a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo2.json @@ -1,6 +1,6 @@ { - "siteId": "SITE_ID_2", - "cpuQuota": "CPU_QUOTA_2", - "memoryQuota": "MEMORY_QUOTA_2", - "diskQuota": "DISK_QUOTA_2" -} \ No newline at end of file + "siteId": "site-1234", + "cpuQuota": 3, + "memoryQuota": 7192, + "diskQuota": 90 + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json index 6a91864..07a4247 100644 --- a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfo3.json @@ -1,6 +1,6 @@ { - "siteId": "SITE_ID_3", - "cpuQuota": "CPU_QUOTA_3", - "memoryQuota": "MEMORY_QUOTA_3", - "diskQuota": "DISK_QUOTA_3" -} \ No newline at end of file + "siteId": "site-123", + "cpuQuota": 4, + "memoryQuota": 8192, + "diskQuota": 100 + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfoBR.json b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfoBR.json new file mode 100644 index 0000000..d38c9da --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceQuotaInfoBR.json @@ -0,0 +1,3 @@ +{ + "siteId": "SITE_ID" +} \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription.json b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription.json new file mode 100644 index 0000000..63dc110 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription.json @@ -0,0 +1,12 @@ +{ + "subscriptionType": "SiteResourceUsageSubscription", + "callbackReference": "http://example.org/callback3", + "customerId": "customer-123", + "tenantId": "tenant-123", + "siteId": "site-456", + "notificationTrigger": { + "triggerType": 30, + "threshold": 90, + "greaterOrLess": true + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription1.json b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription1.json new file mode 100644 index 0000000..e2e941a --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscription1.json @@ -0,0 +1,12 @@ +{ + "subscriptionType": "SiteResourceUsageSubscription", + "callbackReference": "some/uri", + "customerId": "placeholder-customer", + "tenantId": "placeholder-tenant", + "siteList": ["placeholder-site"], + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionBR.json b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionBR.json new file mode 100644 index 0000000..c7d3aa4 --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionBR.json @@ -0,0 +1,11 @@ +{ + "subscriptionType": "SiteResourceUsageSubscription", + "customerId": "customer-new", + "tenantId": "tenant-123", + "siteList": ["site-placeholder"], + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionUpdate.json b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionUpdate.json new file mode 100644 index 0000000..fbbdd8b --- /dev/null +++ b/MEC048/MEO/CSE/jsons/SiteResourceUsageSubscriptionUpdate.json @@ -0,0 +1,12 @@ +{ + "subscriptionType": "SiteResourceUsageSubscription", + "callbackReference": "some/uri/updated", + "customerId": "customer-new", + "tenantId": "tenant-123", + "siteList": ["site-placeholder"], + "notificationTrigger": { + "triggerType": 10, + "threshold": 4, + "greaterOrLess": false + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/libraries/Server.py b/MEC048/MEO/CSE/libraries/Server.py new file mode 100644 index 0000000..b1b6c85 --- /dev/null +++ b/MEC048/MEO/CSE/libraries/Server.py @@ -0,0 +1,52 @@ +#!/usr/bin/python3 +# filepath: c:\Users\Ikram Laptop\ROBOT-Framework\gs032p3-robot-test-suite\MEC048\MEO\CSE\libraries\Server.py + +from http.server import BaseHTTPRequestHandler, HTTPServer +import json, os +import logging + +# Library version +__version__ = '0.0.1' + +class Server(object): + ROBOT_LIBRARY_VERSION = '0.0.1' + + def spawn_web_server(self, host="127.0.0.1", port=8080, timeout=15, method="POST", endpoint="/callback_url", resp_body=None): + + class POST_Server(BaseHTTPRequestHandler): + def __call__(self, *args, **kwargs): + """Handle a request.""" + super().__init__(*args, **kwargs) + + def __init__(self, endpoint, resp_body): + self.resp_body = resp_body + self.endpoint = endpoint + self.req_body = None + + def do_POST(self): + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.end_headers() + + content_len = int(self.headers.get('Content-Length')) + post_body = self.rfile.read(content_len) + self.req_body = post_body + logging.info(f"Received notification: {post_body}") + + def get_req_body(self): + return self.req_body + + def get_resp_body(self): + return self.resp_body + + self.handler = POST_Server(endpoint, resp_body) + self.app = HTTPServer((host, int(port)), self.handler) + self.app.timeout = int(timeout) + + logging.info(f"Starting notification server on {host}:{port} with timeout {timeout}") + self.app.handle_request() + self.app.server_close() + + if self.handler.get_req_body() is not None: + return json.loads(self.handler.get_req_body().decode("utf-8")) + return None \ No newline at end of file diff --git a/MEC048/MEO/CSE/libraries/StressGenerator.py b/MEC048/MEO/CSE/libraries/StressGenerator.py new file mode 100644 index 0000000..ae9419a --- /dev/null +++ b/MEC048/MEO/CSE/libraries/StressGenerator.py @@ -0,0 +1,37 @@ +import multiprocessing +import time + +class StressGenerator: + ROBOT_LIBRARY_VERSION = '0.0.1' + + def generate_cpu_load(self, duration=30, cpu_cores=None): + """ + Generate CPU load by spinning up processes that perform intensive calculations. + + Args: + duration: How long to run the stress test in seconds + cpu_cores: Number of CPU cores to use. If None, uses all available cores. + """ + if cpu_cores is None: + cpu_cores = multiprocessing.cpu_count() + + processes = [] + + def cpu_intensive_task(): + end_time = time.time() + duration + while time.time() < end_time: + # Perform CPU-intensive calculations + for i in range(10000000): + _ = i * i + + # Create and start processes + for _ in range(cpu_cores): + p = multiprocessing.Process(target=cpu_intensive_task) + p.start() + processes.append(p) + + # Wait for all processes to complete + for p in processes: + p.join() + + return f"Generated CPU load on {cpu_cores} cores for {duration} seconds" \ No newline at end of file diff --git a/MEC048/MEO/CSE/libraries/__pycache__/Server.cpython-312.pyc b/MEC048/MEO/CSE/libraries/__pycache__/Server.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95b8591def7f8583ce0628c4f1a849f5887c88f6 GIT binary patch literal 3527 zcmX@j%ge>Uz`)S|Un^q@I|IXG5C?`?p^VRN3=9m@8B!Qh7;_kM8KW3;nWC5&L42kh z<|yVAh7_h8mM9i5%^Jm;!W_lM#Nf`5!qUQ!!kWsyni*nF6h|eKCfiF8N0aH6m{VeL zsz*pjKu~I7X=-taM`B(|PHNFDE|6GoYEfBgk>4*?13d#h!(@;a7-oVpK1+ZdmC6vs zn8Fanl)@OroWhdA+`<^eQpu#rdW#KWMiIype#z`mT_B2sfq?PRYOJQwch+^+xs9=oZ2xib^`=tX(ih9KbiRF3m<*7;W#o+XI}U3MxU)N>0qliI1-`g$fcCR(kRA5N)7jTMSB5KN=XG2#8K( zzbK%vK;?pf;R?0O0*0SKVVMld@*oBXgOVgD*?!go7a}!GH4O0}aWJl7M9$ItMwNI_YI163S!#+xUVcet8dR;7f+qJZ-s04}lz338$nUi{pr6@HqrAU&2f#DW=PJViNW?uR& zmdw1gd}wmJ#hnasZhTH^-Yw38{NfUDYD7tVx7bti<3Ytul?h2X4XR6ufq|hIR8KZA z+z=4CE}(Q#Kxu*T6#;cHPXUze&NGqcg1p&=$_?2UWSy=G zIAbPmP*Mg(?`M#^rh}3$B4**NV1^~$Q%ez&U zB!vsIR!|{b3`(yJ3^&B3r`Jxby&#}Mv7=;% zqw6NtT@X+OJ6e+yR4(Tw=BCES-{Ojo&&^LM%>l7_;^PZT6LTOkMWFBp7imQrpu$ZX zMCgJNDKE4xNlpco?3#>4f*`9vo^Sw{gSWUr=@44&6@i+e0w4vl3=9lES{S}CG4UFG z;$Y@g{lvw=>%#a+gppVE8yh398rX3~MhpxLRSLl+iA5!udFdz_P61NAD&*%W++wt< z;!`NkEXhzP$;?g7FD+51Vl6F6)3wm#D*_dBx7afv4bLJ_eOCmkY;Q3q78KlKhpI0E z#cGi%$U}S(rJ$q&YO&tpf!GtDoReRiS_Ja=Ef!F@aEmo3KQX2F7F$Yca(+sxCI>jh z-D1heFD|*oQjlL%QUq#G++xd3Ey>7FK~xi9PZfhoE(Iun1e5@JZCE9aBf>$|PVq?w z28ITPFDw$AYFDHTzA#8|s(mzJkWgM=u_E%axOoRl56>N8*%>8Ef>($vj=UhJzd>ZX z%to2Z!gd`jJsfwWOxTT1<{x*9I-bzctC2ebI4!hkiWvA2A^(7zzu%_Q<~p~^MQ)YL+-euN zjqV7GPq&(AH6vwy&di+aa^@H1%rDDXUYB#YDCclM{IZ2qTsel zypN|-kYi9}e3)xcu&2LYkv#(g!%7CQ1>kTl0=4161gLr{236B73^!zyFR(~{VNqih zfv5y2(&W6wol#O!pa)3-;FJVOK$al;nDUFk$>tV!e0*7IQE_H|UVQv5w)~{5)Z`Md z1x3yv$ARi2u+6tPY#_PIuE>LdfdQ09ij^4{7(OsFGBSSWU|_Vq&%l41f$sww1HV`U T_ZJpTMv;!NuMC=u5Jv$3fUF*n literal 0 HcmV?d00001 diff --git a/MEC048/MEO/CSE/libraries/__pycache__/StressGenerator.cpython-312.pyc b/MEC048/MEO/CSE/libraries/__pycache__/StressGenerator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25d11bd63c7c3d1a3c5808e96816d275e292f4b7 GIT binary patch literal 1896 zcmX@j%ge>Uz`$^lNju{W3j@Pr5C?`?pp4HN3=9m@8B!Qh7;_k+AT(nXBNKx=Lkd$1 zLkjb1CWy)?rbRAX9=)LsSHt!DGX6eDU4CfDJ&_>EsRktl}wtf zxA=ogic*V<-Ba^YixNxni>g=+^bGV2{gRnsCNVHDure?(fcT$z7#SGa8K*PUFg1vj zFv3)1!7PIbFfcHzhO%p!(iv)*I~da#Qy5z~YFSD^W`X5um{vngaAAnGWMHUeMKX~M ztOSLqVOay$QOj1tmc@x84d%dXWn`#f&f*3Op%67}FgqC;daPL(YM5OZVuctOz~=Fy zC+jW7cP!{>br3=C5lr!yeMGB}J; z30R1CGFLG$Fw_#Mx`rW}iGiU=uLNWp*uWGDI~ zW-eooZY4t{gC>(-X2Y}@44O>0SV}T;Q*W^rCFZ54YO>toNX<)$2MaM~-eQcu#Q}?z zVo;7&P*7<2m6dE26Iz^FR2<`(U6h!s;FDNTl3x%L;Q-Qv>BlGGSqS7!qgix^*5{}|_B*O;8lq@u*4%+%r-v<$3QPFJddD<@Ykh`1=O+u?CXNNl?1M9s(bBo?KomQ;zsvQ7#(?Sb5*ke{be#SKYZ3TgR83RN7i z1gyz^i$AwCrz8`apEC2(Z*hWLot$5qS5m~mz`$^eJphu|Zm|}ZBo>w2VoNM2NX<*R z#gdhunWxEqi={Xvj>)`yt!pbT4 zMSwv_d_v_lLB$ToI|B081=KGJs9(@`ydvP#;dq0Gx8J?fy~pzgkLYzCnTtF!GXk&j z$bVpG5K{Wg!yqILQR3F=*6Z>o#tO~_)f=>TWbBAKP;r4j-~vZL5kCV1 zgC^5UIR*v>KTXzK9P#maiMgrq@wd3*<8$*)MPFa z1O+xIc)&V}6hT~&+rUQM;;@0Z#jZ$+fq?;3Z4`?$Ffe>zW@Kc%%^-H0f%`j)B4Z%q KCk7A+HW&Z|Kh6^X literal 0 HcmV?d00001 diff --git a/MEC048/MEO/CSE/schemas/ExpiryNotification.schema.json b/MEC048/MEO/CSE/schemas/ExpiryNotification.schema.json new file mode 100644 index 0000000..8599a0e --- /dev/null +++ b/MEC048/MEO/CSE/schemas/ExpiryNotification.schema.json @@ -0,0 +1,9 @@ +{ + "notificationType": "ExpiryNotification", + "_links": { + "subscription": { + "href": "http://example.com/cse/v1/subscriptions/subscription-123" + } + }, + "expiryDeadline": "2099-12-31T23:59:59Z" + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/ResourceUsageNotification.schema.json b/MEC048/MEO/CSE/schemas/ResourceUsageNotification.schema.json new file mode 100644 index 0000000..664ee99 --- /dev/null +++ b/MEC048/MEO/CSE/schemas/ResourceUsageNotification.schema.json @@ -0,0 +1,14 @@ +{ + "notificationType": "ResourceUsageNotification", + "timeStamp": "2023-01-01T12:00:00Z", + "customerId": "customer-123", + "tenantId": "tenant-123", + "resourceUseInfo": { + "cpuUsed": 5, + "cpuRemain": 3, + "memoryUsed": 4096, + "memoryRemain": 2048, + "diskUsed": 50, + "diskRemain": 50 + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/ResourceUsageSubscription.schema.json b/MEC048/MEO/CSE/schemas/ResourceUsageSubscription.schema.json new file mode 100644 index 0000000..3b769ad --- /dev/null +++ b/MEC048/MEO/CSE/schemas/ResourceUsageSubscription.schema.json @@ -0,0 +1,60 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "subscriptionType": { + "type": "string", + "enum": ["ResourceUsageSubscription"] + }, + "callbackReference": { + "type": "string", + "format": "uri" + }, + "requestTestNotification": { + "type": "boolean" + }, + "websockNotifConfig": { + "type": "object" + }, + "_links": { + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "href": { + "type": "string" + } + } + } + } + }, + "customerId": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "notificationTrigger": { + "type": "object", + "properties": { + "triggerType": { + "type": "integer", + "enum": [10, 11, 20, 21, 30, 31] + }, + "threshold": { + "type": "integer" + }, + "greaterOrLess": { + "type": "boolean" + } + }, + "required": ["triggerType", "threshold", "greaterOrLess"] + }, + "expiryDeadline": { + "type": "string", + "format": "date-time" + } + }, + "required": ["subscriptionType", "customerId", "tenantId", "notificationTrigger"] + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/SiteResourceUsageNotification.schema.json b/MEC048/MEO/CSE/schemas/SiteResourceUsageNotification.schema.json new file mode 100644 index 0000000..bd054eb --- /dev/null +++ b/MEC048/MEO/CSE/schemas/SiteResourceUsageNotification.schema.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": [ + "notificationType", + "customerId", + "tenantId", + "resourceUseInfo" + ], + "properties": { + "notificationType": { + "type": "string", + "enum": ["SiteResourceUsageNotification"] + }, + "timeStamp": { + "type": "string", + "format": "date-time" + }, + "customerId": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "resourceUseInfo": { + "type": "array", + "items": { + "type": "object", + "required": ["siteId"], + "properties": { + "siteId": { + "type": "string" + }, + "cpuUsed": { + "type": "integer" + }, + "cpuRemain": { + "type": "integer" + }, + "memoryUsed": { + "type": "integer" + }, + "memoryRemain": { + "type": "integer" + }, + "diskUsed": { + "type": "integer" + }, + "diskRemain": { + "type": "integer" + } + } + } + } + } + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/SiteResourceUsageSubscription.schema.json b/MEC048/MEO/CSE/schemas/SiteResourceUsageSubscription.schema.json new file mode 100644 index 0000000..339ae5b --- /dev/null +++ b/MEC048/MEO/CSE/schemas/SiteResourceUsageSubscription.schema.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "subscriptionType": { + "type": "string", + "enum": ["SiteResourceUsageSubscription"] + }, + "callbackReference": { + "type": "string", + "format": "uri" + }, + "requestTestNotification": { + "type": "boolean" + }, + "websockNotifConfig": { + "type": "object" + }, + "_links": { + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "href": { + "type": "string" + } + }, + "required": ["href"] + } + } + }, + "customerId": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "siteList": { + "type": "array", + "items": { + "type": "string" + } + }, + "notificationTrigger": { + "type": "object", + "properties": { + "triggerType": { + "type": "integer", + "enum": [10, 11, 20, 21, 30, 31] + }, + "threshold": { + "type": "integer" + }, + "greaterOrLess": { + "type": "boolean" + } + }, + "required": ["triggerType", "threshold", "greaterOrLess"] + }, + "expiryDeadline": { + "type": "string", + "format": "date-time" + } + }, + "required": ["subscriptionType", "customerId", "tenantId", "siteList", "notificationTrigger"] + } \ No newline at end of file diff --git a/MEC048/MEO/CSE/schemas/SubscriptionLinkList.schema.json b/MEC048/MEO/CSE/schemas/SubscriptionLinkList.schema.json new file mode 100644 index 0000000..5ac9f96 --- /dev/null +++ b/MEC048/MEO/CSE/schemas/SubscriptionLinkList.schema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "_links": { + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "href": { + "type": "string" + } + }, + "required": ["href"] + } + }, + "required": ["self"] + }, + "subscription": { + "type": "array", + "items": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "subscriptionType": { + "type": "string", + "enum": ["ResourceUsageSubscription", "SiteResourceUsageSubscription"] + } + }, + "required": ["href", "subscriptionType"] + } + } + }, + "required": ["_links", "subscription"] + } \ No newline at end of file -- GitLab