X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fvnfd_lib.robot;h=2d50170465831ba8c5831f554de155cc799cf6d8;hb=6cd74807debed3f4414da8b4d3fc4c17b1b56c14;hp=fdef1acccefe73500e198e4891c91c90a4e72f1f;hpb=f96bb45c0a03f2188688d90d67ea718851cec2de;p=osm%2Ftests.git diff --git a/robot-systest/lib/vnfd_lib.robot b/robot-systest/lib/vnfd_lib.robot index fdef1ac..2d50170 100644 --- a/robot-systest/lib/vnfd_lib.robot +++ b/robot-systest/lib/vnfd_lib.robot @@ -28,22 +28,90 @@ Library String *** Variables *** ${success_return_code} 0 +${failure_return_code} 1 ${delete_max_wait_time} 1min ${delete_pol_time} 15sec *** Keywords *** Get VNFDs List - ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list log ${stdout} log ${rc} Should Be Equal As Integers ${rc} ${success_return_code} Create VNFD - [Arguments] ${vnfd_pkg} + [Documentation] Onboards ("creates") a NF Package into OSM. + ... - Parameters: + ... - vnfd_pkg: Name (and location) of the NF Package + ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package. + ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa). + ... Valid strings are the same as in the command. E.g.: + ... - `--override-epa`: adds EPA attributes to all VDUs. + ... - `--override-nonepa`: removes all EPA attributes from all VDUs. + ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with + ... the others above (e.g. '--override-nonepa --override-paravirt'). + ... - Relevant environment variables: + ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. + ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. + + [Arguments] ${vnfd_pkg} ${overrides}=${EMPTY} + + # If env variable "OVERRIDES" exists, it prevails over the value in the argument + ${overrides}= Get Environment Variable OVERRIDES default=${overrides} + + # Proceedes with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} + 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} + + +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} + - ${rc} ${stdout}= Run and Return RC and Output osm vnfd-create ${vnfd_pkg} +Create VNFD Overriding Fields + [Documentation] Onboards ("creates") a NF Package into OSM. + ... - Parameters: + ... - vnfd_pkg: Name (and location) of the NF Package + ... - override_fields: String with options to override fields in descriptor, format: "key1.key2...=value[;key3...=value;...]" + ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package. + ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa). + ... Valid strings are the same as in the command. E.g.: + ... - `--override-epa`: adds EPA attributes to all VDUs. + ... - `--override-nonepa`: removes all EPA attributes from all VDUs. + ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with + ... the others above (e.g. '--override-nonepa --override-paravirt'). + ... - Relevant environment variables: + ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. + ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. + + [Arguments] ${vnfd_pkg} ${override_fields} ${overrides}=${EMPTY} + + # If env variable "OVERRIDES" exists, it prevails over the value in the argument + ${overrides}= Get Environment Variable OVERRIDES default=${overrides} + + # Proceedes with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}' log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} ${lines}= Get Line Count ${stdout} @@ -55,14 +123,27 @@ Create VNFD Delete VNFD [Arguments] ${vnfd_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnfd-delete ${vnfd_id} + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id} log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} -Check For VNFD +Assert Failure Delete VNFD + [Documentation] Deletes a NF Package that cannot be deleted and asserts the failure [Arguments] ${vnfd_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list | awk '{print $2}' | grep ${vnfd_id} - Should Not Be Equal As Strings ${stdout} ${vnfd_id} + ${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 + WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} True + + +Check For VNFD + [Arguments] ${vnfd_id} ${exists}=False + + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id} + Run Keyword If ${exists} Should Be Equal As Strings ${stdout} ${vnfd_id} + ... ELSE Should Not Be Equal As Strings ${stdout} ${vnfd_id} +