AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Testing PMSH functionality |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 3 | |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 4 | Library OperatingSystem |
| 5 | Library RequestsLibrary |
| 6 | Library String |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 7 | Library Process |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 8 | |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 9 | Resource ../../common.robot |
| 10 | |
| 11 | Test Setup CreateSessions |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 12 | Test Teardown Delete All Sessions |
| 13 | |
| 14 | |
| 15 | *** Variables *** |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 16 | |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 17 | ${PMSH_BASE_URL} https://${PMSH_IP}:8443 |
efiacor | e207b42 | 2020-04-23 10:36:54 +0100 | [diff] [blame] | 18 | ${MR_BASE_URL} https://${MR_SIM_IP_ADDRESS}:3095 |
| 19 | ${CBS_BASE_URL} https://${CBS_SIM_IP_ADDRESS}:10443 |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 20 | ${SUBSCRIPTIONS_ENDPOINT} /subscriptions |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 21 | |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 22 | ${MR_EXPECTATION_AAI_PNF_CREATED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json |
| 23 | ${MR_EXPECTATION_AAI_PNF_REMOVED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-deleted.json |
| 24 | ${MR_EXPECTATION_POLICY_RESPONSE_PNF_NEW} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-new.json |
| 25 | ${MR_EXPECTATION_POLICY_RESPONSE_PNF_EXISTING} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-existing.json |
| 26 | ${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json |
| 27 | |
| 28 | ${ADMIN_STATE_LOCKED_PATTERN} 'administrativeState': 'LOCKED' |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 29 | ${CLI_EXEC_GET_CBS_CONFIG_FIRST} docker exec pmsh /bin/sh -c "grep -m 1 'PMSH config from CBS' /var/log/ONAP/dcaegen2/services/pmsh/application.log" |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 30 | |
| 31 | *** Test Cases *** |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 32 | |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 33 | Verify Administrative State in PMSH log file is LOCKED |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 34 | [Tags] PMSH_01 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 35 | [Documentation] Verify Administrative State as logged in PMSH log file is LOCKED |
| 36 | [Timeout] 10 seconds |
| 37 | Sleep 3 Allow time for PMSH to flush to logs |
| 38 | ${cli_cmd_output}= Run Process ${CLI_EXEC_GET_CBS_CONFIG_FIRST} shell=yes |
| 39 | Should Be True ${cli_cmd_output.rc} == 0 |
| 40 | Should Contain ${cli_cmd_output.stdout} ${ADMIN_STATE_LOCKED_PATTERN} |
| 41 | |
| 42 | Verify database tables exist and are empty |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 43 | [Tags] PMSH_02 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 44 | [Documentation] Verify database has been created and is empty |
| 45 | [Timeout] 10 seconds |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 46 | ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} |
| 47 | Should Be True ${resp.status_code} == 200 |
| 48 | Should Contain ${resp.text} [] |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 49 | |
| 50 | Verify PNF detected in AAI when administrative state unlocked |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 51 | [Tags] PMSH_03 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 52 | [Documentation] Verify PNF detected when administrative state unlocked |
| 53 | [Timeout] 40 seconds |
| 54 | SetAdministrativeStateToUnlocked |
| 55 | Sleep 31 Allow PMSH time to pick up changes in CBS config |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 56 | ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} |
| 57 | Should Be Equal As Strings ${resp.json()[0]['subscription_status']} UNLOCKED |
| 58 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_name']} pnf-existing |
| 59 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['orchestration_status']} Active |
| 60 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} PENDING_CREATE |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 61 | |
| 62 | Verify Policy response on MR is handled |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 63 | [Tags] PMSH_04 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 64 | [Documentation] Verify policy response on MR is handled |
| 65 | [Timeout] 40 seconds |
| 66 | SimulatePolicyResponse ${MR_EXPECTATION_POLICY_RESPONSE_PNF_EXISTING} |
efiacor | 49b4644 | 2020-07-06 11:55:44 +0100 | [diff] [blame^] | 67 | Sleep 15 seconds Ensure Policy response on MR is picked up |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 68 | ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} |
| 69 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} CREATED |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 70 | |
| 71 | Verify AAI event on MR detailing new PNF being detected is handled |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 72 | [Tags] PMSH_05 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 73 | [Documentation] Verify PNF created AAI event on MR is handled |
| 74 | [Timeout] 30 seconds |
| 75 | SimulateNewPNF |
efiacor | 49b4644 | 2020-07-06 11:55:44 +0100 | [diff] [blame^] | 76 | Sleep 15 seconds Ensure AAI event on MR is picked up |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 77 | ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} |
| 78 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['nf_name']} pnf_newly_discovered |
| 79 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['orchestration_status']} Active |
| 80 | Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['nf_sub_status']} PENDING_CREATE |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 81 | |
| 82 | Verify AAI event on MR detailing PNF being deleted is handled |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 83 | [Tags] PMSH_06 |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 84 | [Documentation] Verify PNF deleted AAI event on MR is handled |
| 85 | [Timeout] 30 seconds |
| 86 | SimulateDeletedPNF |
| 87 | Sleep 12 seconds Ensure AAI event on MR is picked up |
efiacor | b67a093 | 2020-05-22 13:48:52 +0100 | [diff] [blame] | 88 | ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} |
| 89 | Should Not Contain ${resp.text} pnf_newly_discovered |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 90 | |
| 91 | *** Keywords *** |
AndyWalshe | b412c7b | 2020-02-13 15:05:21 +0000 | [diff] [blame] | 92 | |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 93 | CreateSessions |
| 94 | Create Session pmsh_session ${PMSH_BASE_URL} |
| 95 | Create Session mr_sim_session ${MR_BASE_URL} |
| 96 | Create Session cbs_sim_session ${CBS_BASE_URL} |
| 97 | |
| 98 | SetAdministrativeStateToUnlocked |
| 99 | ${data}= Get Data From File ${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} |
| 100 | ${resp} = Put Request cbs_sim_session /clear data={"path": "/service_component_all/.*"} |
| 101 | Should Be True ${resp.status_code} == 200 |
| 102 | Sleep 2 Allow CBS time to set expectation |
| 103 | ${resp} = Put Request cbs_sim_session /expectation data=${data} |
| 104 | Should Be True ${resp.status_code} == 201 |
| 105 | |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 106 | SimulateNewPNF |
| 107 | ${data}= Get Data From File ${MR_EXPECTATION_AAI_PNF_CREATED} |
efiacor | 49b4644 | 2020-07-06 11:55:44 +0100 | [diff] [blame^] | 108 | ${resp} = Put Request mr_sim_session /clear data={"path": "/events/AAI_EVENT/dcae_pmsh_cg/dcae_pmsh_aai_event"} |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 109 | Should Be True ${resp.status_code} == 200 |
| 110 | ${resp} = Put Request mr_sim_session /expectation data=${data} |
| 111 | Should Be True ${resp.status_code} == 201 |
| 112 | |
| 113 | SimulatePolicyResponse |
| 114 | [Arguments] ${expected_contents} |
| 115 | ${data}= Get Data From File ${expected_contents} |
efiacor | 49b4644 | 2020-07-06 11:55:44 +0100 | [diff] [blame^] | 116 | ${resp} = Put Request mr_sim_session /clear data={"path": "/events/unauthenticated.PMSH_CL_INPUT/dcae_pmsh_cg/dcae_pmsh_policy_cl_input"} |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 117 | Should Be True ${resp.status_code} == 200 |
| 118 | ${resp} = Put Request mr_sim_session /expectation data=${data} |
| 119 | Should Be True ${resp.status_code} == 201 |
| 120 | |
| 121 | SimulateDeletedPNF |
| 122 | ${data}= Get Data From File ${MR_EXPECTATION_AAI_PNF_REMOVED} |
efiacor | 49b4644 | 2020-07-06 11:55:44 +0100 | [diff] [blame^] | 123 | ${resp} = Put Request mr_sim_session /clear data={"path": "/events/AAI_EVENT/dcae_pmsh_cg/dcae_pmsh_aai_event"} |
AndyWalshe | 48496a5 | 2020-03-12 12:52:19 +0000 | [diff] [blame] | 124 | Should Be True ${resp.status_code} == 200 |
| 125 | ${resp} = Put Request mr_sim_session /expectation data=${data} |
| 126 | Should Be True ${resp.status_code} == 201 |