summaryrefslogtreecommitdiffstats
path: root/robot/resources/test_templates/cmpv2.robot
blob: bc99ec2911f3db5a57015af8b0886ca1c39bedc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
*** Settings ***
Documentation    CMPv2 test cases
Library         OperatingSystem
Library         RequestsLibrary
Library         Collections
Library         ONAPLibrary.JSON
Library         ONAPLibrary.Utilities
Library         ONAPLibrary.Templating    WITH NAME    Templating
Resource        pnf_registration_without_SO_template.robot
Resource        ../dcae/deployment.robot
Resource        ../dcae/inventory.robot
Resource        ../global_properties.robot


*** Variables ***
${pnf_simulator_single_event}=  ves/pnf_simulator_single_event.jinja
${VES_ENDPOINT}    ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
${VES_data_path}   eventListener/v7
${single_event_data_path}   /simulator/event
${users}  ${EXECDIR}/robot/assets/cmpv2/mongo-users.json


*** Keywords ***
Pnf simulator send single VES event
    [Arguments]  ${event}   ${ves_host}   ${ves_port}  ${pnf_sim_host}  ${pnf_sim_port}  ${http_reposnse_code}=202
    ${pnf_sim_endpoint}=            Set Variable                http://${pnf_sim_host}:${pnf_sim_port}
    ${ves_url}=                     Set Variable                ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${ves_host}:${ves_port}/${VES_data_path}
    ${single_event}=                Create Dictionary           event=${event}              ves_url=${ves_url}
    Templating.Create Environment   pnf                         ${GLOBAL_TEMPLATE_FOLDER}
    ${data}=                        Templating.Apply Template   pnf                         ${pnf_simulator_single_event}   ${single_event}
    ${pnf_sim_endpoint}=            Set Variable                http://${pnf_sim_host}:${pnf_sim_port}
    ${session}=                     Create Session              pnf_sim                     ${pnf_sim_endpoint}
    ${headers}=                     Create Dictionary            Accept=application/json    Content-Type=application/json
    ${post_resp}=                   Post Request                pnf_sim                     ${single_event_data_path}       data=${data}        headers=${headers}
    Log                             PNF registration request ${data}
    Should Be Equal As Strings      ${post_resp.status_code}    ${http_reposnse_code}
    Log                             VES has accepted event with status code ${post_resp.status_code}


Usecase Teardown
    Undeploy Service                    mongo-dep
    Undeploy Service                    pnf-simulator-dep
    Undeploy Service                    ves-collector-cmpv2-dep
    Undeploy Service                    ves-collector-cmpv2-wrong-sans-dep
    Delete Blueprint From Inventory     ${serviceTypeIdMongo}
    Delete Blueprint From Inventory     ${serviceTypeIdPnfSimulator}
'; var service_create_extension = ''; var service_delete_extension = ''; var auth_username = ''; var auth_password = ''; var confirm_auth_password = ''; if ( form.name == 'addForm' ) { controller_id = form.nf_controller_id; base_uri = form.nf_base_uri; service_create_extension = form.nf_service_create_extension; service_delete_extension = form.nf_service_delete_extension; auth_username = form.nf_auth_username; auth_password = form.nf_auth_password; confirm_auth_password = form.nf_confirm_auth_password; if ( auth_password.value != confirm_auth_password.value ) { bootbox.alert('Passwords do not match.'); return; } } else { controller_id = form.uf_controller_id; base_uri = form.uf_base_uri; service_create_extension = form.uf_service_create_extension; service_delete_extension = form.uf_service_delete_extension; auth_username = form.uf_auth_username; auth_password = form.uf_auth_password; confirm_auth_password = form.uf_confirm_auth_password; if ( auth_password.value != confirm_auth_password.value ) { bootbox.alert('Passwords do not match.'); return; } } if ( (controller_id.value == null) || (controller_id.value == "") || isblank(controller_id.value) ) { errorMsg += 'Controller Id is required.<br>'; } if ( (base_uri.value == null) || (base_uri.value == "") || isblank(base_uri.value) ) { errorMsg += 'Base URL is required.<br>'; } if ( (service_create_extension.value == null) || (service_create_extension.value == "") || isblank(service_create_extension.value) ) { errorMsg += 'Service Create Extension is required.<br>'; } if ( (service_delete_extension.value == null) || (service_delete_extension.value == "") || isblank(service_delete_extension.value) ) { errorMsg += 'Service Delete Extension is required.<br>'; } if ( (auth_username.value == null) || (auth_username.value == "") || isblank(auth_username.value) ) { errorMsg += 'Auth Username is required.<br>'; } if ( (auth_password.value == null) || (auth_password.value == "") || isblank(auth_password.value) ) { errorMsg += 'Auth Password is required.<br>'; } if( errorMsg.length > 0 ) { bootbox.alert(errorMsg); return; } form.submit(); } function updateOwbcProperties(controller_id,base_uri,service_create_extension,service_delete_extension,auth_username,auth_password) { document.getElementById('uf_controller_id').value=controller_id; document.getElementById('uf_key_controller_id').value=controller_id; document.getElementById('uf_base_uri').value=base_uri; document.getElementById('uf_service_create_extension').value=service_create_extension; document.getElementById('uf_service_delete_extension').value=service_delete_extension; document.getElementById('uf_auth_username').value=auth_username; document.getElementById('uf_auth_password').value=auth_password; document.getElementById('uf_confirm_auth_password').value=auth_password; $('#update_owbc_properties').modal('show'); } function deleteOwbcProperties(controller_id) { var url_string = encodeURI("/tunnel/deleteOwbcProperties?controller_id=" + controller_id ); bootbox.confirm({ message: "Are you sure you want to delete OWBC Properties? " + controller_id, callback: function(result) { if ( result ) { location.assign(url_string); } return; }, buttons: { cancel: { label: "Cancel" }, confirm: { label: "Yes" } } }); } </script> </body> </html>