EXPECT_TRUE(repr.verify(testTree, sess, cerr));
}
+
+/// @brief Tests specified configuration.
+///
+/// Configuration is set and then verified using YangRepr object.
+///
+/// @param model name of the model to be verified against
+/// @param tree tree to be verified
+void sanityCheckConfig(const std::string& model, const YRTree& tree) {
+ // Get a translator object to play with.
+ S_Connection conn(new Connection("utils unittests"));
+ S_Session sess(new Session(conn, SR_DS_CANDIDATE));
+
+ // Get it.
+ YangRepr repr(model);
+
+ EXPECT_NO_THROW(repr.set(tree, sess))
+ << " for model " << model;
+ bool result = false;
+ EXPECT_NO_THROW(result = repr.verify(tree, sess, cerr))
+ << " for model " << model;
+ EXPECT_TRUE(result);
+}
+
+// This is test environment sanity check. It verifies that every configuration
+// defined in yang_configs.h is sane.
+TEST(YangReprTest, verifyConfigs) {
+ for (auto x : test_configs) {
+ cout << "Testing tree for model " << x.first << endl;
+ sanityCheckConfig(x.first, x.second);
+ }
+}
+
+
}; // end of anonymous namespace
"disabled", SR_ENUM_T, true }
};
+/// @brief Set of example configurations
+const std::map<std::string, YRTree> test_configs =
+{
+ { exampleModel, exampleTree },
+ { testModel, testTree },
+ { subnetTwoPoolsModelIetf6, subnetTwoPoolsTreeIetf6 },
+ { subnetTimersModel, subnetTimersIetf6 },
+ { validModelIetf6, validTreeIetf6 },
+ { subnetOptionsModelKeaDhcp4, subnetOptionsTreeKeaDhcp4 },
+ { subnetOptionsModelKeaDhcp6, subnetOptionsTreeKeaDhcp6 },
+ { designExampleModel, designExampleTree }
+};
+
+
}; // end of namespace isc::yang::test
}; // end of namespace isc::yang
}; // end of namespace isc