Delay Tolerant Networking | B. Sipos |
Internet-Draft | RKF Engineering |
Intended status: Experimental | E. Birrane, Ed. |
Expires: September 18, 2016 | JHU APL |
March 17, 2016 |
A YANG profile for defining Asynchronous Management Protocol Application Data Models
draft-bsipos-dtn-amp-yang-00
This document specifies a YANG profile for defining Application Data Model (ADM) schema for the Asynchronous Management Protocol (AMP). The AMP has no relation to NETCONF; YANG is used here only for its language syntax, and its module and type systems.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 18, 2016.
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
This profile uses YANG [RFC6020] as an encoding for the management schema and makes use of the YANG module and type systems. The fact that YANG is also used to specify data models for the NETCONF protocol has no direct influence over this use of YANG to specify data models for AMP.
This specification follows [RFC6087] in the definition of the "amp-adm" YANG module. The amp-adm module defines only subtypes and extensions; it does not define any actual data model elements.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
An AMP application SHALL define its Application Data Model (ADM) by means of a YANG module which imports and uses "amp-adm" module extensions. An official Pyang tool [pyang] plugin SHOULD be used to validate the contents of an ADM YANG module.
A YANG module which defines an AMP ADM SHALL NOT be used to also define a data model for NETCONF or any other non-AMP protocol. It may be syntatically allowable to mix models for multiple protocols but it decreases the intelligability of the module for either purpose.
A YANG module which defines an AMP ADM SHALL NOT contain any "default" statements.
For each ADM-specific YANG statement which requires an OID to be assigned to it, it is possible to use one of the "fulloid", "suboid", or "compressoid" substatements to make that assignment. Not all of the OID assignment substatements are available in all contexts, so following the allowed substatement table is important.
The types of OID assignments are:
An ADM SHOULD make use of sub-OIDs where possible, both to avoid typos possible with full OIDs and to avoid nickname assignment for every group within the ADM. Using sub-OIDs also guarantees that the tree structure of the ADM module matches one-for-one with the OID tree.
This section specifies how AMP types interact with native YANG types. All AMP data types are sub-typed from YANG native types solely for the purpose of providing a baseline of behavior for YANG parsers. Any YANG module which defines an AMP ADM SHALL only use types (or derived types) from the "amp-adm" module.
The AMP types of "BYTE", "INT", "UINT", "VAST", and "UVAST" are derived directly from the built-in YANG type of the same numeric domain. There is no functional difference between these types and the native types, other than the namespace of these types. Using AMP-specific names allows ADM module authors to keep consistent terminology between textual specification and YANG specification.
The "SDNV" type is derived from YANG "binary" type due to its domain being larger than any of the built-in YANG types.
The AMP types of "REAL32" and "REAL64" are derived from YANG "binary" type because the built-in floating point type is not a clear superset of the floating point types of [I-D.birrane-dtn-amp].
The "SDNV" type is derived from YANG "binary" type due to its domain being larger than any of the built-in YANG numeric types.
The "TS" type is also derived from YANG "binary" type due to the more complex encoding semantics of the TS type.
The "STR" type is derived from the YANG "string" type only because they both are intended to have the semantics of human-readable text. An ADM SHOULD NOT use the amp:STR type for any data other than text encoded with UTF-8 (see [RFC3629]). The encoding of "STR" type is wholy unrelated to any NETCONF use of the YANG "string" type.
The "BLOB" type is derived from YANG "binary" type. The BLOB is the simplest AMP-specific type which is encoded using internal sub-items (the size separate from the bytes).
The "DC" and "TDC" types are also derived from YANG "binary" type for lack of specific YANG mechanism for type decomposition.
The "MID" type is derived from YANG "binary" type due to its combined use of bit patterns (in its header) and BER-encoded data.
The "MC" type is also derived from YANG "binary" type for lack of specific YANG mechanism for type decomposition.
An ADM SHOULD subtype any numeric type in order to apply additional semantic context to the numerical values (similar to the SMIv2 CounterXX and GaugeXX [RFC2578]). An ADM SHOULD make use of the YANG "units" substatement when numeric types are used (within either a typedef or a type-use).
An ADM SHOULD subtype the BLOB type in order to identify application-specific encoding formats. Using plain BLOB types within an ADM is discouraged due to the opaqueness of the
Any ADM subtype SHALL have no effect on the value encoding of AMP. Subtypes are purely used to assist applications in managing value semantics. Any ADM subtype SHALL include a description substatement explaining the purpose of the subtype.
This section specifies how AMP extension statements interact with native YANG statements within an application YANG module.
This section contains extensions for identifying a data node within the YANG model tree by a unique OID value.
A "fulloid" statement is used to anchor an item in the OID tree. The value of a fulloid is the dotted-numeric notation of the OID value. A fulloid value must not be empty. Any substatements which are sibling to a "fulloid" will be relative to that OID root for the purposes of "suboid" processing.
The format of a fulloid argument is a string of period-separated numeric components.
substatement | cardinality |
---|---|
description | 0..1 |
A "suboid" statement is used to define an item's OID relative to a sibling statement's full OID. The value of a suboid is the dotted-numeric notation of the OID parts under the full OID. A suboid value must not be empty.
The format of a suboid argument is the same as a fulloid argument. The interpretation of a suboid depends upon the context of the statement.
substatement | cardinality |
---|---|
description | 0..1 |
A "nickname" statement is used to define an application-specific numeric identifier for a full OID prefix. The nickname is used by both the AMP agent and manager to shorten OID encoding.
The format of a nickname argument is a single non-negative integer value. Each nickname is defined within the namespace of the ADM module.
substatement | cardinality |
---|---|
description | 0..1 |
fulloid | 1 |
A "compressoid" statement is used to define a full OID based on a module-specific nickname (see Section 4.1.3) as a prefix and a suboid suffix.
The format of a compressoid argument is a nickname value (see Section 4.1.3) within square brackets followed by a suboid string.
substatement | cardinality |
---|---|
description | 0..1 |
The "group" statement is used to define a grouping of other items within the ADM. Each group is assigned an OID (see Section 2.2) and used as an OID anchor for its substatements.
The order of substatements within a group is not significant. Only the OID assignment of each item is significant.
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
group | 0..* |
primitive | 0..* |
control | 0..* |
report | 0..* |
macro | 0..* |
operator | 0..* |
The "primitive" statement is used to define an atomic value within an ADM. Each primitive is assigned an OID (see Section 2.2) and a type. The primitive has different semantics from the YANG "leaf" statement due to the lack of secondary (non-type) attributes (e.g. config/state distinction). All primitive objects are state; any configuration is performed via "control" statements.
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
type | 1 |
units | 0..1 |
The "control" statement is used to define an available control within the ADM. Each control is assigned an OID (see Section 2.2) and an ordered list of parmeter and result items. The control has different semantics from the YANG "rpc" statement due to the difference in protocol encoding and to the asynchronous nature of the AMP.
Each control is parameterized by some number of parameters (see Section 4.3.3) and some number of results (see Section 4.3.4). There is no provision in an ADM for specifying alternative parameters or alternative results (i.e. no parameters are optional).
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
parameter | 0..* |
result | 0..* |
The "parameter" statement is used to define single expected parameter of a "control" statement. In the AMP each control has a fixed number of typed parameters, there is no provision for overloaded controls which take variable numbers of parameters.
A control parameter is an atomic value with a distinct type, but has no distinct OID. The parameter statement's argument is used as the parameter's name. Within a single control, each parameter name SHALL be unique. The parameter name is not related to any AMP encoding, so is useful only for the sake of identifying the parameter within the ADM.
substatement | cardinality |
---|---|
description | 0..1 |
type | 1 |
units | 0..1 |
The "result" statement is used to define single expected result of a "control" statement. In the AMP each control has a fixed number of typed results, there is no provision for overloaded controls which yield variable numbers of results.
A control result is an atomic value with a distinct type, but has no distinct OID. The result statement's argument is used as the result's name. Within a single control, each result name SHALL be unique. The result name is not related to any AMP encoding, so is useful only for the sake of identifying the result within the ADM.
substatement | cardinality |
---|---|
description | 0..1 |
type | 1 |
units | 0..1 |
The "report" statement is used to define the contents of an AMP report, but does not define when any instances of the report may be created. Each report is assigned an OID (see Section 2.2) and an ordered list of content items. Asynchronous reporting is a distinct feature of the AMP from other management protocols.
Each report is parameterized by some number of items which are to be contained in corresponding report instances (see Section 4.3.6). There is no provision in an ADM for specifying alternative report contents.
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
reportitem | 0..* |
The "reportitem" statement is used to define single expected item within a report instance. In the AMP each report has a fixed number of typed items, there is no provision for overloaded reports which yield variable numbers of items.
A reportitem is an atomic value with a distinct OID of the primitive to be included in a report instance. A reportitem has no type of its own. The reportitem statement's argument is used as the item's name. Within a single report, each reportitem name SHALL be unique. The reportitem name is not related to any AMP encoding, so is useful only for the sake of identifying the item within the ADM.
substatement | cardinality |
---|---|
description | 0..1 |
fulloid | compressoid | 1 |
The "macro" statement is used to declare an AMP macro within an ADM.
//FIXME: what value is there in the inline definition?
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
The "operator" statement is used to define the syntax of an ADM operator (for use in expressions). Each operator is assigned an OID (see Section 2.2) and an ordered list of operands.
Each operator is parameterized by some number of items which are to be used as operands at statement execution time. (see Section 4.3.9).
substatement | cardinality |
---|---|
description | 0..1 |
reference | 0..1 |
status | 0..1 |
fulloid | suboid | compressoid | 1 |
operand | 0..* |
The "operand" statement is used to define single expected operand within an operator statement. In the AMP each operation has a fixed number of untyped operands. There is no provision for overloaded operators which take variable numbers of operands.
An operand is an atomic value with no associated OID or type. The operand statement's argument is used as the item's name. Within a single operator, each operand name SHALL be unique. The operand name is not related to any AMP encoding, so is useful only for the sake of identifying the item within the ADM.
substatement | cardinality |
---|---|
description | 0..1 |
Some aspects of an ADM module require in-line instantiations of data which will eventually be encoded in AMP format. Rather than requiring the ADM module author to do the encoding manually, and to allow easier inspection by an ADM module reader, each to-be-encoded data item is represented in the ADM module by one of the "amp:*-instance" statements. Examples of uses for these instances are: a numeric value used in the definition of a "literal" statement, or OID values used in the definition of a "report" statement.
Where possible, an ADM author SHOULD supply all data instances necessary to interpret the constant-data items within an ADM.
The "number-instance" statement is used to define single value of one of the integer data types (BYTE, INT, UINT, VAST, UVAST, SDNV) or one of the floating point types (REAL32, REAL64). The number-type substatement SHALL be present unless the number-instance is a direct substatement of a typed statement (e.g. a literal statement).
The lexical representation of all AMP integer types SHALL conform to the corresponding integer types [RFC6020]. The lexical representation of AMP floating point types SHALL conform to the "decimal64" type of [RFC6020]. The binary-valued floating point domain of the AMP types SHALL be enforced by any YANG module parser.
substatement | cardinality |
---|---|
description | 0..1 |
number-type | 0..1 |
The "number-type" statement is used to identify the specific encoding type for a number-instance parent statement. A number-type statement's argument SHALL be one of the numeric type names:
The number-type statement has no substatemnts.
The "string-instance" statement is used to define single text value for the STR data type. The string-instance argument SHALL NOT contain the UTF-8 code point zero. Code point zero is used to terminate strings in AMP.
substatement | cardinality |
---|---|
description | 0..1 |
The "BLOB-instance" statement is used to define single binary-data value for the BLOB data type. The BLOB-instance argument SHALL be represented by Base-64 encoded text according to [RFC3548]. The length of the encoded BLOB is implicit in the BLOB-instance representation.
substatement | cardinality |
---|---|
description | 0..1 |
The "TS-instance" statement is used to define single time-stamp value. Although its encoding is identical to the SDNV number-instance, the TS-instance YANG representation is different. The TS-instance argument SHALL contain an fully qualified absolute time represented according to [RFC3339].
substatement | cardinality |
---|---|
description | 0..1 |
The "MID-instance" statement is used to define single MID value, including all of the possible MID variations.
substatement | cardinality |
---|---|
description | 0..1 |
MID-type | 1 |
MID-category | 1 |
MID-issuer | 0..1 |
MID-tag | 0..1 |
The "MID-issuer" statement is used to define the optional Issuer payload of the MID value. The presence or absense of a MID-issuer statement determines the header and payload encoding of the MID value. The MID-issuer argument SHALL be a positive integer value.
substatement | cardinality |
---|---|
description | 0..1 |
The "MID-tag" statement is used to define the optional Tag payload of the MID value. The presence or absense of a MID-tag statement determines the header and payload encoding of the MID value. The MID-tag argument SHALL be a positive integer value.
substatement | cardinality |
---|---|
description | 0..1 |
The "DC-instance" statement is used to define a list of BLOB values. The count of values present in the DC is implicit in the number of BLOB-instance substatements. The order of BLOB-instance substatements SHALL correpsond with the encoded DC value.
substatement | cardinality |
---|---|
description | 0..1 |
BLOB-instance | 0..* |
The "MC-instance" statement is used to define a list of MID values. The count of values present in the MC is implicit in the number of MID-instance substatements. The order of MID-instance substatements SHALL correpsond with the encoded MC value.
substatement | cardinality |
---|---|
description | 0..1 |
MID-instance | 0..* |
The "TDC-instance" statement is used to define a list of typed data instance values. The count of values present in the TDC is implicit in the number of "*-instance" substatements. The order of data instance substatements SHALL correpsond with the encoded TDC value.
substatement | cardinality |
---|---|
description | 0..1 |
number-instance | string-instance | BLOB-instance | TS-instance | MID-instance | DC-instance | TDC-instance | 0..* |
This memo requires the use of a YANG module namespace. This draft defines the "urn:ietf:params:xml:ns:yang:draft-amp-adm" namespace only for the purpose of a placeholder.
This memo only defines a mechanism to specify an application schema, it does not impose any limitations or requirements on the contents of that schema. The amp-adm module defines only subtypes and extensions. It does not define any actual data model elements, so there are no direct security implications.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC3339] | Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002. |
[RFC3548] | Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 3548, DOI 10.17487/RFC3548, July 2003. |
[RFC3629] | Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 2003. |
[RFC6020] | Bjorklund, M., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, October 2010. |
[RFC6087] | Bierman, A., "Guidelines for Authors and Reviewers of YANG Data Model Documents", RFC 6087, DOI 10.17487/RFC6087, January 2011. |
[I-D.birrane-dtn-amp] | Birrane, E., "Asynchronous Management Protocol", Internet-Draft draft-birrane-dtn-amp-01, August 2015. |
[RFC2578] | McCloghrie, K., Perkins, D. and J. Schoenwaelder, "Structure of Management Information Version 2 (SMIv2)", STD 58, RFC 2578, DOI 10.17487/RFC2578, April 1999. |
[I-D.birrane-dtn-ama] | Birrane, E., "Asynchronous Management Architecture", Internet-Draft draft-birrane-dtn-ama-02, March 2016. |
[pyang] | Bjorklund, M., "An extensible YANG validator and converter in python", March 2016. |
[CCITT.X690.2002] | International Telephone and Telegraph Consultative Committee, "ASN.1 encoding rules: Specification of basic encoding Rules (BER), Canonical encoding rules (CER) and Distinguished encoding rules (DER)", CCITT Recommendation X.690, July 2002. |
The contents of this section is the machine-readable specification of this YANG module.
The following YANG definition is the top-level "amp" module.
<CODE BEGINS> file "amp-adm.yang" module "amp-adm" { namespace "urn:ietf:params:xml:ns:yang:draft-amp-adm"; prefix "amp"; include amp-types; include amp-extensions; include amp-instances; organization "IETF Delay Tolerant Networking Working Group"; contact "WG Web: <http://tools.ietf.org/wg/dtn/> WG List: <mailto:dtn@ietf.org> WG Chairs: Brian Haberman <mailto:brian@innovationslab.net> Marc Blanchet <mailto:Marc.Blanchet@viagenie.ca> Editor: Brian Sipos <mailto:BSIpos@rkf-eng.com>"; description "This module implements the " +"Asynchornous Management Protocol (AMP) " +"Application Data Model (ADM) profile within YANG"; revision "2016-03-14" { description "Initial draft release."; reference "I-D draft-bsipos-dtn-amp-yang"; } } <CODE ENDS>
The following YANG definition includes types specific to AMP.
<CODE BEGINS> file "amp-types.yang" submodule "amp-types" { belongs-to "amp-adm" { prefix "amp"; } description "This submodule contains the set of core types necessary to " +"define an Asynchronous Management Protocol data model."; reference "draft Asynchronous Management Protocol"; // These extensions are only used within this submodule for annotation extension amp-type-id { argument "num"; description "Internal annotation of the AMP ID number of a type."; } extension amp-type-item { argument "name"; description "Internal annotation of a sub-type item."; } extension amp-type-list { argument "name"; description "Internal annotation of a sub-type list-of-items."; } typedef "BYTE" { type "uint8"; amp:amp-type-id 0; reference "draft Asynchronous Management Protocol"; } typedef "INT" { type "int32"; amp:amp-type-id 1; reference "draft Asynchronous Management Protocol"; } typedef "UINT" { type "uint32"; amp:amp-type-id 2; reference "draft Asynchronous Management Protocol"; } typedef "VAST" { type "int64"; amp:amp-type-id 3; reference "draft Asynchronous Management Protocol"; } typedef "UVAST" { type "uint64"; amp:amp-type-id 4; reference "draft Asynchronous Management Protocol"; } typedef "REAL32" { type "binary"; amp:amp-type-id 5; description "Binary encoding of IEEE-754 32-bit floating point number."; reference "draft Asynchronous Management Protocol"; } typedef "REAL64" { type "binary"; amp:amp-type-id 6; description "Binary encoding of IEEE-754 64-bit floating point number."; reference "draft Asynchronous Management Protocol"; } typedef "SDNV" { type "binary"; amp:amp-type-id 9; description "Binary encoding of self-delimited numeric value."; reference "draft Asynchronous Management Protocol"; } typedef "STR" { type "string"; amp:amp-type-id 7; description "Same UTF-8 encoding as YANG base type. " +"Must be zero-terminated."; reference "draft Asynchronous Management Protocol"; } typedef "TS" { type "binary"; amp:amp-type-id 10; description "A timestamp value."; reference "draft Asynchronous Management Protocol"; } typedef "MID" { type "binary"; amp:amp-type-id 12; description "The basic managed-identifier definition."; reference "draft Asynchronous Management Protocol"; } typedef "BLOB" { type "binary"; amp:amp-type-id 8; description "The BLOB type should be used as a base type for " +"applicaiton-specific types used in data models."; reference "draft Asynchronous Management Protocol"; amp:amp-type-item "count" { type "SDNV"; } amp:amp-type-list "octets" { type "BYTE"; } } typedef "DC" { type "binary"; amp:amp-type-id 11; amp:amp-type-item "count" { type "SDNV"; } amp:amp-type-list "items" { type "BLOB"; } } typedef "TDC" { type "binary"; amp:amp-type-id 18; amp:amp-type-item "entry-count" { type "SDNV"; } // These really need not be BLOBs with internal sizes amp:amp-type-item "entry-types" { type "BLOB"; } amp:amp-type-list "entry-values" { type "BLOB"; } } typedef "MC" { type "binary"; amp:amp-type-id 13; description "Ordered list of MID values."; amp:amp-type-item "count" { type "SDNV"; } amp:amp-type-list "values" { type "MID"; } } // Should be pure MC with no type-id? // The only time [EXPR] type is used in AMP spec is // for DEF definition, which is unambiguous on type. typedef "EXPR" { type "binary"; amp:amp-type-id 14; description "Ordered list of MID values representing a " +"postfix arithmetic."; amp:amp-type-item "expression" { type "MC"; } } // PRED is not a type typedef "DEF" { type "binary"; amp:amp-type-id 15; description "Ordered list of MID values with a corresponding result" +"type and overall OID"; amp:amp-type-item "id" { type "MID"; } amp:amp-type-item "type" { type "BYTE"; } amp:amp-type-item "definition" { type "MC"; } } typedef "TRL" { type "binary"; amp:amp-type-id 16; description "Identify and define a time-based macro rule."; amp:amp-type-item "id" { type "MID"; } amp:amp-type-item "start" { type "TS"; } amp:amp-type-item "period" { type "SDNV"; units "seconds"; } amp:amp-type-item "count" { type "SDNV"; } amp:amp-type-item "action" { type "MC"; } } typedef "SRL" { type "binary"; amp:amp-type-id 17; description "Identify and define a state-based macro rule."; amp:amp-type-item "id" { type "MID"; } amp:amp-type-item "start" { type "TS"; } // Mismatch in AMP spec for PRED type // amp:amp-type-item "condition" { type "PRED"; } amp:amp-type-item "condition" { type "EXPR"; } amp:amp-type-item "count" { type "SDNV"; } amp:amp-type-item "action" { type "MC"; } } // Should be pure TDC with no type-id? // The only time [RPT] is used, the RPT type is unnecessary // because there is no alternative but RPT (i.e. TDC) data. typedef "RPT" { type "binary"; amp:amp-type-id 19; description "Identify and define a report template."; // how is this different from TDC type + MID? amp:amp-type-item "id" { type "MID"; } amp:amp-type-item "entry-count" { type "SDNV"; } // These really need not be BLOBs with internal sizes? amp:amp-type-item "entry-types" { type "BLOB"; } amp:amp-type-list "entry-values" { type "BLOB"; } } // May be useful to define a protocol-level CONFIGURE type which // looks similar to... //typedef CFG { // amp:amp-type-item "target-id" { type "MID"; } // amp:amp-type-list "value" { type "BLOB"; } //} // This would allow a simple macro of CFG values // Should be pure DEF with no type-id? // The only time MACRO is used is not for encoding, but for // typing objects in OID tree. typedef "MACRO" { type "DEF"; amp:amp-type-id 20; description "Ordered list of control/macro MID values."; } typedef "UNK" { type "binary"; amp:amp-type-id 21; } } <CODE ENDS>
The following YANG definition includes extensions specific to AMP.
<CODE BEGINS> file "amp-extensions.yang" submodule "amp-extensions" { belongs-to "amp-adm" { prefix "amp"; } description "This submodule contains the set of core extensions necessary to " +"define an Asynchronous Management Protocol data model."; reference "draft Asynchronous Management Protocol"; extension fulloid { argument "value"; description "This extension defines the complete OID for the parent " +"statement. "; } extension suboid { argument "value"; description "This extension defines a sub-OID of a statement relative " +"to a parent-statement OID."; } extension nickname { argument "id"; description "A nickname is a single integer ID which correpsonds to a " +"full OID value."; } extension compressoid { argument "value"; description "This extension allows using an ADM nickname within the " +"ADM itself."; } extension "group" { argument "name"; description "A logical grouping of ADM items under a parent OID."; } extension "primitive" { argument "name"; description "A single typed value associated with an OID."; } extension "computed" { argument "name"; description "A single typed value-expression associated with an OID."; } extension "report" { argument "name"; description "Definition of a report within an ADM."; } extension "reportitem" { argument "name"; description "A reference to a primitive within a report definition."; } extension "control" { argument "name"; description "Definition of a control within an ADM."; } extension "parameter" { argument "name"; description "An individual parameter to a \"control\" statement. " +"Order of parameters is signifigant within a control."; } extension "result" { argument "name"; description "An individual result value reported as a response to " +"a \"control\" statement. " +"Order of results is signifigant within a control."; } } <CODE ENDS>
The following YANG definition includes extensions to define AMP instance values.
<CODE BEGINS> file "amp-instances.yang" submodule "amp-instances" { belongs-to "amp-adm" { prefix "amp"; } description "This submodule contains the extensions necessary to " +"define AMP data instances directly in an ADM."; reference "draft Asynchronous Management Protocol"; extension number-instance { argument "value"; description "Instantiate a value of BYTE, INT, UINT, VAST, UVAST, " +"SDNV, REAL32, or REAL64 within an ADM."; } extension number-type { argument "name"; description "The type name of a number-instance."; } extension string-instance { argument "value"; description "Instantiate a value of STR from a text value."; } extension TS-instance { argument "value"; description "Instantiate a value of TS from a text value. " +"The value is encoded according to RFC3339."; } extension MID-instance { description "Instantiate a value of MID from substatements " +"specializing the MID."; /// Must contain instance-identifer, amp:fulloid, or amp:compressoid /// May also contain DC-instance for parameterized OID } /// are type and cat necessary? extension MID-type { argument "value"; description "One of data, control, literal, or operator. " +"Default is data."; } extension MID-category { argument "value"; description "One of atomic, computed, or collection. " +"Default is atomic."; } extension MID-issuer { argument "value"; description "A numeric value identifying an issuer."; } extension MID-tag { argument "value"; description "A numeric value identifying a tag."; } extension BLOB-instance { argument "value"; description "Instantiate a value of BLOB from a text value. " +"The value is encoded in Base-64 per RFC3548. "; } extension DC-instance { description "Instantiate a value of DC from BLOB-instance substatements."; } extension TDC-instance { description "Instantiate a value of TDC from *-instance substatements."; } extension MC-instance { description "Instantiate a value of MC from MID-instance substatements."; } /// Really is just MC-instance extension MACRO-instance { description "Instantiate a value of MACRO from MID-instance substatements."; } } <CODE ENDS>
The following YANG definition includes extensions specific to AMP.
<CODE BEGINS> file ""example-adm.yang"" module "example-adm" { namespace "urn:example-adm"; prefix "example-adm"; import "amp-adm" { prefix "amp"; } organization "Example Org."; description "Example module."; amp:fulloid "1.3.6.1.2.3.3"; amp:nickname "3" { amp:fulloid "1.3.6.1.2"; } amp:group "primitives" { amp:suboid "1"; description "Primitive data available for getting or setting"; amp:primitive "example" { amp:suboid "1"; type "amp:UVAST"; description "Example value."; } } amp:group "reports" { amp:suboid 3; amp:report showall { amp:suboid 8; amp:MC-instance { amp:MID-instance { // instance-identifier "/primitives/example"; } } } } amp:group "controls" { amp:suboid "4"; description "Container for all commands in this ADM."; amp:control "get" { amp:suboid "2"; description "Get a single MIB value from the agent."; amp:parameter "corrid" { type "amp:SDNV"; description "The correlation identifier for the request."; } amp:parameter "object" { type "amp:MID"; description "Identity of the object to retrieve."; } amp:result "corrid" { type "amp:SDNV"; description "The correlation identifier for the response."; } amp:result "errorcode" { type "amp:BYTE"; description "If non-zero, an indicator of an error."; } amp:result "data" { type "amp:BLOB"; description "Encoded value of the object."; } } amp:control "set" { amp:suboid "3"; description "Set a single MIB value in the agent."; amp:parameter "corrid" { type "amp:SDNV"; description "The correlation identifier for the request."; } amp:parameter "object" { type "amp:MID"; description "Identify the value to retrieve."; } amp:parameter "data" { type "amp:BLOB"; description "Encoded value used to write the object."; } amp:result "corrid" { type "amp:SDNV"; description "The correlation identifier for the response."; } amp:result "errorcode" { type "amp:BYTE"; description "If non-zero, an indicator of an error."; } } } } <CODE ENDS>