Blob Blame History Raw
submodule ietf-snmp-community {

  belongs-to ietf-snmp {
    prefix snmp;
  }

  import ietf-netconf-acm {
    prefix nacm;
  }

  include ietf-snmp-common;
  include ietf-snmp-target;
  include ietf-snmp-proxy;

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     WG Chair: Thomas Nadeau
               <mailto:tnadeau@lucidvision.com>

     WG Chair: Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>
     Editor:   Martin Bjorklund
               <mailto:mbj@tail-f.com>

     Editor:   Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>";

  description
    "This submodule contains a collection of YANG definitions
     for configuring community-based SNMP.

     Copyright (c) 2014 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC 7407; see
     the RFC itself for full legal notices.";

  reference
    "RFC 3584: Coexistence between Version 1, Version 2, and
       Version 3 of the Internet-standard Network
       Management Framework";

  revision 2015-01-23 {
    description
      "When expression of augment '/snmp:snmp/snmp:target' with
       non-existing leaves removed.";
    reference
      "RFC 7407 Errata";
  }

  revision 2014-12-10 {
    description
      "Initial revision.";
    reference
      "RFC 7407: A YANG Data Model for SNMP Configuration";
  }

  augment /snmp:snmp {

    list community {
      key index;

      description
        "List of communities.";
      reference
        "RFC 3584: Coexistence between Version 1, Version 2,
           and Version 3 of the Internet-standard
           Network Management Framework.
           SNMP-COMMUNITY-MIB.snmpCommunityTable";

      leaf index {
        type snmp:identifier;
        description
          "Index into the community list.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunityIndex";
      }
      choice name {
        nacm:default-deny-all;
        description
          "The community name, specified as either a string or
           a binary value.  The binary name is used when the
           community name contains characters that are not legal
           in a string.

           If not set, the value of 'security-name' is operationally
           used as the snmpCommunityName.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunityName";
        leaf text-name {
          type string;
          description
            "A community name that can be represented as a
             YANG string.";
        }
        leaf binary-name {
          type binary;
          description
            "A community name represented as a binary value.";
        }
      }
      leaf security-name {
        type snmp:security-name;
        mandatory true;
        nacm:default-deny-all;
        description
          "The snmpCommunitySecurityName of this entry.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunitySecurityName";
      }
      leaf engine-id {
        if-feature snmp:proxy;
        type snmp:engine-id;
        description
          "If not set, the value of the local SNMP engine is
           operationally used by the device.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunityContextEngineID";
      }
      leaf context {
        type snmp:context-name;
        default "";
        description
          "The context in which management information is accessed
           when using the community string specified by this entry.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunityContextName";
      }
      leaf target-tag {
        type snmp:tag-value;
        description
          "Used to limit access for this community to the specified
           targets.

           Implementations MAY restrict the values of this leaf
           to be one of the available values of /snmp/target/tag in
           a valid configuration.";
        reference
          "RFC 3584: Coexistence between Version 1, Version 2,
             and Version 3 of the Internet-standard
             Network Management Framework.
             SNMP-COMMUNITY-MIB.snmpCommunityTransportTag";
      }
    }
  }

  grouping v1-target-params {
    container v1 {
      description
        "SNMPv1 parameters type.
         Represents snmpTargetParamsMPModel '0',
         snmpTargetParamsSecurityModel '1', and
         snmpTargetParamsSecurityLevel 'noAuthNoPriv'.";
      leaf security-name {
        type snmp:security-name;
        mandatory true;
        description
          "Implementations MAY restrict the values of this leaf
           to be one of the available values of
           /snmp/community/security-name in a valid configuration.";
        reference
          "RFC 3413: Simple Network Management Protocol (SNMP).
             Applications.
             SNMP-TARGET-MIB.snmpTargetParamsSecurityName";
      }
    }
  }

  grouping v2c-target-params {
    container v2c {
      description
        "SNMPv2 community parameters type.
         Represents snmpTargetParamsMPModel '1',
         snmpTargetParamsSecurityModel '2', and
         snmpTargetParamsSecurityLevel 'noAuthNoPriv'.";
      leaf security-name {
        type snmp:security-name;
        mandatory true;
        description
          "Implementations MAY restrict the values of this leaf
           to be one of the available values of
           /snmp/community/security-name in a valid configuration.";
        reference
          "RFC 3413: Simple Network Management Protocol (SNMP).
             Applications.
             SNMP-TARGET-MIB.snmpTargetParamsSecurityName";
      }
    }
  }

  augment /snmp:snmp/snmp:target-params/snmp:params {
    case v1 {
      uses v1-target-params;
    }
    case v2c {
      uses v2c-target-params;
    }
  }

  augment /snmp:snmp/snmp:target {
    leaf mms {
      type union {
        type enumeration {
          enum "unknown" { value 0; }
        }
        type int32 {
          range "484..max";
        }
      }
      default "484";
      description
        "The maximum message size.";
      reference
        "RFC 3584: Coexistence between Version 1, Version 2,
           and Version 3 of the Internet-standard
           Network Management Framework.
           SNMP-COMMUNITY-MIB.snmpTargetAddrMMS";
    }
  }

}