From dadd0e69a24c6a43534086cb04672dc6d4ddc18b Mon Sep 17 00:00:00 2001 From: krzysztof kuzmicki Date: Wed, 31 Jul 2019 20:08:36 +0200 Subject: ROBOT test cases improvements for PnP PNF in El Alto release Issue-ID: INT-1179 Signed-off-by: Krzysztof Kuzmicki Change-Id: I7b840e4fa53c9058d74872cbaf3e1922651b7997 --- robot/resources/so/add_service_recipe.robot | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 robot/resources/so/add_service_recipe.robot (limited to 'robot/resources/so') diff --git a/robot/resources/so/add_service_recipe.robot b/robot/resources/so/add_service_recipe.robot new file mode 100644 index 00000000..bd999cbd --- /dev/null +++ b/robot/resources/so/add_service_recipe.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Creates a macro service recipe in SO Catalog DB + +Library OperatingSystem +Library Collections +Library ONAPLibrary.SO WITH NAME SO +Library ONAPLibrary.Templating WITH NAME Templating + + +*** Variables *** +${SERVICE_RECIPE_PATH} /serviceRecipe + +${SYSTEM USER} robot-ete +${SO_ADD_SERVICE_RECIPE} so/service_recipe.jinja + + + +*** Keywords *** +Add Service Recipe + [Documentation] Creates a macro service recipe in SO Catalog DB + [Arguments] ${service_model_UUID} ${orchestrationUri} + ${id}= Get First Free Service Recipe Id + ${arguments}= Create Dictionary service_model_UUID=${service_model_UUID} orchestrationUri=${orchestrationUri} id=${id} + Templating.Create Environment so ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Templating.Apply Template so ${SO_ADD_SERVICE_RECIPE} ${arguments} + ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD} + ${get_resp}= SO.Run Post Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SERVICE_RECIPE_PATH} ${data} auth=${auth} + Should Be Equal As Strings ${get_resp.status_code} 201 + [Return] ${get_resp.status_code} ${get_resp.json()} + +Get Service Recipe + [Documentation] Gets service recipe/s in SO + [Arguments] ${service_id}= + ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD} + ${get_resp}= SO.Run Get Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SERVICE_RECIPE_PATH}/${service_id} auth=${auth} + Should Be Equal As Strings ${get_resp.status_code} 200 + [Return] ${get_resp} + +Get First Free Service Recipe Id + [Documentation] Gets first free service recipe id in SO + ${get_resp}= Get Service Recipe + ${source data}= Set Variable ${get_resp.json()} + Log ${source data} + ${serviceRecipes}= Set Variable ${source data['_embedded']['serviceRecipe']} + ${ids}= Create List + :FOR ${recipe} IN @{serviceRecipes} + \ ${id}= Get From Dictionary ${recipe} id + \ Append To List ${ids} ${id} + Sort list ${ids} + ${biggest_id}= Get From List ${ids} -1 + Log Biggest id is ${biggest_id} first free is ${biggest_id+1} + [Return] ${biggest_id+1} -- cgit 1.2.3-korg