From 38e44e993969939ff88b113aae3f7fc55ffb5622 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 14 Sep 2018 11:31:59 +0200 Subject: [PATCH] [65-libyang-models-update] Updated models and doc, tentative models distrib --- doc/guide/netconf.xml | 44 +++++---- src/lib/yang/Makefile.am | 15 ++- src/lib/yang/models/kea-ctrl-agent.yang | 2 +- src/lib/yang/models/kea-dhcp-ddns.yang | 2 +- src/lib/yang/models/kea-dhcp-types.yang | 33 +------ src/lib/yang/models/kea-dhcp4-server.yang | 84 ++++++++--------- src/lib/yang/models/kea-dhcp6-server.yang | 107 +++++++++++++--------- src/lib/yang/models/kea-logging.yang | 2 +- src/lib/yang/models/kea-types.yang | 2 +- 9 files changed, 147 insertions(+), 144 deletions(-) diff --git a/doc/guide/netconf.xml b/doc/guide/netconf.xml index 06f436da26..2357ea088b 100644 --- a/doc/guide/netconf.xml +++ b/doc/guide/netconf.xml @@ -121,8 +121,8 @@ src/lib/libyang/models. To install Kea models, do the following: cd src/lib/yang/models -sudo sysrepoctl -i -g kea-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ -sudo sysrepoctl -i -g ietf-dhcpv6-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ +sudo sysrepoctl -i -g kea-dhcp4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ +sudo sysrepoctl -i -g ietf-dhcp6-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ Note the first -s parameter specifies the location of your YANG schema @@ -132,25 +132,25 @@ configured during sysrepo compilation. The installation should look similar to the following: -$ sudo sysrepoctl -i -g ietf-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ -Installing a new module from file 'ietf-dhcpv4-server.yang'... -Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-server@2018-07-14.yang'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-options'... -Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-options@2018-07-14.yang'... -Resolving dependency: 'ietf-dhcpv4-options' imports 'ietf-dhcpv4-types'... -Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-types@2018-07-14.yang'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-types'... -Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-types@2018-07-14.yang'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-interfaces'... +$ sudo sysrepoctl -i -g ietf-dhcp6-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./ +Installing a new module from file 'ietf-dhcp6-server.yang'... +Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcp6-server@2018-07-14.yang'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-dhcp6-options'... +Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcp6-options@2018-07-14.yang'... +Resolving dependency: 'ietf-dhcp6-options' imports 'ietf-dhcp6-types'... +Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcp6-types@2018-07-14.yang'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-dhcp6-types'... +Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcp6-types@2018-07-14.yang'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-interfaces'... Schema of the module ietf-interfaces is already installed, skipping... -Installing data files for module 'ietf-dhcpv4-server'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-options'... -Skipping installation of data files for module 'ietf-dhcpv4-options'... -Resolving dependency: 'ietf-dhcpv4-options' imports 'ietf-dhcpv4-types'... -Skipping installation of data files for module 'ietf-dhcpv4-types'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-types'... -Skipping installation of data files for module 'ietf-dhcpv4-types'... -Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-interfaces'... +Installing data files for module 'ietf-dhcp6-server'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-dhcp6-options'... +Skipping installation of data files for module 'ietf-dhcp6-options'... +Resolving dependency: 'ietf-dhcp6-options' imports 'ietf-dhcp6-types'... +Skipping installation of data files for module 'ietf-dhcp6-types'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-dhcp6-types'... +Skipping installation of data files for module 'ietf-dhcp6-types'... +Resolving dependency: 'ietf-dhcp6-server' imports 'ietf-interfaces'... Installing data files for module 'ietf-interfaces'... Notifying sysrepo about the change... Install operation completed successfully. @@ -175,9 +175,7 @@ turing-machine | 2013-12-27 | Installed | root:root | 66 iana-if-type | 2014-05-08 | Installed | | | | ietf-interfaces | 2014-05-08 | Installed | root:root | 666 | | ietf-ip | 2014-06-16 | Installed | | | | -kea-dhcpv4-server | 2018-07-14 | Installed | root:root | 666 | | -ietf-dhcpv4-options | 2018-07-14 | Imported | | | | -ietf-dhcpv4-types | 2018-07-14 | Imported | | | | +kea-dhcp4-server | 2018-07-14 | Installed | root:root | 666 | | ietf-dhcpv6-server | 2018-03-04 | Installed | root:root | 666 | | ietf-dhcpv6-options | 2018-03-04 | Imported | | | | ietf-dhcpv6-types | 2018-01-30 | Imported | | | | diff --git a/src/lib/yang/Makefile.am b/src/lib/yang/Makefile.am index b1b591e679..b57d077257 100644 --- a/src/lib/yang/Makefile.am +++ b/src/lib/yang/Makefile.am @@ -1,9 +1,22 @@ -SUBDIRS = . tests +SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) $(SYSREPO_CPPFLAGS) AM_CXXFLAGS = $(KEA_CXXFLAGS) +nobase_dist_pkgdata_DATA = models/ietf-dhcpv6-client.yang +nobase_dist_pkgdata_DATA += models/ietf-dhcpv6-options.yang +nobase_dist_pkgdata_DATA += models/ietf-dhcpv6-relay.yang +nobase_dist_pkgdata_DATA += models/etf-dhcpv6-server.yang +nobase_dist_pkgdata_DATA += models/ietf-dhcpv6-types.yang +nobase_dist_pkgdata_DATA += models/kea-ctrl-agent.yang +nobase_dist_pkgdata_DATA += models/kea-dhcp-ddns.yang +nobase_dist_pkgdata_DATA += models/kea-dhcp-types.yang +nobase_dist_pkgdata_DATA += models/kea-dhcp4-server.yang +nobase_dist_pkgdata_DATA += models/kea-dhcp6-server.yang +nobase_dist_pkgdata_DATA += models/kea-logging.yang +nobase_dist_pkgdata_DATA += models/kea-types.yang + lib_LTLIBRARIES = libkea-yang.la libkea_yang_la_SOURCES = adaptor.cc adaptor.h libkea_yang_la_SOURCES += sysrepo_error.h diff --git a/src/lib/yang/models/kea-ctrl-agent.yang b/src/lib/yang/models/kea-ctrl-agent.yang index eb56f26600..9d94224925 100644 --- a/src/lib/yang/models/kea-ctrl-agent.yang +++ b/src/lib/yang/models/kea-ctrl-agent.yang @@ -18,7 +18,7 @@ module kea-ctrl-agent { description "This model defines a YANG data model that can be used to configure and manage a Kea control agent."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } diff --git a/src/lib/yang/models/kea-dhcp-ddns.yang b/src/lib/yang/models/kea-dhcp-ddns.yang index af4d14624e..56f4e54734 100644 --- a/src/lib/yang/models/kea-dhcp-ddns.yang +++ b/src/lib/yang/models/kea-dhcp-ddns.yang @@ -18,7 +18,7 @@ module kea-dhcp-ddns { description "This model defines a YANG data model that can be used to configure and manage a Kea DHCP-DDNS server."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } diff --git a/src/lib/yang/models/kea-dhcp-types.yang b/src/lib/yang/models/kea-dhcp-types.yang index 3e236c29dd..43e8baf8f8 100644 --- a/src/lib/yang/models/kea-dhcp-types.yang +++ b/src/lib/yang/models/kea-dhcp-types.yang @@ -14,7 +14,7 @@ module kea-dhcp-types { contact "kea-dev@lists.isc.org"; description "This file defines some commonly used Kea DHCP types and groupings."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } @@ -499,33 +499,6 @@ module kea-dhcp-types { } } - // To move to DHCPv6. - grouping interface-id { - description "Interface ID grouping."; - leaf interface-id { - type string; - description "Interface ID entry."; - } - } - - grouping subnet-interface-id { - description "Interface ID grouping for a subnet."; - uses interface-id { - refine interface-id { - description "Subnet interface-id option."; - } - } - } - - grouping network-interface-id { - description "Interface ID grouping for a shared network."; - uses interface-id { - refine interface-id { - description "Shared network interface-id option."; - } - } - } - grouping subnet-id { description "Subnet ID grouping."; leaf id { @@ -751,7 +724,7 @@ module kea-dhcp-types { stored here."; } } - } + } grouping host-user-context { description "User context grouping for a host reservation."; @@ -771,7 +744,7 @@ module kea-dhcp-types { stored here."; } } - } + } grouping network-user-context { description "User context grouping for a shared network."; diff --git a/src/lib/yang/models/kea-dhcp4-server.yang b/src/lib/yang/models/kea-dhcp4-server.yang index 2b9683f141..bbd5422c16 100644 --- a/src/lib/yang/models/kea-dhcp4-server.yang +++ b/src/lib/yang/models/kea-dhcp4-server.yang @@ -21,7 +21,7 @@ module kea-dhcp4-server { description "This model defines a YANG data model that can be used to configure and manage a Kea DHCPv4 server."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } @@ -96,6 +96,39 @@ module kea-dhcp4-server { } } + grouping host { + description "Host grouping."; + leaf identifier-type { + type host-identifier-type; + mandatory true; + description "Host identifier type."; + } + uses dhcp:host-identifier; + leaf ip-address { + type inet:ipv4-address; + description "Host reserved IPv4 address."; + } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; + uses option-data-list; + uses next-server; + uses server-hostname; + uses boot-file-name; + uses dhcp:host-user-context; + } + + grouping reservations { + description "Host reservations grouping."; + container reservations { + description "Host reservations container."; + list host { + key "identifier-type identifier"; + description "Host reservation entry."; + uses host; + } + } + } + grouping subnet4-list { description "Subnet4 list grouping."; list subnet4 { @@ -139,32 +172,12 @@ module kea-dhcp4-server { description "IPv4 subnet prefix."; } uses dhcp:subnet-interface; - uses dhcp:subnet-interface-id; uses dhcp:subnet-id; uses dhcp:subnet-client-class; uses dhcp:subnet-require-client-classes; - container reservations { - description "A container with host reservations specific to - this IPv4 subnet."; - list host { - key "identifier-type identifier"; - description "Host reservation entry."; - leaf identifier-type { - type host-identifier-type; - description "Host identifier type."; - } - uses dhcp:host-identifier; - leaf ip-address { - type inet:ipv4-address; - description "Host reserved IPv4 address."; - } - uses dhcp:host-hostname; - uses dhcp:host-client-classes; - uses option-data-list; - uses next-server; - uses server-hostname; - uses boot-file-name; - uses dhcp:host-user-context; + uses reservations { + refine reservations { + description "Subnet host reservations."; } } uses dhcp:subnet-reservation-mode; @@ -387,6 +400,11 @@ module kea-dhcp4-server { } } uses dhcp:sanity-checks; + uses reservations { + refine reservations { + description "Global host reservations."; + } + } } container logging { @@ -498,24 +516,8 @@ module kea-dhcp4-server { list host { key "subnet-id identifier-type identifier"; description "List of Kea DHCPv4 hosts."; - leaf identifier-type { - type host-identifier-type; - mandatory true; - description "Host identifier type."; - } - uses dhcp:host-identifier; + uses host; uses dhcp:host-subnet-id; - leaf ip-address { - type inet:ipv4-address; - description "Host reserved IP address."; - } - uses dhcp:host-hostname; - uses dhcp:host-client-classes; - uses option-data-list; - uses next-server; - uses server-hostname; - uses boot-file-name; - uses dhcp:host-user-context; leaf auth-key { type string; description "Host authentication key (unused in DHCPv4)."; diff --git a/src/lib/yang/models/kea-dhcp6-server.yang b/src/lib/yang/models/kea-dhcp6-server.yang index 519a404c7d..c358654a65 100644 --- a/src/lib/yang/models/kea-dhcp6-server.yang +++ b/src/lib/yang/models/kea-dhcp6-server.yang @@ -22,7 +22,7 @@ module kea-dhcp6-server { description "This model defines a YANG data model that can be used to configure and manage a Kea DHCPv6 server."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } @@ -57,6 +57,14 @@ module kea-dhcp6-server { } } + grouping interface-id { + description "Interface ID grouping."; + leaf interface-id { + type string; + description "Interface ID entry."; + } + } + grouping relay { description "Relay grouping."; leaf-list ip-addresses { @@ -74,6 +82,40 @@ module kea-dhcp6-server { } } + grouping host { + description "Host grouping."; + leaf identifier-type { + type host-identifier-type; + mandatory true; + description "Host identifier type."; + } + uses dhcp:host-identifier; + leaf-list ip-addresses { + type inet:ipv6-address; + description "Host reserved IP addresses."; + } + leaf-list prefixes { + type inet:ipv6-prefix; + description "Host reserved IP prefixes."; + } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; + uses option-data-list; + uses dhcp:host-user-context; + } + + grouping reservations { + description "Host reservations grouping."; + container reservations { + description "Host reservations container."; + list host { + key "identifier-type identifier"; + description "Host reservation entry."; + uses host; + } + } + } + grouping subnet6-list { description "Subnet6 list grouping."; list subnet6 { @@ -157,7 +199,11 @@ module kea-dhcp6-server { description "IPv6 subnet prefix."; } uses dhcp:subnet-interface; - uses dhcp:subnet-interface-id; + uses interface-id { + refine interface-id { + description "Subnet interface-id option."; + } + } uses dhcp:subnet-id; uses rapid-commit { refine rapid-commit { @@ -166,30 +212,9 @@ module kea-dhcp6-server { } uses dhcp:subnet-client-class; uses dhcp:require-client-classes; - container reservations { - description "A container with host reservations specific to - this IPv6 subnet."; - list host { - key "identifier-type identifier"; - description "Host reservation entry."; - leaf identifier-type { - type host-identifier-type; - mandatory true; - description "Host identifier type."; - } - uses dhcp:host-identifier; - leaf-list ip-addresses { - type inet:ipv6-address; - description "Host reserved IP addresses."; - } - leaf-list prefixes { - type inet:ipv6-prefix; - description "Host reserved IP prefixes."; - } - uses dhcp:host-hostname; - uses dhcp:host-client-classes; - uses option-data-list; - uses dhcp:host-user-context; + uses reservations { + refine reservations { + description "Subnet host reservations."; } } uses dhcp:subnet-reservation-mode; @@ -294,7 +319,11 @@ module kea-dhcp6-server { uses subnet6-list; } uses dhcp:network-interface; - uses dhcp:network-interface-id; + uses interface-id { + refine interface-id { + description "Shared network interface-id option."; + } + } uses dhcp:renew-timer; uses dhcp:rebind-timer; uses option-data-list; @@ -412,6 +441,11 @@ module kea-dhcp6-server { } } uses dhcp:sanity-checks; + uses reservations { + refine reservations { + description "Global host reservations."; + } + } } container logging { @@ -565,25 +599,8 @@ module kea-dhcp6-server { list host { key "subnet-id identifier-type identifier"; description "List of Kea DHCPv6 hosts."; - leaf identifier-type { - type host-identifier-type; - mandatory true; - description "Host identifier type."; - } - uses dhcp:host-identifier; + uses host; uses dhcp:host-subnet-id; - leaf-list ip-addresses { - type inet:ipv6-address; - description "Host reserved IP addresses."; - } - leaf-list prefixes { - type inet:ipv6-prefix; - description "Host reserved prefixes."; - } - uses dhcp:host-hostname; - uses dhcp:host-client-classes; - uses option-data-list; - uses dhcp:host-user-context; leaf auth-key { type string; description "Host authentication key."; diff --git a/src/lib/yang/models/kea-logging.yang b/src/lib/yang/models/kea-logging.yang index a2412c7a18..31ad29f9db 100644 --- a/src/lib/yang/models/kea-logging.yang +++ b/src/lib/yang/models/kea-logging.yang @@ -12,7 +12,7 @@ module kea-logging { description "This model defines a YANG data model that can be used to configure and manage logging of a Kea server."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } diff --git a/src/lib/yang/models/kea-types.yang b/src/lib/yang/models/kea-types.yang index d89690762c..bfbdac738f 100644 --- a/src/lib/yang/models/kea-types.yang +++ b/src/lib/yang/models/kea-types.yang @@ -7,7 +7,7 @@ module kea-types { contact "kea-dev@lists.isc.org"; description "This file defines some commonly used Kea types and groupings."; - revision 2018-08-20 { + revision 2018-09-14 { description "Initial revision"; reference ""; } -- 2.47.2