YANG language preview
1. A system module
leaf-list, a prefixed type, and an augment statement
horizon-dark
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
atom-one-dark
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
github-dark
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
dracula
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
nord
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
github
module example-system {
namespace "urn:example:system";
prefix sys;
import ietf-inet-types {
prefix inet;
}
leaf-list address {
type inet:ip-address;
description
"A list of addresses.";
}
container system {
leaf host-name {
type string;
default "localhost";
}
augment "/system/config" {
leaf enabled {
type boolean;
default true;
}
}
}
}
2. Typedefs and identities
a custom type and an identity hierarchy
horizon-dark
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} atom-one-dark
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} github-dark
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} dracula
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} nord
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} github
typedef percent {
type uint8 {
range "0..100";
}
}
identity ethernet {
base interface-type;
} 3. RPCs and notifications
an rpc definition with input and output
horizon-dark
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
} atom-one-dark
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
} github-dark
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
} dracula
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
} nord
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
} github
rpc reboot {
input {
leaf delay {
type uint32;
default 0;
}
}
output {
leaf success {
type boolean;
}
}
}