module alarms {
  yang-version 1.1;
  namespace "urn:alarms";
  prefix "a";
  import ietf-yang-types {
    prefix yang;
  }
  grouping alarm {
    leaf fault-id {
      type uint16;
      mandatory true;
    }
    leaf fault-source {
      type string {
        length "1..255";
      }
      mandatory true;
    }
    list affected-objects {
      key name;
      leaf name {
        type string {
          length "1..255";
        }
        mandatory true;
      }
    }
    leaf fault-severity {
      type enumeration {
        enum CRITICAL;
        enum MAJOR;
        enum MINOR;
        enum WARNING;
      }
      mandatory true;
    }
    leaf is-cleared {
      type boolean;
      mandatory true;
    }
    leaf fault-text {
      type string {
        length "0..255";
      }
    }
    leaf event-time {
      type yang:date-and-time;
      mandatory true;
    }
  }
  container active-alarm-list {
    list active-alarms {
      config false;
      uses alarm;
    }

    container alarm-inventory {
      config false;
      list alarm-type {
        key "alarm-type-id alarm-type-qualifier";

        leaf alarm-type-id {
          type string;
        }
        leaf alarm-type-qualifier {
          type string;
        }
        leaf-list resource {
          type instance-identifier {
            require-instance false;
          }
        }
      }
    }
  }
  notification alarm-notif {
    uses alarm;
  }
}
