From: Francis Dupont Date: Mon, 12 Nov 2018 17:04:00 +0000 (+0100) Subject: [65-libyang-clean-keatext] Reduced model and adapted tests X-Git-Tag: 204-move-models-base~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a830adcefd9306969216d35c51306df3610278bb;p=thirdparty%2Fkea.git [65-libyang-clean-keatext] Reduced model and adapted tests --- diff --git a/src/lib/yang/tests/keatest-module.yang b/src/lib/yang/tests/keatest-module.yang index 0d09a667ef..d96e7d9cda 100644 --- a/src/lib/yang/tests/keatest-module.yang +++ b/src/lib/yang/tests/keatest-module.yang @@ -3,10 +3,6 @@ module keatest-module { namespace "urn:ietf:params:xml:ns:yang:keatest-module"; prefix tm; - import ietf-inet-types { - prefix inet; - } - organization "Sysrepo and ISC"; description "ISC imported a test module from Sysrepo tests and adapted it @@ -14,20 +10,6 @@ module keatest-module { contact "kea-dev@lists.isc.org"; - typedef threshold-power-dBm { - type union { - type decimal64 { - fraction-digits 2; - } - type enumeration { - enum off { - description "No threshold configured"; - } - } - } - description "Power in dBm"; - } - container container { config true; list list { @@ -152,276 +134,6 @@ module keatest-module { } } } - container wireless{ - presence "wireless is enabled"; - leaf vendor_name{ - type string; - } - } - } - - container transfer { - choice how { - default interval; - case interval { - leaf interval { - type uint16; - default 30; - units minutes; - } - } - case daily { - leaf daily { - type empty; - } - leaf time-of-day { - type string; - units 24-hour-clock; - default 1am; - } - } - case manual { - leaf manual { - type empty; - } - } - } - } - - container location { - presence true; - leaf name { - type string; - } - - leaf longitude { - type string; - mandatory true; - } - - leaf latitude { - type string; - mandatory true; - } - } - - leaf hexnumber{ - type string { - length "0..4"; - pattern "[0-9a-fA-F]*"; - } - } - - container interface { - leaf ifType { - type enumeration { - enum ethernet; - enum atm; - } - } - leaf ifMTU { - type uint32; - } - must "ifType != 'ethernet' or " + - "(ifType = 'ethernet' and ifMTU = 1500)" { - error-message "An ethernet MTU must be 1500"; - } - must "ifType != 'atm' or " + - "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" { - error-message "An atm MTU must be 64 .. 17966"; - } - } - - list user { - description "This is a list of users in the system."; - ordered-by user; - config true; - - key "name"; - - leaf name { - type string; - } - leaf type { - type string; - } - leaf full-name { - type string; - } - } - - leaf-list ordered-numbers { - ordered-by user; - type uint8; - } - - list with_def { - config true; - key "name"; - leaf name { - type string; - } - leaf num { - type int8; - default 0; - } - } - - rpc activate-software-image { - input { - leaf image-name { - type string; - must ". != /top-level-default"; - } - leaf location { - type string; - default "/"; - must ". != 'invalid location'"; - } - } - output { - leaf status { - type string; - must ". != 'invalid status'"; - } - leaf version { - type string; - } - leaf location { - type string; - default "/"; - } - container init-log { - list log-msg { - key "msg time"; - leaf msg { - type string; - } - leaf time { - type uint32; - } - leaf msg-type { - type enumeration { - enum "error" { - value 1; - } - enum "warning" { - value 2; - } - enum "debug" { - value 3; - } - } - } - } - } - } - } - - leaf top-level-default { - type string; - default "default value"; - } - - container university { - container students { - list student { - ordered-by user; - config true; - - key "name"; - - leaf name { - type string; - } - - leaf age { - type uint8; - } - } - } - - container classes { - list class { - config true; - - key "title"; - - leaf title { - type string; - } - - list student { - key "name"; - - leaf name { - type leafref { - path "../../../../students/student/name"; - } - } - leaf age { - type leafref { - path "../../../../students/student[name = current()/../name]/age"; - } - } - } - } - } - } - - container leafref-chain { - leaf A { - type leafref { - path "../B"; - } - } - - leaf B { - type leafref { - path "../C"; - } - } - - leaf C { - type leafref { - path "../D"; - } - } - - leaf D { - type string; - } - } - - grouping link { - container source { - leaf address { - type inet:ipv4-address; - } - leaf interface { - type string; - } - } - container destination { - leaf address { - type inet:ipv4-address; - } - leaf interface { - type string; - } - } - leaf MTU { - type uint16; - default 1500; - } - } - - notification link-discovered { - uses link; - } - - notification link-removed { - uses link; } container kernel-modules { @@ -463,103 +175,9 @@ module keatest-module { } } } - - action unload { } - - action get-dependencies { - output { - leaf-list dependency { - type string; - } - leaf location { - type leafref { - path "/kernel-modules/kernel-module[name = current()/../../name]/location"; - } - } - leaf location2 { - type leafref { - path "../../location"; - } - } - } - } - } } - typedef uniontpdf { - type union { - type string { - pattern "disabled"; - } - type uint8 { - range "1..100"; - } - } - default "disabled"; - } - - typedef enumtpdf { - type enumeration { - enum "a" { - value 1; - } - enum "b" { - value 2; - } - enum "c" { - value 3; - } - } - } - - typedef multiplunions { - type union { - type uniontpdf; - type enumtpdf; - type union { - type boolean; - type decimal64 { - fraction-digits 2; - } - } - } - } - - typedef leafreftpdf { - type leafref { - path "/list/key"; - } - } - - typedef inttpdf { - type uint8 { - range "1..100"; - } - } - - container tpdfs { - leaf unival { - type uniontpdf; - } - - leaf leafrefval { - type leafreftpdf; - } - - leaf intval { - type inttpdf; - } - - leaf undecided { - type multiplunions; - } - } - - leaf dec64-in-union { - type threshold-power-dBm; - } - container presence-container { presence "presence-container"; diff --git a/src/lib/yang/tests/translator_utils_unittests.cc b/src/lib/yang/tests/translator_utils_unittests.cc index d99dc1e385..938028bb69 100644 --- a/src/lib/yang/tests/translator_utils_unittests.cc +++ b/src/lib/yang/tests/translator_utils_unittests.cc @@ -153,7 +153,7 @@ TEST(YangReprTrest, getTestErrors) { // Change a path. YRTree badpath = testTree; - badpath[22].xpath_ = "/keatest-module:kernel-module"; // removed final 's' + badpath[14].xpath_ = "/keatest-module:kernel-module"; // removed final 's' EXPECT_FALSE(repr.verify(badpath, sess, cerr)); // Change a value. diff --git a/src/lib/yang/tests/yang_configs.h b/src/lib/yang/tests/yang_configs.h index afdd98a815..8711bfb129 100644 --- a/src/lib/yang/tests/yang_configs.h +++ b/src/lib/yang/tests/yang_configs.h @@ -32,18 +32,7 @@ const YRTree testTree = { SR_IDENTITYREF_T, true }, { "/keatest-module:main/enum", "maybe", SR_ENUM_T, true }, { "/keatest-module:main/raw", "Zm9vYmFy", SR_BINARY_T, true }, - { "/keatest-module:transfer", "", SR_CONTAINER_T, false }, - { "/keatest-module:transfer/interval", "30", SR_UINT16_T, false }, - { "/keatest-module:interface", "", SR_CONTAINER_T, false }, - { "/keatest-module:top-level-default", "default value", - SR_STRING_T, false }, - { "/keatest-module:university", "", SR_CONTAINER_T, false }, - { "/keatest-module:university/students", "", SR_CONTAINER_T, false }, - { "/keatest-module:university/classes", "", SR_CONTAINER_T, false }, - { "/keatest-module:leafref-chain", "", SR_CONTAINER_T, false }, - { "/keatest-module:kernel-modules", "", SR_CONTAINER_T, false }, - { "/keatest-module:tpdfs", "", SR_CONTAINER_T, false }, - { "/keatest-module:tpdfs/unival", "disabled", SR_STRING_T, false } + { "/keatest-module:kernel-modules", "", SR_CONTAINER_T, false } }; /// @brief A subnet with two pools with ietf-dhcpv6-server model.