From 574612a70bb171f7f409b758bf45f9fc3c0998b4 Mon Sep 17 00:00:00 2001
From: hammad zafar <hammad.zafar@xflowresearch.com>
Date: Wed, 10 Mar 2021 17:02:51 +0500
Subject: [PATCH] fixed Content-Range and Content-Length checks

---
 .../IndividualVNFSnapshotPackageArtifact.robot            | 1 +
 .../VNFSnapshotPackageContent.robot                       | 1 +
 .../VnfSnapshotPackageManagementKeywords.robot            | 8 +++++++-
 .../environment/variables.txt                             | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/SOL005/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot b/SOL005/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot
index c0241349..37db5643 100644
--- a/SOL005/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot
+++ b/SOL005/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot
@@ -40,6 +40,7 @@ GET Individual VNF Snapshot Package Artifact - Partial Content
     Check HTTP Response Status Code Is    206
     Check HTTP Content-Type Header Is Set For Package Artifact
     Check HTTP Content-Range Header Is Set
+    Check HTTP Content-Length Header Is Set
     
 GET Individual VNF Snapshot Package Artifact - Range Request Not Supported
     [Documentation]    Test ID: 5.3.7.10.4
diff --git a/SOL005/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot b/SOL005/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot
index 14b73827..bf1a1400 100644
--- a/SOL005/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot
+++ b/SOL005/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot
@@ -40,6 +40,7 @@ GET VNF Snapshot Package Content - Partial Content
     Check HTTP Response Status Code Is    206
     Check HTTP Content-Type Header Is Set For Package Content
     Check HTTP Content-Range Header Is Set
+    Check HTTP Content-Length Header Is Set
     
 GET VNF Snapshot Package Content - Range Request Not Supported
     [Documentation]    Test ID: 5.3.7.4.4
diff --git a/SOL005/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot b/SOL005/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
index 3c5a616b..fd207409 100644
--- a/SOL005/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
+++ b/SOL005/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
@@ -358,8 +358,14 @@ Check HTTP Content-Type Header Is Set For Package Content
 Check HTTP Content-Range Header Is Set
     Log    Check Content-Range HTTP Header
     Should Contain    ${response['headers']}    Content-Range
-    Should Be Equal As Strings    ${response['headers']['Content-Range']}    ${range}
+    Should Be Equal As Strings    ${response['headers']['Content-Range']}    ${range}/${full_length}
     Log    Header Content-Range is present
+    
+Check HTTP Content-Length Header Is Set
+    Log    Check Content-Length HTTP Header
+    Should Contain    ${response['headers']}    Content-Lenght
+    Should Be Equal As Strings    ${response['headers']['Content-Length']}    ${full_length}
+    Log    Header Content-Length is present
 
 PUT VNF Snapshot Package Content
     log    Trying to upload the contents of VNF Snapshot Package using PUT
diff --git a/SOL005/VNFSnapshotPackageManagement-API/environment/variables.txt b/SOL005/VNFSnapshotPackageManagement-API/environment/variables.txt
index 3bdb6092..ea521e2b 100644
--- a/SOL005/VNFSnapshotPackageManagement-API/environment/variables.txt
+++ b/SOL005/VNFSnapshotPackageManagement-API/environment/variables.txt
@@ -78,7 +78,7 @@ ${ext_artifactPath}    artifactPath/external
 ${CONTENT_TYPE_OCTET}    application/octet-stream
 ${NFVO_RANGE_OK}    1    # If 1 means that Range is supported by the NFVO
 ${range}          bytes=0-1023
-${full_size}        2000            # Size of the requested artifact to be downloaded via partial downloads
+${full_length}        2000            # Size of the requested artifact to be downloaded via partial downloads
 ${erroneousRange}    bytes=10000000-1000000000    # Requesting a out of range number of bytes
 ${vnfPackageOctetStreamId}    octetStreamPkgId
 ${vnfdOctetStreamId}    octetStreamVnfdId
-- 
GitLab