Commit df49e49a authored by Francis Dupont's avatar Francis Dupont
Browse files

[3927] Simplified option-def tests

parent 75552a69
......@@ -1330,10 +1330,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1372,10 +1369,8 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"array\": False,"
" \"record-types\": \"uint16, ipv4-address, ipv6-address, string\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1422,19 +1417,13 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 101,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1488,19 +1477,13 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1529,9 +1512,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1571,8 +1552,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"sub-opts-space\""
" } ]"
......@@ -1613,10 +1592,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidName) {
" \"name\": \"invalid%name\","
" \"code\": 100,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1640,10 +1616,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"sting\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1667,10 +1640,8 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidRecordType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"array\": False,"
" \"record-types\": \"uint32,uint8,sting\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1694,8 +1665,6 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidEncapsulatedSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"invalid%space%name\""
" } ]"
......@@ -1724,7 +1693,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\""
" } ]"
......@@ -1750,8 +1718,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulateOwnSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"isc\""
" } ]"
......@@ -1781,10 +1747,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 109,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp4\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp4\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1818,10 +1781,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"routers\","
" \"code\": 3,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp4\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp4\""
" } ]"
"}";
json = Element::fromJSON(config);
......@@ -1843,10 +1803,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"nis-server-addr\","
" \"code\": 65,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp4\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp4\""
" } ]"
"}";
json = Element::fromJSON(config);
......@@ -1968,10 +1925,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
" \"name\": \"foo\","
" \"code\": 56,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
......@@ -2048,19 +2002,13 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
......@@ -2107,8 +2055,6 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
" \"name\": \"base-option\","
" \"code\": 222,"
" \"type\": \"uint8\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp4\","
" \"encapsulate\": \"isc\""
"},"
......@@ -2116,19 +2062,13 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
......@@ -2625,19 +2565,13 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-encapsulated-options-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-encapsulated-options-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-encapsulated-options-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-encapsulated-options-space\""
" } ]"
"}";
......@@ -2688,19 +2622,13 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-encapsulated-options-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-encapsulated-options-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-encapsulated-options-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-encapsulated-options-space\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
......@@ -2841,10 +2769,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-4491\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-4491\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
......@@ -2927,10 +2852,7 @@ buildHooksLibrariesConfig(const std::vector<std::string>& libraries) {
" \"name\": \"foo\","
" \"code\": 56,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
......
......@@ -205,10 +205,7 @@ public:
" \"name\": \"bool-option\","
" \"code\": 1000,"
" \"type\": \"boolean\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp6\""
"} ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
......@@ -1572,10 +1569,7 @@ TEST_F(Dhcp6ParserTest, optionDefIpv6Address) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv6-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1612,10 +1606,8 @@ TEST_F(Dhcp6ParserTest, optionDefRecord) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"array\": False,"
" \"record-types\": \"uint16, ipv4-address, ipv6-address, string\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1661,19 +1653,13 @@ TEST_F(Dhcp6ParserTest, optionDefMultiple) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 101,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1725,19 +1711,13 @@ TEST_F(Dhcp6ParserTest, optionDefDuplicate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1766,9 +1746,7 @@ TEST_F(Dhcp6ParserTest, optionDefArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1806,8 +1784,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"sub-opts-space\""
" } ]"
......@@ -1847,10 +1823,7 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidName) {
" \"name\": \"invalid%name\","
" \"code\": 100,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1874,10 +1847,7 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"sting\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1901,10 +1871,8 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidRecordType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
" \"array\": False,"
" \"record-types\": \"uint32,uint8,sting\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -1928,8 +1896,6 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidEncapsulatedSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"invalid%space%name\""
" } ]"
......@@ -1958,7 +1924,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulatedSpaceAndArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\""
" } ]"
......@@ -1984,8 +1949,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulateOwnSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"isc\""
" } ]"
......@@ -2016,10 +1979,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp6\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
......@@ -2053,10 +2013,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 3,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp6\""
" } ]"
"}";
json = Element::fromJSON(config);
......@@ -2078,10 +2035,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"geolocation\","
" \"code\": 63,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"\""
" \"space\": \"dhcp6\""
" } ]"
"}";
json = Element::fromJSON(config);
......@@ -2212,10 +2166,7 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
" \"name\": \"foo\","
" \"code\": 38,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
......@@ -2293,19 +2244,13 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ]"
"}";
......@@ -2353,8 +2298,6 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
" \"name\": \"base-option\","
" \"code\": 100,"
" \"type\": \"uint8\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"isc\""
"},"
......@@ -2362,19 +2305,13 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
......@@ -2811,10 +2748,7 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-4491\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-4491\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
......@@ -2884,19 +2818,13 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-opts-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-opts-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
" \"array\": False,"
" \"record-types\": \"\","
" \"space\": \"vendor-opts-space\","
" \"encapsulate\": \"\""
" \"space\": \"vendor-opts-space\""
" } ]"