From c02ba8242d8758cbf77211cb94d41ad52f283511 Mon Sep 17 00:00:00 2001
From: piscione <piscione@etsi.org>
Date: Thu, 13 Jul 2023 12:23:54 +0200
Subject: [PATCH] TTF027: Updated DNS TCs for MEC011v3.2.1

---
 MEC011/SRV/DNS/PlatDnsRules.robot        | 86 ++++++++++++++++--------
 MEC011/SRV/DNS/environment/variables.txt |  6 +-
 2 files changed, 61 insertions(+), 31 deletions(-)

diff --git a/MEC011/SRV/DNS/PlatDnsRules.robot b/MEC011/SRV/DNS/PlatDnsRules.robot
index 883e195..b792fe0 100644
--- a/MEC011/SRV/DNS/PlatDnsRules.robot
+++ b/MEC011/SRV/DNS/PlatDnsRules.robot
@@ -21,23 +21,37 @@ TP_MEC_MEC011_SRV_DNS_001_OK
     ...    Check that the IUT responds with a list of active DNS rules
     ...    when queried by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.9.3.1
-    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
-
+    ...    Reference  "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.2.9.3.1"
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Get list of active DNS rules    ${APP_INSTANCE_ID}
     Check HTTP Response Status Code Is    200
     Check HTTP Response Body Json Schema Is    DnsRuleList
 
+TP_MEC_MEC011_SRV_DNS_001_NF
+    [Documentation]
+    ...    Check that the IUT responds with a list of active DNS rules
+    ...    when queried by a MEC Application
+    ...
+    ...    Reference  "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.2.9.3.1"
+    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
+    Get list of active DNS rules    ${NOT_EXISTENT_APP_INSTANCE_ID}
+    Check HTTP Response Status Code Is    404
+    
+
+
 
 TP_MEC_MEC011_SRV_DNS_002_OK
     [Documentation]
     ...    Check that the IUT responds with the information on a specific DNS rule
     ...    when queried by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.1
-    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
-
+    ...    Reference  "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Get individual DNS rule    ${APP_INSTANCE_ID}    ${DNS_RULE_ID}
     Check HTTP Response Status Code Is    200
@@ -45,13 +59,15 @@ TP_MEC_MEC011_SRV_DNS_002_OK
     Check Response Contains    ${response['body']}    dnsRuleId    ${DNS_RULE_ID}
 
 
+
 TP_MEC_MEC011_SRV_DNS_002_NF
     [Documentation]
     ...    Check that the IUT responds with an error when
     ...    a request for an unknown URI is sent by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.1
-
+    ...    Reference  "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...               "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Get individual DNS rule    ${APP_INSTANCE_ID}    ${NON_ESISTENT_DNS_RULE_ID}
     Check HTTP Response Status Code Is    404
@@ -59,16 +75,17 @@ TP_MEC_MEC011_SRV_DNS_002_NF
 
 TP_MEC_MEC011_SRV_DNS_003_OK
     [Documentation]
-    ...    Check that the IUT updates a specific DNS rule
-    ...    when commanded by a MEC Application
+    ...    Check that the IUT responds with the information on a specific DNS rule 
+    ...    when queried by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.2
-    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
-
+    ...    Reference "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Update a DNS Rule    ${APP_INSTANCE_ID}    ${DNS_RULE_ID}    DnsRuleUpdate
     Check HTTP Response Status Code Is    200
     Check HTTP Response Body Json Schema Is    DnsRule
+    Check Response Contains    ${response['body']}    dnsRuleId    ${DNS_RULE_ID}
     Check Response Contains    ${response['body']}    ipAddress    ${SOME_IP_ADDRESS}
 
 
@@ -77,8 +94,9 @@ TP_MEC_MEC011_SRV_DNS_003_BR
     ...    Check that the IUT responds with an error when
     ...    a request with incorrect parameters is sent by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.2
-    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
+    ...    Reference "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
 
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Update a DNS Rule    ${APP_INSTANCE_ID}    ${DNS_RULE_ID}    DnsRuleUpdateError
@@ -90,8 +108,9 @@ TP_MEC_MEC011_SRV_DNS_003_NF
     ...    Check that the IUT responds with an error when
     ...    a request for an unknown URI is sent by a MEC Application
     ...
-    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.2
-    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
+    ...    Reference "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
 
     [Tags]    PIC_MEC_PLAT    PIC_SERVICES
     Update a DNS Rule    ${APP_INSTANCE_ID}    ${NON_ESISTENT_DNS_RULE_ID}    DnsRuleUpdate
@@ -99,17 +118,17 @@ TP_MEC_MEC011_SRV_DNS_003_NF
 
 
 
-#TP_MEC_MEC011_SRV_DNS_003_PF
-#    [Documentation]
-#    ...    Check that the IUT responds with an error when
-#    ...    a request sent by a MEC Application doesn't comply with a required condition
-#    ...
-#    ...    Reference    ETSI GS MEC 011 V2.2.1, clause 7.2.10.3.2
-#    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/DnsRule
-#
-#    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
-#    Update a DNS Rule with invalid etag    ${APP_INSTANCE_ID}    ${DNS_RULE_ID}    DnsRuleUpdate
-#    Check HTTP Response Status Code Is    412
+TP_MEC_MEC011_SRV_DNS_003_PF
+    [Documentation]
+    ...    Check that the IUT responds with an error when
+    ...    a request sent by a MEC Application doesn't comply with a required condition
+    ...
+    ...    Reference "ETSI GS MEC 011 3.2.1, clause 5.2.8",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.1.2.3",
+    ...              "ETSI GS MEC 011 3.2.1, clause 7.2.10.3.1"
+    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
+    Update a DNS Rule with invalid etag    ${APP_INSTANCE_ID}    ${DNS_RULE_ID}    DnsRuleUpdate
+    Check HTTP Response Status Code Is    412
 
 
 
@@ -138,6 +157,7 @@ Update a DNS Rule
     Set Headers    {"Accept":"application/json"}
     Set Headers    {"Content-Type":"application/json"}
     Set Headers    {"Authorization":"${TOKEN}"}
+    Set Headers    {"If-Match": "${VALID_ETAG}"}
     ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
     ${body}=    Get File    ${file}
     PUT    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/dns_rules/${dnsRuleId}    ${body}
@@ -147,4 +167,12 @@ Update a DNS Rule
 Update a DNS Rule with invalid etag
     [Arguments]    ${appInstanceId}    ${dnsRuleId}    ${content}
     Set Headers    {"If-Match": "${INVALID_ETAG}"}
-    Update a DNS Rule    ${appInstanceId}    ${dnsRuleId}    ${content}
\ No newline at end of file
+    Set Headers    {"Accept":"application/json"}
+    Set Headers    {"Content-Type":"application/json"}
+    Set Headers    {"Authorization":"${TOKEN}"}
+    Set Headers    {"If-Match": "${INVALID_ETAG}"}
+    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
+    ${body}=    Get File    ${file}
+    PUT    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/dns_rules/${dnsRuleId}    ${body}
+    ${output}=    Output    response
+    Set Suite Variable    ${response}    ${output}
\ No newline at end of file
diff --git a/MEC011/SRV/DNS/environment/variables.txt b/MEC011/SRV/DNS/environment/variables.txt
index bed8e73..08e8d3a 100644
--- a/MEC011/SRV/DNS/environment/variables.txt
+++ b/MEC011/SRV/DNS/environment/variables.txt
@@ -7,13 +7,15 @@ ${response}                         {}
 ${TOKEN}                            Basic YWxhZGRpbjpvcGVuc2VzYW1l
 ${apiRoot}        
 ${apiName}        mec_app_support
-${apiVersion}     v1
+${apiVersion}     v2
 
 # Specific variables
 ${APP_INSTANCE_ID}                       5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f
+${NOT_EXISTENT_APP_INSTANCE_ID}          NOT_EXISTENT_APP_INSTANCE_ID
 ${DNS_RULE_ID}                           e0deee2b-6e50-4f33-ab09-8bf0585025d3
 ${NON_ESISTENT_DNS_RULE_ID}              NON_ESISTENT_DNS_RULE_ID
-${INVALID_ETAG}                     INVALID_ETAG
+${INVALID_ETAG}                          INVALID_ETAG
+${VALID_ETAG}                            abcdef
 
 ${SOME_IP_ADDRESS}                   146.241.7.3
 
-- 
GitLab