module ietf-gnca {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-gnca";
prefix "gnca";
import ietf-yang-types {
prefix "yang";
}
organization
"IETF Network Configuration (NETCONF) Working Group";
contact
"WG Web:
WG List:
Editor: Igor Bryskin
Editor: Xufeng Liu
Editor: Alexander Clemm
";
description
"Event Condition Action (ECA) model.";
revision 2018-02-28 {
description "Initial revision";
reference "RFC XXXX";
}
/*
* Typedefs
*/
identity argument-type {
description
"Possible values are:
constant, variable, or datastore state.";
}
identity comparison-type {
description
"Possible values are:
equal, not-equal, greater, greater-equal, less, less-equal.";
}
identity logical-operation-type {
description
"Possible values are:
not, or, and.";
}
identity function-type {
description
"Possible values are:
plus, minus, mult, divide, remain.";
}
identity content-moving-operation-type {
description
"Possible values are:
copy, iterate, insert.";
}
identity action-type {
description
"Possible values are:
action, content-move, function-call, rpc, notify.";
}
identity policy-variable-type {
description
"Possible values are:
boolean, int32, int64, uint32, uint64, string, etc.";
}
/*
* Groupings
*/
grouping policy-variable-attributes {
description
"Defining the policy variable attributes, including name, type
and value. These attributes are used as part of the Policy
Variable (PV) definition.";
leaf name {
type string;
description
"A string to uniquely identify a Policy Variable (PV), either
globally for a global PV, or within the soope of ECA for a
local PV.";
}
choice type-choice {
description
"The type of a policy variable may be either a common
primative type like boolean or a type from existing
schema node referenced by an XPath string.";
case common {
leaf type {
type identityref {
base policy-variable-type;
}
description
"A common policy variable type, defined as an
identity.";
}
}
case xpath {
leaf xpath {
type string;
description
"A XPath string, referencing a schema node, whose
type is used as the type of the policy variable.";
}
}
}
anydata value {
description
"The value of the policy variable, in a format that is
determined by the policy type.";
}
} // policy-variable-attributes
grouping policy-argument {
description
"Defining a policy argument, which can be used in a comparison
or an action.";
container policy-argument {
description
"Containing the attributes of a policy argument.";
leaf type {
type identityref {
base argument-type;
}
description
"Identifies the argument type.";
}
choice argument-choice {
description
"Argument formation options, depending on the policy
type.";
case policy-constant {
leaf constant {
type string;
description
"The constant value of the policy argument.";
}
}
case policy-variable {
leaf policy-variable {
type leafref {
path "/gnca/policy-variables/"
+ "policy-variable/name";
}
description
"A reference to a global policy variable, which
is shared by all ECA scripts.";
}
}
case local-policy-variable {
leaf local-policy-variable {
type leafref {
path "/gnca/ecas/eca/policy-variable/name";
}
description
"A reference to a local policy variable, which
is kept within an ECA instance, and appears/
disappears with start/stop of the ECA execution.";
}
}
case xpath {
leaf xpath {
type string;
description
"An XPath string, referencing the data in the
datastore.";
}
}
}
}
} // policy-argument
grouping action-element-attributes {
description
"Grouping of action element attributes.";
leaf action-type {
type identityref {
base action-type;
}
description
"Identifies the action type.";
}
choice action-operation {
description
"The operation choices that an ECA Action can take.";
case action {
leaf action-name {
type leafref {
path "/gnca/actions/action/name";
}
description
"The operation is to execute a configured ECA Action.";
}
} // action
case content-moving {
container content-moving {
description
"The operation is to move contents between two policy
arguments.";
leaf content-moving-type {
type identityref {
base content-moving-operation-type;
}
description
"The type of moving operation, which can be copy,
iterate (copy a list of elements one by one), or
insert.";
}
container src {
description
"The source policy argment.";
uses policy-argument;
}
container dst {
description
"The destination policy argument.";
uses policy-argument;
}
}
} // content-moving
case function-call {
container function-call {
description
"The operation is to call a function, which is of one of
a few basic predefined types, such as plus, minus,
multiply, devide, or remainder.";
leaf function-type {
type identityref {
base function-type;
}
description
"One of the predefined basic function types, such as
plus, minus, multiply, devide, or remainder.";
}
container src {
description
"The source policy argument.";
uses policy-argument;
}
container dst {
description
"The distination policy argument.";
uses policy-argument;
}
}
} // function-call
case rpc-operation {
container rpc-operation {
description
"The operation is to call an RPC, which is defined by
a YANG module supported by the server.";
leaf name {
type string;
description
"The name of the YANG RPC or YANG action to be
called.";
}
leaf nc-action-xpath {
type string;
description
"The location where the YANG action is defined.
This is used if and only if a YANG action is called.
This leaf is not set when a YANG RPC is called.";
}
list policy-variable {
key name;
description
"A list of policy arguments used as the input or output
parameters passed to the RPC.";
leaf name {
type string;
description
"A string name used as the list key to form a list
of policy arguments.";
}
uses policy-argument;
}
}
} // rpc-operation
case notify-operation {
container notify-operation {
description
"The operation is to send a YANG notification.";
leaf name {
type string;
description
"Name of the subscribed YANG notification.";
}
list policy-variable {
key name;
description
"A list of policy arguments carried in the notification
message.";
leaf name {
type string;
description
"A string name used as the list key to form a list
of policy arguments.";
}
uses policy-argument;
}
}
} // notify-operation
}
} // action-element-attributes
/*
* Data nodes
*/
container gnca {
description
"Top level container for Generalized Network Control Automation
(GNCA).";
// policy-variables
container policy-variables {
description
"Container of global Policy Variables (PVs).";
list policy-variable {
key name;
description
"A list of global Policy Variables (PVs), with a string
name as the entry key.";
uses policy-variable-attributes;
}
} // policy-variables
container conditions {
description
"Container of ECA Conditions.";
list condition {
key name;
description
"A list of ECA Conditions.";
leaf name {
type string;
description
"A string name to uniquely identify an ECA Condition
globally.";
}
choice expression-choice {
description
"The choices of expression format to specify a condition,
which can be either a XPath string or a YANG logical
operation structure.";
case logical-operation {
leaf logical-operation-type {
type identityref {
base logical-operation-type;
}
description
"The logical operation type used to combine the
results from the list comparison-operation and the
list sub-condition, defined below.";
}
list comparison-operation {
key name;
description
"A list of comparison oprations, each of them defines
a comparison in the form of ,
where and are policy arguments, while
is the comparison-type, which can be
==, !=, >, <, >=, <=";
leaf name {
type string;
description
"A string name to uniquely identify a comparison
operation.";
}
leaf comparision-type {
type identityref {
base comparison-type;
}
description
"The comparison operation applied to the two
arguments arg1 and arg2 defined blow.";
}
container arg1 {
description
"The policy argument used as the first parameter of
the comparison opration.
A policy argument represents either a constant, PV
or data store value pointed by XPath.";
uses policy-argument;
}
container arg2 {
description
"The policy argument used as the secone parameter
of the comparison opration.
A policy argument represents either a constant, PV
or data store value pointed by XPath.";
uses policy-argument;
}
}
list sub-condition {
key name;
description
"A list of sub conditions applied by the
logical-operation-type. This list of sub conditions
provides the capability of hierarchically combining
conditions.";
leaf name {
type leafref {
path "/gnca/conditions/condition/name";
}
description
"A reference to a defined condition, which is used
as a sub-condition for the logical operation at
this hierarchy level.";
}
} // sub-condition
} // logical-operation
case xpath {
leaf condition-xpath {
type string;
description
"A XPath string, representing a logical expression,
which can contain comparisons of datastore values
and logical operations in the XPath format.";
}
} // xpath
} // expression-choice
} // condition
} // conditions
container actions {
description
"Container of ECA Actions.";
list action {
key name;
description
"A list of ECA Actions.";
leaf name {
type string;
description
"A string name to uniquely identify an ECA Action
globally.";
}
list action-element {
key name;
description
"A list of elements contained in an ECA Action. ";
leaf name {
type string;
description
"A string name to uniquely identify the action element
within the scope of an ECA action.";
}
uses action-element-attributes;
}
container time-schedule {
description
"Specifying the time schedule to execute this ECA
Action.
If not specified, the ECA Action is executed immediately
when it is called.";
leaf start {
type yang:date-and-time;
description
"The start time of the ECA Action.
If not specified, the ECA Action is executed
immediately when it is called.";
}
leaf repeat-interval {
type string {
pattern
'(R\d*/)?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?'
+ '(\d+M)?(\d+S)?';
}
description
"The repeat interval to execute this ECA Action.
The repeat interval is a string in ISO 8601 format,
representing a delay duration or a repeated delay
duration.
If not specified, the ECA Action is executed without
delay and without repetition.";
}
} // time-schedule
}
} // actions
container ecas {
description
"Container of ECAs.";
list eca {
key name;
description
"A lis of ECAs";
leaf name {
type string;
description
"A string name to uniquely identify an ECA globally.";
}
leaf event-name {
type string;
mandatory true;
description
"The name of an event that triggers the execution of
this ECA.";
}
list policy-variable {
key name;
description
"A list of ECA local Policy Variables (PVs), with a
string name as the entry key.";
uses policy-variable-attributes;
leaf is-static {
type boolean;
description
"'true' if the PV is static; 'false' if the PV is
dynamic.
A dynamic PV appears/disappears with the start/stop
of the ECA execution; a static PV exists as long as
the ECA is configured.";
}
}
list condition-action {
key name;
description
"A list of Condition-Actions, which are configured
conditions each with associated actions to be executed
if the condition is evaluated to TRUE";
leaf name {
type string;
description
"A string name uniquely identify a Condition-Action
within this ECA.";
}
leaf condition {
type leafref {
path "/gnca/conditions/condition/name";
}
description
"The reference to a configured condition.";
}
leaf action {
type leafref {
path "/gnca/actions/action/name";
}
description
"The reference to a configured action.";
}
} // condition-action
list cleanup-condition-action {
key name;
description
"A list of Condition-Actions, which are configured
conditions each with associated actions to be executed
if the condition is evaluated to TRUE.
This is the exception handler of this ECA, and is
evaluated and executed in case any Action from the
normal Condition-Action list was attempted and rejected
by the server.";
leaf name {
type string;
description
"A string name uniquely identify a Condition-Action
within this ECA.";
}
leaf condition {
type leafref {
path "/gnca/conditions/condition/name";
}
description
"The reference to a configured condition.";
}
leaf action {
type leafref {
path "/gnca/actions/action/name";
}
description
"The reference to a configured action.";
}
} // cleanup-condition-action
action start {
description
"Start to execute this ECA.";
}
action stop {
description
"Stop the execution of this ECA.";
}
action pause {
description
"Pause the execution of this ECA.";
}
action resume {
description
"Resume the execution of this ECA.";
}
action next-action {
description
"Resume the execution of this ECA to complete the next
action.";
}
list execution {
key id;
config false;
description
"A list of executions that this ECA has completed,
are currently running, and will start in the scheduled
future.";
leaf id {
type uint32;
description
"The ID to uniquely identify an execution of the ECA.";
}
leaf oper-status {
type enumeration {
enum completed {
description "Completed with no error.";
}
enum running {
description "Currently with no error.";
}
enum sleeping {
description "Sleeping because of time schedule.";
}
enum paused {
description "Paused by the operator.";
}
enum stoped {
description "Stopped by the operator.";
}
enum failed {
description "Failed with errors.";
}
enum error-handling {
description
"Asking the operator to handle an error.";
}
}
description
"The running status of the execution.";
}
leaf start-time {
type yang:date-and-time;
description
"The time when the ECA started.";
}
leaf stop-time {
type yang:date-and-time;
description
"The time when the ECA completed or stopped.";
}
leaf next-scheduled-time {
type yang:date-and-time;
description
"The next time when the ECA is scheduled to resume.";
}
leaf last-condition-action {
type leafref {
path "../../condition-action/name";
}
description
"The reference to a condition-action last executed
or being executed.";
}
leaf last-condition {
type leafref {
path "../../condition-action/condition";
}
description
"The reference to a condition last executed or being
executed.";
}
leaf last-action {
type leafref {
path "../../condition-action/action";
}
description
"The reference to aa action last executed or being
executed.";
}
leaf last-cleanup-condition-action {
type leafref {
path "../../cleanup-condition-action/name";
}
description
"The reference to a cleanup-condition-action last
executed or being executed.";
}
}
}
} // ecas
container eca-scripts {
description
"Container of ECA Scripts.";
list eca-script {
key script-name;
description
"A list of ECA Script.";
leaf script-name {
type string;
description
"A string name to uniquely identify an ECA Script.";
}
list eca {
key eca-name;
description
"A list of ECAs contained in this ECA Script.";
leaf eca-name {
type leafref {
path "/gnca/ecas/eca/name";
}
description
"The reference to a configured ECA.";
}
}
}
} // eca-scripts
leaf running-script {
type leafref {
path "/gnca/eca-scripts/eca-script/script-name";
}
description
"The reference to the ECA script that is currently running.";
}
}
}