aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/so/add_service_recipe.robot
diff options
context:
space:
mode:
authorkrzysztof kuzmicki <krzysztof.kuzmicki@nokia.com>2019-07-31 20:08:36 +0200
committerDaniel Rose <dr695h@att.com>2019-08-02 19:23:00 +0000
commitdadd0e69a24c6a43534086cb04672dc6d4ddc18b (patch)
tree83ba7fac3fe3367da96642ab5289a01d2eaa0097 /robot/resources/so/add_service_recipe.robot
parente971ed9437e004b415b4321edc75883d69eca3e5 (diff)
ROBOT test cases improvements for PnP PNF in El Alto release
Issue-ID: INT-1179 Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> Change-Id: I7b840e4fa53c9058d74872cbaf3e1922651b7997
Diffstat (limited to 'robot/resources/so/add_service_recipe.robot')
-rw-r--r--robot/resources/so/add_service_recipe.robot52
1 files changed, 52 insertions, 0 deletions
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}