From 893c12a45db90f35dea17d4bd255b5f9436d8cd9 Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Thu, 17 Jan 2019 13:48:16 -0500 Subject: Add Create Model Issue-ID: INT-808 Change-Id: I009cb83315d6310cb244d7ec422a9c90c54bbb5a Signed-off-by: Brian Freeman --- robot/assets/templates/clamp/create_model.template | 1 + robot/resources/clamp_interface.robot | 25 +++++++++++++++++++++- robot/testsuites/clamp.robot | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 robot/assets/templates/clamp/create_model.template (limited to 'robot') diff --git a/robot/assets/templates/clamp/create_model.template b/robot/assets/templates/clamp/create_model.template new file mode 100644 index 00000000..dfa628cd --- /dev/null +++ b/robot/assets/templates/clamp/create_model.template @@ -0,0 +1 @@ +{"name":"${MODEL_NAME}","controlNamePrefix":"ClosedLoop-","bpmnText":"","propText":"{}","imageText":"\n\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\n\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\n\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\n\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\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\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\n","templateName":"${TEMPLATE_NAME}"} diff --git a/robot/resources/clamp_interface.robot b/robot/resources/clamp_interface.robot index 4aa87d4d..4d29b095 100644 --- a/robot/resources/clamp_interface.robot +++ b/robot/resources/clamp_interface.robot @@ -3,8 +3,10 @@ Documentation The main interface for interacting with Microservice Bus. Library RequestsLibrary Library Collections Library String +Library JSONUtils Resource global_properties.robot +Resource json_templater.robot *** Variables *** ${CLAMP_HEALTH_CHECK_PATH} /restservices/clds/v1/healthcheck @@ -13,8 +15,19 @@ ${CLAMP_BASE_PATH} /restservices/clds/v1 ${CLAMP_CLIENT_KEY} robot/assets/keys/org.onap.clamp.key.clear.pem ${CLAMP_CLIENT_CERT} robot/assets/keys/org.onap.clamp.cert.pem +${CLAMP_TEMPLATE_PATH} robot/assets/templates/clamp + *** Keywords *** +Run CLAMP Create Model + [Documentation] Create a new CLAMP Model + [Arguments] ${model_name} ${template_name} + ${dict}= Create Dictionary MODEL_NAME=${model_name} TEMPLATE_NAME=${template_name} + ${data}= Fill JSON Template File ${CLAMP_TEMPLATE_PATH}/create_model.template ${dict} + ${data_path}= Set Variable ${CLAMP_BASE_PATH}/clds/model/${model_name} + ${resp}= Run CLAMP HTTPS Put Request ${data_path} ${data} + Should Be Equal As Strings ${resp.status_code} 200 + Run CLAMP Get Properties [Documentation] get CLAMP Control Loop properties [Arguments] ${property_id} @@ -45,6 +58,17 @@ Run CLAMP Health Check ${resp}= Run CLAMP Get Request ${CLAMP_HEALTH_CHECK_PATH} Should Be Equal As Integers ${resp.status_code} 200 +Run CLAMP HTTPS Put Request + [Documentation] Runs CLAMP HTTPS Put request + [Arguments] ${data_path} ${data} + @{client_certs}= Create List ${CLAMP_CLIENT_CERT} ${CLAMP_CLIENT_KEY} + ${session}= Create Client Cert Session session ${CLAMP_ENDPOINT} client_certs=@{client_certs} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Put Request session ${data_path} data=${data} headers=${headers} + Should Be Equal As Integers ${resp.status_code} 200 + Log ${resp.json()} + [Return] ${resp} + Run CLAMP HTTPS Get Request [Documentation] Runs CLAMP HTTPS Get request [Arguments] ${data_path} @@ -63,4 +87,3 @@ Run CLAMP Get Request Should Be Equal As Integers ${resp.status_code} 200 Log Received response from CLAMP ${resp.text} [Return] ${resp} - diff --git a/robot/testsuites/clamp.robot b/robot/testsuites/clamp.robot index cd860009..407609ab 100644 --- a/robot/testsuites/clamp.robot +++ b/robot/testsuites/clamp.robot @@ -11,4 +11,5 @@ Basic CLAMP Health Check ${current_model_id}= Run CLAMP Get Model Names ${current_control_loop_id}= Run CLAMP Get Control Loop ${current_model_id} Run CLAMP Get Properties ${current_control_loop_id} - + # model_name and template_name will be inputs or config after testing + Run CLAMP Create Model ControlLoopTest3 DCAE-Designer-Template-CLAMPT2VLB_v2_0_vLB0605c122-90f10 -- cgit 1.2.3-korg