X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Finc%2Futils%2Futils.h;fp=ntsimulator%2Finc%2Futils%2Futils.h;h=0000000000000000000000000000000000000000;hb=f1d5c9198acde7a7ce296490087cad37e008f688;hp=61ce1e35a4ef3cf0eec2cef0e02a9b2800991b6a;hpb=f2d8f1002fa93848c80a88e5658db4816cba3020;p=sim%2Fo1-interface.git diff --git a/ntsimulator/inc/utils/utils.h b/ntsimulator/inc/utils/utils.h deleted file mode 100644 index 61ce1e3..0000000 --- a/ntsimulator/inc/utils/utils.h +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* -* -* Copyright 2019 highstreet technologies GmbH and others -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -***************************************************************************/ - -#ifndef EXAMPLES_NTSIMULATOR_UTILS_H_ -#define EXAMPLES_NTSIMULATOR_UTILS_H_ - -#include "sysrepo.h" -#include "sysrepo/values.h" -#include "sysrepo/xpath.h" - -#include -#include -#include -#include -#include - -#define TRUE 1 -#define FALSE 0 - -#define NETCONF_CONNECTIONS_PER_DEVICE (getSshConnectionsFromConfigJson() + getTlsConnectionsFromConfigJson()) -#define SSH_CONNECTIONS_PER_DEVICE getSshConnectionsFromConfigJson() -#define TLS_CONNECTIONS_PER_DEVICE getTlsConnectionsFromConfigJson() - -#define PREPARE_ADD_NEW_VALUE(v, num) {\ - num++;\ - } - -#define CREATE_NEW_VALUE(rc, v, num) {\ - rc = sr_realloc_values(num, num+1, &v);\ - if (SR_ERR_OK != rc) {\ - return rc;\ - }\ - num++;\ - } - -typedef struct -{ - int normal; - int warning; - int minor; - int major; - int critical; -} counterAlarms; - -void set_curl_common_info_ves(CURL *curl); - -long random_at_most(long max); -void getCurrentDateAndTime(char *date_and_time); -int getSecondsFromLastQuarterInterval(void); -int getSecondsFromLastDayInterval(void); -void getPreviousQuarterInterval(int number_of_intervals, char *date_and_time); -void getPreviousDayPmTimestamp(int number_of_intervals, char *date_and_time); -long int getMicrosecondsSinceEpoch(void); -void prepare_ves_message_curl(CURL *curl); - -cJSON* vesCreateCommonEventHeader(char *domain, char *event_type, char *source_name, int seq_id); -cJSON* vesCreateHeartbeatFields(int heartbeat_interval); -cJSON* vesCreatePnfRegistrationFields(int port, bool is_tls); -cJSON* vesCreateFaultFields(char *alarm_condition, char *alarm_object, char *severity, char *date_time, char *specific_problem); - -char* readConfigFileInString(void); -void writeConfigFile(char *config); -int writeSkeletonConfigFile(void); - -int getFaultNotificationDelayPeriodFromConfigJson(int *period_array, int *count); -int getVesHeartbeatPeriodFromConfigJson(void); -char* getVesAuthMethodFromConfigJson(void); -char* getVesIpFromConfigJson(void); -char* getVesUsernameFromConfigJson(void); -char* getVesPasswordFromConfigJson(void); -int getVesPortFromConfigJson(void); -int getVesRegistrationFromConfigJson(void); -int getNetconfAvailableFromConfigJson(void); -int getVesAvailableFromConfigJson(void); -int getSshConnectionsFromConfigJson(void); -int getTlsConnectionsFromConfigJson(void); - -void generateRandomMacAddress(char *mac_address); - -int writeSkeletonStatusFile(void); -char* readStatusFileInString(void); - -int writeStatusNotificationCounters(counterAlarms ves_counter, counterAlarms netconf_counter); -void writeStatusFile(char *status); -int removeDeviceEntryFromStatusFile(char *deviceName); - -cJSON* getDeviceListFromStatusFile(void); -int compute_notifications_count(counterAlarms *ves_counter, counterAlarms *netconf_counter); -int getDeviceCounters(char *containerId, counterAlarms *ves_counter, counterAlarms *netconf_counter); - -int getIntFromString(char *string, int def_value); - -#endif /* EXAMPLES_NTSIMULATOR_UTILS_H_ */