PRH -> BBS re-registration case
Skeleton for test

Change-Id: I1a78b04a653e5cf9f21f25b0d29d989920390984
Issue-ID: INT-1100
Signed-off-by: Marcin Migdal <marcin.migdal@nokia.com>
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json
new file mode 100644
index 0000000..8787dc1
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json
@@ -0,0 +1,23 @@
+{
+    "pnf-name": "NOK6061ZW9",
+    "pnf-name2": "example-pnf-name2-val-58071",
+    "pnf-name2-source": "example-pnf-name2-source-val-22408",
+    "pnf-id": "example-pnf-id-val-55834",
+    "equip-type": "example-equip-type-val-5497",
+    "equip-vendor": "example-equip-vendor-val-85730",
+    "equip-model": "example-equip-model-val-38526",
+    "management-option": "example-management-option-val-15776",
+    "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556",
+    "sw-version": "example-sw-version-val-64239",
+    "in-maint": true,
+    "frame-id": "example-frame-id-val-76733",
+    "serial-number": "example-serial-number-val-79366",
+    "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781",
+    "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979",
+    "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703",
+    "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386",
+    "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665",
+    "inv-status": "example-inv-status-val-8477",
+    "prov-status": "example-prov-status-val-68268",
+    "nf-role": "example-nf-role-val-68489"
+}
\ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json
new file mode 100644
index 0000000..95c5570
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json
@@ -0,0 +1,11 @@
+{
+  "link-name": "bbs-link",
+  "link-type": "attachment-point",
+  "relationship-list": [
+    {
+      "relationship": {
+        "related-link": "/network/pnfs/pnf/NOK6061ZW9"
+      }
+    }
+  ]
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-ready-event.json
new file mode 100644
index 0000000..5c77e12
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-ready-event.json
@@ -0,0 +1,8 @@
+[
+  {
+    "additionalFields": {
+      "attachment-point": "bbs-link"
+    },
+    "correlationId": "NOK6061ZW9"
+  }
+]
\ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json
new file mode 100644
index 0000000..84e5223
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json
@@ -0,0 +1,42 @@
+[
+  {
+    "event": {
+      "commonEventHeader": {
+        "startEpochMicrosec": 1540212137393,
+        "sourceId": "val13",
+        "eventId": "registration_40212137",
+        "nfcNamingCode": "oam",
+        "internalHeaderFields": {
+          "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
+        },
+        "eventType": "pnfRegistration",
+        "priority": "Normal",
+        "version": "4.0.1",
+        "reportingEntityName": "NOK6061ZW9",
+        "sequence": 0,
+        "domain": "pnfRegistration",
+        "lastEpochMicrosec": 1540212137393,
+        "eventName": "pnfRegistration_Nokia_5gDu",
+        "vesEventListenerVersion": "7.0.1",
+        "sourceName": "NOK6061ZW9",
+        "nfNamingCode": "gNB"
+      },
+      "pnfRegistrationFields": {
+        "unitType": "val8",
+        "serialNumber": "6061ZW9",
+        "pnfRegistrationFieldsVersion": "2.0",
+        "manufactureDate": "1540212137393",
+        "modelNumber": "val6",
+        "lastServiceDate": "1540212137393",
+        "unitFamily": "BBU",
+        "vendorName": "Nokia",
+        "oamV4IpAddress": "val3",
+        "oamV6IpAddress": "val4",
+        "softwareVersion": "val7",
+        "additionalFields": {
+          "attachment-point": "bbs-link"
+        }
+      }
+    }
+  }
+]
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
index acaf78f..9914a7e 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -17,7 +17,7 @@
 ${CONSUL_SETUP_URL}    http://${CONSUL_SETUP}
 
 *** Test Cases ***
-Simple BBS case event
+BBS case event - attachment point
     [Documentation]    PRH get from DMaaP valid event with valid attachment point
     [Tags]    PRH    Valid event    Attachment point
     [Template]    Verify PNF ready sent and logical link created
@@ -52,3 +52,8 @@
     [Tags]    PRH    AAI not responding
     Verify AAI not responding is logged    ${TEST_CASES_DIR}/aai-not-responding
 
+BBS case event - Re-registration
+    [Documentation]    After regitered PNF, PRH reads another one PRH event with registration event
+    [Tags]    PRH    Valid event    Re registraiton
+    [Template]    Verify PNF re registration
+    ${TEST_CASES_DIR}/re-registration
\ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
index 482a6ee..86c1095 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -54,6 +54,13 @@
     Check PRH log    connection timed out: aai    Host is unreachable: aai
     Ensure Container Is Running   aai_simulator
 
+Verify PNF re registration
+    [Timeout]    100s
+    [Arguments]    ${test_case_directory}
+    ${expected_logical_link}=    Get Data From File    ${test_case_directory}/expected-logical-link.json
+    Verify PNF ready sent    ${test_case_directory}
+    Check recorded Logical Link    ${expected_logical_link}
+
 Check CBS ready
     ${resp}=    Get Request    ${consul_setup_session}    /v1/catalog/services
     Should Be Equal As Strings    ${resp.status_code}    200
@@ -130,4 +137,4 @@
 
 Create headers
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
-    Set Suite Variable    ${suite_headers}    ${headers}
+    Set Suite Variable    ${suite_headers}    ${headers}
\ No newline at end of file