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

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

diff --git a/SOL003/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot b/SOL003/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot
index 44da2f1e..e850c728 100644
--- a/SOL003/VNFSnapshotPackageManagement-API/IndividualVNFSnapshotPackageArtifact.robot
+++ b/SOL003/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: 7.3.8.5.4
diff --git a/SOL003/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot b/SOL003/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot
index 9518e4bb..458d08b7 100644
--- a/SOL003/VNFSnapshotPackageManagement-API/VNFSnapshotPackageContent.robot
+++ b/SOL003/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: 7.3.8.4.4
diff --git a/SOL003/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot b/SOL003/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
index 9a74ba0f..0a68e145 100644
--- a/SOL003/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
+++ b/SOL003/VNFSnapshotPackageManagement-API/VnfSnapshotPackageManagementKeywords.robot
@@ -313,9 +313,15 @@ 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-Length
+    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 perform a PUT. This method should not be implemented
     Set Headers  {"Accept":"${ACCEPT_ZIP}"}  
diff --git a/SOL003/VNFSnapshotPackageManagement-API/environment/variables.txt b/SOL003/VNFSnapshotPackageManagement-API/environment/variables.txt
index 4ccd69c8..c7b18c06 100644
--- a/SOL003/VNFSnapshotPackageManagement-API/environment/variables.txt
+++ b/SOL003/VNFSnapshotPackageManagement-API/environment/variables.txt
@@ -77,7 +77,7 @@ ${artifactPath}    artifactPath
 ${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