]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[433-update-yang-models] Enabled (and fixed) more tests
authorFrancis Dupont <fdupont@isc.org>
Sat, 10 Aug 2019 12:14:26 +0000 (14:14 +0200)
committerTomek Mrugalski <tomek@isc.org>
Tue, 13 Aug 2019 21:43:06 +0000 (17:43 -0400)
doc/examples/kea4/cassandra.json
doc/examples/kea6/cassandra.json
doc/examples/kea6/tee-times.json
src/lib/cc/data.cc
src/lib/yang/tests/adaptor_config_unittests.cc
src/lib/yang/tests/config_unittests.cc
src/lib/yang/testutils/translator_test.cc

index 8d7d8504179732838537021ca6bf9eec3f786d85..83fad11a9433e6c8b11501c0fe9e5374fc187de2 100644 (file)
@@ -46,7 +46,7 @@
 
       // This parameter enables/disables Nagle's algorithm on connections.
       // The default is true.
-      "tcp-nodelay": true /*,
+      "tcp-nodelay": true,
 
       // This parameter configures consistency level. The default is "quorum".
       // Supported values:
@@ -79,7 +79,7 @@
       // - local-serial
       // - local-one
       // See https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlConfigSerialConsistency.html for more details.
-      "serial-consistency": "serial" */
+      "serial-consistency": "serial"
   },
 
 // Addresses will be assigned with a lifetime of 4000 seconds.
index f1bf18f9e10a7080082bbb620a359993ab114b15..071b16583fc87bdbe206f5b3244b6c0711d6372f 100644 (file)
@@ -45,7 +45,7 @@
 
       // This parameter enables/disables Nagle's algorithm on connections.
       // The default is true.
-      "tcp-nodelay": true /*,
+      "tcp-nodelay": true,
 
       // This parameter configures consistency level. The default is "quorum".
       // Supported values:
@@ -78,7 +78,7 @@
       // - local-serial
       // - local-one
       // See https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlConfigSerialConsistency.html for more details.
-      "serial-consistency": "serial" */
+      "serial-consistency": "serial"
   },
 
 // Addresses will be assigned with preferred and valid lifetimes
index 713fb9113cb82a398158d3fb17f688afc0cd8119..ffe044080e1ef7e211cf7fb4494da4154c3ef7ee 100644 (file)
        "pools": [ { "pool": "2001:db8:3::/80" } ],
        "t1-percent": .45,
        "t2-percent": .7
-  }]
-},
+  }],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index e9a00da49a507a49ee166a1cc01bfcfc93bff925..0572e0ef777fd650a93967eef74e0711fa3e9c4e 100644 (file)
@@ -978,7 +978,7 @@ IntElement::equals(const Element& other) const {
 bool
 DoubleElement::equals(const Element& other) const {
     return (other.getType() == Element::real) &&
-           (d == other.doubleValue());
+           (str() == other.str());
 }
 
 bool
index 742d822bd9a7d37139b278c8aebcf55810cd1747..b86a43af879cc6ff86efba04848a988ab5113f4d 100644 (file)
@@ -68,9 +68,12 @@ TEST_F(AdaptorConfigTest, loadExamples4) {
                                "classify.json",
                                "classify2.json",
                                "comments.json",
+                               "config-backend.json",
                                "dhcpv4-over-dhcpv6.json",
                                "global-reservations.json",
+                               "ha-load-balancing-primary.json",
                                "hooks.json",
+                               "hooks-radius.json",
                                "leases-expiration.json",
                                "multiple-options.json",
                                "mysql-reservations.json",
@@ -98,9 +101,11 @@ TEST_F(AdaptorConfigTest, loadExamples6) {
                                "classify.json",
                                "classify2.json",
                                "comments.json",
+                               "config-backend.json",
                                "dhcpv4-over-dhcpv6.json",
                                "duid.json",
                                "global-reservations.json",
+                               "ha-hot-standby.json",
                                "hooks.json",
                                "iPXE.json",
                                "leases-expiration.json",
@@ -113,6 +118,7 @@ TEST_F(AdaptorConfigTest, loadExamples6) {
                                "simple.json",
                                "softwire46.json",
                                "stateless.json",
+                               "tee-times.json",
                                "with-ddns.json" };
     ElementPtr x;
 
index e15bc0429cdaf264879ad7fd8fef17af016bb80f..7910650bbb98a3a9db4e7e01087a029173077b91 100644 (file)
@@ -334,9 +334,12 @@ TEST_F(ConfigTest, examples4) {
         "classify.json",
         "classify2.json",
         "comments.json",
+        "config-backend.json",
         "dhcpv4-over-dhcpv6.json",
         "global-reservations.json",
+        "ha-load-balancing-primary.json",
         "hooks.json",
+        "hooks-radius.json",
         "leases-expiration.json",
         "multiple-options.json",
         "mysql-reservations.json",
@@ -372,9 +375,11 @@ TEST_F(ConfigTest, examples6) {
         "classify.json",
         "classify2.json",
         "comments.json",
+        "config-backend.json",
         "dhcpv4-over-dhcpv6.json",
         "duid.json",
         "global-reservations.json",
+        "ha-hot-standby.json",
         "hooks.json",
         "iPXE.json",
         "leases-expiration.json",
@@ -387,6 +392,7 @@ TEST_F(ConfigTest, examples6) {
         "simple.json",
         "softwire46.json",
         "stateless.json",
+        "tee-times.json",
         "with-ddns.json"
     };
     for (string file : examples) {
index 3418413648a9c97bdc0379475794de624fb350ee..1405ee53a0dd87a9c403db84afcea0b6eb8cc498 100644 (file)
@@ -33,7 +33,7 @@ YangRepr::YangReprItem::get(const string& xpath, S_Session session) {
         }
         val_xpath = string(s_val->xpath());
         type = s_val->type();
-        ostringstream int_value;
+        ostringstream num_value;
         switch (type) {
         case SR_CONTAINER_T:
         case SR_CONTAINER_PRESENCE_T:
@@ -52,33 +52,38 @@ YangRepr::YangReprItem::get(const string& xpath, S_Session session) {
             break;
 
         case SR_UINT8_T:
-            int_value << static_cast<unsigned>(s_val->data()->get_uint8());
-            value = int_value.str();
+            num_value << static_cast<unsigned>(s_val->data()->get_uint8());
+            value = num_value.str();
             break;
 
         case SR_UINT16_T:
-            int_value << s_val->data()->get_uint16();
-            value = int_value.str();
+            num_value << s_val->data()->get_uint16();
+            value = num_value.str();
             break;
 
         case SR_UINT32_T:
-            int_value << s_val->data()->get_uint32();
-            value = int_value.str();
+            num_value << s_val->data()->get_uint32();
+            value = num_value.str();
             break;
 
         case SR_INT8_T:
-            int_value << static_cast<unsigned>(s_val->data()->get_int8());
-            value = int_value.str();
+            num_value << static_cast<unsigned>(s_val->data()->get_int8());
+            value = num_value.str();
             break;
 
         case SR_INT16_T:
-            int_value << s_val->data()->get_int16();
-            value = int_value.str();
+            num_value << s_val->data()->get_int16();
+            value = num_value.str();
             break;
 
         case SR_INT32_T:
-            int_value << s_val->data()->get_int32();
-            value = int_value.str();
+            num_value << s_val->data()->get_int32();
+            value = num_value.str();
+            break;
+
+        case SR_DECIMAL64_T:
+            num_value << s_val->data()->get_decimal64();
+            value = num_value.str();
             break;
 
         case SR_IDENTITYREF_T:
@@ -95,7 +100,7 @@ YangRepr::YangReprItem::get(const string& xpath, S_Session session) {
 
         default:
             isc_throw(NotImplemented,
-                      "YangReprItem called with unupported type: " << type);
+                      "YangReprItem called with unsupported type: " << type);
         }
     } catch (const sysrepo_exception& ex) {
         isc_throw(SysrepoError,
@@ -268,6 +273,16 @@ YangRepr::set(const Tree& tree, S_Session session) const {
                 }
                 break;
 
+            case SR_DECIMAL64_T:
+                try {
+                    double d64 = boost::lexical_cast<double>(item.value_);
+                    s_val.reset(new Val(d64));
+                } catch (const boost::bad_lexical_cast&) {
+                    isc_throw(BadValue,
+                              "'" << item.value_ << "' not a real");
+                }
+                break;
+
             default:
                 isc_throw(NotImplemented,
                           "YangRepr::set called with unupported type: "