metal/mtce/src/hwmon/hwmonAlarm.h
Jim Gauld 6a5e10492c Decouple Guest-server/agent from stx-metal
This decouples the build and packaging of guest-server, guest-agent from
mtce, by splitting guest component into stx-nfv repo.

This leaves existing C++ code, scripts, and resource files untouched,
so there is no functional change. Code refactoring is beyond the scope
of this update.

Makefiles were modified to include devel headers directories
/usr/include/mtce-common and /usr/include/mtce-daemon.
This ensures there is no contamination with other system headers.

The cgts-mtce-common package is renamed and split into:
- repo stx-metal: mtce-common, mtce-common-dev
- repo stx-metal: mtce
- repo stx-nfv: mtce-guest
- repo stx-ha: updates package dependencies to mtce-pmon for
  service-mgmt, sm, and sm-api

mtce-common:
- contains common and daemon shared source utility code

mtce-common-dev:
- based on mtce-common, contains devel package required to build
  mtce-guest and mtce
- contains common library archives and headers

mtce:
- contains components: alarm, fsmon, fsync, heartbeat, hostw, hwmon,
  maintenance, mtclog, pmon, public, rmon

mtce-guest:
- contains guest component guest-server, guest-agent

Story: 2002829
Task: 22748

Change-Id: I9c7a9b846fd69fd566b31aa3f12a043c08f19f1f
Signed-off-by: Jim Gauld <james.gauld@windriver.com>
2018-09-18 17:15:08 -04:00

91 lines
3.7 KiB
C++

#ifndef __HWMONALARM_H__
#define __HWMONALARM_H__
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGTS Platform Maintenance 'Alarm' Header
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <list>
using namespace std;
#include "alarmUtil.h"
#include "hwmon.h"
// #include "fmAPI.h"
typedef enum
{
HWMON_ALARM_ID__SENSOR = 0,
HWMON_ALARM_ID__SENSORCFG = 1,
HWMON_ALARM_ID__SENSORGROUP = 2,
HWMON_ALARM_ID__LAST = 3
} hwmonAlarm_id_type ;
typedef struct
{
string entity ;
string instance ;
EFmAlarmSeverityT severity ;
} hwmonAlarm_entity_status_type ;
#define REASON_SUPPRESSED ((const char *)"is 'suppressed'")
#define REASON_UNSUPPRESSED ((const char *)"is 'unsuppressed'")
#define REASON_OK ((const char *)"is 'ok'")
#define REASON_DEGRADED ((const char *)"is 'degraded'")
#define REASON_DEPROVISIONED ((const char *)"is 'deprovisioned'")
#define REASON_IGNORED ((const char *)"is 'ignored'")
#define REASON_OOT ((const char *)"is 'out-of-tolerance'")
#define REASON_SET_TO_ALARM ((const char *)"is 'set to alarm'")
#define REASON_SET_TO_LOG ((const char *)"is 'set to log'")
#define REASON_SET_TO_POWERCYCLE ((const char *)"is 'set to powercycle'")
#define REASON_SET_TO_RESET ((const char *)"is 'set to reset'")
#define REASON_SET_TO_IGNORE ((const char *)"is 'set to ignore'")
#define REASON_RESETTING ((const char *)"is 'resetting'")
#define REASON_POWERCYCLING ((const char *)"is 'power-cycling'")
#define REASON_OFFLINE ((const char *)"is 'offline'")
#define REASON_ONLINE ((const char *)"is 'online'")
int hwmon_alarm_util ( string & hostname,
hwmonAlarm_id_type id,
EFmAlarmStateT state,
EFmAlarmSeverityT severity,
string & sub_entity ,
string reason );
/* Clear the specified maintenance alarm for specific host */
int hwmonAlarm_clear ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonAlarm_critical ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonAlarm_major ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonAlarm_minor ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonAlarm_warning ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonLog_clear ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonLog_critical ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonLog_major ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonLog_minor ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
int hwmonLog_warning ( string & hostname, hwmonAlarm_id_type id, string sub_entity, string reason );
/* generate a customer log for the specified severity */
int hwmonLog ( string & hostname, hwmonAlarm_id_type id, EFmAlarmSeverityT sev, string sub_entity, string reason );
/* Utility will init the alarm and return the severity if it is currently asserted */
EFmAlarmSeverityT hwmon_alarm_query ( string & hostname, hwmonAlarm_id_type id, string & sensorname );
int hwmonAlarm_query_entity ( string & hostname, string & entity, list<hwmonAlarm_entity_status_type> & alarm_list );
#endif /* __HWMONALARM_H__ */