E2E sunny scenario for PNF registration
Change-Id: I09e23319bd33ba89ac256a3d687c9caa351d4d46
Issue-ID: INT-685
Signed-off-by: krzysztof kuzmicki <krzysztof.kuzmicki@nokia.com>
diff --git a/robot/resources/aai/add_pnf_registration_info.template b/robot/resources/aai/add_pnf_registration_info.template
new file mode 100644
index 0000000..2122ef2
--- /dev/null
+++ b/robot/resources/aai/add_pnf_registration_info.template
@@ -0,0 +1,12 @@
+{
+ "pnf-name": "${correlation_id}",
+ "pnf-name2": "example-pnf-name2-val-78244",
+ "pnf-name2-source": "example-pnf-name2-source-val-99275",
+ "pnf-id": "example-pnf-id-val-7989",
+ "equip-type": "example-equip-type-val-20348",
+ "equip-vendor": "example-equip-vendor-val-52182",
+ "equip-model": "example-equip-model-val-8370",
+ "management-option": "example-management-option-val-72881",
+ "ipaddress-v4-oam": "",
+ "ipaddress-v6-oam": ""
+}
diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot
index 7d8db8e..ea69372 100644
--- a/robot/resources/global_properties.robot
+++ b/robot/resources/global_properties.robot
@@ -33,3 +33,8 @@
${GLOBAL_AAI_ZONE_NAME} nova
${GLOBAL_AAI_DESIGN_TYPE} integration
${GLOBAL_AAI_ZONE_CONTEXT} labs
+${GLOBAL_DNS_HV_VES_NAME} dcae-hv-ves-collector
+${GLOBAL_HV_VES_SERVER_PORT} 6061
+${GLOBAL_DNS_VES_NAME} dcae-ves-collector
+${GLOBAL_VES_SERVER_PORT} 8080:
+
diff --git a/robot/resources/test_templates/pnf_registration_without_SO_template.robot b/robot/resources/test_templates/pnf_registration_without_SO_template.robot
new file mode 100644
index 0000000..cc18aa1
--- /dev/null
+++ b/robot/resources/test_templates/pnf_registration_without_SO_template.robot
@@ -0,0 +1,97 @@
+*** Settings ***
+Documentation PNF Registration Handler (PRH) test cases
+Resource ../aai/aai_interface.robot
+Resource ../mr_interface.robot
+Resource ../json_templater.robot
+Library OpenstackLibrary
+Library OperatingSystem
+Library UUID
+Library Collections
+Library JSONUtils
+Library HTTPUtils
+
+
+*** Variables ***
+${aai_so_registration_entry_template}= robot/assets/templates/aai/add_pnf_registration_info.template
+${pnf_ves_integration_request}= robot/assets/templates/ves/pnf_registration_request.template
+${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} /events/unauthenticated.PNF_READY/2/1
+${VES_ENDPOINT} http://${GLOBAL_DNS_VES_NAME}:${GLOBAL_VES_SERVER_PORT}
+${VES_data_path} /eventListener/v7
+
+
+*** Keywords ***
+Create A&AI antry without SO and succesfully registrate PNF
+ [Documentation] Test case template for create A&AI antry without SO and succesfully registrate PNF
+ [Arguments] ${PNF_entry_dict}
+ Create PNF initial entry in A&AI ${PNF_entry_dict}
+ Send VES integration request ${PNF_entry_dict}
+ Verifi PNF Integration Request in A&AI ${PNF_entry_dict}
+ Verifi PNF Integration Request in MR ${PNF_entry_dict}
+
+Create PNF initial entry in A&AI
+ [Documentation] Creates PNF initial entry in A&AI registry. Entry contains only correlation id (pnf-name)
+ [Arguments] ${PNF_entry_dict}
+ ${template}= Fill Json Template File ${aai_so_registration_entry_template} ${PNF_entry_dict}
+ Log Filled A&AI entry template ${template}
+ ${correlation_id}= Get From Dictionary ${PNF_entry_dict} correlation_id
+ ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id}
+ Log Removing existing entry "${PNF_entry_dict.correlation_id}" from A&AI registry
+ ${put_resp}= Run A&AI Put Request /aai/v11/network/pnfs/pnf/${PNF_entry_dict.correlation_id} ${template}
+ Log Adding new entry with correlation ID "${PNF_entry_dict.correlation_id}" to A&AI registry (empty IPv4 and IPv6 address)
+
+Send VES integration request
+ [Documentation] Send VES integration request. Request contains correlation id (sourceName), oamV4IpAddress and oamV6IpAddress
+ [Arguments] ${PNF_entry_dict}
+ ${template}= Fill Json Template File ${pnf_ves_integration_request} ${PNF_entry_dict}
+ ${post_resp}= Run VES HTTP Post Request ${template}
+ Should Be Equal As Strings ${post_resp.status_code} 202
+ Log VES integration request has been send
+
+Verifi PNF integration request in A&AI
+ [Documentation] Verifi if PNF integration request entries are present in A&AI
+ [Arguments] ${PNF_entry_dict}
+ Wait Until Keyword Succeeds 10x 1s Query PNF A&AI updated entry ${PNF_entry_dict}
+ Log PNF integration request in A&AI has been verified and contains all necessary entries
+
+Verifi PNF integration request in MR
+ [Documentation] Verifi if PNF integration request entries are present in MR unauthenticated.PNF_READY/ topic
+ [Arguments] ${PNF_entry_dict}
+ ${get_resp}= Run MR Get Request ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH}
+ Should Be Equal As Strings ${get_resp.status_code} 200
+ ${json_resp_item}= Get From List ${get_resp.json()} 0
+ ${json}= evaluate json.loads('${json_resp_item}') json
+ Log JSON recieved from MR ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} endpoint ${json}
+ Should Be Equal As Strings ${json["ipaddress-v4-oam"]} ${PNF_entry_dict.PNF_IPv4_address}
+ Should Be Equal As Strings ${json["ipaddress-v6-oam"]} ${PNF_entry_dict.PNF_IPv6_address}
+ Should Be Equal As Strings ${json["correlationId"]} ${PNF_entry_dict.correlation_id}
+ Log PNF integration request in MR has been verified and contains all necessary entries
+
+Query PNF A&AI updated entry
+ [Documentation] Query PNF A&AI updated entry
+ [Arguments] ${PNF_entry_dict}
+ ${get_resp}= Run A&AI Get Request /aai/v11/network/pnfs/pnf/${PNF_entry_dict.correlation_id}
+ Should Be Equal As Strings ${get_resp.status_code} 200
+ ${json_resp}= Set Variable ${get_resp.json()}
+ Log JSON recieved from A&AI endpoint ${json_resp}
+ Should Be Equal As Strings ${json_resp["ipaddress-v4-oam"]} ${PNF_entry_dict.PNF_IPv4_address}
+ Should Be Equal As Strings ${json_resp["ipaddress-v6-oam"]} ${PNF_entry_dict.PNF_IPv6_address}
+ Should Be Equal As Strings ${json_resp["pnf-name"]} ${PNF_entry_dict.correlation_id}
+ Log PNF integration request in A&AI has been verified and contains all necessary entries
+
+Run VES HTTP Post Request
+ [Documentation] Runs a VES Post request
+ [Arguments] ${data}
+ Disable Warnings
+ ${session}= Create Session ves ${VES_ENDPOINT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${post_resp}= Post Request ves ${VES_data_path} data=${data} headers=${headers}
+ Log PNF integration request ${data}
+ Should Be Equal As Strings ${post_resp.status_code} 202
+ Log VES has accepted event with status code ${post_resp.status_code}
+ [Return] ${post_resp}
+
+Cleanup PNF entry in A&AI
+ [Documentation] Creates PNF initial entry in A&AI registry
+ [Arguments] ${PNF_entry_dict}
+ ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id}
+ Log Teardown complete
diff --git a/robot/resources/ves/pnf_registration_request.template b/robot/resources/ves/pnf_registration_request.template
new file mode 100644
index 0000000..61b46d1
--- /dev/null
+++ b/robot/resources/ves/pnf_registration_request.template
@@ -0,0 +1,36 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1538407540940,
+ "sourceId": "val13",
+ "eventId": "registration_38407540",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {},
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW3",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1538407540940,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "${correlation_id}",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW3",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1538407540942",
+ "modelNumber": "val6",
+ "lastServiceDate": "1538407540942",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "${PNF_IPv4_address}",
+ "oamV6IpAddress": "${PNF_IPv6_address}",
+ "softwareVersion": "val7"
+ }
+ }
+}
+