diff options
author | Francis Dupont <fdupont@isc.org> | 2019-08-10 14:14:26 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2019-08-13 23:43:06 +0200 |
commit | 551c124d6e824651a21f6d6d4db22f330c517fc2 (patch) | |
tree | 09e23e4d334ddf985d9cf7aaa9d9599927791e44 | |
parent | [433-update-yang-models] Updated code and tests (diff) | |
download | kea-551c124d6e824651a21f6d6d4db22f330c517fc2.tar.xz kea-551c124d6e824651a21f6d6d4db22f330c517fc2.zip |
[433-update-yang-models] Enabled (and fixed) more tests
-rw-r--r-- | doc/examples/kea4/cassandra.json | 4 | ||||
-rw-r--r-- | doc/examples/kea6/cassandra.json | 4 | ||||
-rw-r--r-- | doc/examples/kea6/tee-times.json | 4 | ||||
-rw-r--r-- | src/lib/cc/data.cc | 2 | ||||
-rw-r--r-- | src/lib/yang/tests/adaptor_config_unittests.cc | 6 | ||||
-rw-r--r-- | src/lib/yang/tests/config_unittests.cc | 6 | ||||
-rw-r--r-- | src/lib/yang/testutils/translator_test.cc | 43 |
7 files changed, 47 insertions, 22 deletions
diff --git a/doc/examples/kea4/cassandra.json b/doc/examples/kea4/cassandra.json index 8d7d850417..83fad11a94 100644 --- a/doc/examples/kea4/cassandra.json +++ b/doc/examples/kea4/cassandra.json @@ -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. diff --git a/doc/examples/kea6/cassandra.json b/doc/examples/kea6/cassandra.json index f1bf18f9e1..071b16583f 100644 --- a/doc/examples/kea6/cassandra.json +++ b/doc/examples/kea6/cassandra.json @@ -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 diff --git a/doc/examples/kea6/tee-times.json b/doc/examples/kea6/tee-times.json index 713fb9113c..ffe044080e 100644 --- a/doc/examples/kea6/tee-times.json +++ b/doc/examples/kea6/tee-times.json @@ -48,13 +48,11 @@ "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", diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index e9a00da49a..0572e0ef77 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -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 diff --git a/src/lib/yang/tests/adaptor_config_unittests.cc b/src/lib/yang/tests/adaptor_config_unittests.cc index 742d822bd9..b86a43af87 100644 --- a/src/lib/yang/tests/adaptor_config_unittests.cc +++ b/src/lib/yang/tests/adaptor_config_unittests.cc @@ -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; diff --git a/src/lib/yang/tests/config_unittests.cc b/src/lib/yang/tests/config_unittests.cc index e15bc0429c..7910650bbb 100644 --- a/src/lib/yang/tests/config_unittests.cc +++ b/src/lib/yang/tests/config_unittests.cc @@ -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) { diff --git a/src/lib/yang/testutils/translator_test.cc b/src/lib/yang/testutils/translator_test.cc index 3418413648..1405ee53a0 100644 --- a/src/lib/yang/testutils/translator_test.cc +++ b/src/lib/yang/testutils/translator_test.cc @@ -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: " |