From 9abf762a922751b4ed2c9407833529fdd4205fa2 Mon Sep 17 00:00:00 2001
From: piscione <piscione@etsi.org>
Date: Tue, 25 May 2021 14:53:45 +0200
Subject: [PATCH] Fixes on MEC015 and MEC030 test cases.

---
 .../SRV/MTS/MultiAccessTrafficSteering.robot  |   8 +-
 MEC015/SRV/MTS/environment/variables.txt      |   2 +-
 MEC015/SRV/TM/TrafficManagement.robot         |  18 +--
 MEC015/SRV/TM/jsons/BwInfoDeltas.json         |   2 +-
 MEC015/SRV/TM/schemas/BwInfoDelta.schema.json | 127 ++++++++++++++++++
 MEC030/SRV/V2X/V2XInformationService.robot    |  84 +++++++-----
 .../jsons/ProvChgUuMbmsSubscription_BR.json   |   4 +-
 7 files changed, 183 insertions(+), 62 deletions(-)
 create mode 100644 MEC015/SRV/TM/schemas/BwInfoDelta.schema.json

diff --git a/MEC015/SRV/MTS/MultiAccessTrafficSteering.robot b/MEC015/SRV/MTS/MultiAccessTrafficSteering.robot
index ce819b5..fa054b6 100644
--- a/MEC015/SRV/MTS/MultiAccessTrafficSteering.robot
+++ b/MEC015/SRV/MTS/MultiAccessTrafficSteering.robot
@@ -27,7 +27,8 @@ TP_MEC_MEC015_SRV_MTS_002_OK
     ...  Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     ...  ETSI GS MEC 015 V2.1.1, clause 9.5.3.1
     ...  https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.yaml
-    Retrieve MTS session list information
+    #Retrieve MTS session list information
+    Retrieve MTS session list information using filter  ${CORRECT_FILTER}   ${SESSION_ID}   
     Check HTTP Response Status Code Is    200
     Check HTTP Response Body Json Schema Is   MtsSessionInfo
     FOR    ${mstSessionInfo}    IN    @{response['body']}
@@ -119,7 +120,7 @@ TP_MEC_MEC015_SRV_MTS_004_OK
     Check HTTP Response Status Code Is    200
     Check HTTP Response Body Json Schema Is   MtsSessionInfo
     Should Be Equal As Strings  ${response['body']['appInsId']}                   ${APP_INSTANCE_ID}
-    Should Be Equal As Strings  ${response['body']['requestType']}             ${REQUEST_TYPE_SESSION}     
+    Should Be Equal As Strings  ${response['body']['requestType']}             ${REQUEST_TYPE_APPLICATION}     
     Should Be Equal As Strings  ${response['body']['mtsMode']}                   ${MTS_LOW_MODE_COST} 
     Should Be Equal As Strings  ${response['body']['trafficDirection']}         ${TRAFFIC_DIRECTION_DL}   
 
@@ -189,9 +190,6 @@ TP_MEC_MEC015_SRV_MTS_006_OK
     Unregister from the MTS Service   ${SESSION_ID}
     Check HTTP Response Status Code Is    204
 
-##TP_MEC_MEC015_SRV_MTS_006_BR missing. 
-#See issues https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/11 for further details.
-
 TP_MEC_MEC015_SRV_MTS_006_NF
     [Documentation]
     ...  Check that the IUT deregisters a MTS session when commanded by a MEC Application
diff --git a/MEC015/SRV/MTS/environment/variables.txt b/MEC015/SRV/MTS/environment/variables.txt
index cceeac3..3a0e17f 100644
--- a/MEC015/SRV/MTS/environment/variables.txt
+++ b/MEC015/SRV/MTS/environment/variables.txt
@@ -19,6 +19,6 @@ ${SESSION_ID}						1
 ${WRONG_SESSION_ID}					WRONG_SESSION_ID
 ${NOT_EXISTING_SESSION_ID}			NOT_EXISTING_SESSION_ID
 
-${REQUEST_TYPE_SESSION}				0
+${REQUEST_TYPE_APPLICATION}			1
 ${MTS_LOW_MODE_COST}				0
 ${TRAFFIC_DIRECTION_DL}				00
diff --git a/MEC015/SRV/TM/TrafficManagement.robot b/MEC015/SRV/TM/TrafficManagement.robot
index 21f4779..323dc06 100644
--- a/MEC015/SRV/TM/TrafficManagement.robot
+++ b/MEC015/SRV/TM/TrafficManagement.robot
@@ -170,12 +170,12 @@ TP_MEC_MEC015_SRV_TM_006_OK
     # Preamble
     Register Bandwidth Management Service Application specific   BwInfoApplicationSpecific
     # Test body
-    ${path}    Catenate    SEPARATOR=      jsons/     BwInfoUpdate.json
+    ${path}    Catenate    SEPARATOR=      jsons/     BwInfoDeltas.json
     ${body}    Get File    ${path}
     ${json_object}=	Evaluate  json.loads('''${body}''')  json
     Request a deltas changes    ${ALLOCATION_ID}    ${body}
     Check HTTP Response Status Code Is    200
-    Check HTTP Response Body Json Schema Is   BwInfo
+    Check HTTP Response Body Json Schema Is   BwInfoDelta
         Should Be Equal As Strings  ${response['body']['appInsId']}    ${json_object['appInsId']}  
     Should Be Equal As Strings  ${response['body']['fixedAllocation']}    ${json_object['fixedAllocation']}  
     Should Be Equal As Strings  ${response['body']['allocationDirection']}    ${json_object['allocationDirection']}   
@@ -311,20 +311,6 @@ Request a deltas changes
     Set Suite Variable    ${response}    ${output}
 
 
-Request a deltas changes with invalid ETAG
-    [Arguments]    ${allocation_id}    ${content}
-    Should Be True    ${PIC_MEC_PLAT} == 1
-    Should Be True    ${PIC_SERVICES} == 1
-    Set Headers    {"Accept":"application/json"}
-    Set Headers    {"Content-Type":"application/json"}
-    Set Headers    {"Authorization":"${TOKEN}"}
-    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
-    ${body}=    Get File    ${file}
-    Patch    ${apiRoot}/${apiName}/${apiVersion}/bw_allocations/${allocation_id}    ${body}
-    ${output}=    Output    response
-    Set Suite Variable    ${response}    ${output}
-
-
 Register Bandwidth Management Service with incorrect parameters
     [Arguments]    ${content}
     Should Be True    ${PIC_MEC_PLAT} == 1
diff --git a/MEC015/SRV/TM/jsons/BwInfoDeltas.json b/MEC015/SRV/TM/jsons/BwInfoDeltas.json
index 6560b8b..28d4b0a 100644
--- a/MEC015/SRV/TM/jsons/BwInfoDeltas.json
+++ b/MEC015/SRV/TM/jsons/BwInfoDeltas.json
@@ -1,6 +1,6 @@
 {
 "appInsId": "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f",
-  "requestType": "0",
+  "requestType": 0,
   "fixedAllocation": "32",
   "allocationDirection": "01"
 }
\ No newline at end of file
diff --git a/MEC015/SRV/TM/schemas/BwInfoDelta.schema.json b/MEC015/SRV/TM/schemas/BwInfoDelta.schema.json
new file mode 100644
index 0000000..66ca806
--- /dev/null
+++ b/MEC015/SRV/TM/schemas/BwInfoDelta.schema.json
@@ -0,0 +1,127 @@
+{
+ "items": {
+	"properties": {
+		"allocationDirection": {
+			"description": "The direction of the requested BW allocation: 00 = Downlink (towards the UE) 01 = Uplink (towards the application/session) 10 = Symmetrical",
+			"type": "string",
+			"x-etsi-mec-cardinality": "1",
+			"x-etsi-mec-origin-type": "String"
+		},
+		"appInsId": {
+			"description": "Application instance identifier",
+			"type": "string",
+			"x-etsi-mec-cardinality": "1",
+			"x-etsi-mec-origin-type": "String"
+		},
+		"fixedAllocation": {
+			"description": "Size of requested fixed BW allocation in [bps]",
+			"type": "string",
+			"x-etsi-mec-cardinality": "1",
+			"x-etsi-mec-origin-type": "String"
+		},
+		"fixedBWPriority": {
+			"description": "Indicates the allocation priority when dealing with several applications or sessions in parallel. Values are not defined in the present document",
+			"enum": [
+				"SEE_DESCRIPTION"
+			],
+			"type": "string",
+			"x-etsi-mec-cardinality": "0..1",
+			"x-etsi-mec-origin-type": "Enum"
+		},
+		"requestType": {
+			"description": "Numeric value (0 - 255) corresponding to specific type of consumer as following: 0 = APPLICATION_SPECIFIC_BW_ALLOCATION 1 = SESSION_SPECIFIC_BW_ALLOCATION",
+			"type": "integer",
+			"enum": [
+				0,
+				1
+			],
+			"x-etsi-mec-cardinality": "1",
+			"x-etsi-mec-origin-type": "Enum_inlined"
+		},
+		"sessionFilter": {
+			"description": "Session filtering criteria, applicable when requestType is set as SESSION_SPECIFIC_BW_ALLOCATION. Any filtering criteria shall define a single session only. In case multiple sessions match sessionFilter the request shall be rejected",
+			"items": {
+				"type": "object",
+				"properties": {
+					"dstAddress": {
+						"description": "Destination address identity of session (including range)",
+						"type": "string",
+						"x-etsi-mec-cardinality": "0..1",
+						"x-etsi-mec-origin-type": "String"
+					},
+					"dstPort": {
+						"description": "Destination port identity of session",
+						"items": {
+							"type": "string"
+						},
+						"minItems": 0,
+						"type": "array",
+						"x-etsi-mec-cardinality": "0..N",
+						"x-etsi-mec-origin-type": "String"
+					},
+					"protocol": {
+						"description": "Protocol number",
+						"type": "string",
+						"x-etsi-mec-cardinality": "0..1",
+						"x-etsi-mec-origin-type": "String"
+					},
+					"sourceIp": {
+						"description": "Source address identity of session (including range)",
+						"type": "string",
+						"x-etsi-mec-cardinality": "0..1",
+						"x-etsi-mec-origin-type": "String"
+					},
+					"sourcePort": {
+						"description": "Source port identity of session",
+						"items": {
+							"type": "string"
+						},
+						"minItems": 0,
+						"type": "array",
+						"x-etsi-mec-cardinality": "0..N",
+						"x-etsi-mec-origin-type": "String"
+					}
+				}
+			},
+			"minItems": 0,
+			"type": "array",
+			"x-etsi-mec-cardinality": "0..N",
+			"x-etsi-mec-origin-type": "Structure (inlined)"
+		},
+		"timeStamp": {
+			"description": "Time stamp to indicate when the corresponding information elements are sent",
+			"properties": {
+				"nanoSeconds": {
+					"description": "The nanoseconds part of the Time. Time is defined as Unix-time since January 1, 1970, 00:00:00 UTC",
+					"format": "uint32",
+					"type": "integer",
+					"x-etsi-mec-cardinality": "1",
+					"x-etsi-mec-origin-type": "Uint32"
+				},
+				"seconds": {
+					"format": "uint32",
+					"type": "integer",
+					"description": "The seconds part of the Time. Time is defined as Unixtime since January 1, 1970, 00:00:00 UTC",
+					"x-etsi-mec-cardinality": "1",
+					"x-etsi-mec-origin-type": "Uint32"
+				}
+			},
+			"required": [
+				"seconds",
+				"nanoSeconds"
+			],
+			"type": "object",
+			"x-etsi-mec-cardinality": "0..1",
+			"x-etsi-mec-origin-type": "Structure (inlined)"
+		}
+	},
+	"required": [
+		"appInsId",
+		"requestType",
+		"fixedAllocation",
+		"allocationDirection"
+	],
+	"type": "object",
+	"x-etsi-ref": "7.2.2"
+}
+}
\ No newline at end of file
diff --git a/MEC030/SRV/V2X/V2XInformationService.robot b/MEC030/SRV/V2X/V2XInformationService.robot
index 4814e03..915cbc6 100644
--- a/MEC030/SRV/V2X/V2XInformationService.robot
+++ b/MEC030/SRV/V2X/V2XInformationService.robot
@@ -129,8 +129,9 @@ TP_MEC_MEC030_SRV_V2X_004_OK
     ...  ETSI GS MEC 030 V2.1.1, clause 7.6.3.4
     ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
     Request predicted QoS   PredictedQoS.json
-    Check HTTP Response Status Code Is    200
     Check HTTP Response Body Json Schema Is   PredictedQoS
+    Check HTTP Response Status Code Is    200
+    
     
 TP_MEC_MEC030_SRV_V2X_004_BR
     [Documentation]
@@ -250,18 +251,6 @@ TP_MEC_MEC030_SRV_V2X_006_BR
     Retrieve subscription list information    ${SUB_TYPE_INVALID}
     Check HTTP Response Status Code Is    400
 
-
-##Below test not done yet. See this issue: https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/9 
-#TP_MEC_MEC030_SRV_V2X_006_NF 
-#    [Documentation] 
-#    ...  Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
-#    ...  ETSI GS MEC 030 V2.1.1, clause 7.8.3.1
-#    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
-#        
-#    Should Be True    ${PIC_MEC_SYSTEM} == 1
-#    Should Be True    ${PIC_SERVICES} == 1
-#    Retrieve subscription list information    ${SUB_TYPE_INVALID}
-#    Check HTTP Response Status Code Is    404
                     
 ##POST on ${apiRoot}/${apiName}/${apiVersion}/subscription  
 TP_MEC_MEC030_SRV_V2X_007_OK_01
@@ -524,24 +513,21 @@ TP_MEC_MEC030_SRV_V2X_009_BR
     Update existing subscription   ${SUB_PROV_CHG_UU_UNI_ID}  ${body}
     Check HTTP Response Status Code Is    400
 
-
-##Below test not done yet. See issue https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/10
-#TP_MEC_MEC030_SRV_V2X_009_NF
-#    [Documentation] 
-#    ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
-#    ...  ETSI GS MEC 030 V2.1.1, clause 7.9.3.2
-#    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
-#    Should Be True    ${PIC_MEC_SYSTEM} == 1
-#    Should Be True    ${PIC_SERVICES} == 1
-#    ${path}    Catenate    SEPARATOR=      jsons/     ProvChgUuUniSubscriptionUpdate_NF.json
-#    ${body}    Get File    ${path}
-#    ${json_object}=	Evaluate  json.loads('''${body}''')  json
-#    Update existing subscription   ${SUB_PROV_CHG_UU_UNI_ID}  ${body}
-#    Check HTTP Response Status Code Is    404
+TP_MEC_MEC030_SRV_V2X_009_NF
+    [Documentation] 
+    ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
+    ...  ETSI GS MEC 030 V2.1.1, clause 7.9.3.2
+    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
+    Should Be True    ${PIC_MEC_SYSTEM} == 1
+    Should Be True    ${PIC_SERVICES} == 1
+    ${path}    Catenate    SEPARATOR=      jsons/     ProvChgUuUniSubscriptionUpdate.json
+    ${body}    Get File    ${path}
+    ${json_object}=	Evaluate  json.loads('''${body}''')  json
+    Update existing subscription   ${NOT_EXISTING_SUB_ID}  ${body}
+    Log   ${NOT_EXISTING_SUB_ID}
+    Check HTTP Response Status Code Is    404
   
 ##DELETE on ${apiRoot}/${apiName}/${apiVersion}/subscriptions/{subscriptionId}
-
-##Different implementation respect to the TP. See issue: https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/7
 TP_MEC_MEC030_SRV_V2X_010_OK_01 
     [Documentation] 
     ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
@@ -552,8 +538,37 @@ TP_MEC_MEC030_SRV_V2X_010_OK_01
     Remove existing subscription    ${SUB_PROV_CHG_UU_UNI_ID}
     Check HTTP Response Status Code Is    204  
 
+TP_MEC_MEC030_SRV_V2X_010_OK_02 
+    [Documentation] 
+    ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
+    ...  ETSI GS MEC 030 V2.1.1, clause 7.9.3.2
+    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
+    Should Be True    ${PIC_MEC_SYSTEM} == 1
+    Should Be True    ${PIC_SERVICES} == 1
+    Remove existing subscription    ${SUB_PROV_CHG_UU_MBMS_ID}
+    Check HTTP Response Status Code Is    204  
+    
+TP_MEC_MEC030_SRV_V2X_010_OK_03 
+    [Documentation] 
+    ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
+    ...  ETSI GS MEC 030 V2.1.1, clause 7.9.3.2
+    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
+    Should Be True    ${PIC_MEC_SYSTEM} == 1
+    Should Be True    ${PIC_SERVICES} == 1
+    Remove existing subscription    ${SUB_PROV_CHG_PC5_ID}
+    Check HTTP Response Status Code Is    204  
+    
+TP_MEC_MEC030_SRV_V2X_010_OK_04 
+    [Documentation] 
+    ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
+    ...  ETSI GS MEC 030 V2.1.1, clause 7.9.3.2
+    ...  https://forge.etsi.org/rep/mec/gs030-vis-api/blob/master/MEC030_V2XInformationService.yaml
+    Should Be True    ${PIC_MEC_SYSTEM} == 1
+    Should Be True    ${PIC_SERVICES} == 1
+    Remove existing subscription    ${SUB_V2X_MSG_ID}
+    Check HTTP Response Status Code Is    204  
+    
 
-##Different implementation respect to the TP. See issue: https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/7
 TP_MEC_MEC030_SRV_V2X_010_NF
     [Documentation] 
     ...  Check that the IUT responds with the requested of updating subscription when queried by a MEC Application
@@ -564,11 +579,7 @@ TP_MEC_MEC030_SRV_V2X_010_NF
     Remove existing subscription       ${NOT_EXISTING_SUB_ID}
     Check HTTP Response Status Code Is    404   
 
-##TP_MEC_MEC030_SRV_V2X_010_OK_02, TP_MEC_MEC030_SRV_V2X_010_OK_03 and TP_MEC_MEC030_SRV_V2X_010_OK_04 are missing because issue
-## https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/7
-
-##TP with identifier TP_MEC_MEC030_SRV_V2X_010_BR is missing because of following issue:
-## https://forge.etsi.org/rep/mec/gs032p2-test-purposes/issues/8       
+      
 *** Keywords ***
 Retrieve configured provisioning information over Uu unicast using ecgi filter
     [Arguments]       ${value}
@@ -753,8 +764,7 @@ Update existing subscription
     Set Headers    {"Accept":"application/json"}
     Set Headers    {"Content-Type":"application/json"}
     Set Headers    {"Authorization":"${TOKEN}"}
-    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}      ${body}
-    Log    ${body}   
+    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}      ${body}   
     ${output}=    Output    response
     Set Suite Variable    ${response}    ${output} 
     
diff --git a/MEC030/SRV/V2X/jsons/ProvChgUuMbmsSubscription_BR.json b/MEC030/SRV/V2X/jsons/ProvChgUuMbmsSubscription_BR.json
index 02d6066..5f6b824 100644
--- a/MEC030/SRV/V2X/jsons/ProvChgUuMbmsSubscription_BR.json
+++ b/MEC030/SRV/V2X/jsons/ProvChgUuMbmsSubscription_BR.json
@@ -13,8 +13,8 @@
 				}
 			},
 			"geoArea": {
-				"latitude": -36495271.093864456,
-				"longitude": -68485808.83181348
+				"latitude": -36.093,
+				"longitude": -68.83
 			}
 		},
 		"v2xServerUsd": {
-- 
GitLab