]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[742-new-libyang-and-sysrepo-versions] Updated to the 0.7.8 value API
authorFrancis Dupont <fdupont@isc.org>
Sat, 20 Jul 2019 19:14:54 +0000 (21:14 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 26 Jul 2019 14:27:31 +0000 (16:27 +0200)
src/lib/yang/tests/translator_database_unittests.cc
src/lib/yang/tests/translator_logger_unittests.cc
src/lib/yang/tests/translator_pd_pool_unittests.cc
src/lib/yang/tests/translator_unittests.cc
src/lib/yang/tests/translator_utils_unittests.cc
src/lib/yang/testutils/translator_test.cc
src/lib/yang/translator.cc

index 3e8e3c43ce605efe671d238c2cfc28d7de78a9b0..bf71051a038057e38a7c6fe3fe7f87a3fc75fbfb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -62,7 +62,11 @@ TEST_F(TranslatorDatabaseTest, get) {
     S_Val s_type(new Val("memfile"));
     EXPECT_NO_THROW(sess_->set_item(xtype.c_str(), s_type));
     uint32_t li = 3600;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_interval(new Val(li));
+#else
     S_Val s_interval(new Val(li, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xinterval.c_str(), s_interval));
 
     // Get empty.
@@ -120,7 +124,11 @@ TEST_F(TranslatorDatabaseTest, setEmpty) {
     S_Val s_type(new Val("memfile"));
     EXPECT_NO_THROW(sess_->set_item(xtype.c_str(), s_type));
     uint32_t li = 3600;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_interval(new Val(li));
+#else
     S_Val s_interval(new Val(li, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xinterval.c_str(), s_interval));
 
     // Reset to empty.
@@ -181,7 +189,11 @@ TEST_F(TranslatorDatabasesTest, get) {
     S_Val s_host(new Val("localhost"));
     EXPECT_NO_THROW(sess_->set_item(xhost.c_str(), s_host));
     uint16_t mport = 3306;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_port(new Val(mport));
+#else
     S_Val s_port(new Val(mport, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xport.c_str(), s_port));
 
     // Get empty.
@@ -277,7 +289,11 @@ TEST_F(TranslatorDatabasesTest, setEmpty) {
     S_Val s_host(new Val("localhost"));
     EXPECT_NO_THROW(sess_->set_item(xhost.c_str(), s_host));
     uint16_t mport = 3306;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_port(new Val(mport));
+#else
     S_Val s_port(new Val(mport, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xport.c_str(), s_port));
 
     // Reset to empty.
@@ -311,7 +327,11 @@ TEST_F(TranslatorDatabasesTest, setEmpties) {
     S_Val s_host(new Val("localhost"));
     EXPECT_NO_THROW(sess_->set_item(xhost.c_str(), s_host));
     uint16_t mport = 3306;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_port(new Val(mport));
+#else
     S_Val s_port(new Val(mport, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xport.c_str(), s_port));
 
     // Reset to empty.
index 1de5e8f07f030244b3c47cbf2b9cd97891e90234..cc8100a8e0c7e34725e35223196515a84d622637 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -65,7 +65,11 @@ TEST_F(TranslatorLoggersTest, get) {
     S_Val s_severity(new Val("WARN", SR_ENUM_T));
     EXPECT_NO_THROW(sess_->set_item(xseverity.c_str(), s_severity));
     uint32_t max_ver = 10;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_maxver(new Val(max_ver));
+#else
     S_Val s_maxver(new Val(max_ver, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(xmaxver.c_str(), s_maxver));
 
     // Get empty.
index 55583296bcf578efd7eda0b6add2d0ab96e9f6cb..1be28b16c8e18986f4b899fc33d6d05b49476056 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -89,7 +89,11 @@ TEST_F(TranslatorPdPoolsTest, getIetf) {
     EXPECT_NO_THROW(sess_->set_item(prefix.c_str(), s_prefix));
     const string& length = xpath + "/prefix-length";
     uint8_t len = 56;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_length(new Val(len));
+#else
     S_Val s_length(new Val(len, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(length.c_str(), s_length));
 
     // Get the pool.
@@ -128,7 +132,11 @@ TEST_F(TranslatorPdPoolsTest, getKea) {
     spool << xpath + "/pd-pool[prefix='" << prefix << "']";
     const string& x_delegated = spool.str() + "/delegated-len";
     uint8_t dl = 64;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_delegated(new Val(dl));
+#else
     S_Val s_delegated(new Val(dl, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(x_delegated.c_str(), s_delegated));
 
     // Get the pool.
@@ -332,7 +340,11 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
     spool << xpath + "/pd-pool[prefix='" << prefix << "']";
     const string& x_delegated = spool.str() + "/delegated-len";
     uint8_t dl = 64;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_delegated(new Val(dl));
+#else
     S_Val s_delegated(new Val(dl, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(x_delegated.c_str(), s_delegated));
 
     // Create the second pd-pool 2001:db8:0:2000::/56
@@ -341,7 +353,11 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
     spool2 << xpath + "/pd-pool[prefix='" << prefix2 << "']";
     const string& x_delegated2 = spool2.str() + "/delegated-len";
     uint8_t dl2 = 60;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    S_Val s_delegated2(new Val(dl2));
+#else
     S_Val s_delegated2(new Val(dl2, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess_->set_item(x_delegated2.c_str(), s_delegated2));
 
 
index ddf314e1b7fb412116cb1f60bdf90bfcb86d18a2..14ee74cdc4e5ab428992d8e0ec23ae6ebfe5abbe 100644 (file)
@@ -61,7 +61,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Unsigned 8 bit integer.
     uint8_t u8(123);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -70,7 +74,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Unsigned 16 bit integer.
     uint16_t u16(12345);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u16));
+#else
     s_val.reset(new Val(u16, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -79,7 +87,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Unsigned 32 bit integer.
     uint32_t u32(123456789);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u32));
+#else
     s_val.reset(new Val(u32, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -88,7 +100,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Signed 8 bit integer.
     int8_t s8(-123);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s8));
+#else
     s_val.reset(new Val(s8, SR_INT8_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -97,7 +113,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Signed 16 bit integer.
     int16_t s16(-12345);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s16));
+#else
     s_val.reset(new Val(s16, SR_INT16_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -106,7 +126,11 @@ TEST(TranslatorBasicTest, valueFrom) {
 
     // Signed 32 bit integer.
     int32_t s32(-123456789);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s32));
+#else
     s_val.reset(new Val(s32, SR_INT32_T));
+#endif
     EXPECT_NO_THROW(elem = TranslatorBasic::value(s_val));
     ASSERT_TRUE(elem);
     ASSERT_EQ(Element::integer, elem->getType());
@@ -191,7 +215,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Unsigned 8 bit integer.
     xpath = "/keatest-module:main/ui8";
     uint8_t u8(8);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -202,7 +230,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Unsigned 16 bit integer.
     xpath = "/keatest-module:main/ui16";
     uint16_t u16(16);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u16));
+#else
     s_val.reset(new Val(u16, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -213,7 +245,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Unsigned 32 bit integer.
     xpath = "/keatest-module:main/ui32";
     uint32_t u32(32);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u32));
+#else
     s_val.reset(new Val(u32, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -224,7 +260,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Signed 8 bit integer.
     xpath = "/keatest-module:main/i8";
     int8_t s8(8);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s8));
+#else
     s_val.reset(new Val(s8, SR_INT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -235,7 +275,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Signed 16 bit integer.
     xpath = "/keatest-module:main/i16";
     int16_t s16(16);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s16));
+#else
     s_val.reset(new Val(s16, SR_INT16_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -246,7 +290,11 @@ TEST(TranslatorBasicTest, getItem) {
     // Signed 32 bit integer.
     xpath = "/keatest-module:main/i32";
     int32_t s32(32);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s32));
+#else
     s_val.reset(new Val(s32, SR_INT32_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItem(xpath));
     ASSERT_TRUE(elem);
@@ -294,13 +342,25 @@ TEST(TranslatorBasicTest, getItem) {
 
     // Leaf-list: 1, 2 and 3.
     u8 = 1;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     u8 = 2;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     u8 = 3;
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     EXPECT_NO_THROW(elem = t_obj->getItems(xpath));
     ASSERT_TRUE(elem);
index 938028bb690ffcd8bd880a2ec5fb26b7f70c0f37..2bd374009d113f7859e6dd0a80af364a8f5d73d9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -84,32 +84,56 @@ TEST(YangReprTest, getTest) {
 
     xpath = "/keatest-module:main/ui8";
     uint8_t u8(8);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u8));
+#else
     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/ui16";
     uint16_t u16(16);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u16));
+#else
     s_val.reset(new Val(u16, SR_UINT16_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/ui32";
     uint32_t u32(32);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(u32));
+#else
     s_val.reset(new Val(u32, SR_UINT32_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/i8";
     int8_t s8(8);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s8));
+#else
     s_val.reset(new Val(s8, SR_INT8_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/i16";
     int16_t s16(16);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s16));
+#else
     s_val.reset(new Val(s16, SR_INT16_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/i32";
     int32_t s32(32);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+    s_val.reset(new Val(s32));
+#else
     s_val.reset(new Val(s32, SR_INT32_T));
+#endif
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
 
     xpath = "/keatest-module:main/id_ref";
index bf542ccb6b5573b92b5b5496bec3f5661c64c076..3418413648a9c97bdc0379475794de624fb350ee 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -187,7 +187,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_UINT8_T:
                 try {
                     uint8_t u8 = boost::lexical_cast<unsigned>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(u8));
+#else
                     s_val.reset(new Val(u8, SR_UINT8_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an uint8");
@@ -197,7 +201,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_UINT16_T:
                 try {
                     uint16_t u16 = boost::lexical_cast<uint16_t>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(u16));
+#else
                     s_val.reset(new Val(u16, SR_UINT16_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an uint16");
@@ -207,7 +215,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_UINT32_T:
                 try {
                     uint32_t u32 = boost::lexical_cast<uint32_t>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(u32));
+#else
                     s_val.reset(new Val(u32, SR_UINT32_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an uint32");
@@ -217,7 +229,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_INT8_T:
                 try {
                     int8_t i8 = boost::lexical_cast<int>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(i8));
+#else
                     s_val.reset(new Val(i8, SR_INT8_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an int8");
@@ -227,7 +243,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_INT16_T:
                 try {
                     int16_t i16 = boost::lexical_cast<int16_t>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(i16));
+#else
                     s_val.reset(new Val(i16, SR_INT16_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an int16");
@@ -237,7 +257,11 @@ YangRepr::set(const Tree& tree, S_Session session) const {
             case SR_INT32_T:
                 try {
                     int32_t i32 = boost::lexical_cast<int32_t>(item.value_);
+#ifdef HAVE_POST_0_7_7_SYSREPO
+                    s_val.reset(new Val(i32));
+#else
                     s_val.reset(new Val(i32, SR_INT32_T));
+#endif
                 } catch (const boost::bad_lexical_cast&) {
                     isc_throw(BadValue,
                               "'" << item.value_ << "' not an int32");
index d2983ccd497ee4f7256d2250132a769b60a6f892..aa5cc0ec5b869965ac80f4b777a47eccb45b4569 100644 (file)
@@ -186,7 +186,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<uint8_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<uint8_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_UINT16_T:
@@ -195,7 +199,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<uint16_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<uint16_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_UINT32_T:
@@ -204,7 +212,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<uint32_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<uint32_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_INT8_T:
@@ -213,7 +225,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<int8_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<int8_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_INT16_T:
@@ -222,7 +238,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<int16_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<int16_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_INT32_T:
@@ -231,7 +251,11 @@ TranslatorBasic::value(ConstElementPtr elem, sr_type_t type) {
                       "value for an integer called with not an integer: "
                       << elem->str());
         }
+#ifdef HAVE_POST_0_7_7_SYSREPO
+        s_val.reset(new Val(static_cast<int32_t>(elem->intValue())));
+#else
         s_val.reset(new Val(static_cast<int32_t>(elem->intValue()), type));
+#endif
         break;
 
     case SR_BINARY_T: