2 Documentation Connects NTSim of specific device type
3 ... NTSim information are stored in test environment variable file <environment>
4 ... as dictionary NETWORK_FUNCTIONS = {}
5 ... change device type on command line with e.g. --variable DEVICE_TYPE:O_RAN_FH
6 ... Enable alarms by setting fault-notification-delay-period and validate the alarms published by NTSim
7 ... received by SDNR via VES use case
10 Library ConnectLibrary
11 Library SDNCRestconfLibrary
12 Library SDNCBaseLibrary
14 Library NTSimManagerNG
15 Library FaultManagementApp
16 Library FaultManagementAppBackend
21 Suite Setup global suite setup &{GLOBAL_SUITE_SETUP_CONFIG}
22 Suite Teardown global suite teardown
26 ${DEVICE_TYPE} _FILL_HERE_
28 ${TIME_PERIOD_SEND_NOTIFY} 22s
29 ${PROCESS_TIME_NOTIF} 30s
30 &{ALARM_SEVERITY_DEFAULT} Critical=${0} Major=${0} Minor=${0} Warning=${0} NonAlarmed=${0}
36 [Documentation] add network function to trigger alarm notification via VES in next tests
37 Add Network Element Connection device_name=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} is_required=${True}
38 ... host=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['IP']} port=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PORT']}
39 ... username=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['USER']} password=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PASSWORD']}
40 ... check_connection_status=Connected
41 SDNCRestconfLibrary.Should Be Equal Connection Status Until Time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} Connected
43 Set alarm notification
45 NTSimManagerNG.clear_alarm_count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
46 NTSimManagerNG.set_ves_config_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} faults-enabled=${True}
47 ${vesAlarmGenerated} = NTSimManagerNG.Get Alarm Count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
48 Sleep 1s reason=insert time gap in log files
49 ${start_time} = Get Current Date time_zone=UTC result_format=%Y-%m-%dT%H:%M:%S.%f
50 Sleep 1s reason=insert time delay to account for time differences of container and host
51 Set Global Variable ${start_time}
52 ${alarm_status_start} = FaultManagementApp.get_alarm_status
53 Set Global Variable ${alarm_status_start}
54 NTSimManagerNG.set_fault_delay_list_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} delay-period=${fault_delay}
55 Log Send notification every ${FAULT_DELAY} sec for ${TIME_PERIOD_SEND_NOTIFY} level=INFO console=True
56 Sleep ${TIME_PERIOD_SEND_NOTIFY}
58 UnSet alarm notification
59 [Documentation] stops alarm generation and create dictionary ${vesAlarmGenerated}
60 ... for further checks
62 NTSimManagerNG.set_fault_delay_list_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} delay-period=${0}
63 #NTSimManagerNG.set_ves_config_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
64 #... faults-enabled=${False}
65 Log Wait ${PROCESS_TIME_NOTIF} to process notifications level=INFO console=True
66 Sleep ${PROCESS_TIME_NOTIF}
67 # get generated alarms
68 ${vesAlarmGenerated} = NTSimManagerNG.Get Alarm Count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
69 ${alarmsGenerated} = Get Dictionary Values ${vesAlarmGenerated}
70 Log ${alarmsGenerated}
71 ${numAlarmsGenerated} = evaluate sum(${alarmsGenerated})
72 Log ${numAlarmsGenerated}
73 Should Not Be Equal As Integers ${numAlarmsGenerated} 0 msg=no alarm notifications generated
74 Set Global Variable ${vesAlarmGenerated}
78 [Documentation] NTSim sends alarm notification for all simulated devices
79 ... Verification is done for all simulated devices of the simulator
82 @{pnf_list}= NTSimManagerNG.get_simulated_pnfs_nf_as_node_id_list ${DEVICE_TYPE}
83 ${length} = Get Length ${pnf_list}
84 Should Not Be Equal As Integers ${length} 0 msg=No network functions created
85 Log to console ${pnf_list}
86 FOR ${device} IN @{pnf_list}
87 ${alarm_log_list_debug_backend} = FaultManagementAppBackend.get_alarm_log_list source-type=Ves
88 ... timestamp=>=${start_time}
90 Log ${alarm_log_list_debug_backend}
91 ${alarm_log_list} = FaultManagementApp.get_alarm_log_list source-type=Ves
92 ... timestamp=>=${start_time}
94 ${alarm_log_list_stats} = get_counts_from_list ${alarm_log_list} severity ${ALARM_SEVERITY_DEFAULT}
95 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Critical ${vesAlarmGenerated}[critical] msg=Value of dictionary key 'Critical' does not match not match expected value '${vesAlarmGenerated}[critical]'. Current: ${alarm_log_list_stats["Critical"]}
96 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Major ${vesAlarmGenerated}[major] msg=Value of dictionary key 'Critical' does not match not match expected value '${vesAlarmGenerated}[major]'. Current: ${alarm_log_list_stats["Major"]}
97 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Minor ${vesAlarmGenerated}[minor] msg=Value of dictionary key 'Critical' does not match not match expected value '${vesAlarmGenerated}[minor]'. Current: ${alarm_log_list_stats["Minor"]}
98 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Warning ${vesAlarmGenerated}[warning] msg=Value of dictionary key 'Critical' does not match not match expected value '${vesAlarmGenerated}[warning]'. Current: ${alarm_log_list_stats["Warning"]}
99 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} NonAlarmed ${vesAlarmGenerated}[normal] msg=Value of dictionary key 'Critical' does not match not match expected value '${vesAlarmGenerated}[normal]'. Current: ${alarm_log_list_stats["NonAlarmed"]}
102 Verify current problem list
104 ${alarm_log_list} = FaultManagementApp.get_alarm_log_list timestamp=>=${start_time}
105 ${current_problem_list_calculated}= FaultManagementApp.calculate_current_alarm_list ${alarm_log_list}
106 Log ${current_problem_list_calculated}
107 ${current_problem_list}= FaultManagementApp.get_current_problem_list timestamp=>=${start_time}
108 Log ${current_problem_list}
109 ${current_problem_list_debug}= FaultManagementApp.get_current_problem_list
110 Log ${current_problem_list_debug}
111 ${current_problem_list_debug_backend}= FaultManagementAppBackend.get_current_problem_list timestamp=>=${start_time}
112 Log ${current_problem_list_debug_backend}
113 ${current_problem_list_calculated_stats}= get_counts_from_list ${current_problem_list_calculated} severity ${ALARM_SEVERITY_DEFAULT}
114 ${current_problem_list_stats}= get_counts_from_list ${current_problem_list} severity ${ALARM_SEVERITY_DEFAULT}
115 Log Dictionary ${current_problem_list_calculated_stats}
116 Log Dictionary ${current_problem_list_stats}
117 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Critical ${current_problem_list_calculated_stats}[Critical]
118 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Major ${current_problem_list_calculated_stats}[Major]
119 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Minor ${current_problem_list_calculated_stats}[Minor]
120 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Warning ${current_problem_list_calculated_stats}[Warning]
122 Verify alarm status bar
124 Sleep 10s reason=wait update alarmstatus
125 ${alarm_status_end} = FaultManagementApp.get_alarm_status
126 Log Dictionary ${alarm_status_start}
127 Log Dictionary ${alarm_status_end}
128 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[criticals]-${alarm_status_start}[criticals] == ${vesAlarmGenerated}[critical]
129 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[majors]-${alarm_status_start}[majors] == ${vesAlarmGenerated}[major]
130 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[minors]-${alarm_status_start}[minors] == ${vesAlarmGenerated}[minor]
131 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[warnings]-${alarm_status_start}[warnings] == ${vesAlarmGenerated}[warning]
133 Remove networkelement connection
134 ConnectApp.Remove network element connection ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
135 Run Keyword And Continue On Failure ConnectApp.Should be equal connection status until time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} not existing
136 SDNCRestconfLibrary.Should Be Equal Connection Status Until Time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} not existing