Commit cca3f6bc authored by Francis Dupont's avatar Francis Dupont

[65-libyang-simplify-update-models] Updated netconf tests

parent ab899afe
......@@ -389,18 +389,15 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
......@@ -421,18 +418,15 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
......@@ -441,9 +435,9 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Check that the debug output was correct.
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"modified: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
"/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.0.0/24 => "
"/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
"/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.1.0/24");
// logChanges is called in another thread so we can have to wait for it.
......@@ -462,18 +456,15 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
......@@ -492,22 +483,19 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
thread_.reset(new Thread([this]() { io_service_->run(); }));
// Change configuration (subnet #1 moved to #10).
string xpath = "/kea-dhcp4-server:config/subnet4/subnet4[id='1']";
string xpath = "/kea-dhcp4-server:config/subnet4[id='1']";
EXPECT_NO_THROW(agent_->running_sess_->delete_item(xpath.c_str()));
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='10']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/id",
{ "/kea-dhcp4-server:config/subnet4[id='10']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='10']/id",
"10", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='10']/subnet",
"10.0.0.0/24", SR_STRING_T, true }, // The change is here!
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
......@@ -516,30 +504,30 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
// Check that the debug output was correct.
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id = 1");
"/kea-dhcp4-server:config/subnet4[id='1']/id = 1");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
"/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.0.0/24");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='1'] "
"/kea-dhcp4-server:config/subnet4[id='1'] "
"(list instance)");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='10'] "
"/kea-dhcp4-server:config/subnet4[id='10'] "
"(list instance)");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='10']/id = 10");
"/kea-dhcp4-server:config/subnet4[id='10']/id = 10");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='10']/subnet = "
"/kea-dhcp4-server:config/subnet4[id='10']/subnet = "
"10.0.0.0/24");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"moved: "
"/kea-dhcp4-server:config/subnet4/subnet4[id='10'] "
"after /kea-dhcp4-server:config/subnet4/subnet4[id='2']");
"/kea-dhcp4-server:config/subnet4[id='10'] "
"after /kea-dhcp4-server:config/subnet4[id='2']");
// logChanges is called in another thread so we can have to wait for it.
while (!TestCallback::finished) {
......@@ -638,18 +626,15 @@ TEST_F(NetconfAgentTest, yangConfig) {
// YANG configuration.
const YRTree tree = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load YANG configuration.
......@@ -802,18 +787,15 @@ TEST_F(NetconfAgentTest, update) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
......@@ -875,18 +857,15 @@ TEST_F(NetconfAgentTest, update) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
......@@ -942,18 +921,15 @@ TEST_F(NetconfAgentTest, validate) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
......@@ -1018,18 +994,15 @@ TEST_F(NetconfAgentTest, validate) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
{ "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
......@@ -1116,12 +1089,10 @@ TEST_F(NetconfAgentTest, noValidate) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
......@@ -1175,14 +1146,12 @@ TEST_F(NetconfAgentTest, noValidate) {
// Change configuration (add invalid user context).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
{ "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
{ "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
{ "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
{ "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/user-context",
{ "/kea-dhcp4-server:config/subnet4[id='1']/user-context",
"BOGUS", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment