EXPECT_TRUE(query->inClass("router"));
}
-// Checks subnet options have the priority over class options
+// Checks class options have the priority over subnet options
TEST_F(Dhcpv4SrvTest, subnetClassPriority) {
IfaceMgrTestConfig test_config(true);
IfaceMgr::instance().openSockets4();
" \"subnet\": \"192.0.2.0/24\", "
" \"option-data\": ["
" { \"name\": \"ip-forwarding\", "
- " \"data\": \"false\" } ] } ], "
+ " \"data\": \"true\" } ] } ], "
"\"client-classes\": [ "
"{ \"name\": \"router\","
" \"option-data\": ["
" { \"name\": \"ip-forwarding\", "
- " \"data\": \"true\" } ], "
+ " \"data\": \"false\" } ], "
" \"test\": \"option[12].text == 'foo'\" } ] }";
ConstElementPtr json;
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceGlobal) {
const std::string config =
"{"
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceClass) {
const std::string config =
"{"
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceClasses) {
const std::string config =
"{"
" {"
" \"name\": \"frog\","
" \"interface\": \"eth1\","
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"domain-name-servers\","
+ " \"data\": \"192.0.2.4\""
+ " }"
+ " ],"
" \"subnet4\": ["
" {"
" \"subnet\": \"192.0.2.0/26\","
" \"id\": 10,"
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"domain-name-servers\","
+ " \"data\": \"192.0.2.5\""
+ " }"
+ " ],"
" \"pools\": ["
" {"
- " \"pool\": \"192.0.2.1 - 192.0.2.63\""
+ " \"pool\": \"192.0.2.1 - 192.0.2.63\","
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"domain-name-servers\","
+ " \"data\": \"192.0.2.5\""
+ " }"
+ " ]"
" }"
" ],"
" \"reservations\": ["
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceNetwork) {
const std::string config =
"{"
" \"data\": \"192.0.2.1\""
" }"
" ],"
- " \"client-classes\": ["
- " {"
- " \"name\": \"alpha\","
- " \"test\": \"'' == ''\","
- " \"option-data\": ["
- " {"
- " \"name\": \"domain-name-servers\","
- " \"data\": \"192.0.2.2\""
- " }"
- " ]"
- " }"
- " ],"
" \"shared-networks\": ["
" {"
" \"name\": \"frog\","
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceSubnet) {
const std::string config =
"{"
" \"data\": \"192.0.2.1\""
" }"
" ],"
- " \"client-classes\": ["
- " {"
- " \"name\": \"alpha\","
- " \"test\": \"'' == ''\","
- " \"option-data\": ["
- " {"
- " \"name\": \"domain-name-servers\","
- " \"data\": \"192.0.2.2\""
- " }"
- " ]"
- " }"
- " ],"
" \"shared-networks\": ["
" {"
" \"name\": \"frog\","
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedencePool) {
const std::string config =
"{"
" \"data\": \"192.0.2.1\""
" }"
" ],"
- " \"client-classes\": ["
- " {"
- " \"name\": \"alpha\","
- " \"test\": \"'' == ''\","
- " \"option-data\": ["
- " {"
- " \"name\": \"domain-name-servers\","
- " \"data\": \"192.0.2.2\""
- " }"
- " ]"
- " }"
- " ],"
" \"shared-networks\": ["
" {"
" \"name\": \"frog\","
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pool < host reservation
+// Order is global < shared-network < subnet < pool < class < host reservation
TEST_F(Dhcpv4SharedNetworkTest, precedenceReservation) {
const std::string config =
"{"
" \"interface\": \"eth1\", "
" \"option-data\": ["
" { \"name\": \"ipv6-forwarding\", "
- " \"data\": \"false\" } ] } ], "
+ " \"data\": \"true\" } ] } ], "
"\"client-classes\": [ "
"{ \"name\": \"router\","
" \"option-data\": ["
" { \"name\": \"ipv6-forwarding\", "
- " \"data\": \"true\" } ], "
+ " \"data\": \"false\" } ], "
" \"test\": \"option[1234].text == 'foo'\" } ] }";
ASSERT_NO_THROW(configure(config));
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedenceGlobal) {
const std::string config =
"{"
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedenceClass) {
const std::string config =
"{"
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedenceClasses) {
const std::string config =
"{"
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
-TEST_F(Dhcpv6SharedNetworkTest, precedenceNetworkClass) {
+// Order is global < shared-network < subnet < pools < class < host reservation
+TEST_F(Dhcpv6SharedNetworkTest, precedencePoolClass) {
const std::string config =
"{"
" \"option-data\": ["
" \"id\": 10,"
" \"pools\": ["
" {"
- " \"pool\": \"2001:db8:1::1 - 2001:db8:1::64\""
+ " \"pool\": \"2001:db8:1::1 - 2001:db8:1::64\","
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"dns-servers\","
+ " \"data\": \"2001:db8:1::4\""
+ " }"
+ " ]"
" }"
" ],"
" \"reservations\": ["
" ]"
"}";
- testPrecedence(config, "2001:db8:1::3");
+ testPrecedence(config, "2001:db8:1::2");
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedenceSubnet) {
const std::string config =
"{"
" \"data\": \"2001:db8:1::1\""
" }"
" ],"
- " \"client-classes\": ["
- " {"
- " \"name\": \"alpha\","
- " \"test\": \"'' == ''\","
- " \"option-data\": ["
- " {"
- " \"name\": \"dns-servers\","
- " \"data\": \"2001:db8:1::2\""
- " }"
- " ]"
- " }"
- " ],"
" \"shared-networks\": ["
" {"
" \"name\": \"frog\","
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedencePool) {
const std::string config =
"{"
" \"data\": \"2001:db8:1::1\""
" }"
" ],"
- " \"client-classes\": ["
- " {"
- " \"name\": \"alpha\","
- " \"test\": \"'' == ''\","
- " \"option-data\": ["
- " {"
- " \"name\": \"dns-servers\","
- " \"data\": \"2001:db8:1::2\""
- " }"
- " ]"
- " }"
- " ],"
" \"shared-networks\": ["
" {"
" \"name\": \"frog\","
}
// Verify option processing precedence
-// Order is global < class < shared-network < subnet < pools < host reservation
+// Order is global < shared-network < subnet < pools < class < host reservation
TEST_F(Dhcpv6SharedNetworkTest, precedenceReservation) {
const std::string config =
"{"