Merge "SO Support for new AAI certificate"
[integration.git] / test / csit / tests / dcaegen2 / testcases / dcae_ves.robot
1 *** Settings ***
2 Documentation     Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios
3 Library           RequestsLibrary   
4 Library           OperatingSystem
5 Library           Collections
6 Library           DcaeLibrary
7 Resource          resources/dcae_keywords.robot
8 Test Setup        Cleanup VES Events
9 Suite Setup       VES Collector Suite Setup DMaaP
10 Suite Teardown    VES Collector Suite Shutdown DMaaP    
11
12 *** Variables ***
13 ${VESC_URL_HTTPS}                        https://%{VESC_IP}:8443
14 ${VESC_URL}                              http://%{VESC_IP}:8080 
15 ${VES_ANY_EVENT_PATH}                    /eventListener/v5
16 ${VES_BATCH_EVENT_PATH}                  /eventListener/v5/eventBatch
17 ${VES_THROTTLE_STATE_EVENT_PATH}         /eventListener/v5/clientThrottlingState
18 ${HEADER_STRING}                         content-type=application/json
19 ${EVENT_DATA_FILE}                       %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json
20 ${EVENT_MEASURE_FILE}                    %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json
21 ${EVENT_DATA_FILE_BAD}                   %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json
22 ${EVENT_BATCH_DATA_FILE}                 %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json
23 ${EVENT_THROTTLING_STATE_DATA_FILE}      %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json
24 ${EVENT_PNF_REGISTRATION}               %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json
25
26 #DCAE Health Check
27 ${CONFIG_BINDING_URL}                    http://localhost:8443
28 ${CB_HEALTHCHECK_PATH}                   /healthcheck
29 ${CB_SERVICE_COMPONENT_PATH}             /service_component/
30 ${VES_Service_Name1}                     dcae-controller-ves-collector
31 ${VES_Service_Name2}                     ves-collector-not-exist
32
33 *** Test Cases ***    
34 VES Collector Health Check
35     [Tags]    DCAE-VESC-R1
36     [Documentation]   Ves Collector Health Check
37     ${uuid}=    Generate UUID
38     ${session}=    Create Session       dcae    ${VESC_URL}
39     ${headers}=  Create Dictionary     Accept=*/*     X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
40     ${resp}=    Get Request     dcae    /healthcheck        headers=${headers}
41     Should Be Equal As Strings  ${resp.status_code}     200  
42
43 Publish Single VES VoLTE Fault Event
44     [Tags]    DCAE-VESC-R1
45     [Documentation]   Post single event and expect 200 Response 
46     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
47     ${headers}=   Create Header From String    ${HEADER_STRING}
48     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
49     Log    Receive HTTP Status code ${resp.status_code}
50     Should Be Equal As Strings  ${resp.status_code}     200
51     ${isEmpty}=   Is Json Empty    ${resp}
52     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
53     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546015
54     Should Be Equal As Strings    ${ret}    true
55
56 Publish Single VES VNF Measurement Event
57     [Tags]    DCAE-VESC-R1
58     [Documentation]   Post single event and expect 200 Response 
59     ${evtdata}=   Get Event Data From File   ${EVENT_MEASURE_FILE}
60     ${headers}=   Create Header From String    ${HEADER_STRING}
61     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}   ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
62     Log    Receive HTTP Status code ${resp.status_code}
63     Should Be Equal As Strings  ${resp.status_code}     200
64     ${isEmpty}=   Is Json Empty    ${resp}
65     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
66     ${ret}=  DMaaP Message Receive    0b2b5790-3673-480a-a4bd-5a00b88e5af6
67     Should Be Equal As Strings    ${ret}    true
68
69 Publish VES VoLTE Fault Batch Events
70     [Tags]    DCAE-VESC-R1
71     [Documentation]   Post batched events and expect 200 Response 
72     ${evtdata}=   Get Event Data From File   ${EVENT_BATCH_DATA_FILE}
73     ${headers}=   Create Header From String    ${HEADER_STRING}
74     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_BATCH_EVENT_PATH}  ${headers}  ${evtdata}
75     Should Be Equal As Strings  ${resp.status_code}     200
76     #${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546016
77     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546025
78     Should Be Equal As Strings    ${ret}    true      
79     
80 Publish Single VES VoLTE Fault Event With Bad Data
81     [Tags]    DCAE-VESC-R1
82     [Documentation]    Run with JSON Envent with missing comma to expect 400 response
83     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE_BAD}
84     ${headers}=   Create Header From String    ${HEADER_STRING}  
85     Log   Send HTTP Request with invalid Json Event Data
86     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
87     Log    Receive HTTP Status code ${resp.status_code}
88     Should Be Equal As Strings  ${resp.status_code}     400
89     ${isEmpty}=   Is Json Empty    ${resp}
90     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
91     
92 Publish VES Event With Invalid Method
93     [Tags]    DCAE-VESC-R1
94     [Documentation]    Use invalid Put instead of Post method to expect 405 response
95     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
96     ${headers}=   Create Header From String    ${HEADER_STRING}
97     Log   Send HTTP Request with invalid method Put instead of Post
98     ${resp}=  Publish Event To VES Collector With Put Method No Auth  ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
99     Log    Receive HTTP Status code ${resp.status_code}
100     Should Be Equal As Strings  ${resp.status_code}     404 
101     
102 Publish VES Event With Invalid URL Path
103     [Tags]    DCAE-VESC-R1
104     [Documentation]    Use invalid url path to expect 404 response
105     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
106     ${headers}=   Create Header From String    ${HEADER_STRING}
107     Log   Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path
108     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  /listener/v5/  ${headers}  ${evtdata}
109     Log    Receive HTTP Status code ${resp.status_code}
110     Should Be Equal As Strings  ${resp.status_code}     404    
111     
112 #Enable VESC HTTPS And Basic Auth
113     #[Tags]    DCAE-VESC-R1
114     #[Documentation]    Enable VESC Https and Authentication, Disable Http and Run Health Check
115     #Enable VESC Https Auth
116     #
117     #${auth}=  Create List  ${VESC_HTTPS_USER}   ${VESC_HTTPS_PD}
118     #${session}=    Create Session      dcaegen2-r1     ${VESC_URL_HTTPS}    auth=${auth}   disable_warnings=1
119     #${headers}=  Create Dictionary     Accept=*/*    X-FromAppId=${GLOBAL_APPLICATION_ID}
120     #${resp}=   Get Request     dcaegen2-r1     /healthcheck        headers=${headers}
121     #Should Be Equal As Strings         ${resp.status_code}     200
122
123 Publish Single VES Fault Event Over HTTPS
124     [Tags]    DCAE-VESC-R1
125     [Documentation]   Post single event and expect 200 Response 
126     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
127     ${headers}=   Create Header From String    ${HEADER_STRING}
128     Log  Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD}
129     ${resp}=  Publish Event To VES Collector    ${VESC_URL_HTTPS}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}  sample1  sample1
130     Log    Receive HTTP Status code ${resp.status_code}
131     Should Be Equal As Strings  ${resp.status_code}     200
132     ${isEmpty}=   Is Json Empty    ${resp}
133     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
134     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546015
135     Should Be Equal As Strings    ${ret}    true 
136     
137 Publish Single VES Measurement Event Over HTTPS
138     [Tags]    DCAE-VESC-R1
139     [Documentation]   Post single event and expect 200 Response 
140     ${evtdata}=   Get Event Data From File   ${EVENT_MEASURE_FILE}
141     ${headers}=   Create Header From String    ${HEADER_STRING}
142     ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
143     Log    Receive HTTP Status code ${resp.status_code}
144     Should Be Equal As Strings  ${resp.status_code}     200
145     ${isEmpty}=   Is Json Empty    ${resp}
146     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
147     ${ret}=  DMaaP Message Receive    0b2b5790-3673-480a-a4bd-5a00b88e5af6
148     Should Be Equal As Strings    ${ret}    true
149
150 Publish VES Fault Batch Events Over HTTPS
151     [Tags]    DCAE-VESC-R1
152     [Documentation]   Post batched events and expect 202 Response 
153     ${evtdata}=   Get Event Data From File   ${EVENT_BATCH_DATA_FILE}
154     ${headers}=   Create Header From String    ${HEADER_STRING}
155     ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  ${VES_BATCH_EVENT_PATH}  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
156     Should Be Equal As Strings  ${resp.status_code}     200
157     #${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546016
158     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546025
159     Should Be Equal As Strings    ${ret}    true
160
161 Publish VES Event With Invalid URL Path HTTPS
162     [Tags]    DCAE-VESC-R1
163     [Documentation]    Use invalid url path to expect 404 response
164     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
165     ${headers}=   Create Header From String    ${HEADER_STRING}
166     Log   Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path
167     ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  /eventlistener/v5  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
168     Log    Receive HTTP Status code ${resp.status_code}
169     Should Be Equal As Strings  ${resp.status_code}     404
170     
171 Publish PNF Registration Event  
172     [Tags]    DCAE-VESC-R1
173     [Documentation]   Post PNF registration event and expect 200 Response 
174     ${evtdata}=   Get Event Data From File   ${EVENT_PNF_REGISTRATION}
175     ${headers}=   Create Header From String    ${HEADER_STRING}
176     ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
177     Log    Receive HTTP Status code ${resp.status_code}
178     Should Be Equal As Strings  ${resp.status_code}     200
179     ${isEmpty}=   Is Json Empty    ${resp}
180     Run Keyword If   '${isEmpty}' == False   Log  ${resp.json()}
181     ${ret}=  DMaaP Message Receive    QTFCOC540002E-reg
182     Should Be Equal As Strings    ${ret}    true
183