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