From 3a8250e16152c65b62d878de2879b19a58a475a8 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Wed, 12 Sep 2018 15:42:32 +0200 Subject: [PATCH] [65-libyang-generic] Resolved rebase conflicts --- src/lib/yang/models/ietf-dhcpv4-options.yang | 243 -------- src/lib/yang/models/ietf-dhcpv4-types.yang | 64 -- src/lib/yang/models/kea-dhcpv4-server.yang | 578 ------------------- src/lib/yang/tests/keatest-module.yang | 2 +- src/lib/yang/translator.h | 3 +- 5 files changed, 3 insertions(+), 887 deletions(-) delete mode 100644 src/lib/yang/models/ietf-dhcpv4-options.yang delete mode 100644 src/lib/yang/models/ietf-dhcpv4-types.yang delete mode 100644 src/lib/yang/models/kea-dhcpv4-server.yang diff --git a/src/lib/yang/models/ietf-dhcpv4-options.yang b/src/lib/yang/models/ietf-dhcpv4-options.yang deleted file mode 100644 index 57a081c19d..0000000000 --- a/src/lib/yang/models/ietf-dhcpv4-options.yang +++ /dev/null @@ -1,243 +0,0 @@ -module ietf-dhcpv4-options { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-options"; - prefix "dhcpv4-options"; - - import ietf-inet-types { - prefix inet; - } - import ietf-yang-types { - prefix yang; - } - import ietf-dhcpv4-types { - prefix dhcpv4-types; - } - - organization "DHC WG"; - contact - "piotr.strzyzewski@polsl.pl"; - description "This model defines a YANG data model that can be - used to configure DHCPv4 options."; - - revision 2018-07-14 { - description "Initial revision"; - reference ""; - } - - /* - * Features - */ - - // features for server options - feature router-op { - description "Support for Router Option"; - } - feature time-server-op { - description "Support for Time Server Option"; - } - feature domain-server-op { - description "Support for Domain Server Option"; - } - feature log-server-op { - description "Support for Log Server Option"; - } - feature hostname-op { - description "Support for Hostname Option"; - } - feature domain-name-op { - description "Support for Domain Name Option"; - } - feature broadcast-op { - description "Support for Broadcast Address Option"; - } - feature ntp-server-op { - description "Support for NTP Servers Option"; - } - feature server-name-op { - description "Support for Server-Name Option"; - } - feature bootfile-name-op { - description "Support for Bootfile-Name Option"; - } - - /* - * Groupings - */ - - grouping server-option-definitions { - description "Contains definitions for options configured on the - DHCPv4 server which will be supplied to clients."; - - container router-option { - // if-feature router-op - // presence "Enable this option"; - description "Router (3) Router addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list router { - key router-id; - description "Router info"; - leaf router-id { - type uint8; - mandatory true; - description "Router list entry ID"; - } - leaf router-addr { - type inet:ipv4-address; - mandatory true; - description "Router address"; - } - } - } - container time-server-option { - // if-feature time-server-op - // presence "Enable this option"; - description "Time Server (4) Timeserver addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list time-server { - key time-server-id; - description "Time Server info"; - leaf time-server-id { - type uint8; - mandatory true; - description "Time Server list entry ID"; - } - leaf time-server-addr { - type inet:ipv4-address; - mandatory true; - description "Time Server address"; - } - } - } - container domain-server-option { - // if-feature domain-server-op - // presence "Enable this option"; - description "Domain Server (6) DNS Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list domain-server { - key domain-server-id; - description "DNS Server info"; - leaf domain-server-id { - type uint8; - mandatory true; - description "DNS Server list entry ID"; - } - leaf domain-server-addr { - type inet:ipv4-address; - mandatory true; - description "DNS Server address"; - } - } - } - container log-server-option { - // if-feature log-server-op - // presence "Enable this option"; - description "Log Server (7) Logging Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list log-server { - key log-server-id; - description "Logging Server info"; - leaf log-server-id { - type uint8; - mandatory true; - description "Logging Server list entry ID"; - } - leaf log-server-addr { - type inet:ipv4-address; - mandatory true; - description "Logging Server address"; - } - } - } - container hostname-option { - // if-feature hostname-op; - // presence "Enable this option"; - description "Hostname (12) Hostname string"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf hostname { - type string; - description "Hostname"; - } - } - container domain-name-option { - // if-feature domain-name-op; - // presence "Enable this option"; - description "Domain Name (15) The DNS domain name of the client"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf domain-name { - type string; - description "Domain Name"; - } - } - container broadcast-option { - // if-feature broadcast-op - // presence "Enable this option"; - description "Broadcast Address (28) Broadcast Address"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf broadcast-addr { - type inet:ipv4-address; - description "Broadcast address"; - } - } - container ntp-server-option { - // if-feature ntp-server-op - // presence "Enable this option"; - description "NTP Servers (42) NTP Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list ntp-server { - key ntp-server-id; - description "NTP Server info"; - leaf ntp-server-id { - type uint8; - mandatory true; - description "NTP Server list entry ID"; - } - leaf ntp-server-addr { - type inet:ipv4-address; - mandatory true; - description "NTP Server address"; - } - } - } - container server-name-option { - // if-feature server-name-op; - // presence "Enable this option"; - description "Server-Name (66) TFTP Server Name"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf server-name { - type string; - description "TFTP Server Name"; - } - } - container bootfile-name-option { - // if-feature bootfile-name-op; - // presence "Enable this option"; - description "Bootfile-Name (67) Boot File Name"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf bootfile-name { - type string; - description "Boot File Name"; - } - } - container domain-search-option { - // if-feature domain-search-op; - // presence "Enable this option"; - description "Domain Search (119) DNS domain search list"; - reference "RFC3397: Dynamic Host Configuration Protocol - (DHCP) Domain Search Option"; - list domain-search { - key domain-search-id; - description "Domain Search info"; - leaf domain-search-id { - type uint8; - mandatory true; - description "Domain Search entry ID"; - } - leaf domain-search-entry { - type string; - mandatory true; - description "Domain Search list entry"; - } - } - } - } -} diff --git a/src/lib/yang/models/ietf-dhcpv4-types.yang b/src/lib/yang/models/ietf-dhcpv4-types.yang deleted file mode 100644 index 4b33d2a418..0000000000 --- a/src/lib/yang/models/ietf-dhcpv4-types.yang +++ /dev/null @@ -1,64 +0,0 @@ -module ietf-dhcpv4-types { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-types"; - prefix "dhcpv4-types"; - - import ietf-inet-types { - prefix inet; - } - import ietf-yang-types { - prefix yang; - } - - organization "DHC WG"; - contact - "piotr.strzyzewski@polsl.pl"; - description "This model defines a YANG data model that can be - used to define some commonly used DHCPv4 types"; - - revision 2018-07-14 { - description "Initial revision"; - reference ""; - } - - /* - * Grouping - */ - grouping vendor-infor { - description "Vendor information."; - container vendor-info { - description ""; - leaf ent-num { - type uint32; - description "enterprise number"; - } - leaf-list data { - type string; - description "specific vendor info"; - } - } - } - - grouping portset-para { - description "portset parameters"; - container port-parameter { - description "port parameter"; - leaf offset { - type uint8; - mandatory true; - description "offset in a port set"; - } - leaf psid-len { - type uint8; - mandatory true; - description "length of a psid"; - } - leaf psid { - type uint16; - mandatory true; - description "psid value"; - } - } - } - -} diff --git a/src/lib/yang/models/kea-dhcpv4-server.yang b/src/lib/yang/models/kea-dhcpv4-server.yang deleted file mode 100644 index 939d14412c..0000000000 --- a/src/lib/yang/models/kea-dhcpv4-server.yang +++ /dev/null @@ -1,578 +0,0 @@ -module kea-dhcpv4-server { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:kea-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 Kea-dhcp4, a DHCPv4 server from ISC."; - - revision 2018-07-14 { - description "Initial revision; mostly based on DHCPv6 version"; - reference ""; - } - - /* - * 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; - 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 uint32; - units "seconds"; - description "renew time"; - } - leaf rebind-time { - type uint32; - units "seconds"; - 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; - 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"; - } - 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"; - leaf client-ident { - type string; - description "Client ID"; - } - } - 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."; - leaf hw { - type yang:mac-address; - description "HW address"; - } - leaf description { - type string; - description "description of the event"; - } - } - } - } -} diff --git a/src/lib/yang/tests/keatest-module.yang b/src/lib/yang/tests/keatest-module.yang index 934ca915a8..ce64742faa 100644 --- a/src/lib/yang/tests/keatest-module.yang +++ b/src/lib/yang/tests/keatest-module.yang @@ -541,7 +541,7 @@ module keatest-module { container tpdfs { leaf unival { type uniontpdf; - } + } leaf leafrefval { type leafreftpdf; diff --git a/src/lib/yang/translator.h b/src/lib/yang/translator.h index a72124a841..ec79611dba 100644 --- a/src/lib/yang/translator.h +++ b/src/lib/yang/translator.h @@ -41,7 +41,8 @@ public: /// @note Should be const as it is read only... /// /// @param xpath The xpath of the basic value. - /// @return The Element representing the item at xpath or null when not found. + /// @return The Element representing the item at xpath or null + /// when not found. /// @throw SysrepoError when sysrepo raises an error. /// @throw NotImplemented when the value type is not supported. isc::data::ElementPtr getItem(const std::string& xpath); -- 2.47.2