Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event mgmt #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions models/yang/annotations/sonic-alarm-annot.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module sonic-alarm-annot {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All sonic yangs need to be in the buildimage folder.


yang-version "1";

namespace "http://openconfig.net/yang/annotation/sonic-alarm-annot";
prefix "salarm-annot";

import sonic-alarm { prefix salarm; }
import sonic-extensions { prefix sonic-ext; }

deviation /salarm:show-alarms {
deviate add {
sonic-ext:rpc-callback "rpc_get_alarms";
}
}
deviation /salarm:acknowledge-alarms {
deviate add {
sonic-ext:rpc-callback "rpc_acknowledge_alarms";
}
}

deviation /salarm:unacknowledge-alarms {
deviate add {
sonic-ext:rpc-callback "rpc_unacknowledge_alarms";
}
}

deviation /salarm:sonic-alarm/salarm:ALARM/salarm:ALARM_LIST {
deviate add {
sonic-ext:db-name "EVENT_DB";
}
}

deviation /salarm:sonic-alarm/salarm:ALARM_STATS/salarm:ALARM_STATS_LIST {
deviate add {
sonic-ext:db-name "EVENT_DB";
}
}
}
29 changes: 29 additions & 0 deletions models/yang/annotations/sonic-event-annot.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module sonic-event-annot {

yang-version "1";

namespace "http://openconfig.net/yang/annotation/sonic-event-annot";
prefix "sevent-annot";

import sonic-event { prefix sevent; }
import sonic-extensions { prefix sonic-ext; }

deviation /sevent:show-events {
deviate add {
sonic-ext:rpc-callback "rpc_get_events";
}
}

deviation /sevent:sonic-event/sevent:EVENT/sevent:EVENT_LIST {
deviate add {
sonic-ext:db-name "EVENT_DB";
}
}

deviation /sevent:sonic-event/sevent:EVENT_STATS/sevent:EVENT_STATS_LIST {
deviate add {
sonic-ext:db-name "EVENT_DB";
}
}

}
23 changes: 23 additions & 0 deletions models/yang/annotations/sonic-evprofile-annot.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module sonic-evprofile-annot {

yang-version "1";

namespace "http://openconfig.net/Azure/sonic-evprofile-annot";
prefix "evprofile-annot";

import sonic-extensions { prefix sonic-ext; }
import sonic-evprofile { prefix sep; }

deviation /sep:get-evprofile {
deviate add {
sonic-ext:rpc-callback "rpc_getevprofile_cb";
}
}

deviation /sep:set-evprofile {
deviate add {
sonic-ext:rpc-callback "rpc_setevprofile_cb";
}
}

}
283 changes: 283 additions & 0 deletions models/yang/sonic/sonic-alarm.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
module sonic-alarm {
namespace "http://github.com/Azure/sonic-alarm";
prefix salarm;
yang-version 1.1;


import ietf-yang-types {
prefix yang-types;
}

import sonic-event { prefix event;}

// meta
organization
"SONiC";

contact
"SONiC";

description
"This module defines operational state data for SONiC alarms.";

revision "2021-01-15" {
description
"Initial revision.";
}


grouping alarm-state {

leaf id {
type string;
description "Sequence identifier for an alarm.";
}

leaf resource {
type string;
description "The item that is under alarm within the device.";
}

leaf text {
type string;
description "Dynamic message raised with the alarm.";
}

leaf time-created {
type event:timeticks64;
description
"The time at which the alarm was raised by the system.
This value is expressed date-and-time format.";
}

leaf type-id {
type string;
description "Type of the alarm raised";
}

leaf severity {
type event:severity-type;
description
"Severity of a raised condition.";
}

leaf acknowledged {
type boolean;
description
"This denotes whether an alarm is acknowledged by the operator.
An acknowledged alarm is not considered in determining the
health of the system.";
}

leaf acknowledge-time {
type event:timeticks64;
description
"The time at which alarm is acknowledged by the system.
This value is expressed as nanoseconds since the Unix Epoch.";
}

}

container sonic-alarm {

container ALARM {

list ALARM_LIST {
key "id";
uses alarm-state;
}
}

container ALARM_STATS {


list ALARM_STATS_LIST {

key "id";
leaf id {
type enumeration {
enum state;
}
description
"Table identifier value defined as state.";
}

leaf alarms {
type uint64;
description
"Total alarms in the system.";
}

leaf critical {
type uint64;
description
"Total critical alarms in the system.";
}

leaf major {
type uint64;
description
"Total major alarms in the system.";
}

leaf minor {
type uint64;
description
"Total minor alarms in the system.";
}

leaf warning {
type uint64;
description
"Total warnings in the system.";
}

leaf acknowledged {
type uint64;
description
"Total acknowledged alarms in the system.";
}

}
}
}

rpc acknowledge-alarms {
description
"Acknowledge an alarm on the system.";

input {
leaf-list id {
type string;
description
"Alarm identifier.";
}
}
output {
leaf status {
type int32;
description
"The status of the operation execution request.";
}
leaf status-detail {
type string;
description
"The detailed status of the operation execution request.";
}
}
}

rpc unacknowledge-alarms {
description
"Un-acknowledge an alarm on the system.";

input {
leaf-list id {
type string;
description
"Alarm identifier.";
}
}
output {
leaf status {
type int32;
description
"The status of the operation execution request.";
}
leaf status-detail {
type string;
description
"The detailed status of the operation execution request.";
}
}
}


rpc show-alarms {
description
"Get current alarms based on given filter.";

input {
choice option {
case time {
description
"Filter alarms on given time duration.";
container time {
leaf begin {
type yang-types:date-and-time;
description
"Specify the start time in RFC3339 format (UTC).
For example: 2021-05-12T13:45:45.455Z";
}
leaf end {
type yang-types:date-and-time;
description
"Specify end time in RFC3339 format (UTC).
For example: 2021-05-12T13:45:45.455Z";
}
}
}

case last-interval {
description
"Filter alarms based on last interval.";
leaf interval {
type enumeration {
enum 5_MINUTES;
enum 60_MINUTES;
enum 24_HOURS;
}
description
"Last interval period.";
}
}

case severity {
description
"Filter events based on severity.";
leaf severity {
type event:severity-type;
description
"Alarm severity";
}
}

case id {
description
"Filter alarms on unique ID.";
container id {
leaf begin {
type string;
description
"Begin identifier.";
}
leaf end {
type string;
description
"End identifier.";
}
}
}
}
}

output {
leaf status {
type int32;
description
"Status of the operation execution request.";
}
leaf status-detail {
type string;
description
"Status details of the operation execution request.";
}
container ALARM {
list ALARM_LIST {
key "id";
uses alarm-state;
}
}
}
}
}
Loading