Added 4 new TC
[integration.git] / test / csit / tests / dcaegen2 / prh_testcases / prh_tests.robot
1 *** Settings ***
2 Library           RequestsLibrary
3
4 *** Variables ***
5 ${DMAAP_SIM_URL}    http://${DMAAP_SIMULATOR}
6 ${AAI_SIM_URL}    http://${AAI_SIMULATOR}
7 ${PRH_URL}        http://${PRH}
8
9 *** Test Cases ***
10 Getting and Consuming Positive Scenario
11     [Documentation]    Get message from new topic and consume it - positive scenarios
12     [Tags]    PRH
13     [Setup]    Start prh
14     [Template]    Run Getting and Consuming
15     [Timeout]
16     {"pnfName":"NOKQTFCOC540002E","ipv4":"10.16.123.234","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}    NOKQTFCOC540002E    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002E", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002E-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002E", "pnfManufactureDate":1516406400}}}
17     {"pnfName":"NOKQTFCOC540002F","ipv4":"","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}    NOKQTFCOC540002F    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002F", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002F-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002F", "pnfManufactureDate":1516406400}}}
18     {"pnfName":"NOKQTFCOC540002G","ipv4":"10.16.123.234","ipv6":""}    NOKQTFCOC540002G    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002G", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002G-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002G", "pnfManufactureDate":1516406400}}}
19     {"pnfName":"ERIQTFCOC5400000","ipv4":"10.16.123.23","ipv6":""}    ERIQTFCOC5400000    {"event": {"commonEventHeader": {"sourceId":"QTFCOC5400000", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC5400000-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Ericsson", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.23", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC5400000", "pnfManufactureDate":1516406400}}}
20     [Teardown]    Stop prh
21
22 *** Keywords ***
23 Run Getting and Consuming
24     [Arguments]    ${posted_event_to_dmaap}    ${pnfs_name}    ${event_in_dmaap}
25     [Timeout]    1 minutes
26     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
27     Set pnfs name in AAI    ${pnfs_name}
28     Set get event in DMAAP    ${event_in_dmaap}    ${headers}
29     : FOR    ${Index}    IN RANGE    1    30
30     \    Create Session    prh_ready    ${DMAAP_SIM_URL}
31     \    ${resp}=    Get Request    prh_ready    /events/pnfReady    headers=${headers}
32     \    Exit For Loop If    '${resp.text}' == '${posted_event_to_dmaap}'
33     \    Sleep    1s
34     Should Be Equal    ${resp.text}    ${posted_event_to_dmaap}
35
36 Start prh
37     [Timeout]    1 minute
38     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
39     Create Session    prh_start    ${PRH_URL}
40     ${resp}=    Get Request    prh_start    /start    headers=${headers}
41     Should Be Equal    ${resp.text}    "PRH Service has been started!"
42
43 Stop prh
44     [Timeout]    1 minute
45     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
46     Create Session    prh_stop    ${PRH_URL}
47     ${resp}=    Get Request    prh_stop    /stopPrh    headers=${headers}
48     Should Be Equal    ${resp.text}    "PRH Service has already been stopped!"
49
50 Set pnfs name in AAI
51     [Arguments]    ${pnfs_name}
52     [Timeout]    1 minute
53     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=text/html
54     Create Session    set_pnfs_in_aai    ${AAI_SIM_URL}
55     ${resp}=    Put Request    set_pnfs_in_aai    /set_pnfs    headers=${headers}    data=${pnfs_name}
56     Should Be Equal As Strings    ${resp.status_code}    200
57     Log To Console    ${resp.text}
58
59 Set get event in DMAAP
60     [Arguments]    ${event_in_dmaap}    ${headers}
61     [Timeout]    1 minute
62     Create Session    set_get_event    ${DMAAP_SIM_URL}
63     ${resp}=    Put Request    set_get_event    /set_get_event    headers=${headers}    data=${event_in_dmaap}
64     Should Be Equal As Strings    ${resp.status_code}    200
65     Log To Console    ${resp.text}