Feature 10908: Update charm in running VNF instance
[osm/tests.git] / robot-systest / lib / vnfd_lib.robot
index 1d57598..2d50170 100644 (file)
@@ -28,7 +28,7 @@ Library   String
 
 *** Variables ***
 ${success_return_code}   0
-${failure_return_code}   0
+${failure_return_code}   1
 ${delete_max_wait_time}   1min
 ${delete_pol_time}   15sec
 
@@ -71,6 +71,24 @@ Create VNFD
     [Return]  ${id}
 
 
+Update VNFD
+    [Documentation]   Onboards ("Updates") a NF Package into OSM.
+    ...               - Parameters:
+    ...                 - vnfd_pkg: Name (and location) of the NF Package
+    ...                 - vnfd_name: Name of the existing NF Package
+
+    [Arguments]   ${vnfd_pkg}   ${vnfd_name}
+
+    # Proceedes with the onboarding with the appropriate arguments
+    ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name}
+    log   ${stdout}
+    Should Be Equal As Integers   ${rc}   ${success_return_code}
+    ${lines}=  Get Line Count  ${stdout}
+    ${last}=  Evaluate  ${lines} - 1
+    ${id}=  Get Line  ${stdout}  ${last}
+    [Return]  ${id}
+
+
 Create VNFD Overriding Fields
     [Documentation]   Onboards ("creates") a NF Package into OSM.
     ...               - Parameters:
@@ -118,7 +136,7 @@ Assert Failure Delete VNFD
     ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfpkg-delete ${vnfd_id}
     log   ${stdout}
     Should Be Equal As Integers   ${rc}   ${failure_return_code}
-    Should Contain  ${stdout}  409  msg=Expected Conflict  values=False
+    Should Contain   ${stdout}   409   msg=Expected Conflict   values=False
     WAIT UNTIL KEYWORD SUCCEEDS   ${delete_max_wait_time}   ${delete_pol_time}   Check For VNFD   ${vnfd_id}   True