From: Piotr Strzy¿ewski Date: Sat, 14 Jul 2018 22:48:38 +0000 (+0200) Subject: Initial version of YANG DHCPv4 server model X-Git-Tag: gitlab29-base~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f224420125f97b96e4808e1658a19a4f07caf62;p=thirdparty%2Fkea.git Initial version of YANG DHCPv4 server model --- diff --git a/src/lib/yang/models/ietf-dhcpv4-server.yang b/src/lib/yang/models/ietf-dhcpv4-server.yang new file mode 100644 index 0000000000..fae9bae98a --- /dev/null +++ b/src/lib/yang/models/ietf-dhcpv4-server.yang @@ -0,0 +1,577 @@ +module ietf-dhcpv4-server { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-server"; + prefix "dhcpv4-server"; + + import ietf-inet-types { + prefix inet; + } + import ietf-yang-types { + prefix yang; + } + import ietf-dhcpv4-options { + prefix dhcpv4-options; + } + import ietf-dhcpv4-types { + prefix dhcpv4-types; + } + import ietf-interfaces { + prefix if; + } + + organization "DHC WG"; + contact + "piotr.strzyzewski@polsl.pl"; + description "This model defines a YANG data model that can be + used to configure and manage a DHCPv4 server."; + + revision 2018-07-14 { + description "Initial revision; mostly based on DHCPv6 version"; + } + + /* + * Typedef + */ + typedef threshold { + type union { + type uint16 { + range 0..100; + } + type enumeration { + enum "disabled" { + description "No threshold"; + } + } + } + description "Threshold value in percent"; + } + + /* + * Data Nodes + */ + container server { + presence "Enables the server"; + description "DHCPv4 server portion"; + + /* + * Configuration data + */ + container server-config { + description "This container contains the configuration data + of a server."; + container serv-attributes { + description + "This container contains basic attributes of a DHCPv4 server + such as IPv4 address, server name and so on. Some optional + functions that can be provided by the server is also included."; + leaf name { + type string; + description "server's name"; + } + leaf description { + type string; + description "description of the server."; + } + leaf-list ipv4-address { + type inet:ipv4-address; + description "server's IPv4 address."; + } + leaf-list interfaces-config { + // Note - this should probably be references to + // entries in the ietf-interfaces model + type if:interface-ref; + description "A leaf list to denote which one or more interfaces + the server should listen on. The default value is to listen + on all the interfaces. This node is also used to set a unicast + address for the server to listen with a specific interface. + For example, if someone want the server to listen on a unicast + address with a specific interface, she/he can use the format + like 'eth0/192.0.2.1'."; + } + uses dhcpv4-types:vendor-infor; + } + + container option-sets { + description "DHCPv4 employs various options to carry additional + information and parameters in DHCP messages. This container defines + all the possible options that need to be configured at the server + side."; + list option-set { + key option-set-id; + description "A server may allow different option sets to be + configured for different conditions (i.e. different networks, + clients and etc). This 'option-set' list enables various sets of + options being defined and configured in a single server. Different + sets are distinguished by the key called 'option-set-id'. All the + possible options discussed above are defined in the list and each + option is corresponding to a container. Since all the options in + the list are optional, each container in this list has a 'presence' + statement to indicate whether this option (container) will be + included in the current option set or not. In addition, each container + also has a 'if-feature' statement to indicate whether the server + supports this option (container)."; + leaf option-set-id { + type uint32; + description "option set id"; + } + uses dhcpv4-options:server-option-definitions; + } + } + + container network-ranges { + description "This model supports a hierarchy + to achieve dynamic configuration. That is to say we could configure the + server at different levels through this model. The top level is a global + level which is defined as the container 'network-ranges'. The following + levels are defined as sub-containers under it. The 'network-ranges' + contains the parameters (e.g. option-sets) that would be allocated to + all the clients served by this server."; + + leaf option-set-id { + type leafref { + path "/server/server-config/option-sets/option-set/option-set-id"; + } + description + "The ID field of relevant global option-set to be provisioned to + clients."; + } + list network-range { + key network-range-id; + description + "Under the 'network-ranges' container, a 'network-range' list + is defined to configure the server at a network level which is also + considered as the second level. Different network are identified by the + key 'network-range-id'. This is because a server may have different + configuration parameters (e.g. option sets) for different networks."; + leaf network-range-id { + type uint32; + mandatory true; + description "equivalent to subnet id"; + } + leaf network-description { + type string; + mandatory true; + description "description of the subnet"; + } + leaf network-prefix { + type inet:ipv4-prefix; + mandatory true; + description "subnet prefix"; + } + leaf option-set-id { + type leafref { + path "/server/server-config/option-sets/option-set/option-set-id"; + } + description "The ID field of relevant option-set to be provisioned to + clients of this network-range."; + } + + container address-pools { + description + "A container that describes the DHCPv4 server's + address pools."; + list address-pool { + key pool-id; + description "A DHCPv4 server can be configured with + several address pools. This list defines such address pools + which are distinguished by the key called 'pool-id'."; + leaf pool-id { + type uint32; + mandatory true; + description "pool id"; + } + leaf pool-prefix { + type inet:ipv4-prefix; + mandatory true; + description "pool prefix"; + } + leaf start-address { + type inet:ipv4-address-no-zone; + mandatory true; + description "start address"; + } + leaf end-address { + type inet:ipv4-address-no-zone; + mandatory true; + description "end address"; + } + leaf renew-time { + type yang:timeticks; + mandatory true; + description "renew time"; + } + leaf rebind-time { + type yang:timeticks; + mandatory true; + description "rebind time"; + } +// leaf rapid-commit { +// type boolean; +// mandatory false; +// description "A boolean value specifies whether the pool +// supports client-server exchanges involving two messages."; +// } + leaf client-class { + type string; + description + "If this leaf is specified, this pool will only serve + the clients belonging to this class."; + } + leaf max-address-count { + type threshold; + mandatory true; + description "maximum count of addresses that can + be allocated in this pool. This value may be + less than count of total addresses."; + } + leaf option-set-id { + type leafref { + path "/server/server-config/option-sets/option-set/option-set-id"; + } + mandatory true; + description "The ID field of relevant option-set to be + provisioned to clients of this address-pool."; + } + } + } + + container host-reservations { + description + "This container allows the server to make reservations at host level."; + list host-reservation { + key cli-id; + description "This list allows the server to reserve addresses, + prefixes, hostname and options for different clients."; + leaf cli-id { + type uint32; + mandatory true; + description "client id"; + } + + choice client-identifier { + description "When making reservations, the server needs to choose a + identifier to identify the client. Currently 'Client ID' and + 'hardware address' are supported."; + case client-id { + description "Client ID"; + type string; + } + case hw-address { + description "hardware address"; + leaf hardware-address { + type yang:mac-address; + description "MAC address of client"; + } + } + } + + leaf-list reserv-addr { + type inet:ipv4-address-no-zone; + description "reserved addr"; + } + + leaf hostname { + type string; + description "reserved hostname"; + } + + leaf option-set-id { + type leafref { + path "/server/server-config/option-sets/option-set/option-set-id"; + } + description "The ID field of relevant option-set to be provisioned + in the host reservation."; + } + } + } + + } + } + +/* + container relay-opaque-paras { + description "This container contains some opaque values in Relay Agent + options that need to be configured on the server side only for value + match. Such Relay Agent options include Interface-Id option, + Remote-Id option and Subscriber-Id option."; + list relays { + key relay-name; + description "relay agents"; + leaf relay-name { + type string; + mandatory true; + description "relay agent name"; + } + list interface-info { + key if-name; + description "interface info"; + leaf if-name { + type string; + mandatory true; + description "interface name"; + } + leaf interface-id { + type string; + mandatory true; + description "interface id"; + } + } + list subscribers { + key subscriber; + description "subscribers"; + leaf subscriber { + type uint32; + mandatory true; + description "subscriber"; + } + leaf subscriber-id { + type string; + mandatory true; + description "subscriber id"; + } + } + list remote-host { + key ent-num; + description "remote host"; + leaf ent-num { + type uint32; + mandatory true; + description "enterprise number"; + } + leaf remote-id { + type string; + mandatory true; + description "remote id"; + } + } + } + } +*/ + } + + /* + * State data + */ + container server-state { + config "false"; + description "states of server"; + container network-ranges { + description "This model supports a hierarchy to achieve dynamic configuration. + That is to say we could configure the server at different levels through + this model. The top level is a global level which is defined as the container + 'network-ranges'. The following levels are defined as sub-containers under it. + The 'network-ranges' contains the parameters (e.g. option-sets) that would be + allocated to all the clients served by this server."; + list network-range { + key network-range-id; + description "The ID field of relevant option-set to be provisioned + to clients of this network-range."; + leaf network-range-id { + type uint32; + mandatory true; + description "equivalent to subnet id"; + } + container address-pools { + description "A container that describes the DHCPv4 server's address pools"; + list address-pool { + key pool-id; + description "A DHCPv4 server can be configured with + several address pools. This list defines such address pools + which are distinguished by the key called 'pool-id'."; + leaf pool-id { + type uint32; + mandatory true; + description "pool id"; + } + leaf total-address-count { + type uint32; + mandatory true; + description "count of total addresses in the pool"; + } + leaf allocated-address-conut { + type uint32; + mandatory true; + description "count of allocated addresses in the pool"; + } + } + list binding-info { + key cli-id; + description "A list that records a binding information for each DHCPv4 + client that has already been allocated IPv4 addresses."; + leaf cli-id { + type uint32; + mandatory true; + description "client id"; + } + list cli-hw { + key hw-address; + description "client host id"; + leaf hw-address { + type yang:mac-address; + mandatory true; + description "HW address"; + } + leaf-list cli-addr { + type inet:ipv4-address; + description "client addr"; + } + leaf pool-id { + type uint32; + mandatory true; + description "pool id"; + } + } + } + } + + container host-reservations { + description "This container provides host reservations in the host level."; + list binding-info { + key cli-id; + description + "A list records a binding information for each DHCPv4 + client that has already been alloated IPv4 addresses or prefixes + by host reservations."; + leaf cli-id { + type uint32; + mandatory true; + description "client id"; + } + list cli-hw { + key hw-address; + description "client host id"; + leaf hw-address { + type yang:mac-address; + mandatory true; + description "HW address"; + } + leaf-list cli-addr { + type inet:ipv4-address; + description "client addr"; + } + } + } + } + + } + } + + container packet-stats { + description "A container presents the packet statistics related to + the DHCPv4 server."; + leaf request-count { + type uint32; + mandatory true; + description "request counter"; + } + leaf renew-count { + type uint32; + mandatory true; + description "renew counter"; + } + leaf rebind-count { + type uint32; + mandatory true; + description "rebind counter"; + } + leaf decline-count { + type uint32; + mandatory true; + description "decline count"; + } + leaf release-count { + type uint32; + mandatory true; + description "release counter"; + } + leaf info-req-count { + type uint32; + mandatory true; + description "information request counter"; + } + leaf advertise-count { + type uint32; + mandatory true; + description "advertise counter"; + } + leaf confirm-count { + type uint32; + mandatory true; + description "confirm counter"; + } + leaf reconfigure-count { + type uint32; + mandatory true; + description "reconfigure counter"; + } + leaf relay-forward-count { + type uint32; + mandatory true; + description "relay forward counter"; + } + leaf relay-reply-count { + type uint32; + mandatory true; + description "relay reply counter"; + } + } + } + } + + /* + * Notifications + */ + + notification notifications { + description "dhcpv4 server notification module"; + container dhcpv4-server-event { + description "dhcpv4 server event"; + container address-pool-running-out { + description "Raised when the address pool is going to + run out. A threshold for utilization ratio of the pool has + been defined in the server feature so that it will notify the + administrator when the utilization ratio reaches the + threshold, and such threshold is a settable parameter."; + leaf total-address-count { + type uint32; + mandatory true; + description "Count of total addresses in the pool."; + } + leaf max-address-count { + type uint32; + mandatory true; + description "Maximum count of addresses that can be allocated + in the pool. This value may be less than count of total + addresses."; + } + leaf allocated-address-conut { + type uint32; + mandatory true; + description "Count of allocated addresses in the pool."; + } + leaf serv-name { + type string; + description "server name"; + } + leaf pool-name { + type string; + mandatory true; + description "pool name"; + } + } + container invalid-client-detected { + description "Raised when the server has found a client which + can be regarded as a potential attacker. Some description + could also be included."; + container hw { + description "HW address"; + uses yang:mac-address; + } + leaf description { + type string; + description "description of the event"; + } + } + } + } +}