X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Finc%2Futils%2Futils.h;h=6208600f92528aed93e7b783b26b9b0fc9a9184f;hb=610985b805c2b5c730bbc247ccbf76dd624792d0;hp=ceee1300f627a20542992437eb0881c74db13662;hpb=29ce368a8b49cb41f3a1640581ff9958ea50ad8c;p=sim%2Fo1-interface.git diff --git a/ntsimulator/inc/utils/utils.h b/ntsimulator/inc/utils/utils.h index ceee130..6208600 100644 --- a/ntsimulator/inc/utils/utils.h +++ b/ntsimulator/inc/utils/utils.h @@ -1,9 +1,19 @@ -/* - * utils.h - * - * Created on: Feb 19, 2019 - * Author: parallels - */ +/************************************************************************* +* +* 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_ @@ -35,6 +45,15 @@ 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); @@ -54,7 +73,7 @@ cJSON* vesCreateFaultFields(char *alarm_condition, char *alarm_object, char *sev char* readConfigFileInString(void); void writeConfigFile(char *config); -int getFaultNotificationDelayPeriodFromConfigJson(void); +int getFaultNotificationDelayPeriodFromConfigJson(int *period_array, int *count); int getVesHeartbeatPeriodFromConfigJson(void); char* getVesAuthMethodFromConfigJson(void); char* getVesIpFromConfigJson(void); @@ -65,4 +84,15 @@ int getVesAvailableFromConfigJson(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); + #endif /* EXAMPLES_NTSIMULATOR_UTILS_H_ */