Compare commits

...
Author SHA1 Message Date
Tobias Waldekranz 9bdf44ad7a mech: Play around with a native yang model 2023-03-27 10:02:27 +02:00
9 changed files with 254 additions and 41 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<CLICON_FEATURE>ietf-system:ntp-udp-port</CLICON_FEATURE>
<CLICON_YANG_DIR>@DATAROOTDIR@/clixon</CLICON_YANG_DIR>
<CLICON_YANG_DIR>@DATAROOTDIR@/yang</CLICON_YANG_DIR>
<CLICON_YANG_MODULE_MAIN>infix</CLICON_YANG_MODULE_MAIN>
<CLICON_YANG_MODULE_MAIN>device</CLICON_YANG_MODULE_MAIN>
<CLICON_CLI_MODE>exec</CLICON_CLI_MODE>
<CLICON_BACKEND_DIR>@LIBDIR@/clixon/backend</CLICON_BACKEND_DIR>
<CLICON_NETCONF_DIR>@LIBDIR@/clixon/netconf</CLICON_NETCONF_DIR>
+32
View File
@@ -0,0 +1,32 @@
module device {
yang-version 1.1;
namespace "urn:kernelkit:yang:device";
prefix device;
import ietf-datastores {
prefix ds;
}
import ietf-system {
prefix sys;
}
import infix {
prefix ix;
}
import clixon-autocli {
prefix autocli;
}
description
"Base model
";
revision 2023-02-10 {
description
"Initial revision.";
reference
"N/A";
}
}
+64
View File
@@ -0,0 +1,64 @@
submodule infix-if-bridge {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
include infix-if;
augment "/native/interfaces/interface/type" {
case bridge {
container bridge {
presence bridge;
description
"Bridge configuration";
container vlans {
list vlan {
key vid;
leaf vid {
type uint16;
}
leaf-list untagged {
type interface-ref;
must "deref(.)/../bridge-port/bridge = ../../../../name" {
error-message
"All interfaces must be attached to this bridge";
}
}
leaf-list tagged {
type interface-ref;
}
}
}
}
}
}
augment "/native/interfaces/interface/port" {
case bridge-port {
container bridge-port {
description
"Bridge port specific configuration";
leaf bridge {
type interface-ref;
mandatory true;
description
"Bridge interface to which this interface is attached";
must "deref(.)/../bridge" {
error-message
"Must refer to a bridge interface";
}
}
leaf pvid {
type uint16;
}
}
}
}
}
+39
View File
@@ -0,0 +1,39 @@
submodule infix-if-lag {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
include infix-if;
augment "/native/interfaces/interface/type" {
case lag {
container lag {
presence lag;
description
"Link aggregation configuration";
}
}
}
augment "/native/interfaces/interface/port" {
case lag-port {
container lag-port {
description
"LAG port configuration";
leaf lag {
type interface-ref;
mandatory true;
description
"LAG interface to which this interface is attached";
must "deref(.)/../lag" {
error-message
"Must refer to a LAG interface";
}
}
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
submodule infix-if-veth {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
include infix-if;
augment "/native/interfaces/interface/type" {
case veth {
container veth {
description
"Virtual ethernet pair specific configuration";
leaf peer {
type interface-ref;
mandatory true;
description
"Peer veth interface to which this interface is connected";
}
}
}
}
}
+35
View File
@@ -0,0 +1,35 @@
submodule infix-if-vlan {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
include infix-if;
typedef vid {
type uint16 {
range "1..4095";
}
}
augment "/native/interfaces/interface/type" {
case vlan {
container vlan {
description
"VLAN specific configuration";
leaf interface {
type interface-ref;
mandatory true;
description
"Lower interface from which the specified VLAN is demuxed";
}
leaf id {
type vid;
mandatory true;
}
}
}
}
}
+32
View File
@@ -0,0 +1,32 @@
submodule infix-if {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
include infix-native;
typedef interface-ref {
type leafref {
path "/native/interfaces/interface/name";
}
description
"This type is used by data models that need to reference
interfaces.";
}
augment "/native" {
container interfaces {
list interface {
key "name";
leaf name {
type string;
}
choice type;
choice port;
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
submodule infix-native {
yang-version 1.1;
belongs-to infix {
prefix ix;
}
container native;
}
+19 -40
View File
@@ -1,46 +1,25 @@
module infix {
yang-version 1.1;
namespace "urn:kernelkit:infix";
prefix ix;
yang-version 1.1;
namespace "urn:kernelkit:yang:infix";
prefix ix;
import ietf-datastores {
prefix ds;
}
include infix-native;
include infix-if;
include infix-if-bridge;
include infix-if-lag;
include infix-if-veth;
include infix-if-vlan;
import ietf-system {
prefix sys;
}
import ietf-interfaces {
prefix if;
}
import ietf-ip {
prefix ip;
}
import iana-if-type {
prefix ianaift;
}
import clixon-autocli {
prefix autocli;
}
organization "Kernelkit";
contact
"https://github.com/kernelkit/";
description
"Infix's native system model";
revision 2023-03-17 {
description
"Base model
";
revision 2023-02-10 {
description
"Initial revision.";
reference
"N/A";
}
revision 2023-03-16 {
description "Add timezone deviations for system/clock.";
reference "N/A";
}
deviation /sys:system/clock/timezone-utc-offset {
deviate not-supported;
}
"Initial revision.";
reference
"github.com/kernelkit/infix";
}
}