2 Documentation PNF Registration Handler (PRH) test cases
3 Resource ../aai/aai_interface.robot
4 Resource ../mr_interface.robot
5 Library ONAPLibrary.Openstack
6 Library OperatingSystem
7 Library RequestsLibrary
9 Library ONAPLibrary.JSON
10 Library ONAPLibrary.Utilities
11 Library ONAPLibrary.Templating WITH NAME Templating
12 Library ONAPLibrary.AAI WITH NAME AAI
15 ${aai_so_registration_entry_template}= aai/add_pnf_registration_info.jinja
16 ${pnf_ves_integration_request}= ves/pnf_registration_request.jinja
17 ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} /events/unauthenticated.PNF_READY/2/1
18 ${VES_ENDPOINT} ${GLOBAL_DCAE_VES_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_SERVER_PORT}
19 ${VES_data_path} /eventListener/v7
23 Create A&AI antry without SO and succesfully registrate PNF
24 [Documentation] Test case template for create A&AI antry without SO and succesfully registrate PNF
25 [Arguments] ${PNF_entry_dict}
26 Create PNF initial entry in A&AI ${PNF_entry_dict}
27 Send VES integration request ${PNF_entry_dict}
28 Verify PNF Integration Request in A&AI ${PNF_entry_dict}
30 Create PNF initial entry in A&AI
31 [Documentation] Creates PNF initial entry in A&AI registry. Entry contains only correlation id (pnf-name)
32 [Arguments] ${PNF_entry_dict}
33 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
34 ${template}= Templating.Apply Template aai ${aai_so_registration_entry_template} ${PNF_entry_dict}
35 Log Filled A&AI entry template ${template}
36 ${correlation_id}= Get From Dictionary ${PNF_entry_dict} correlation_id
37 ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id}
38 Log Removing existing entry "${PNF_entry_dict.correlation_id}" from A&AI registry
39 ${put_resp}= AAI.Run Put Request ${AAI_FRONTEND_ENDPOINT} /aai/v11/network/pnfs/pnf/${PNF_entry_dict.correlation_id} ${template} auth=${GLOBAL_AAI_AUTHENTICATION}
40 Log Adding new entry with correlation ID "${PNF_entry_dict.correlation_id}" to A&AI registry (empty IPv4 and IPv6 address)
42 Send VES integration request
43 [Documentation] Send VES integration request. Request contains correlation id (sourceName), oamV4IpAddress and oamV6IpAddress
44 [Arguments] ${PNF_entry_dict}
45 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
46 ${template}= Templating.Apply Template aai ${pnf_ves_integration_request} ${PNF_entry_dict}
47 ${post_resp}= Run VES HTTP Post Request ${template}
48 Should Be Equal As Strings ${post_resp.status_code} 202
49 Log VES integration request has been send
51 Verify PNF integration request in A&AI
52 [Documentation] Verify if PNF integration request entries are present in A&AI
53 [Arguments] ${PNF_entry_dict}
54 Wait Until Keyword Succeeds 10x 5s Query PNF A&AI updated entry ${PNF_entry_dict}
55 Log PNF integration request in A&AI has been verified and contains all necessary entries
57 Verify PNF integration request in MR
58 [Documentation] Verify if PNF integration request entries are present in MR unauthenticated.PNF_READY/ topic
59 [Arguments] ${PNF_entry_dict}
60 Wait Until Keyword Succeeds 10x 1s Query PNF MR entry ${PNF_entry_dict}
61 Log PNF integration request in MR has been verified and contains all necessary entries
63 Query PNF A&AI updated entry
64 [Documentation] Query PNF A&AI updated entry
65 [Arguments] ${PNF_entry_dict}
66 ${get_resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} /aai/v11/network/pnfs/pnf/${PNF_entry_dict.correlation_id} auth=${GLOBAL_AAI_AUTHENTICATION}
67 Should Be Equal As Strings ${get_resp.status_code} 200
68 ${json_resp}= Set Variable ${get_resp.json()}
69 Log JSON recieved from A&AI endpoint ${json_resp}
70 Should Be Equal As Strings ${json_resp["ipaddress-v4-oam"]} ${PNF_entry_dict.PNF_IPv4_address}
71 Should Be Equal As Strings ${json_resp["ipaddress-v6-oam"]} ${PNF_entry_dict.PNF_IPv6_address}
72 Should Be Equal As Strings ${json_resp["pnf-name"]} ${PNF_entry_dict.correlation_id}
73 Log PNF integration request in A&AI has been verified and contains all necessary entries
76 [Documentation] Query PNF MR updated entry
77 [Arguments] ${PNF_entry_dict}
78 ${get_resp}= Run MR Get Request ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH}
79 Should Be Equal As Strings ${get_resp.status_code} 200
80 ${json_resp_item}= Get From List ${get_resp.json()} 0
81 ${json}= evaluate json.loads('${json_resp_item}') json
82 Log JSON recieved from MR ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} endpoint ${json}
83 Should Be Equal As Strings ${json["ipaddress-v4-oam"]} ${PNF_entry_dict.PNF_IPv4_address}
84 Should Be Equal As Strings ${json["ipaddress-v6-oam"]} ${PNF_entry_dict.PNF_IPv6_address}
85 Should Be Equal As Strings ${json["correlationId"]} ${PNF_entry_dict.correlation_id}
86 Log PNF integration request in MR has been verified and contains all necessary entries
88 Run VES HTTP Post Request
89 [Documentation] Runs a VES Post request
92 ${session}= Create Session ves ${VES_ENDPOINT}
93 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
94 ${post_resp}= Post Request ves ${VES_data_path} data=${data} headers=${headers}
95 Log PNF integration request ${data}
96 Should Be Equal As Strings ${post_resp.status_code} 202
97 Log VES has accepted event with status code ${post_resp.status_code}
100 Cleanup PNF entry in A&AI
101 [Documentation] Creates PNF initial entry in A&AI registry
102 [Arguments] ${PNF_entry_dict}
103 ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id}
104 Log Teardown complete