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 raised by NTS
7 ... received by SDNR via netconf
10 Library ConnectLibrary
11 Library SDNCBaseLibrary
12 Library SDNCRestconfLibrary
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} DEFINE_IN_INIT
27 ${HOST} ${NETWORK_FUNCTIONS}[${DEVICE_TYPE}][NETCONF_HOST]
28 ${PORT} ${NETWORK_FUNCTIONS}[${DEVICE_TYPE}][BASE_PORT]
29 ${USERNAME} ${NETWORK_FUNCTIONS}[${DEVICE_TYPE}][USER]
30 ${PASSWORD} ${NETWORK_FUNCTIONS}[${DEVICE_TYPE}][PASSWORD]
31 ${HOST_NOK} 192.168.240.240
33 ${USERNAME_NOK} wrong-username
34 ${PASSWORD_NOK} wrong-password
35 ${CORE_MODEL} Unsupported
36 ${UNDEFINED} undefined
38 ${TIME_PERIOD_SEND_NOTIF} 22s
39 &{ALARM_SEVERITY_DEFAULT} Critical=${0} Major=${0} Minor=${0} Warning=${0} NonAlarmed=${0}
45 [Documentation] configure NTS manager to support restconf registration
46 Add Network Element Connection device_name=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} is_required=${True}
47 ... host=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['IP']} port=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PORT']}
48 ... username=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['USER']} password=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PASSWORD']}
49 ... check_connection_status=Connected
50 SDNCRestconfLibrary.Should Be Equal Connection Status Until Time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} Connected
52 Set alarm notification
54 NTSimManagerNG.clear_alarm_count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
55 NTSimManagerNG.Set Netconf Config Nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} faults-enabled=${True}
56 ${vesAlarmGenerated} = NTSimManagerNG.Get Alarm Count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
57 Sleep 1s reason=insert time gap in log files
58 ${start_time} = Get Current Date time_zone=UTC result_format=%Y-%m-%dT%H:%M:%S.%f
59 Sleep 1s reason=insert time delay to account for time differences of container and host
60 Set Global Variable ${start_time}
61 ${current_problem_list}= FaultManagementApp.Get Current Problem List
62 Log ${current_problem_list}
63 ${alarm_status_start} = FaultManagementApp.get_alarm_status
64 Set Global Variable ${alarm_status_start}
65 NTSimManagerNG.set_fault_delay_list_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} delay-period=${fault_delay}
67 Log Send notification every ${FAULT_DELAY} sec for ${TIME_PERIOD_SEND_NOTIF} level=INFO html=False console=True repr=False
68 Sleep ${TIME_PERIOD_SEND_NOTIF}
70 UnSet alarm notification
71 [Documentation] stops alarm generation and create dictionary ${netconfAlarmGenerated}
72 ... for further checks
74 ${netconfAlarmGenerated} = NTSimManagerNG.Get Alarm Count ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
75 NTSimManagerNG.set_fault_delay_list_nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} delay-period=${0}
76 NTSimManagerNG.Set Netconf Config Nf ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} faults-enabled=${False}
77 # get generated alarms
78 ${alarmsGenerated} = Get Dictionary Values ${netconfAlarmGenerated}
79 Log ${alarmsGenerated}
80 ${numAlarmsGenerated} = evaluate sum(${alarmsGenerated})
81 Log ${numAlarmsGenerated}
82 Should Not Be Equal As Integers ${numAlarmsGenerated} 0 msg=no alarm notifications generated
83 Set Global Variable ${netconfAlarmGenerated}
89 ${alarm_log_list} = FaultManagementApp.get_alarm_log_list source-type=Netconf
90 ... timestamp=>=${start_time}
91 ... node-id=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
92 ${alarm_log_list_stats} = get_counts_from_list ${alarm_log_list} severity ${ALARM_SEVERITY_DEFAULT}
93 Log Dictionary ${alarm_log_list_stats}
94 ${alarm_log_list_debug} = FaultManagementApp.get_alarm_log_list source-type=Netconf
95 Log ${alarm_log_list_debug}
96 ${alarm_log_list_debug_backend} = FaultManagementAppBackend.get_alarm_log_list source-type=Netconf
97 ... timestamp=>=${start_time}
98 Log ${alarm_log_list_debug_backend}
100 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Critical ${netconfAlarmGenerated}[critical]
101 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Major ${netconfAlarmGenerated}[major]
102 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Minor ${netconfAlarmGenerated}[minor]
103 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} Warning ${netconfAlarmGenerated}[warning]
104 Run Keyword And Continue On Failure Dictionary Should Contain Item ${alarm_log_list_stats} NonAlarmed ${netconfAlarmGenerated}[normal]
106 Verify current problem list
108 # fails immediatly if netconfAlarmGenerated is not set
109 Log ${netconfAlarmGenerated}
110 ${alarm_log_list} = FaultManagementApp.get_alarm_log_list timestamp=>=${start_time}
111 ${current_problem_list_calculated}= FaultManagementApp.calculate_current_alarm_list ${alarm_log_list}
112 Log ${current_problem_list_calculated}
113 ${current_problem_list}= FaultManagementApp.get_current_problem_list timestamp=>=${start_time}
114 Log ${current_problem_list}
115 ${current_problem_list_debug}= FaultManagementApp.get_current_problem_list
116 Log ${current_problem_list_debug}
117 ${current_problem_list_debug_backend}= FaultManagementAppBackend.get_current_problem_list timestamp=>=${start_time}
118 Log ${current_problem_list_debug_backend}
119 ${current_problem_list_calculated_stats} = get_counts_from_list ${current_problem_list_calculated} severity ${ALARM_SEVERITY_DEFAULT}
120 ${current_problem_list_stats} = get_counts_from_list ${current_problem_list} severity ${ALARM_SEVERITY_DEFAULT}
121 Log Dictionary ${current_problem_list_calculated_stats}
122 Log Dictionary ${current_problem_list_stats}
123 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Critical ${current_problem_list_calculated_stats}[Critical]
124 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Major ${current_problem_list_calculated_stats}[Major]
125 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Minor ${current_problem_list_calculated_stats}[Minor]
126 Run Keyword And Continue On Failure Dictionary Should Contain Item ${current_problem_list_stats} Warning ${current_problem_list_calculated_stats}[Warning]
128 Verify alarm status bar
130 Sleep 10s reason=wait update alarmstatus
131 ${alarm_status_end} = FaultManagementApp.get_alarm_status
132 Log Dictionary ${alarm_status_start}
133 Log Dictionary ${alarm_status_end}
134 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[criticals]-${alarm_status_start}[criticals] == ${netconfAlarmGenerated}[critical]
135 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[majors]-${alarm_status_start}[majors] == ${netconfAlarmGenerated}[major]
136 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[minors]-${alarm_status_start}[minors] == ${netconfAlarmGenerated}[minor]
137 Run Keyword And Continue On Failure Evaluate ${alarm_status_end}[warnings]-${alarm_status_start}[warnings] == ${netconfAlarmGenerated}[warning]
139 Remove networkelement connection
140 ConnectApp.Remove network element connection ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
141 Run Keyword And Continue On Failure ConnectApp.Should be equal connection status until time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} not existing
142 SDNCRestconfLibrary.Should Be Equal Connection Status Until Time ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']} not existing