Fix setting identityrefs
The valid identities only include derived identities of the base and NOT
the base itself.
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/216
Change-Id: I877c2458d310054c01eb7db726ebf20f9ffe8062
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 6507f08..3f562e1 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -213,7 +213,6 @@
std::set<identityRef_> identSet;
for (auto base : resolveTypedef<ResolveMode::Identity>(type)) { // Iterate over all bases
- identSet.emplace(base->module()->name(), base->name());
// Iterate over derived identities (this is recursive!)
for (auto derived : base->der()->schema()) {
identSet.emplace(derived->module()->name(), derived->name());
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 37b473d..4905166 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -674,7 +674,6 @@
node.first = "example-schema";
node.second = "foodIdentLeaf";
type = yang::IdentityRef{{{"second-schema", "pineapple"},
- {"example-schema", "food"},
{"example-schema", "pizza"},
{"example-schema", "hawaii"},
{"example-schema", "fruit"}}};
@@ -686,7 +685,6 @@
node.second = "pizzaIdentLeaf";
type = yang::IdentityRef{{
- {"example-schema", "pizza"},
{"example-schema", "hawaii"},
}};
}
@@ -697,8 +695,6 @@
node.second = "foodDrinkIdentLeaf";
type = yang::IdentityRef{{
- {"example-schema", "food"},
- {"example-schema", "drink"},
{"example-schema", "fruit"},
{"example-schema", "hawaii"},
{"example-schema", "pizza"},
@@ -769,7 +765,6 @@
node.first = "example-schema";
node.second = "leafFoodTypedef";
type = yang::IdentityRef{{
- {"example-schema", "food"},
{"example-schema", "fruit"},
{"example-schema", "hawaii"},
{"example-schema", "pizza"},