]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-simplify-update-models] Removed all extra containers
authorFrancis Dupont <fdupont@isc.org>
Tue, 20 Nov 2018 02:56:02 +0000 (03:56 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 22 Nov 2018 22:13:47 +0000 (17:13 -0500)
39 files changed:
doc/examples/kea4/all-keys.json
doc/examples/kea6/all-keys.json
src/lib/yang/models/kea-ctrl-agent.yang
src/lib/yang/models/kea-dhcp-ddns.yang
src/lib/yang/models/kea-dhcp-types.yang
src/lib/yang/models/kea-dhcp4-server.yang
src/lib/yang/models/kea-dhcp6-server.yang
src/lib/yang/models/kea-logging.yang
src/lib/yang/models/kea-types.yang
src/lib/yang/tests/translator_class_unittests.cc
src/lib/yang/tests/translator_database_unittests.cc
src/lib/yang/tests/translator_host_unittests.cc
src/lib/yang/tests/translator_logger_unittests.cc
src/lib/yang/tests/translator_option_def_unittests.cc
src/lib/yang/tests/translator_pd_pool_unittests.cc
src/lib/yang/tests/translator_pool_unittests.cc
src/lib/yang/tests/translator_shared_network_unittests.cc
src/lib/yang/tests/translator_subnet_unittests.cc
src/lib/yang/tests/yang_configs.h
src/lib/yang/translator_class.cc
src/lib/yang/translator_class.h
src/lib/yang/translator_config.cc
src/lib/yang/translator_config.h
src/lib/yang/translator_database.cc
src/lib/yang/translator_database.h
src/lib/yang/translator_host.cc
src/lib/yang/translator_host.h
src/lib/yang/translator_logger.cc
src/lib/yang/translator_logger.h
src/lib/yang/translator_option_def.cc
src/lib/yang/translator_option_def.h
src/lib/yang/translator_pd_pool.cc
src/lib/yang/translator_pd_pool.h
src/lib/yang/translator_pool.cc
src/lib/yang/translator_pool.h
src/lib/yang/translator_shared_network.cc
src/lib/yang/translator_shared_network.h
src/lib/yang/translator_subnet.cc
src/lib/yang/translator_subnet.h

index 713aa1f6ff3fc81557259aa71ce9bad1033caa60..c566cdc3f5f52f517f36550af9f48ad5d75f7e8d 100644 (file)
         "subnet4": [],
 
         // Global valid lifetime value.
-        "valid-lifetime": 6000
+        "valid-lifetime": 6000,
+
+        // Configuration control.
+        "config-control":
+        {
+            // Only configuration databases entry is defined.
+            "config-databases": [
+                {
+                    // Name of the database to connect to.
+                    "name": "config",
+
+                    // Type of the database, e.g. "mysql", "pgsql", "cql".
+                    "type": "mysql"
+                }
+            ]
+        },
+
+        // Server tag.
+        "server-tag": "my DHCPv4 server",
+
+        // DHCP queue control parameters.
+        "dhcp-queue-control":
+        {
+            // Queue type is mandatory.
+            "queue-type": "kea-ring4"
+        }
     },
 
     // Logging configuration begins here.
index 52d6d953c04d20e84030f56b8521b71622dc1aa8..2274d579f08a02e9dea1b8cd4c88765727031d38 100644 (file)
         "subnet6": [],
 
         // Global valid lifetime value.
-        "valid-lifetime": 6000
+        "valid-lifetime": 6000,
+
+        // Configuration control.
+        "config-control":
+        {
+            // Only configuration databases entry is defined.
+            "config-databases": [
+                {
+                    // Name of the database to connect to.
+                    "name": "config",
+
+                    // Type of the database, e.g. "mysql", "pgsql", "cql".
+                    "type": "mysql"
+                }
+            ]
+        },
+
+        // Server tag.
+        "server-tag": "my DHCPv6 server",
+
+        // DHCP queue control parameters.
+        "dhcp-queue-control":
+        {
+            // Queue type is mandatory.
+            "queue-type": "kea-ring6"
+        }
     },
 
     // Logging configuration begins here.
index f886413b5f600239052c3eb62f209fb55d6d0ea7..718e89d21740c7d4c0845b5f399eb79c3205120a 100644 (file)
@@ -12,7 +12,7 @@ module kea-ctrl-agent {
   }
   import kea-logging {
     prefix logging;
-    revision-date 2018-11-11;
+    revision-date 2018-11-16;
   }
 
   organization "Internet Systems Consortium";
@@ -20,7 +20,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-11-11 {
+  revision 2018-11-16 {
     description "Initial revision";
     reference "";
   }
index f0622326d1464170130a439b762f49d7258c89c9..35c5f45bffbd25523c4e2b99cb51bb88a38efb6c 100644 (file)
@@ -12,7 +12,7 @@ module kea-dhcp-ddns {
   }
   import kea-logging {
     prefix logging;
-    revision-date 2018-11-11;
+    revision-date 2018-11-16;
   }
 
   organization "Internet Systems Consortium";
@@ -20,7 +20,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-11-11 {
+  revision 2018-11-16 {
     description "Initial revision";
     reference "";
   }
index 6fbd3ebc927e28448c0761037a0199e5de094287..ebba98a450c6e2a38225390b0a57fadd35611421 100644 (file)
@@ -183,13 +183,10 @@ module kea-dhcp-types {
       description "Lease database.";
       uses database;
     }
-    container hosts-databases {
-      description "Hosts databases.";
-      list hosts-database {
-        key database-type;
-        description "List of databases.";
-        uses database;
-      }
+    list hosts-database {
+      key database-type;
+      description "List of databases.";
+      uses database;
     }
   }
 
@@ -765,7 +762,7 @@ module kea-dhcp-types {
     description "Config control grouping.";
     container config-control {
       description "Config control.";
-      list config-databases {
+      list config-database {
         key database-type;
         description "List of databases.";
         uses database;
index c60a5a6b56e91c41a3df42b431e2c1b13d87db8c..d67bc66a276ab51d6942f6f522aa5a72b0438b34 100644 (file)
@@ -16,7 +16,7 @@ module kea-dhcp4-server {
   }
   import kea-logging {
     prefix logging;
-    revision-date 2018-11-11;
+    revision-date 2018-11-16;
   }
 
   organization "Internet Systems Consortium";
@@ -24,7 +24,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-11-14 {
+  revision 2018-11-16 {
     description "Initial revision";
     reference "";
   }
@@ -130,13 +130,10 @@ module kea-dhcp4-server {
 
   grouping reservations {
     description "Host reservations grouping.";
-    container reservations {
-      description "Host reservations container.";
-      list host {
-        key "identifier-type identifier";
-        description "Host reservation entry.";
-        uses host;
-      }
+    list host {
+      key "identifier-type identifier";
+      description "Host reservation list.";
+      uses host;
     }
   }
 
@@ -150,32 +147,29 @@ module kea-dhcp4-server {
       uses dhcp:renew-timer;
       uses dhcp:rebind-timer;
       uses option-data-list;
-      container pools {
-        description "List of pools.";
-        list pool {
-          key "start-address end-address";
-          ordered-by user;
-          description "Pool entry.";
-          leaf prefix {
-            type inet:ipv4-prefix;
-            description "Defines a pool of dynamic IPv4 addresses to be managed
-                         by the server.";
-          }
-          leaf start-address {
-            type inet:ipv4-address;
-            mandatory true;
-            description "First IPv4 address in a pool.";
-          }
-          leaf end-address {
-            type inet:ipv4-address;
-            mandatory true;
-            description "Last IPv4 address in a pool.";
-          }
-          uses option-data-list;
-          uses dhcp:pool-client-class;
-          uses dhcp:pool-require-client-classes;
-          uses dhcp:pool-user-context;
+      list pool {
+        key "start-address end-address";
+        ordered-by user;
+        description "Pool list.";
+        leaf prefix {
+          type inet:ipv4-prefix;
+          description "Defines a pool of dynamic IPv4 addresses to be managed
+                       by the server.";
+        }
+        leaf start-address {
+          type inet:ipv4-address;
+          mandatory true;
+          description "First IPv4 address in a pool.";
         }
+        leaf end-address {
+          type inet:ipv4-address;
+          mandatory true;
+          description "Last IPv4 address in a pool.";
+        }
+        uses option-data-list;
+        uses dhcp:pool-client-class;
+        uses dhcp:pool-require-client-classes;
+        uses dhcp:pool-user-context;
       }
       leaf subnet {
         type inet:ipv4-prefix;
@@ -187,8 +181,8 @@ module kea-dhcp4-server {
       uses dhcp:subnet-client-class;
       uses dhcp:subnet-require-client-classes;
       uses reservations {
-        refine reservations {
-          description "Subnet host reservations.";
+        refine host {
+          description "Subnet host reservations list.";
         }
       }
       uses dhcp:subnet-reservation-mode;
@@ -217,44 +211,46 @@ module kea-dhcp4-server {
     }
   }
 
-  grouping client-class {
+  grouping client-classes {
     description "Client class grouping.";
-    uses dhcp:class-name;
-    uses dhcp:class-test;
-    uses dhcp:class-only-if-required;
-    uses option-def-list;
-    uses option-data-list;
-    uses next-server;
-    uses server-hostname;
-    uses boot-file-name;
-    uses dhcp:class-user-context;
+    list client-class {
+      key name;
+      ordered-by user;
+      description "List of client classes.";
+      uses dhcp:class-name;
+      uses dhcp:class-test;
+      uses dhcp:class-only-if-required;
+      uses option-def-list;
+      uses option-data-list;
+      uses next-server;
+      uses server-hostname;
+      uses boot-file-name;
+      uses dhcp:class-user-context;
+    }
   }
 
   grouping option-def-list {
     description "Option definition list grouping.";
-    container option-def-list {
-      description "List with custom option definitions.";
-      list option-def {
-        key "code space";
-        description "Option definition entry.";
-        leaf code {
-          type uint8;
-          mandatory true;
-          description "Option code to be used by the new option definition.";
-        }
-        leaf space {
-          type string;
-          mandatory true;
-          description "Option space for the new option (typically dhcp4).";
-        }
-        uses dhcp:option-def-name;
-        uses dhcp:option-def-type;
-        uses dhcp:option-def-record-types;
-        uses dhcp:option-def-encapsulate;
-        uses dhcp:option-def-array;
-        uses dhcp:option-def-user-context;
+    list option-def {
+      key "code space";
+      description "Option definition entry.";
+      leaf code {
+        type uint8;
+        mandatory true;
+        description "Option code to be used by the new option definition.";
       }
-    }
+      leaf space {
+        type string;
+        mandatory true;
+        description "Option space for the new option (typically dhcp4).";
+      }
+      uses dhcp:option-def-name;
+      uses dhcp:option-def-type;
+      uses dhcp:option-def-record-types;
+      uses dhcp:option-def-encapsulate;
+      uses dhcp:option-def-array;
+      uses dhcp:option-def-user-context;
+     }
   }
 
   grouping option-data-list {
@@ -292,42 +288,31 @@ module kea-dhcp4-server {
     uses dhcp:renew-timer;
     uses dhcp:rebind-timer;
     uses dhcp:decline-probation-period;
+    uses subnet4-list;
 
-    container subnet4 {
-      description "Global list of IPv4 subnets.";
+    list shared-network {
+      key name;
+      description "List of IPv4 shared networks.";
+      uses dhcp:network-name;
       uses subnet4-list;
-    }
-
-    container shared-networks {
-      description "Defines a list of IPv4 shared networks.";
-      list shared-network {
-        key name;
-        description "List of IPv4 shared networks.";
-        uses dhcp:network-name;
-        container subnet4 {
-          description "List of IPv4 subnets that belong to this shared
-                       network.";
-          uses subnet4-list;
-        }
-        uses dhcp:network-interface;
-        uses dhcp:renew-timer;
-        uses dhcp:rebind-timer;
-        uses option-data-list;
-        uses match-client-id;
-        uses next-server;
-        uses server-hostname;
-        uses boot-file-name;
-        container relay {
-          description "Optional information about relay agent.";
-          uses relay;
-        }
-        uses authoritative;
-        uses dhcp:network-reservation-mode;
-        uses dhcp:network-client-class;
-        uses dhcp:network-require-client-classes;
-        uses dhcp:valid-lifetime;
-        uses dhcp:network-user-context;
+      uses dhcp:network-interface;
+      uses dhcp:renew-timer;
+      uses dhcp:rebind-timer;
+      uses option-data-list;
+      uses match-client-id;
+      uses next-server;
+      uses server-hostname;
+      uses boot-file-name;
+      container relay {
+        description "Optional information about relay agent.";
+        uses relay;
       }
+      uses authoritative;
+      uses dhcp:network-reservation-mode;
+      uses dhcp:network-client-class;
+      uses dhcp:network-require-client-classes;
+      uses dhcp:valid-lifetime;
+      uses dhcp:network-user-context;
     }
 
     container interfaces-config {
@@ -371,16 +356,7 @@ module kea-dhcp4-server {
       description "Host reservation identifiers.";
     }
 
-    container client-classes {
-      description "Client classes.";
-      list client-class {
-        key name;
-        ordered-by user;
-        description "List of client classes.";
-        uses client-class;
-      }
-    }
-
+    uses client-classes;
     uses option-def-list;
     uses option-data-list;
     uses kea:hooks-libraries;
@@ -409,8 +385,8 @@ module kea-dhcp4-server {
     }
     uses dhcp:sanity-checks;
     uses reservations {
-      refine reservations {
-        description "Global host reservations.";
+      refine host {
+        description "Global host reservations list.";
       }
     }
     uses dhcp:config-control;
index 3bdda1cd59434dd6af85a11398a4e12c49d33218..f523b8faefeb8ed9a8ca6d5ec747f10911630b6d 100644 (file)
@@ -16,7 +16,7 @@ module kea-dhcp6-server {
   }
   import kea-logging {
     prefix logging;
-    revision-date 2018-11-11;
+    revision-date 2018-11-16;
   }
 
   organization "Internet Systems Consortium";
@@ -24,7 +24,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-11-14 {
+  revision 2018-11-16 {
     description "Initial revision";
     reference "";
   }
@@ -107,13 +107,10 @@ module kea-dhcp6-server {
 
   grouping reservations {
     description "Host reservations grouping.";
-    container reservations {
-      description "Host reservations container.";
-      list host {
-        key "identifier-type identifier";
-        description "Host reservation entry.";
-        uses host;
-      }
+    list host {
+      key "identifier-type identifier";
+      description "Host reservation list.";
+      uses host;
     }
   }
 
@@ -128,69 +125,63 @@ module kea-dhcp6-server {
       uses dhcp:renew-timer;
       uses dhcp:rebind-timer;
       uses option-data-list;
-      container pools {
-        description "List of pools.";
-        list pool {
-          key "start-address end-address";
-          ordered-by user;
-          description "Pool entry.";
-          leaf prefix {
-            type inet:ipv6-prefix;
-            description "Pool prefix.";
-          }
-          leaf start-address {
-            type inet:ipv6-address;
-            mandatory true;
-            description "First IPv6 address in a pool.";
-          }
-          leaf end-address {
-            type inet:ipv6-address;
-            mandatory true;
-            description "Last IPv6 address in a pool.";
-          }
-          uses option-data-list;
-          uses dhcp:pool-client-class;
-          uses dhcp:pool-require-client-classes;
-          uses dhcp:pool-user-context;
+      list pool {
+        key "start-address end-address";
+        ordered-by user;
+        description "Pool list.";
+        leaf prefix {
+          type inet:ipv6-prefix;
+          description "Pool prefix.";
         }
+        leaf start-address {
+          type inet:ipv6-address;
+          mandatory true;
+          description "First IPv6 address in a pool.";
+        }
+        leaf end-address {
+          type inet:ipv6-address;
+          mandatory true;
+          description "Last IPv6 address in a pool.";
+        }
+        uses option-data-list;
+        uses dhcp:pool-client-class;
+        uses dhcp:pool-require-client-classes;
+        uses dhcp:pool-user-context;
       }
-      container pd-pools {
-        description "List of prefix delegation pools.";
-        list pd-pool {
-          key prefix;
-          ordered-by user;
-          description "Prefix delegation pool entry.";
-          leaf prefix {
-            type inet:ipv6-prefix;
-            mandatory true;
-            description "IPv6 pool prefix.";
-          }
-          leaf delegated-len {
-            type uint8;
-            description "Prefix pool delegated length.";
-          }
-          uses option-data-list;
-          uses dhcp:client-class {
-            refine client-class {
-              description "Prefix pool client class guard. (only
-                           clients belonging to this class will be
-                           allowed in this pool).";
-            }
-          }
-          uses dhcp:require-client-classes {
-            refine require-client-classes {
-              description "Prefix pool require client classes.";
-            }
+      list pd-pool {
+        key prefix;
+        ordered-by user;
+        description "Prefix delegation pool list.";
+        leaf prefix {
+          type inet:ipv6-prefix;
+          mandatory true;
+          description "IPv6 pool prefix.";
+        }
+        leaf delegated-len {
+          type uint8;
+          description "Prefix pool delegated length.";
+        }
+        uses option-data-list;
+        uses dhcp:client-class {
+          refine client-class {
+            description "Prefix pool client class guard. (only
+                         clients belonging to this class will be
+                         allowed in this pool).";
           }
-          leaf excluded-prefix {
-            type inet:ipv6-prefix;
-            description "Prefix pool excluded prefix.";
+        }
+        uses dhcp:require-client-classes {
+          refine require-client-classes {
+            description "Prefix pool require client classes.";
           }
-          uses kea:user-context {
-            refine user-context {
-              description "Prefix pool user context. Arbitrary JSON data
-                           can be stored here.";
-            }
+        }
+        leaf excluded-prefix {
+          type inet:ipv6-prefix;
+          description "Prefix pool excluded prefix.";
+        }
+        uses kea:user-context {
+          refine user-context {
+            description "Prefix pool user context. Arbitrary JSON data
+                         can be stored here.";
           }
         }
       }
@@ -214,8 +205,8 @@ module kea-dhcp6-server {
       uses dhcp:subnet-client-class;
       uses dhcp:require-client-classes;
       uses reservations {
-        refine reservations {
-          description "Subnet host reservations.";
+        refine host {
+          description "Subnet host reservations list.";
         }
       }
       uses dhcp:subnet-reservation-mode;
@@ -227,39 +218,41 @@ module kea-dhcp6-server {
     }
   }
 
-  grouping client-class {
-    description "Client class grouping.";
-    uses dhcp:class-name;
-    uses dhcp:class-test;
-    uses dhcp:class-only-if-required;
-    uses option-data-list;
-    uses dhcp:class-user-context;
+  grouping client-classes {
+    description "Client classes grouping.";
+    list client-class {
+      key name;
+      ordered-by user;
+      description "List of client classes.";
+      uses dhcp:class-name;
+      uses dhcp:class-test;
+      uses dhcp:class-only-if-required;
+      uses option-data-list;
+      uses dhcp:class-user-context;
+    }
   }
 
   grouping option-def-list {
     description "Option definition list grouping.";
-    container option-def-list {
-      description "Option definition list.";
-      list option-def {
-        key "code space";
-        description "Option definition entry.";
-        leaf code {
-          type uint16;
-          mandatory true;
-          description "Option code to be used by the new option definition.";
-        }
-        leaf space {
-          type string;
-          mandatory true;
-          description "Option space for the new option (typically dhcp6).";
-        }
-        uses dhcp:option-def-name;
-        uses dhcp:option-def-type;
-        uses dhcp:option-def-record-types;
-        uses dhcp:option-def-encapsulate;
-        uses dhcp:option-def-array;
-        uses dhcp:option-def-user-context;
+    list option-def {
+      key "code space";
+      description "Option definition entry.";
+      leaf code {
+        type uint16;
+        mandatory true;
+        description "Option code to be used by the new option definition.";
+      }
+      leaf space {
+        type string;
+        mandatory true;
+        description "Option space for the new option (typically dhcp6).";
       }
+      uses dhcp:option-def-name;
+      uses dhcp:option-def-type;
+      uses dhcp:option-def-record-types;
+      uses dhcp:option-def-encapsulate;
+      uses dhcp:option-def-array;
+      uses dhcp:option-def-user-context;
     }
   }
 
@@ -299,48 +292,37 @@ module kea-dhcp6-server {
     uses dhcp:renew-timer;
     uses dhcp:rebind-timer;
     uses dhcp:decline-probation-period;
+    uses subnet6-list;
 
-    container subnet6 {
-      description "Global subnet6 list.";
+    list shared-network {
+      key name;
+      uses dhcp:network-name;
+      description "List of IPv4 shared networks.";
       uses subnet6-list;
-    }
-
-    container shared-networks {
-      description "Defines a list of IPv6 shared networks.";
-      list shared-network {
-        key name;
-        uses dhcp:network-name;
-        description "List of IPv4 shared networks.";
-        container subnet6 {
-          description "List of IPv6 subnets that belong to this shared
-                       network.";
-          uses subnet6-list;
-        }
-        uses dhcp:network-interface;
-        uses interface-id {
-          refine interface-id {
-            description "Shared network interface-id option.";
-          }
+      uses dhcp:network-interface;
+      uses interface-id {
+        refine interface-id {
+          description "Shared network interface-id option.";
         }
-        uses dhcp:renew-timer;
-        uses dhcp:rebind-timer;
-        uses option-data-list;
-        container relay {
-          description "Optional information about relay agent.";
-          uses relay;
-        }
-        uses dhcp:network-reservation-mode;
-        uses dhcp:network-client-class;
-        uses dhcp:require-client-classes;
-        uses preferred-lifetime;
-        uses rapid-commit {
-          refine rapid-commit {
-            description "Shared network rapid commit flag.";
-          }
+      }
+      uses dhcp:renew-timer;
+      uses dhcp:rebind-timer;
+      uses option-data-list;
+      container relay {
+        description "Optional information about relay agent.";
+        uses relay;
+      }
+      uses dhcp:network-reservation-mode;
+      uses dhcp:network-client-class;
+      uses dhcp:require-client-classes;
+      uses preferred-lifetime;
+      uses rapid-commit {
+        refine rapid-commit {
+          description "Shared network rapid commit flag.";
         }
-        uses dhcp:valid-lifetime;
-        uses dhcp:network-user-context;
       }
+      uses dhcp:valid-lifetime;
+      uses dhcp:network-user-context;
     }
 
     container interfaces-config {
@@ -371,16 +353,7 @@ module kea-dhcp6-server {
       description "Host reservation identifiers.";
     }
 
-    container client-classes {
-      description "Client classes.";
-      list client-class {
-        key name;
-        ordered-by user;
-        description "List of client classes.";
-        uses client-class;
-      }
-    }
-
+    uses client-classes;
     uses option-def-list;
     uses option-data-list;
     uses kea:hooks-libraries;
@@ -440,8 +413,8 @@ module kea-dhcp6-server {
     }
     uses dhcp:sanity-checks;
     uses reservations {
-      refine reservations {
-        description "Global host reservations.";
+      refine host {
+        description "Global host reservations list.";
       }
     }
     uses dhcp:config-control;
index 688d652c7d835b0b7aef6e89ef4c317c098e4dfc..8e3583c07fb87cb8daff770ea91c0e9d6d6fdb74 100644 (file)
@@ -13,7 +13,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-11-11 {
+  revision 2018-11-16 {
     description "Initial revision";
     reference "";
   }
@@ -22,85 +22,83 @@ module kea-logging {
   * Groupings
   */
 
-  grouping configuration {
-    description "Contains parameters for logging configuration.";
-
-    container loggers {
-      description "Loggers.";
-      list logger {
-        key name;
-        description "List of loggers.";
-        leaf name {
+  grouping loggers {
+    description "Loggers.";
+    list logger {
+      key name;
+      description "List of loggers.";
+      leaf name {
+        type string;
+        mandatory true;
+        description "Name of the logger.";
+      }
+      list output-option {
+        key output;
+        description "List of output options.";
+        leaf output {
           type string;
-          mandatory true;
-          description "Name of the logger.";
+          description "Type of output. Special values are stdout (standard
+            output), stderr (standard error), syslog (syslog using default
+            name), syslog:name (syslog using specified name). Any other
+            value is interpreted as a filename.";
         }
-        container output-options {
-          description "Output options.";
-          list option {
-            key output;
-            description "List of output options.";
-            leaf output {
-              type string;
-              description "Type of output. Special values are stdout (standard
-                output), stderr (standard error), syslog (syslog using default
-                name), syslog:name (syslog using specified name). Any other
-                value is interpreted as a filename.";
-            }
-            leaf flush {
-              type boolean;
-              description "When true flush buffers after each message.";
-            }
-            leaf maxsize {
-              type uint32;
-              description "Maximum size of output file before rotation.
-                Values below 204800 including 0 disable rotation.";
-            }
-            leaf maxver {
-              type uint32 {
-                range 1..max;
-              }
-              description "Maximum version to keep a rotated output file.";
-            }
-          }
+        leaf flush {
+          type boolean;
+          description "When true flush buffers after each message.";
         }
-        leaf debuglevel {
-          type uint8 {
-            range 0..99;
-          }
-          description "What level of debug messages should be printed.";
+        leaf maxsize {
+          type uint32;
+          description "Maximum size of output file before rotation.
+            Values below 204800 including 0 disable rotation.";
         }
-        leaf severity {
-          type enumeration {
-            enum "FATAL" {
-              description "Condition is so serious that the server cannot
-                continue executing";
-            }
-            enum "ERROR" {
-              description "Error condition. The server will continue
-                executing, but the results may not be as expected.";
-            }
-            enum "WARN" {
-              description "Out of the ordinary condition. However, the server
-                will continue executing normally.";
-            }
-            enum "INFO" {
-              description "Information message marking some event.";
-            }
-            enum "DEBUG" {
-              description "For debugging purposes.";
-            }
-            enum "NONE" {
-              description "All messages are inhibited.";
-            }
+        leaf maxver {
+          type uint32 {
+            range 1..max;
           }
-          description "Category of messages logged.";
+          description "Maximum version to keep a rotated output file.";
+        }
+      }
+      leaf debuglevel {
+        type uint8 {
+          range 0..99;
         }
-        leaf user-context {
-          type kea:user-context;
-          description "Logger user context.";
+        description "What level of debug messages should be printed.";
+      }
+      leaf severity {
+        type enumeration {
+          enum "FATAL" {
+            description "Condition is so serious that the server cannot
+              continue executing";
+          }
+          enum "ERROR" {
+            description "Error condition. The server will continue
+              executing, but the results may not be as expected.";
+          }
+          enum "WARN" {
+            description "Out of the ordinary condition. However, the server
+              will continue executing normally.";
+          }
+          enum "INFO" {
+            description "Information message marking some event.";
+          }
+          enum "DEBUG" {
+            description "For debugging purposes.";
+          }
+          enum "NONE" {
+            description "All messages are inhibited.";
+          }
         }
+        description "Category of messages logged.";
+      }
+      leaf user-context {
+        type kea:user-context;
+        description "Logger user context.";
       }
     }
   }
+
+  grouping configuration {
+    description "Contains parameters for logging configuration.";
+    uses loggers;
+  }
 }
index bfbdac738f49223adf0e048f73e5ac4e47ddaeab..2346634ff4a50e4982e84ce07885e45b42a4f342 100644 (file)
@@ -55,20 +55,17 @@ module kea-types {
 
   grouping hooks-libraries {
     description "Hooks libraries grouping.";
-    container hooks-libraries {
-      description "Hook libraries.";
-      list hook-library {
-        key library;
-        description "List of hook library.";
-        leaf library {
-          type string;
-          mandatory true;
-          description "Path to the DSO.";
-        }
-        leaf parameters {
-          type string;
-          description "Parameters (JSON value).";
-        }
+    list hook-library {
+      key library;
+      description "List of hook library.";
+      leaf library {
+        type string;
+        mandatory true;
+        description "Path to the DSO.";
+      }
+      leaf parameters {
+        type string;
+        description "Parameters (JSON value).";
       }
     }
   }
index e299835b57965385bdc9b795a606fda30f717a9a..30191b259c0c54366b17d6f791a2d78ef389684d 100644 (file)
@@ -45,7 +45,7 @@ TEST_F(TranslatorClassesTest, getEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Get the client class list and check if it is empty.
-    const string& xpath = "/kea-dhcp4-server:config/client-classes";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr classes;
     EXPECT_NO_THROW(classes = t_obj_->getClasses(xpath));
     EXPECT_FALSE(classes);
@@ -57,7 +57,7 @@ TEST_F(TranslatorClassesTest, get) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the client class.
-    const string& xpath = "/kea-dhcp6-server:config/client-classes";
+    const string& xpath = "/kea-dhcp6-server:config";
     const string& xclass = xpath + "/client-class[name='foo']";
     const string& xtest = xclass + "/test";
     S_Val v_test(new Val("not member('ALL')", SR_STRING_T));
@@ -87,7 +87,7 @@ TEST_F(TranslatorClassesTest, setEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set empty list.
-    const string& xpath = "/kea-dhcp4-server:config/client-classes";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr classes = Element::createList();
     EXPECT_NO_THROW(t_obj_->setClasses(xpath, classes));
 
@@ -108,7 +108,7 @@ TEST_F(TranslatorClassesTest, set) {
     useModel(KEA_DHCP6_SERVER);
 
     // Set one client class.
-    const string& xpath = "/kea-dhcp6-server:config/client-classes";
+    const string& xpath = "/kea-dhcp6-server:config";
     ElementPtr classes = Element::createList();
     ElementPtr cclass = Element::createMap();
     cclass->set("name", Element::create(string("foo")));
@@ -132,15 +132,13 @@ TEST_F(TranslatorClassesTest, set) {
     string expected =
         "kea-dhcp6-server:config (container)\n"
         " |\n"
-        " -- client-classes (container)\n"
+        " -- client-class (list instance)\n"
         "     |\n"
-        "     -- client-class (list instance)\n"
-        "         |\n"
-        "         -- name = foo\n"
-        "         |\n"
-        "         -- test = ''==''\n"
-        "         |\n"
-        "         -- only-if-required = false\n";
+        "     -- name = foo\n"
+        "     |\n"
+        "     -- test = ''==''\n"
+        "     |\n"
+        "     -- only-if-required = false\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
index 6c5e552da518af12042f9f3d14223ea8475ea469..3e8e3c43ce605efe671d238c2cfc28d7de78a9b0 100644 (file)
@@ -153,7 +153,7 @@ TEST_F(TranslatorDatabasesTest, getEmpty) {
     useModel(KEA_DHCP6_SERVER);
 
     // Get empty.
-    const string& xpath = "/kea-dhcp6-server:config/hosts-databases";
+    const string& xpath = "/kea-dhcp6-server:config/hosts-database";
     ConstElementPtr databases;
     EXPECT_NO_THROW(databases = t_obj_->getDatabases(xpath));
     EXPECT_FALSE(databases);
@@ -165,9 +165,8 @@ TEST_F(TranslatorDatabasesTest, get) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
-    const string& xdatabase =
-        xpath + "/hosts-database[database-type='mysql']";
+    const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+    const string& xdatabase = xpath + "[database-type='mysql']";
     const string& xname = xdatabase + "/name";
     const string& xuser = xdatabase + "/user";
     const string& xpassword = xdatabase + "/password";
@@ -225,7 +224,7 @@ TEST_F(TranslatorDatabasesTest, set) {
     useModel(KEA_DHCP6_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp6-server:config/hosts-databases";
+    const string& xpath = "/kea-dhcp6-server:config/hosts-database";
     ElementPtr database = Element::createMap();
     database->set("type", Element::create(string("memfile")));
     database->set("lfc-interval", Element::create(3600));
@@ -262,9 +261,8 @@ TEST_F(TranslatorDatabasesTest, setEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
-    const string& xdatabase =
-        xpath + "/hosts-database[database-type='mysql']";
+    const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+    const string& xdatabase = xpath + "[database-type='mysql']";
     const string& xname = xdatabase + "/name";
     const string& xuser = xdatabase + "/user";
     const string& xpassword = xdatabase + "/password";
@@ -297,9 +295,8 @@ TEST_F(TranslatorDatabasesTest, setEmpties) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
-    const string& xdatabase =
-        xpath + "/hosts-database[database-type='mysql']";
+    const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+    const string& xdatabase = xpath + "[database-type='mysql']";
     const string& xname = xdatabase + "/name";
     const string& xuser = xdatabase + "/user";
     const string& xpassword = xdatabase + "/password";
index 4abc8dd7fec6525095ed62ba37a78777d598d5c1..375d775832ab9a9bf9f07b4f4bff97de5198e69f 100644 (file)
@@ -46,7 +46,7 @@ TEST_F(TranslatorHostsTest, getEmpty) {
 
     // Get the host reservation list and check if it is empty.
     const string& xpath =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/reservations";
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     ConstElementPtr hosts;
     EXPECT_NO_THROW(hosts = t_obj_->getHosts(xpath));
     ASSERT_TRUE(hosts);
@@ -60,14 +60,13 @@ TEST_F(TranslatorHostsTest, get) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& xsubnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Create the host reservation for 2001:db8::1.
-    const string& xpath = subnet + "/reservations";
     ostringstream shost;
     shost << xpath + "/host[identifier-type='hw-address']"
           << "[identifier='00:01:02:03:04:05']";
@@ -102,14 +101,13 @@ TEST_F(TranslatorHostsTest, setEmpty) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& xsubnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set empty list.
-    const string& xpath = subnet + "/reservations";
     ConstElementPtr hosts = Element::createList();
     EXPECT_NO_THROW(t_obj_->setHosts(xpath, hosts));
 
@@ -127,14 +125,13 @@ TEST_F(TranslatorHostsTest, set) {
     useModel(KEA_DHCP4_SERVER);
 
     // Create the subnet 10.0.0.0/14 #111.
-    const string& subnet =
-        "/kea-dhcp4-server:config/subnet4/subnet4[id='111']";
+    const string& xpath =
+        "/kea-dhcp4-server:config/subnet4[id='111']";
     S_Val v_subnet(new Val("10.0.0.0/24", SR_STRING_T));
-    const string& xsubnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set one host.
-    const string& xpath = subnet + "/reservations";
     ElementPtr hosts = Element::createList();
     ElementPtr host = Element::createMap();
     host->set("flex-id", Element::create(string("00:ff")));
@@ -158,25 +155,21 @@ TEST_F(TranslatorHostsTest, set) {
     string expected =
         "kea-dhcp4-server:config (container)\n"
         " |\n"
-        " -- subnet4 (container)\n"
+        " -- subnet4 (list instance)\n"
+        "     |\n"
+        "     -- id = 111\n"
         "     |\n"
-        "     -- subnet4 (list instance)\n"
+        "     -- subnet = 10.0.0.0/24\n"
+        "     |\n"
+        "     -- host (list instance)\n"
+        "         |\n"
+        "         -- identifier-type = flex-id\n"
         "         |\n"
-        "         -- id = 111\n"
+        "         -- identifier = 00:ff\n"
         "         |\n"
-        "         -- subnet = 10.0.0.0/24\n"
+        "         -- hostname = foo\n"
         "         |\n"
-        "         -- reservations (container)\n"
-        "             |\n"
-        "             -- host (list instance)\n"
-        "                 |\n"
-        "                 -- identifier-type = flex-id\n"
-        "                 |\n"
-        "                 -- identifier = 00:ff\n"
-        "                 |\n"
-        "                 -- hostname = foo\n"
-        "                 |\n"
-        "                 -- ip-address = 10.0.0.1\n";
+        "         -- ip-address = 10.0.0.1\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
@@ -189,14 +182,13 @@ TEST_F(TranslatorHostsTest, getMany) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& xsubnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Create the host reservation for 2001:db8::1.
-    const string& xpath = subnet + "/reservations";
     ostringstream shost;
     shost << xpath + "/host[identifier-type='hw-address']"
           << "[identifier='00:01:02:03:04:05']";
@@ -205,7 +197,6 @@ TEST_F(TranslatorHostsTest, getMany) {
     EXPECT_NO_THROW(sess_->set_item(xaddr.c_str(), s_addr));
 
     // Create another reservation for 2001:db8::2
-    const string xpath2 = subnet + "/reservations";
     ostringstream shost2;
     shost2 << xpath + "/host[identifier-type='hw-address']"
            << "[identifier='00:01:0a:0b:0c:0d']";
@@ -215,8 +206,7 @@ TEST_F(TranslatorHostsTest, getMany) {
 
     // Get the host.
     ConstElementPtr hosts;
-    string hosts_path = subnet + "/reservations";
-    EXPECT_NO_THROW(hosts = t_obj_->getHosts(hosts_path));
+    EXPECT_NO_THROW(hosts = t_obj_->getHosts(xpath));
     ASSERT_TRUE(hosts);
 
     EXPECT_EQ(hosts->str(),
index a8bc744137e0160e818b8c19bfac11d253cf0259..981e6f3a3f22e56dfe8d366b264a79d4f128d215 100644 (file)
@@ -44,7 +44,7 @@ TEST_F(TranslatorLoggersTest, getEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Get empty.
-    const string& xpath = "/kea-dhcp4-server:logging/loggers";
+    const string& xpath = "/kea-dhcp4-server:logging";
     ConstElementPtr loggers;
     EXPECT_NO_THROW(loggers = t_obj_->getLoggers(xpath));
     ASSERT_TRUE(loggers);
@@ -57,10 +57,10 @@ TEST_F(TranslatorLoggersTest, get) {
     useModel(KEA_DHCP6_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp6-server:logging/loggers";
+    const string& xpath = "/kea-dhcp6-server:logging";
     const string& xlogger = xpath + "/logger[name='foo']";
     const string& xseverity = xlogger + "/severity";
-    const string& xoption = xlogger + "/output-options/option[output='/bar']";
+   const string& xoption = xlogger + "/output-option[output='/bar']";
     const string& xmaxver = xoption + "/maxver";
     S_Val s_severity(new Val("WARN", SR_ENUM_T));
     EXPECT_NO_THROW(sess_->set_item(xseverity.c_str(), s_severity));
@@ -106,7 +106,7 @@ TEST_F(TranslatorLoggersTest, set) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set a value.
-    const string& xpath = "/kea-dhcp4-server:logging/loggers";
+    const string& xpath = "/kea-dhcp4-server:logging";
     ElementPtr option = Element::createMap();
     option->set("output", Element::create(string("/bar")));
     option->set("maxver", Element::create(10));
@@ -158,21 +158,17 @@ TEST_F(TranslatorLoggersTest, set) {
     string expected =
         "kea-dhcp4-server:logging (container)\n"
         " |\n"
-        " -- loggers (container)\n"
+        " -- logger (list instance)\n"
         "     |\n"
-        "     -- logger (list instance)\n"
-        "         |\n"
-        "         -- name = foo\n"
-        "         |\n"
-        "         -- output-options (container)\n"
-        "         |   |\n"
-        "         |   -- option (list instance)\n"
-        "         |       |\n"
-        "         |       -- output = /bar\n"
-        "         |       |\n"
-        "         |       -- maxver = 10\n"
-        "         |\n"
-        "         -- severity = WARN\n";
+        "     -- name = foo\n"
+        "     |\n"
+        "     -- output-option (list instance)\n"
+        "     |   |\n"
+        "     |   -- output = /bar\n"
+        "     |   |\n"
+        "     |   -- maxver = 10\n"
+        "     |\n"
+        "     -- severity = WARN\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
index 6daab7449305f96ce650542ac692a9cee2d9e915..515d9ec303f3c35606a515ded62d1f7fef7c2f3d 100644 (file)
@@ -45,7 +45,7 @@ TEST_F(TranslatorOptionDefListTest, getEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Get the option definition list and check if it is empty.
-    const string& xpath = "/kea-dhcp4-server:config/option-def-list";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr options;
     EXPECT_NO_THROW(options = t_obj_->getOptionDefList(xpath));
     ASSERT_TRUE(options);
@@ -59,7 +59,7 @@ TEST_F(TranslatorOptionDefListTest, get) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the option code 100.
-    const string& xpath = "/kea-dhcp6-server:config/option-def-list";
+    const string& xpath = "/kea-dhcp6-server:config";
     const string& xdef = xpath + "/option-def[code='100'][space='isc']";
     const string& xname = xdef + "/name";
     const string& xtype = xdef + "/type";
@@ -98,7 +98,7 @@ TEST_F(TranslatorOptionDefListTest, setEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set empty list.
-    const string& xpath = "/kea-dhcp4-server:config/option-def-list";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr defs = Element::createList();
     EXPECT_NO_THROW(t_obj_->setOptionDefList(xpath, defs));
 
@@ -120,7 +120,7 @@ TEST_F(TranslatorOptionDefListTest, set) {
     useModel(KEA_DHCP6_SERVER);
 
     // Set one option def.
-    const string& xpath = "/kea-dhcp6-server:config/option-def-list";
+    const string& xpath = "/kea-dhcp6-server:config";
     ElementPtr defs = Element::createList();
     ElementPtr def = Element::createMap();
     def->set("code", Element::create(100));
@@ -145,19 +145,17 @@ TEST_F(TranslatorOptionDefListTest, set) {
     string expected =
         "kea-dhcp6-server:config (container)\n"
         " |\n"
-        " -- option-def-list (container)\n"
+        " -- option-def (list instance)\n"
         "     |\n"
-        "     -- option-def (list instance)\n"
-        "         |\n"
-        "         -- code = 100\n"
-        "         |\n"
-        "         -- space = isc\n"
-        "         |\n"
-        "         -- name = foo\n"
-        "         |\n"
-        "         -- type = string\n"
-        "         |\n"
-        "         -- array = false\n";
+        "     -- code = 100\n"
+        "     |\n"
+        "     -- space = isc\n"
+        "     |\n"
+        "     -- name = foo\n"
+        "     |\n"
+        "     -- type = string\n"
+        "     |\n"
+        "     -- array = false\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
index cb9ad3e030e795262f6215c13cc1295bdb72cb95..e8de18333aff85dbaa29f0b527e85df6beaf8cd2 100644 (file)
@@ -47,7 +47,7 @@ TEST_F(TranslatorPdPoolsTest, getEmptyIetf) {
     // Get the pd-pool list and check if it is empty.
     const string& xpath =
         "/ietf-dhcpv6-server:server/server-config/network-ranges"
-        "/network-range[network-range-id='111']/pd-pools";
+        "/network-range[network-range-id='111']/pd-pools/pd-pool";
     ConstElementPtr pools;
     EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
     ASSERT_TRUE(pools);
@@ -62,7 +62,7 @@ TEST_F(TranslatorPdPoolsTest, getEmptyKea) {
 
     // Get the pd-pool list and check if it is empty.
     const string& xpath =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools";
+        "/kea-dhcp6-server:config/subnet6[id='111']/pd-pool";
     ConstElementPtr pools;
     EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
     ASSERT_TRUE(pools);
@@ -104,7 +104,7 @@ TEST_F(TranslatorPdPoolsTest, getIetf) {
 
     // Get the pd-pool list and check if the pd-pool is in it.
     ConstElementPtr pools;
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(subnet + "/pd-pools"));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(subnet + "/pd-pools/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -117,14 +117,13 @@ TEST_F(TranslatorPdPoolsTest, getKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Create the pd-pool 2001:db8:0:1000::/64.
-    const string& xpath = subnet + "/pd-pools";
     const string& prefix = "2001:db8:0:1000::/56";
     ostringstream spool;
     spool << xpath + "/pd-pool[prefix='" << prefix << "']";
@@ -145,7 +144,7 @@ TEST_F(TranslatorPdPoolsTest, getKea) {
 
     // Get the pd-pool list and check if the pd-pool is in it.
     ConstElementPtr pools;
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -172,7 +171,7 @@ TEST_F(TranslatorPdPoolsTest, setEmptyIetf) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     EXPECT_EQ(0, pools->size());
@@ -184,20 +183,19 @@ TEST_F(TranslatorPdPoolsTest, setEmptyKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set empty list.
-    const string& xpath = subnet + "/pd-pools";
     ConstElementPtr pools = Element::createList();
     EXPECT_NO_THROW(t_obj_->setPdPools(xpath, pools));
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     EXPECT_EQ(0, pools->size());
@@ -227,7 +225,7 @@ TEST_F(TranslatorPdPoolsTest, setIetf) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -270,14 +268,13 @@ TEST_F(TranslatorPdPoolsTest, setKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set one pool.
-    const string& xpath = subnet + "/pd-pools";
     ElementPtr pools = Element::createList();
     ElementPtr pool = Element::createMap();
     pool->set("prefix", Element::create(string("2001:db8:0:1000::")));
@@ -288,7 +285,7 @@ TEST_F(TranslatorPdPoolsTest, setKea) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -301,21 +298,17 @@ TEST_F(TranslatorPdPoolsTest, setKea) {
     string expected =
         "kea-dhcp6-server:config (container)\n"
         " |\n"
-        " -- subnet6 (container)\n"
+        " -- subnet6 (list instance)\n"
         "     |\n"
-        "     -- subnet6 (list instance)\n"
-        "         |\n"
-        "         -- id = 111\n"
+        "     -- id = 111\n"
+        "     |\n"
+        "     -- subnet = 2001:db8::/48\n"
+        "     |\n"
+        "     -- pd-pool (list instance)\n"
         "         |\n"
-        "         -- subnet = 2001:db8::/48\n"
+        "         -- prefix = 2001:db8:0:1000::/56\n"
         "         |\n"
-        "         -- pd-pools (container)\n"
-        "             |\n"
-        "             -- pd-pool (list instance)\n"
-        "                 |\n"
-        "                 -- prefix = 2001:db8:0:1000::/56\n"
-        "                 |\n"
-        "                 -- delegated-len = 64\n";
+        "         -- delegated-len = 64\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
@@ -328,14 +321,13 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Create the first pd-pool 2001:db8:0:1000::/56.
-    const string& xpath = subnet + "/pd-pools";
     const string& prefix = "2001:db8:0:1000::/56";
     ostringstream spool;
     spool << xpath + "/pd-pool[prefix='" << prefix << "']";
@@ -345,10 +337,9 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
     EXPECT_NO_THROW(sess_->set_item(x_delegated.c_str(), s_delegated));
 
     // Create the second pd-pool 2001:db8:0:2000::/56
-    const string& xpath2 = subnet + "/pd-pools";
     const string& prefix2 = "2001:db8:0:2000::/56";
     ostringstream spool2;
-    spool2 << xpath2 + "/pd-pool[prefix='" << prefix2 << "']";
+    spool2 << xpath + "/pd-pool[prefix='" << prefix2 << "']";
     const string& x_delegated2 = spool2.str() + "/delegated-len";
     uint8_t dl2 = 60;
     S_Val s_delegated2(new Val(dl2, SR_UINT8_T));
@@ -357,7 +348,7 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
 
     // Get the pools list.
     ConstElementPtr pools;
-    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath2));
+    EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath + "/pd-pool"));
     ASSERT_TRUE(pools);
 
     // Check that both of them are returned properly.
index 998bf506577a0c608033e5665bb71832bca2f459..af1c024373405c2bbe38f59ecfac68243ef2e45c 100644 (file)
@@ -46,7 +46,8 @@ TEST_F(TranslatorPoolsTest, getEmptyIetf) {
 
     // Get the pool list and check if it is empty.
     const string& xpath = "/ietf-dhcpv6-server:server/server-config/"
-        "network-ranges/network-range[network-range-id='111']/address-pools";
+        "network-ranges/network-range[network-range-id='111']/"
+         "address-pools/address-pool";
     ConstElementPtr pools;
     EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
     ASSERT_TRUE(pools);
@@ -61,7 +62,7 @@ TEST_F(TranslatorPoolsTest, getEmptyKea) {
 
     // Get the pool list and check if it is empty.
     const string& xpath =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools";
+        "/kea-dhcp6-server:config/subnet6[id='111']/pool";
     ConstElementPtr pools;
     EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
     ASSERT_TRUE(pools);
@@ -95,7 +96,7 @@ TEST_F(TranslatorPoolsTest, getIetf) {
 
     // Get the pool list and check if the pool is in it.
     ConstElementPtr pools;
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/address-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -108,14 +109,13 @@ TEST_F(TranslatorPoolsTest, getKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Create the pool 2001:db8::1:0/112.
-    const string& xpath = subnet + "/pools";
     const string& prefix = "2001:db8::1:0/112";
     string start_addr;
     string end_addr;
@@ -140,7 +140,7 @@ TEST_F(TranslatorPoolsTest, getKea) {
 
     // Get the pool list and check if the pool is in it.
     ConstElementPtr pools;
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -166,7 +166,7 @@ TEST_F(TranslatorPoolsTest, setEmptyIetf) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/address-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     EXPECT_EQ(0, pools->size());
@@ -178,20 +178,19 @@ TEST_F(TranslatorPoolsTest, setEmptyKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set empty list.
-    const string& xpath = subnet + "/pools";
     ConstElementPtr pools = Element::createList();
     EXPECT_NO_THROW(t_obj_->setPools(xpath, pools));
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     EXPECT_EQ(0, pools->size());
@@ -219,7 +218,7 @@ TEST_F(TranslatorPoolsTest, setIetf) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/address-pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -264,14 +263,13 @@ TEST_F(TranslatorPoolsTest, setKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& subnet =
-        "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+    const string& xpath =
+        "/kea-dhcp6-server:config/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
-    const string& subnet_subnet = subnet + "/subnet";
-    EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+    const string& subnet = xpath + "/subnet";
+    EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
 
     // Set one pool.
-    const string& xpath = subnet + "/pools";
     ElementPtr pools = Element::createList();
     ElementPtr pool = Element::createMap();
     pool->set("pool",
@@ -281,7 +279,7 @@ TEST_F(TranslatorPoolsTest, setKea) {
 
     // Get it back.
     pools.reset();
-    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
+    EXPECT_NO_THROW(pools = t_obj_->getPools(xpath + "/pool"));
     ASSERT_TRUE(pools);
     ASSERT_EQ(Element::list, pools->getType());
     ASSERT_EQ(1, pools->size());
@@ -294,21 +292,17 @@ TEST_F(TranslatorPoolsTest, setKea) {
     string expected =
         "kea-dhcp6-server:config (container)\n"
         " |\n"
-        " -- subnet6 (container)\n"
+        " -- subnet6 (list instance)\n"
         "     |\n"
-        "     -- subnet6 (list instance)\n"
-        "         |\n"
-        "         -- id = 111\n"
+        "     -- id = 111\n"
+        "     |\n"
+        "     -- subnet = 2001:db8::/48\n"
+        "     |\n"
+        "     -- pool (list instance)\n"
         "         |\n"
-        "         -- subnet = 2001:db8::/48\n"
+        "         -- start-address = 2001:db8::1\n"
         "         |\n"
-        "         -- pools (container)\n"
-        "             |\n"
-        "             -- pool (list instance)\n"
-        "                 |\n"
-        "                 -- start-address = 2001:db8::1\n"
-        "                 |\n"
-        "                 -- end-address = 2001:db8::100\n";
+        "         -- end-address = 2001:db8::100\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
index 58b44562bf2e165ac176cb4fcd79a98f6ddb445d..ad255e75ba80855ba5c445479d88856541cc9a45 100644 (file)
@@ -44,7 +44,7 @@ TEST_F(TranslatorSharedNetworksTest, getEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Get the shared network list and check if it is empty.
-    const string& xpath = "/kea-dhcp4-server:config/shared-networks";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr networks;
     EXPECT_NO_THROW(networks = t_obj_->getSharedNetworks(xpath));
     ASSERT_TRUE(networks);
@@ -58,9 +58,9 @@ TEST_F(TranslatorSharedNetworksTest, get) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111 in shared network foo.
-    const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+    const string& xpath = "/kea-dhcp6-server:config";
     const string& xnetwork = xpath + "/shared-network[name='foo']";
-    const string& xsubnet = xnetwork + "/subnet6/subnet6[id='111']/subnet";
+    const string& xsubnet = xnetwork + "/subnet6[id='111']/subnet";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
 
@@ -93,7 +93,7 @@ TEST_F(TranslatorSharedNetworksTest, setEmpty) {
     useModel(KEA_DHCP4_SERVER);
 
     // Set empty list.
-    const string& xpath = "/kea-dhcp4-server:config/shared-networks";
+    const string& xpath = "/kea-dhcp4-server:config";
     ConstElementPtr networks = Element::createList();
     EXPECT_NO_THROW(t_obj_->setSharedNetworks(xpath, networks));
 
@@ -116,7 +116,7 @@ TEST_F(TranslatorSharedNetworksTest, set) {
     useModel(KEA_DHCP6_SERVER);
 
     // Set one shared network.
-    const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+    const string& xpath = "/kea-dhcp6-server:config";
     ElementPtr networks = Element::createList();
     ElementPtr share = Element::createMap();
     ElementPtr subnets = Element::createList();
@@ -144,19 +144,15 @@ TEST_F(TranslatorSharedNetworksTest, set) {
     string expected =
         "kea-dhcp6-server:config (container)\n"
         " |\n"
-        " -- shared-networks (container)\n"
+        " -- shared-network (list instance)\n"
         "     |\n"
-        "     -- shared-network (list instance)\n"
+        "     -- name = foo\n"
+        "     |\n"
+        "     -- subnet6 (list instance)\n"
         "         |\n"
-        "         -- name = foo\n"
+        "         -- id = 123\n"
         "         |\n"
-        "         -- subnet6 (container)\n"
-        "             |\n"
-        "             -- subnet6 (list instance)\n"
-        "                 |\n"
-        "                 -- id = 123\n"
-        "                 |\n"
-        "                 -- subnet = 2001:db8::/48\n";
+        "         -- subnet = 2001:db8::/48\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
@@ -175,7 +171,7 @@ TEST_F(TranslatorSharedNetworksTest, set) {
 TEST_F(TranslatorSharedNetworksTest, getList) {
     useModel(KEA_DHCP6_SERVER);
 
-    const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+    const string& xpath = "/kea-dhcp6-server:config";
 
     // Those two networks will be added.
     const string& xnetwork1 = xpath + "/shared-network[name='foo']";
@@ -198,22 +194,22 @@ TEST_F(TranslatorSharedNetworksTest, getList) {
         "[ " + exp_net1 + ", " + exp_net2 + " ]";
 
     // Create the subnet1: 2001:db8:1::/48 #1 in shared network foo.
-    const string& xsubnet1 = xnetwork1 + "/subnet6/subnet6[id='1']/subnet";
+    const string& xsubnet1 = xnetwork1 + "/subnet6[id='1']/subnet";
     S_Val v_subnet1(new Val("2001:db8:1::/48", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(xsubnet1.c_str(), v_subnet1));
 
     // Create the subnet2: 2001:db8:2::/48 #2 in shared network foo.
-    const string& xsubnet2 = xnetwork1 + "/subnet6/subnet6[id='2']/subnet";
+    const string& xsubnet2 = xnetwork1 + "/subnet6[id='2']/subnet";
     S_Val v_subnet2(new Val("2001:db8:2::/48", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(xsubnet2.c_str(), v_subnet2));
 
     // Create the subnet1: 2001:db8:101::/48 #101 in shared network foo.
-    const string& xsubnet3 = xnetwork2 + "/subnet6/subnet6[id='101']/subnet";
+    const string& xsubnet3 = xnetwork2 + "/subnet6[id='101']/subnet";
     S_Val v_subnet(new Val("2001:db8:101::/48", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(xsubnet3.c_str(), v_subnet));
 
     // Create the subnet2: 2001:db8:2::/48 #2 in shared network foo.
-    const string& xsubnet4 = xnetwork2 + "/subnet6/subnet6[id='102']/subnet";
+    const string& xsubnet4 = xnetwork2 + "/subnet6[id='102']/subnet";
     S_Val v_subnet4(new Val("2001:db8:102::/48", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(xsubnet4.c_str(), v_subnet4));
 
index d3adf2f3dbc83d93c28fb25cbefce1ac3d032058..b2ec4452a4c0179b5195d7cf9416e2b58cf1b164 100644 (file)
@@ -45,7 +45,8 @@ TEST_F(TranslatorSubnetsTest, getEmptyIetf) {
 
     // Get the subnet list and check if it is empty.
     const string& xpath =
-        "/ietf-dhcpv6-server:server/server-config/network-ranges";
+        "/ietf-dhcpv6-server:server/server-config/"
+        "network-ranges/network-range";
     ConstElementPtr subnets;
     EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
     ASSERT_TRUE(subnets);
@@ -90,7 +91,7 @@ TEST_F(TranslatorSubnetsTest, getIetf) {
 
     // Get the subnet list and check if the subnet is in it.
     ConstElementPtr subnets;
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/network-range"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -103,7 +104,7 @@ TEST_F(TranslatorSubnetsTest, getKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& xpath = "/kea-dhcp6-server:config/subnet6";
+    const string& xpath = "/kea-dhcp6-server:config";
     const string& xsub = xpath + "/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
     const string& xsubnet = xsub + "/subnet";
@@ -120,7 +121,7 @@ TEST_F(TranslatorSubnetsTest, getKea) {
 
     // Get the subnet list and check if the subnet is in it.
     ConstElementPtr subnets;
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/subnet6"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -176,7 +177,7 @@ TEST_F(TranslatorSubnetsTest, getPoolsIetf) {
 
     // Get the subnet list and check if the subnet is in it.
     ConstElementPtr subnets;
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/network-range"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -189,21 +190,20 @@ TEST_F(TranslatorSubnetsTest, getPoolsKea) {
     useModel(KEA_DHCP6_SERVER);
 
     // Create the subnet 2001:db8::/48 #111.
-    const string& xpath = "/kea-dhcp6-server:config/subnet6";
+    const string& xpath = "/kea-dhcp6-server:config";
     const string& xsub = xpath + "/subnet6[id='111']";
     S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
     const string& xsubnet = xsub + "/subnet";
     EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
 
     // Create the pool 2001:db8::1:0/112.
-    const string& xpool = xsub + "/pools";
-    const string& prefix1 = xpool + "/pool[start-address='2001:db8::1:0']" +
+    const string& prefix1 = xsub + "/pool[start-address='2001:db8::1:0']" +
         "[end-address='2001:db8::1:ffff']/prefix";
     S_Val s_pool1(new Val("2001:db8::1:0/112", SR_STRING_T));
     EXPECT_NO_THROW(sess_->set_item(prefix1.c_str(), s_pool1));
 
     // Create the pool 2001:db8::2:0/112.
-    const string& prefix2 = xpool + "/pool[start-address='2001:db8::2:0']" +
+    const string& prefix2 = xsub + "/pool[start-address='2001:db8::2:0']" +
         "[end-address='2001:db8::2:ffff']";
     S_Val s_pool2;
     EXPECT_NO_THROW(sess_->set_item(prefix2.c_str(), s_pool2));
@@ -233,7 +233,7 @@ TEST_F(TranslatorSubnetsTest, getPoolsKea) {
 
     // Get the subnet list and check if the subnet is in it.
     ConstElementPtr subnets;
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/subnet6"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -253,7 +253,7 @@ TEST_F(TranslatorSubnetsTest, setEmptyIetf) {
 
     // Get it back.
     subnets.reset();
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/network-range"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     EXPECT_EQ(0, subnets->size());
@@ -305,7 +305,7 @@ TEST_F(TranslatorSubnetsTest, setIetf) {
 
     // Get it back.
     subnets.reset();
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/network-range"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -367,7 +367,7 @@ TEST_F(TranslatorSubnetsTest, setTwoIetf) {
 
     // Get it back.
     subnets.reset();
-    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
+    EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath + "/network-range"));
     ASSERT_TRUE(subnets);
     ASSERT_EQ(Element::list, subnets->getType());
     ASSERT_EQ(1, subnets->size());
@@ -459,29 +459,25 @@ TEST_F(TranslatorSubnetsTest, setTwoKea) {
     string expected =
         "kea-dhcp4-server:config (container)\n"
         " |\n"
-        " -- subnet4 (container)\n"
+        " -- subnet4 (list instance)\n"
         "     |\n"
-        "     -- subnet4 (list instance)\n"
-        "         |\n"
-        "         -- id = 123\n"
-        "         |\n"
-        "         -- pools (container)\n"
-        "         |   |\n"
-        "         |   -- pool (list instance)\n"
-        "         |   |   |\n"
-        "         |   |   -- start-address = 10.0.1.0\n"
-        "         |   |   |\n"
-        "         |   |   -- end-address = 10.0.1.15\n"
-        "         |   |   |\n"
-        "         |   |   -- prefix = 10.0.1.0/28\n"
-        "         |   |\n"
-        "         |   -- pool (list instance)\n"
-        "         |       |\n"
-        "         |       -- start-address = 10.0.1.200\n"
-        "         |       |\n"
-        "         |       -- end-address = 10.0.1.222\n"
-        "         |\n"
-        "         -- subnet = 10.0.1.0/24\n";
+        "     -- id = 123\n"
+        "     |\n"
+        "     -- pool (list instance)\n"
+        "     |   |\n"
+        "     |   -- start-address = 10.0.1.0\n"
+        "     |   |\n"
+        "     |   -- end-address = 10.0.1.15\n"
+        "     |   |\n"
+        "     |   -- prefix = 10.0.1.0/28\n"
+        "     |\n"
+        "     -- pool (list instance)\n"
+        "     |   |\n"
+        "     |   -- start-address = 10.0.1.200\n"
+        "     |   |\n"
+        "     |   -- end-address = 10.0.1.222\n"
+        "     |\n"
+        "     -- subnet = 10.0.1.0/24\n";
     EXPECT_EQ(expected, tree->to_string(100));
 
     // Check it validates.
index cfefbf228e73dbb5e8f54a782ec2b58336c5c6ba..c0b2f845d982bc0f3870ced35880a5b69db76e0b 100644 (file)
@@ -289,43 +289,40 @@ const YRTree validTreeIetf6 = {
 const std::string subnetOptionsModelKeaDhcp4 = KEA_DHCP4_SERVER;
 const YRTree subnetOptionsTreeKeaDhcp4 = {
     { "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
-    { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']", "",
+    { "/kea-dhcp4-server:config/subnet4[id='111']", "",
       SR_LIST_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/id",
+    { "/kea-dhcp4-server:config/subnet4[id='111']/id",
       "111", SR_UINT32_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']", "", SR_LIST_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']/code",
       "100", SR_UINT8_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']/space",
       "dns", SR_STRING_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']/data",
       "12121212", SR_STRING_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']/csv-format",
       "false", SR_BOOL_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "option-data[code='100'][space='dns']/always-send",
       "false", SR_BOOL_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools",
-      "", SR_CONTAINER_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "pool[start-address='10.0.1.0'][end-address='10.0.1.255']",
       "", SR_LIST_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "pool[start-address='10.0.1.0'][end-address='10.0.1.255']/start-address",
       "10.0.1.0", SR_STRING_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "pool[start-address='10.0.1.0'][end-address='10.0.1.255']/end-address",
       "10.0.1.255", SR_STRING_T, false },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+    { "/kea-dhcp4-server:config/subnet4[id='111']/"
       "pool[start-address='10.0.1.0'][end-address='10.0.1.255']/prefix",
       "10.0.1.0/24", SR_STRING_T, true },
-    { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/subnet",
+    { "/kea-dhcp4-server:config/subnet4[id='111']/subnet",
       "10.0.0.0/8", SR_STRING_T, true }
 };
 
@@ -334,50 +331,47 @@ const YRTree subnetOptionsTreeKeaDhcp4 = {
 const std::string subnetOptionsModelKeaDhcp6 = KEA_DHCP6_SERVER;
 const YRTree subnetOptionsTreeKeaDhcp6 = {
     { "/kea-dhcp6-server:config", "", SR_CONTAINER_T, false },
-    { "/kea-dhcp6-server:config/subnet6", "", SR_CONTAINER_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']", "",
+    { "/kea-dhcp6-server:config/subnet6[id='111']", "",
       SR_LIST_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/id",
+    { "/kea-dhcp6-server:config/subnet6[id='111']/id",
       "111", SR_UINT32_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools",
-      "", SR_CONTAINER_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']",
       "", SR_LIST_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "start-address", "2001:db8::1:0", SR_STRING_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "end-address", "2001:db8::1:ffff", SR_STRING_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "prefix", "2001:db8::1:0/112", SR_STRING_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']",
       "", SR_LIST_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']/code",
       "100", SR_UINT16_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']/space",
       "dns", SR_STRING_T, false },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']/data",
       "12121212", SR_STRING_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']/csv-format",
       "false", SR_BOOL_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+    { "/kea-dhcp6-server:config/subnet6[id='111']/"
       "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
       "option-data[code='100'][space='dns']/always-send",
       "false", SR_BOOL_T, true },
-    { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet",
+    { "/kea-dhcp6-server:config/subnet6[id='111']/subnet",
       "2001:db8::/48", SR_STRING_T, true }
 };
 
index ad75dd6b41d6700c8ff8ebe13b92badbfbde5ad0..88f97cd46103698e47fe2a9fcf6eb95855f09291 100644 (file)
@@ -69,7 +69,7 @@ TranslatorClass::getClassKea(const string& xpath) {
         result->set("option-data", options);
     }
     if (model_ == KEA_DHCP4_SERVER) {
-        ConstElementPtr defs = getOptionDefList(xpath +"/option-def-list");
+        ConstElementPtr defs = getOptionDefList(xpath);
         if (defs && (defs->size() > 0)) {
             result->set("option-def", defs);
         }
@@ -132,7 +132,7 @@ TranslatorClass::setClassKea(const string& xpath, ConstElementPtr elem) {
     if (model_ == KEA_DHCP4_SERVER) {
         ConstElementPtr defs = elem->get("option-def");
         if (defs) {
-            setOptionDefList(xpath + "/option-def-list", defs);
+            setOptionDefList(xpath, defs);
             created = true;
         }
         ConstElementPtr next = elem->get("next-server");
@@ -194,7 +194,7 @@ TranslatorClasses::getClasses(const string& xpath) {
 
 ElementPtr
 TranslatorClasses::getClassesKea(const string& xpath) {
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath + "/client-class");
     if (!iter) {
         // Can't happen.
         isc_throw(Unexpected, "getClassesKea: can't get iterator: " << xpath);
index d74852eafa41340e8d85b82e35ef8be55a9ae787..a027d4a7247fc3f5282b627b472ac53e29404d0d 100644 (file)
@@ -39,7 +39,7 @@ namespace yang {
 ///    +--rw test?               string
 ///    +--rw only-if-required?   boolean
 ///    +--rw option-data*
-///    +--rw option-def-list     option-def*
+///    +--rw option-def*
 ///    +--rw next-server?        inet:ipv4-address
 ///    +--rw server-hostname?    string
 ///    +--rw boot-file-name?     string
@@ -58,15 +58,10 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp6-server:config (container)
-///  /kea-dhcp6-server:config/client-classes (container)
-///  /kea-dhcp6-server:config/client-classes/
-///     client-class[name='foo'] (list instance)
-///  /kea-dhcp6-server:config/client-classes/
-///     client-class[name='foo']/name = foo
-///  /kea-dhcp6-server:config/client-classes/
-///     client-class[name='foo']/test = ''==''
-///  /kea-dhcp6-server:config/client-classes/
-///     client-class[name='foo']/ only-if-required = false
+///  /kea-dhcp6-server:config/client-class[name='foo'] (list instance)
+///  /kea-dhcp6-server:config/client-class[name='foo']/name = foo
+///  /kea-dhcp6-server:config/client-class[name='foo']/test = ''==''
+///  /kea-dhcp6-server:config/client-class[name='foo']/only-if-required = false
 /// @endcode
 
 /// @brief A translator class for converting a client class between
index d3d08901e17731a6f7b0389bb2f6e8fb024cd84d..10976cc192fdde637258100459794292a18d6a1d 100644 (file)
@@ -71,7 +71,8 @@ TranslatorConfig::getConfigIetf6() {
     ElementPtr dhcp6 = Element::createMap();
     result->set("Dhcp6", dhcp6);
     string xpath = "/" + model_ + ":server/server-config";
-    ConstElementPtr ranges = getSubnets(xpath + "/network-ranges");
+    ConstElementPtr ranges =
+        getSubnets(xpath + "/network-ranges/network-range");
     if (ranges && !ranges->empty()) {
         dhcp6->set("subnet6", ranges);
     }
@@ -112,7 +113,7 @@ TranslatorConfig::getParam(ElementPtr& storage, const std::string& xpath,
 
 ElementPtr
 TranslatorConfig::getHooksKea(const std::string& xpath) {
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath + "/hook-library");
     if (iter) {
         ElementPtr hook_libs = Element::createList();
         for (;;) {
@@ -196,7 +197,7 @@ TranslatorConfig::getDdnsKea(const std::string& xpath) {
 ElementPtr
 TranslatorConfig::getConfigControlKea(const string& xpath) {
     ElementPtr config_ctrl = Element::createMap();
-    ConstElementPtr databases = getDatabases(xpath + "/config-databases");
+    ConstElementPtr databases = getDatabases(xpath + "/config-database");
     if (databases && !databases->empty()) {
         config_ctrl->set("config-databases", databases);
     }
@@ -218,11 +219,11 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
     getParam(result, xpath, "rebind-timer");
     getParam(result, xpath, "decline-probation-period");
 
-    ConstElementPtr networks = getSharedNetworks(xpath + "/shared-networks");
+    ConstElementPtr networks = getSharedNetworks(xpath);
     if (networks && !networks->empty()) {
         result->set("shared-networks", networks);
     }
-    ConstElementPtr classes = getClasses(xpath + "/client-classes");
+    ConstElementPtr classes = getClasses(xpath);
     if (classes && !classes->empty()) {
         result->set("client-classes", classes);
     }
@@ -230,7 +231,7 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
     if (database) {
         result->set("lease-database", database);
     }
-    ConstElementPtr databases = getDatabases(xpath + "/hosts-databases");
+    ConstElementPtr databases = getDatabases(xpath + "/hosts-database");
     if (databases && !databases->empty()) {
         result->set("hosts-databases", databases);
     }
@@ -239,7 +240,7 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
     if (host_ids) {
         result->set("host-reservation-identifiers", host_ids);
     }
-    ConstElementPtr defs = getOptionDefList(xpath + "/option-def-list");
+    ConstElementPtr defs = getOptionDefList(xpath);
     if (defs && !defs->empty()) {
         result->set("option-def", defs);
     }
@@ -247,7 +248,7 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
     if (options && !options->empty()) {
         result->set("option-data", options);
     }
-    ConstElementPtr hooks = getHooksKea(xpath + "/hooks-libraries");
+    ConstElementPtr hooks = getHooksKea(xpath);
     if (hooks && !hooks->empty()) {
         result->set("hooks-libraries", hooks);
     }
@@ -275,7 +276,7 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
         sanity->set("lease-checks", checks);
         result->set("sanity-checks", sanity);
     }
-    ConstElementPtr hosts = getHosts(xpath + "/reservations");
+    ConstElementPtr hosts = getHosts(xpath);
     if (hosts && !hosts->empty()) {
         result->set("reservations", hosts);
     }
@@ -390,7 +391,7 @@ ElementPtr
 TranslatorConfig::getServerKeaLogging() {
     string xpath = "/" + model_ + ":logging";
     ElementPtr result = Element::createMap();
-    ConstElementPtr loggers = getLoggers(xpath + "/loggers");
+    ConstElementPtr loggers = getLoggers(xpath);
     if (loggers && !loggers->empty()) {
         result->set("loggers", loggers);
     }
@@ -502,11 +503,11 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr networks = elem->get("shared-networks");
     if (networks) {
-        setSharedNetworks(xpath + "/shared-networks", networks);
+        setSharedNetworks(xpath, networks);
     }
     ConstElementPtr classes = elem->get("client-classes");
     if (classes && !classes->empty()) {
-        setClasses(xpath + "/client-classes", classes);
+        setClasses(xpath, classes);
     }
     ConstElementPtr database = elem->get("lease-database");
     if (database) {
@@ -514,14 +515,14 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr databases = elem->get("hosts-databases");
     if (databases && !databases->empty()) {
-        setDatabases(xpath + "/hosts-databases", databases);
+        setDatabases(xpath + "/hosts-database", databases);
     } else {
         // Reuse of database from lease-database.
         database = elem->get("hosts-database");
         if (database) {
             ElementPtr list = Element::createList();
             list->add(copy(database));
-            setDatabases(xpath + "/hosts-databases", list);
+            setDatabases(xpath + "/hosts-database", list);
         }
     }
     ConstElementPtr host_ids = elem->get("host-reservation-identifiers");
@@ -532,7 +533,7 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr defs = elem->get("option-def");
     if (defs && !defs->empty()) {
-        setOptionDefList(xpath + "/option-def-list", defs);
+        setOptionDefList(xpath, defs);
     }
     ConstElementPtr options = elem->get("option-data");
     if (options && !options->empty()) {
@@ -546,7 +547,7 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
                 continue;
             }
             ostringstream hook_lib;
-            hook_lib << xpath << "/hooks-libraries/hook-library[library='"
+            hook_lib << xpath << "/hook-library[library='"
                      << name->stringValue() << "']";
             ConstElementPtr params = lib->get("parameters");
             if (params) {
@@ -691,14 +692,13 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr hosts = elem->get("reservations");
     if (hosts && !hosts->empty()) {
-        setHosts(xpath + "/reservations", hosts);
+        setHosts(xpath, hosts);
     }
     ConstElementPtr config_ctrl = elem->get("config-control");
     if (config_ctrl && !config_ctrl->empty()) {
         databases = config_ctrl->get("config-databases");
         if (databases && !databases->empty()) {
-            setDatabases(xpath + "/config-control/config-databases",
-                         databases);
+            setDatabases(xpath + "/config-control/config-database", databases);
         }
     }
     ConstElementPtr server_tag = elem->get("server-tag");
@@ -860,7 +860,7 @@ TranslatorConfig::setServerKeaLogging(ConstElementPtr elem) {
     string xpath = "/" + model_ + ":logging";
     ConstElementPtr loggers = elem->get("loggers");
     if (loggers) {
-        setLoggers(xpath + "/loggers", loggers);
+        setLoggers(xpath, loggers);
     }
 }
 
index 48a3c307855d74199646af1f093c14305c416005..ad7cdaca729837cad69cad7479efbcda5f421b25 100644 (file)
@@ -69,8 +69,8 @@ namespace yang {
 /// +--rw renew-timer?                   uint32
 /// +--rw rebind-timer?                  uint32
 /// +--rw decline-probation-period?      uint32
-/// +--rw subnet4                        subnet4*
-/// +--rw shared-networks                shared-network*
+/// +--rw subnet4*
+/// +--rw shared-network*
 /// +--rw interfaces-config
 ///    +--rw interfaces*                 string
 ///    +--rw dhcp-socket-type?           enumeration
@@ -78,10 +78,10 @@ namespace yang {
 ///    +--rw re-detect?                  boolean
 ///    +--rw user-context?               string
 /// +--rw lease-database!                <database>
-/// +--rw hosts-databases                hosts-database*
+/// +--rw hosts-database*
 /// +--rw host-reservation-identifiers*  enumeration
-/// +--rw client-classes                 client-class*
-/// +--rw option-def-list                option-def*
+/// +--rw client-class*
+/// +--rw option-def*
 /// +--rw option-data*
 /// +--rw hook-library*
 ///    +--rw library                     string
@@ -99,8 +99,9 @@ namespace yang {
 /// +--rw user-context?                  string
 /// +--rw sanity-checks
 ///    +--rw lease-checks?               enumeration
+/// +--rw host*
 /// +--rw config-control
-///    +--rw config-databases            config-databases*
+///    +--rw config-database*
 /// +--rw server-tag                     string
 /// +--rw dhcp-queue-control             string
 /// @endcode
@@ -139,17 +140,13 @@ namespace yang {
 /// @code
 /// <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
 ///   <subnet4>
-///     <subnet4>
-///       <id>1</id>
-///       <pools>
-///         <pool>
-///           <start-address>10.0.35.64</start-address>
-///           <end-address>10.0.35.95</end-address>
-///           <prefix>10.0.35.64/27</prefix>
-///         </pool>
-///       </pools>
-///       <subnet>10.0.35.0/24</subnet>
-///     </subnet4>
+///     <id>1</id>
+///     <pool>
+///       <start-address>10.0.35.64</start-address>
+///       <end-address>10.0.35.95</end-address>
+///       <prefix>10.0.35.64/27</prefix>
+///     </pool>
+///     <subnet>10.0.35.0/24</subnet>
 ///   </subnet4>
 ///   <interfaces-config>
 ///     <interfaces>eth1</interfaces>
@@ -206,20 +203,20 @@ namespace yang {
 /// +--rw renew-timer?                   uint32
 /// +--rw rebind-timer?                  uint32
 /// +--rw decline-probation-period?      uint32
-/// +--rw subnet6                        subnet6*
-/// +--rw shared-networks                shared-network*
+/// +--rw subnet6*
+/// +--rw shared-network*
 /// +--rw interfaces-config
 ///    +--rw interfaces*                 string
 ///    +--rw re-detect?                  boolean
 ///    +--rw user-context?               string
 /// +--rw lease-database!                <database>
-/// +--rw hosts-databases                hosts-database*
+/// +--rw hosts-database*
 /// +--rw relay-supplied-options*        string
 /// +--rw mac-sources*                   string
 /// +--rw host-reservation-identifiers*  enumeration
-/// +--rw client-classes                 client-class*
-/// +--rw option-def-list                option-def*
-/// +--rw option-data-list               option-data*
+/// +--rw client-class*
+/// +--rw option-def*
+/// +--rw option-data*
 /// +--rw hook-library*
 ///    +--rw library                     string
 ///    +--rw parameters?                 string
@@ -232,8 +229,9 @@ namespace yang {
 /// +--rw user-context?                  string
 /// +--rw sanity-checks
 ///    +--rw lease-checks?               enumeration
+/// +--rw host*
 /// +--rw config-control
-///    +--rw config-databases            config-databases*
+///    +--rw config-database*
 /// +--rw server-tag                     string
 /// +--rw dhcp-queue-control             string
 /// @endcode
@@ -271,17 +269,13 @@ namespace yang {
 /// @code
 /// <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp6-server">
 ///   <subnet6>
-///     <subnet6>
-///       <id>1</id>
-///       <pools>
-///         <pool>
-///           <start-address>2001:db8::1:0</start-address>
-///           <end-address>2001:db8::1:ffff</end-address>
-///           <prefix>2001:db8::1:0/112</prefix>
-///         </pool>
-///       </pools>
-///       <subnet>2001:db8::/64</subnet>
-///     </subnet6>
+///     <id>1</id>
+///     <pool>
+///       <start-address>2001:db8::1:0</start-address>
+///       <end-address>2001:db8::1:ffff</end-address>
+///       <prefix>2001:db8::1:0/112</prefix>
+///     </pool>
+///     <subnet>2001:db8::/64</subnet>
 ///   </subnet6>
 ///   <interfaces-config>
 ///     <interfaces>eth1</interfaces>
@@ -303,7 +297,7 @@ namespace yang {
 /// YANG syntax for kea-*:logging is:
 /// @code
 /// +--rw logging
-///    +--rw loggers
+///    +--rw logger*
 /// @endcode
 ///
 /// Example of Logging simple configuration:
@@ -333,18 +327,16 @@ namespace yang {
 /// with a kea server model and exported to XML format:
 /// @code
 /// <logging xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
-///   <loggers>
-///     <logger>
-///       <name>kea-dhcp6</name>
-///       <output-options>
-///         <option>
-///           <output>stderr</output>
-///         </option>
-///       </output-options>
-///       <debuglevel>99</debuglevel>
-///       <severity>DEBUG</severity>
-///     </logger>
-///   </loggers>
+///   <logger>
+///     <name>kea-dhcp6</name>
+///     <output-options>
+///       <option>
+///         <output>stderr</output>
+///       </option>
+///     </output-options>
+///     <debuglevel>99</debuglevel>
+///     <severity>DEBUG</severity>
+///   </logger>
 /// </logging>
 /// @endcode
 ///
index 5d30503f9d535f64df7838456ac9490cbb4bc2e5..cea73f9454a64042cc36ce985fde504b413f67b0 100644 (file)
@@ -255,7 +255,7 @@ TranslatorDatabases::getDatabases(const string& xpath) {
 
 ElementPtr
 TranslatorDatabases::getDatabasesKea(const string& xpath) {
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath);
     if (!iter) {
         // Can't happen.
         isc_throw(Unexpected, "getDatabasesKea can't get iterator: " << xpath);
@@ -297,7 +297,6 @@ void
 TranslatorDatabases::setDatabasesKea(const string& xpath,
                                      ConstElementPtr elem) {
     if (!elem) {
-        delItem(xpath + "/hosts-database");
         delItem(xpath);
         return;
     }
@@ -308,7 +307,7 @@ TranslatorDatabases::setDatabasesKea(const string& xpath,
         }
         string type = database->get("type")->stringValue();
         ostringstream key;
-        key << xpath << "/hosts-database[database-type='" << type << "']";
+        key << xpath << "[database-type='" << type << "']";
         setDatabase(key.str(), database, true);
     }
 }
index 29637fd85f267455aa230c4264b71cfebee0f278..4ce40c71f94672430cd49eba19928ece928d4a95 100644 (file)
@@ -79,20 +79,19 @@ namespace yang {
 /// @endcode
 /// @code
 /// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/hosts-databases (container)
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql'] (list instance)
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/type = mysql
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/name = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/user = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/password = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/host = localhost
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
 ///    hosts-database[database-type='mysql']/port = 3306
 /// @endcode
 
index 7b21c161ae4d94bfe6a4e3d2a3dc2c5ab4183816..9b164c8ecbf071d02eac76ba9fe073f1299da4b8 100644 (file)
@@ -195,7 +195,7 @@ ElementPtr
 TranslatorHosts::getHosts(const string& xpath) {
     try {
         ElementPtr result = Element::createList();
-        S_Iter_Value iter = getIter(xpath + "/*");
+        S_Iter_Value iter = getIter(xpath + "/host");
         if (!iter) {
             // Can't happen.
             isc_throw(Unexpected, "getHosts can't get iterator: " << xpath);
index 066183da53dd6c049618a9d3e1b10eee30f473d5..3677f7094b1f073e9b133710ab357c39c78c0612 100644 (file)
@@ -82,24 +82,21 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp4-server:config (container)
-///  /kea-dhcp4-server:config/subnet4 (container)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111'] (list instance)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/id = 111
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/subnet = 10.0.0.0/24
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/
-///     reservations (container)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+///  /kea-dhcp4-server:config/subnet4[id='111'] (list instance)
+///  /kea-dhcp4-server:config/subnet4[id='111']/id = 111
+///  /kea-dhcp4-server:config/subnet4[id='111']/subnet = 10.0.0.0/24
+///  /kea-dhcp4-server:config/subnet4[id='111']/
 ///     host[identifier-type='flex-id'][identifier='00:ff'] (list instance)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+///  /kea-dhcp4-server:config/subnet4[id='111']/
 ///     host[identifier-type='flex-id'][identifier='00:ff']/
 ///     identifier-type = flex-id
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+///  /kea-dhcp4-server:config/subnet4[id='111']/
 ///     host[identifier-type='flex-id'][identifier='00:ff']/
 ///     identifier = 00:ff
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+///  /kea-dhcp4-server:config/subnet4[id='111']/
 ///     host[identifier-type='flex-id'][identifier='00:ff']/
 ///     hostname = foo
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+///  /kea-dhcp4-server:config/subnet4[id='111']/
 ///     host[identifier-type='flex-id'][identifier='00:ff']/
 ///     ip-address = 10.0.0.1
 /// @endcode
index c61d55fc01cf4e95254a79c180dafba8dfcc8e10..c0855e9e7f82defe4eefa07d6d785aa05b1e9c23 100644 (file)
@@ -54,7 +54,7 @@ TranslatorLogger::getLoggerKea(const string& xpath) {
     }
     ElementPtr result = Element::createMap();
     result->set("name", name);
-    ConstElementPtr options = getOutputOptions(xpath + "/output-options");
+    ConstElementPtr options = getOutputOptions(xpath);
     if (options && (options->size() > 0)) {
         result->set("output_options", options);
     }
@@ -99,7 +99,7 @@ TranslatorLogger::getOutputOption(const string& xpath) {
 
 ElementPtr
 TranslatorLogger::getOutputOptions(const string& xpath) {
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath + "/output-option");
     if (!iter) {
         // Can't happen.
         isc_throw(Unexpected, "getOutputOptions: can't get iterator: "
@@ -140,7 +140,7 @@ TranslatorLogger::setLoggerKea(const string& xpath, ConstElementPtr elem) {
     // Skip name as it is the key.
     ConstElementPtr options = elem->get("output_options");
     if (options && (options->size() > 0)) {
-        setOutputOptions(xpath + "/output-options", options);
+        setOutputOptions(xpath, options);
     }
     ConstElementPtr debuglevel = elem->get("debuglevel");
     if (debuglevel) {
@@ -193,7 +193,7 @@ TranslatorLogger::setOutputOptions(const string& xpath, ConstElementPtr elem) {
         }
         string output = option->get("output")->stringValue();
         ostringstream key;
-        key << xpath << "/option[output='" << output << "']";
+        key << xpath << "/output-option[output='" << output << "']";
         setOutputOption(key.str(), option);
     }
 }
@@ -226,7 +226,7 @@ TranslatorLoggers::getLoggers(const string& xpath) {
 
 ElementPtr
 TranslatorLoggers::getLoggersKea(const string& xpath) {
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath + "/logger");
     if (!iter) {
         // Can't happen.
         isc_throw(Unexpected, "getLoggersKea: can't get iterator: " << xpath);
index 1b33e5e59663362d25f67f59babc04e74f75fd55..f243a67463ba29c8017b5cb321bac35c3269f88c 100644 (file)
@@ -40,11 +40,10 @@ namespace yang {
 /// YANG syntax for kea-logging is with name as the logger list key and
 /// output as the output option list key.
 /// @code
-///  +--rw logger               container
+///  +--rw logger               (list)
 ///     |
 ///     +--rw name?             string
-///     +--rw output-options    container
-///     |  +--rw option*        [output]
+///     +--rw output-option*
 ///     |     +--rw output      string
 ///     |     +--rw maxver?     uint32
 ///     |     +--rw maxsize?    uint32
@@ -72,18 +71,15 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp4-server:logging (container)
-///  /kea-dhcp4-server:logging/loggers (container)
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo'] (list instance)
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/name = foo
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/
-///     output-options (container)
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+///  /kea-dhcp4-server:logging/logger[name='foo'] (list instance)
+///  /kea-dhcp4-server:logging/logger[name='foo']/name = foo
+///  /kea-dhcp4-server:logging/logger[name='foo']/
 ///     option[output='/bar'] (list instance)
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+///  /kea-dhcp4-server:logging/logger[name='foo']/
 ///     option[output='/bar']/option = /bar
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+///  /kea-dhcp4-server:logging/logger[name='foo']/
 ///     option[output='/bar']/maxver = 10
-///  /kea-dhcp4-server:logging/loggers/logger[name='foo']/severity = WARN
+///  /kea-dhcp4-server:logging/logger[name='foo']/severity = WARN
 /// @endcode
 
 /// @brief A translator class for converting a logger between
index 83a62febb03150ae96ae18c62a77660ccaab59b1..8153859c26b36b0cfa1685729292723ea9d152af 100644 (file)
@@ -162,7 +162,7 @@ TranslatorOptionDefList::getOptionDefList(const string& xpath) {
 ConstElementPtr
 TranslatorOptionDefList::getOptionDefListKea(const string& xpath) {
     ElementPtr result = Element::createList();
-    S_Iter_Value iter = getIter(xpath + "/*");
+    S_Iter_Value iter = getIter(xpath + "/option-def");
     if (!iter) {
         // Can't happen.
         isc_throw(Unexpected, "getOptionDefListKea: can't get iterator: "
index 73eb0229cf2d83c4dcbdd323678fdf51d379063f..b3332edd25d6a82560a65cf229665f0d6a93b3ff 100644 (file)
@@ -56,18 +56,17 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp6-server:config (container)
-///  /kea-dhcp6-server:config/option-def-list (container)
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc'] (list instance)
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc']/code = 100
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc']/space = isc
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc']/name = foo
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc']/type = string
-///  /kea-dhcp6-server:config/option-def-list/
+///  /kea-dhcp6-server:config/
 ///     option-def[code='100'][space='isc']/array = false
 /// @endcode
 
index 716f8c3e7c77fe5cbac113789e438c268135c49b..26250affca0a97758b8431ba8be301855b652fa1 100644 (file)
@@ -300,7 +300,7 @@ ElementPtr
 TranslatorPdPools::getPdPools(const string& xpath) {
     try {
         ElementPtr result = Element::createList();
-        S_Iter_Value iter = getIter(xpath + "/*");
+        S_Iter_Value iter = getIter(xpath);
         if (!iter) {
             // Can't happen.
             isc_throw(Unexpected, "getPdPools: can't get iterator: " << xpath);
index 5ae4d7667566fd0240fd3e1a1ff5de3f71f3f8ab..8435adc3e873f6c9151e7d3f88af15f2b9c8166a 100644 (file)
@@ -96,16 +96,14 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp6-server:config (container)
-///  /kea-dhcp6-server:config/subnet6 (container)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111'] (list instance)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/id = 111
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet = 2001:db8::/48
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools (container)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+///  /kea-dhcp6-server:config/subnet6[id='111'] (list instance)
+///  /kea-dhcp6-server:config/subnet6[id='111']/id = 111
+///  /kea-dhcp6-server:config/subnet6[id='111']/subnet = 2001:db8::/48
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pd-pool[prefix='2001:db8:0:1000::/56' (list instance)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pd-pool[prefix='2001:db8:0:1000::/56'/prefix = 2001:db8:0:1000::/56
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pd-pool[prefix='2001:db8:0:1000::/56'/delegated-len = 64
 /// @endcode
 
index b4ae2654befb6cbcddd05684b7c9e8e35db124fe..cdeec8bcd5f3395b26306d1b99d9598e41394be1 100644 (file)
@@ -280,7 +280,7 @@ ElementPtr
 TranslatorPools::getPools(const string& xpath) {
     try {
         ElementPtr result = Element::createList();
-        S_Iter_Value iter = getIter(xpath + "/*");
+        S_Iter_Value iter = getIter(xpath);
         if (!iter) {
             // Can't happen.
             isc_throw(Unexpected, "getPools can't get iterator: " << xpath);
index ffc1086bcd6054f0a1aac525fce9d3d67800f13e..af58671d0b962c9fb36f5c1f2997128e4f359ad0 100644 (file)
@@ -108,18 +108,16 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp6-server:config (container)
-///  /kea-dhcp6-server:config/subnet6 (container)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111'] (list instance)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/id = 111
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet = 2001:db8::/48
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools (container)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+///  /kea-dhcp6-server:config/subnet6[id='111'] (list instance)
+///  /kea-dhcp6-server:config/subnet6[id='111']/id = 111
+///  /kea-dhcp6-server:config/subnet6[id='111']/subnet = 2001:db8::/48
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pool[start-address='2001:db8::1'][end-address='2001:db8::100']
 ///     (list instance)
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pool[start-address='2001:db8::1'][end-address='2001:db8::100']/
 ///     start-address = 2001:db8::1
-///  /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+///  /kea-dhcp6-server:config/subnet6[id='111']/
 ///     pool[start-address='2001:db8::1'][end-address='2001:db8::100']/
 ///     end-address = 2001:db8::100
 /// @endcode
index 8372841b79e066fe1fe865170f0d21907dbbff81..fed72de3fcc2581f9a1f6e43772ab42aa8dfd1d1 100644 (file)
@@ -295,7 +295,7 @@ ElementPtr
 TranslatorSharedNetworks::getSharedNetworks(const string& xpath) {
     try {
         ElementPtr result = Element::createList();
-        S_Iter_Value iter = getIter(xpath + "/*");
+        S_Iter_Value iter = getIter(xpath + "/shared-network");
         if (!iter) {
             // Can't happen.
             isc_throw(Unexpected, "getSharedNetworks: can't get iterator: "
index c07d7fc8db299856c3e4a5672b8c666ab89eb3e1..15ced6154e825801391bd6a23b171e8d4a6325db 100644 (file)
@@ -76,14 +76,14 @@ namespace yang {
 ///  +--rw relay                     ip-addresses*
 ///  +--rw user-context?             string
 ///  (DHCPv4 only)
-///  +--rw subnet4                   subnet4*
+///  +--rw subnet4*
 ///  +--rw match-client-id?          boolean
 ///  +--rw next-server?              inet:ipv4-address
 ///  +--rw server-hostname?          string
 ///  +--rw boot-file-name?           string
 ///  +--rw authoritative?            boolean
 ///  (DHCPv6 only)
-///  +--rw subnet6                   subnet6*
+///  +--rw subnet6*
 ///  +--rw preferred-lifetime?       uint32
 ///  +--rw interface-id?             string
 ///  +--rw rapid-commit?             boolean
@@ -106,19 +106,14 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp6-server:config (container)
-///  /kea-dhcp6-server:config/shared-networks (container)
-///  /kea-dhcp6-server:config/shared-networks/
-///     shared-network[name='foo'] (list instance)
-///  /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-///     name = foo
-///  /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-///     subnet6 (container)
-///  /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-///     subnet6/subnet6[id='123'] (list instance)
-///  /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-///     subnet6/subnet6[id='123']/id = 123
-///  /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-///     subnet6/subnet6[id='123']/subnet = 2001:db8::/48
+///  /kea-dhcp6-server:config/shared-network[name='foo'] (list instance)
+///  /kea-dhcp6-server:config/shared-network[name='foo']/name = foo
+///  /kea-dhcp6-server:config/shared-network[name='foo']/
+///     subnet6[id='123'] (list instance)
+///  /kea-dhcp6-server:config/shared-network[name='foo']/
+///     subnet6[id='123']/id = 123
+///  /kea-dhcp6-server:config/shared-network[name='foo']/
+///     subnet6[id='123']/subnet = 2001:db8::/48
 /// @endcode
 
 /// @brief A translator class for converting a shared network between
index e047aa9ddfd5173e4859609638923feddd908b10..9ff6c1a339956ce42f7930c2f5b18a11c75fee8a 100644 (file)
@@ -58,12 +58,12 @@ TranslatorSubnet::getSubnetIetf6(const string& xpath) {
     ElementPtr result = Element::createMap();
     /// @todo timers
     /// @todo: option-data
-    ConstElementPtr pools = getPools(xpath + "/address-pools");
+    ConstElementPtr pools = getPools(xpath + "/address-pools/address-pool");
     if (pools) {
         /// Set empty list too.
         result->set("pools", pools);
     }
-    pools = getPdPools(xpath + "/pd-pools");
+    pools = getPdPools(xpath + "/pd-pools/pd-pool");
     if (pools && (pools->size() > 0)) {
         result->set("pd-pools", pools);
     }
@@ -116,12 +116,12 @@ TranslatorSubnet::getSubnetKea(const string& xpath) {
     if (options && (options->size() > 0)) {
         result->set("option-data", options);
     }
-    ConstElementPtr pools = getPools(xpath + "/pools");
+    ConstElementPtr pools = getPools(xpath + "/pool");
     if (pools && (pools->size() > 0)) {
         result->set("pools", pools);
     }
     if (model_ == KEA_DHCP6_SERVER) {
-        pools = getPdPools(xpath + "/pd-pools");
+        pools = getPdPools(xpath + "/pd-pool");
         if (pools && (pools->size() > 0)) {
             result->set("pd-pools", pools);
         }
@@ -160,7 +160,7 @@ TranslatorSubnet::getSubnetKea(const string& xpath) {
     if (required && (required->size() > 0)) {
         result->set("require-client-classes", required);
     }
-    ConstElementPtr hosts = getHosts(xpath + "/reservations");
+    ConstElementPtr hosts = getHosts(xpath);
     if (hosts && (hosts->size() > 0)) {
         result->set("reservations", hosts);
     }
@@ -289,12 +289,12 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
     }
     ConstElementPtr pools = elem->get("pools");
     if (pools && (pools->size() > 0)) {
-        setPools(xpath + "/pools", pools);
+        setPools(xpath, pools);
     }
     if (model_ == KEA_DHCP6_SERVER) {
         pools = elem->get("pd-pools");
         if (pools && (pools->size() > 0)) {
-            setPdPools(xpath + "/pd-pools", pools);
+            setPdPools(xpath, pools);
         }
     }
     ConstElementPtr subnet = elem->get("subnet");
@@ -330,7 +330,7 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
     }
     ConstElementPtr hosts = elem->get("reservations");
     if (hosts && (hosts->size() > 0)) {
-        setHosts(xpath + "/reservations", hosts);
+        setHosts(xpath, hosts);
     }
     ConstElementPtr mode = elem->get("reservation-mode");
     if (mode) {
@@ -409,7 +409,7 @@ ElementPtr
 TranslatorSubnets::getSubnets(const string& xpath) {
     try {
         ElementPtr result = Element::createList();
-        S_Iter_Value iter = getIter(xpath + "/*");
+        S_Iter_Value iter = getIter(xpath);
         if (!iter) {
             /// Can't happen.
             isc_throw(Unexpected, "getSubnets: can't get iterator: " << xpath);
@@ -434,10 +434,9 @@ TranslatorSubnets::setSubnets(const string& xpath, ConstElementPtr elem) {
     try {
         if (model_ == IETF_DHCPV6_SERVER) {
             setSubnetsIetf6(xpath, elem);
-        } else if (model_ == KEA_DHCP4_SERVER) {
-            setSubnetsKea(xpath, elem, "subnet4");
-        } else if (model_ == KEA_DHCP6_SERVER) {
-            setSubnetsKea(xpath, elem, "subnet6");
+        } else if ((model_ == KEA_DHCP4_SERVER) ||
+                   (model_ == KEA_DHCP6_SERVER)) {
+            setSubnetsKea(xpath, elem);
         } else {
             isc_throw(NotImplemented,
                       "setSubnets not implemented for the model: " << model_);
@@ -465,16 +464,14 @@ TranslatorSubnets::setSubnetsIetf6(const string& xpath, ConstElementPtr elem) {
 }
 
 void
-TranslatorSubnets::setSubnetsKea(const string& xpath, ConstElementPtr elem,
-                                 const std::string& subsel) {
+TranslatorSubnets::setSubnetsKea(const string& xpath, ConstElementPtr elem) {
     for (size_t i = 0; i < elem->size(); ++i) {
         ConstElementPtr subnet = elem->get(i);
         if (!subnet->contains("id")) {
             isc_throw(BadValue, "subnet without id: " << subnet->str());
         }
         ostringstream prefix;
-        prefix << xpath << "/" << subsel << "[id='"
-               << subnet->get("id")->intValue() << "']";
+        prefix << xpath << "[id='" << subnet->get("id")->intValue() << "']";
         setSubnet(prefix.str(), subnet);
     }
 }
index f8062dd38d90f6de208a0af031fb5b95c6e0b5e6..61b2dbf434769bab5a4f93af6902d755e7bf8780 100644 (file)
@@ -79,8 +79,8 @@ namespace yang {
 ///  +--rw network-prefix        inet:ipv4-prefix
 ///  +--rw option-set-id?
 ///     /server/server-config/option-sets/option-set/option-set-id
-///  +--rw address-pools         address-pool* [pool-id]
-///  +--rw pd-pools              pd-pool* [pool-id]
+///  +--rw address-pool*         [pool-id]
+///  +--rw pd-pool*              [pool-id]
 ///  +--rw host-reservations     host-reservation* [cli-id]
 /// @endcode
 ///
@@ -90,13 +90,13 @@ namespace yang {
 ///  +--rw renew-timer?              uint32
 ///  +--rw rebind-timer?             uint32
 ///  +--rw option-data*
-///  +--rw pools                     pool*
+///  +--rw pool*
 ///  +--rw subnet                    inet:ip-prefix
 ///  +--rw interface?                string
 ///  +--rw id                        uint32
 ///  +--rw client-class?             string
 ///  +--rw require-client-classes*   string
-///  +--rw reservations              host*
+///  +--rw host*
 ///  +--rw reservation-mode?         enumeration
 ///  +--rw relay                     ip-addresses*
 ///  +--rw user-context?             string
@@ -111,7 +111,7 @@ namespace yang {
 ///  +--rw authoritative?            boolean
 ///  (DHCPv6 only)
 ///  +--rw preferred-lifetime?       uint32
-///  +--rw pd-pools                  pd-pool*
+///  +--rw pd-pool*
 ///  +--rw interface-id?             string
 ///  +--rw rapid-commit?             boolean
 /// @endcode
@@ -204,31 +204,29 @@ namespace yang {
 /// @endcode
 /// @code
 ///  /kea-dhcp4-server:config (container)
-///  /kea-dhcp4-server:config/subnet4 (container)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123'] (list instance)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/id = 123
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools (container)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123'] (list instance)
+///  /kea-dhcp4-server:config/subnet4[id='123']/id = 123
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.0'][end-address='10.0.1.15'] (list instance)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
 ///     start-address = 10.0.1.0
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
 ///     end-address = 10.0.1.15
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
 ///     prefix = 10.0.1.0/28
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.200'][end-address='10.0.1.222']
 ///     (list instance)
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.200'][end-address='10.0.1.222']/
 ///     start-address = 10.0.1.200
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+///  /kea-dhcp4-server:config/subnet4[id='123']/
 ///     pool[start-address='10.0.1.200'][end-address='10.0.1.222']/
 ///     end-address = 10.0.1.222
-///  /kea-dhcp4-server:config/subnet4/subnet4[id='123']/subnet = 10.0.1.0/24
+///  /kea-dhcp4-server:config/subnet4[id='123']/subnet = 10.0.1.0/24
 /// @endcode
 
 /// @brief A translator class for converting a subnet between YANG and JSON.
@@ -339,10 +337,8 @@ protected:
     ///
     /// @param xpath The xpath of the subnet list.
     /// @param elem The JSON element.
-    /// @param subsel The subnet list name.
     void setSubnetsKea(const std::string& xpath,
-                       isc::data::ConstElementPtr elem,
-                       const std::string& subsel);
+                       isc::data::ConstElementPtr elem);
 };
 
 }; // end of namespace isc::yang