Parcourir la source

[5227] Updated optionStandardDefOverride test and regen

Francis Dupont il y a 7 ans
Parent
commit
5a2f43451d

+ 10 - 14
src/bin/dhcp4/tests/config_parser_unittest.cc

@@ -2163,15 +2163,11 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
     checkResult(status, 1);
     checkResult(status, 1);
     EXPECT_TRUE(errorContainsPosition(status, "<string>"));
     EXPECT_TRUE(errorContainsPosition(status, "<string>"));
 
 
-    /// @todo The option 213 is a standard DHCPv4 option. However, at
-    /// this point there is no definition for this option in
-    /// libdhcp++, so it should be allowed to define it from the
-    /// configuration interface. This test will have to be removed
-    /// once definitions for remaining standard options are created.
+    /// There is no definition for unassigned option 170.
     config =
     config =
         "{ \"option-def\": [ {"
         "{ \"option-def\": [ {"
-        "      \"name\": \"access-network-domain-name\","
-        "      \"code\": 213,"
+        "      \"name\": \"unassigned-option-170\","
+        "      \"code\": 170,"
         "      \"type\": \"string\","
         "      \"type\": \"string\","
         "      \"space\": \"dhcp4\""
         "      \"space\": \"dhcp4\""
         "  } ]"
         "  } ]"
@@ -2186,12 +2182,12 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
     checkResult(status, 0);
     checkResult(status, 0);
 
 
     def = CfgMgr::instance().getStagingCfg()->
     def = CfgMgr::instance().getStagingCfg()->
-        getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 213);
+        getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 170);
     ASSERT_TRUE(def);
     ASSERT_TRUE(def);
 
 
     // Check the option data.
     // Check the option data.
-    EXPECT_EQ("access-network-domain-name", def->getName());
-    EXPECT_EQ(213, def->getCode());
+    EXPECT_EQ("unassigned-option-170", def->getName());
+    EXPECT_EQ(170, def->getCode());
     EXPECT_EQ(OPT_STRING_TYPE, def->getType());
     EXPECT_EQ(OPT_STRING_TYPE, def->getType());
     EXPECT_FALSE(def->getArrayType());
     EXPECT_FALSE(def->getArrayType());
 
 
@@ -2820,7 +2816,7 @@ TEST_F(Dhcp4ParserTest, optionDataSinglePool) {
     // Expect a single option with the code equal to 100.
     // Expect a single option with the code equal to 100.
     ASSERT_EQ(1, std::distance(range.first, range.second));
     ASSERT_EQ(1, std::distance(range.first, range.second));
     const uint8_t foo_expected[] = {
     const uint8_t foo_expected[] = {
-	0xAB, 0xCD, 0xEF, 0x01, 0x05
+        0xAB, 0xCD, 0xEF, 0x01, 0x05
     };
     };
     // Check if option is valid in terms of code and carried data.
     // Check if option is valid in terms of code and carried data.
     testOption(*range.first, 56, foo_expected, sizeof(foo_expected));
     testOption(*range.first, 56, foo_expected, sizeof(foo_expected));
@@ -2893,7 +2889,7 @@ TEST_F(Dhcp4ParserTest, optionDataMultiplePools) {
     // Expect a single option with the code equal to 100.
     // Expect a single option with the code equal to 100.
     ASSERT_EQ(1, std::distance(range1.first, range1.second));
     ASSERT_EQ(1, std::distance(range1.first, range1.second));
     const uint8_t foo_expected[] = {
     const uint8_t foo_expected[] = {
-	0xAB, 0xCD, 0xEF, 0x01, 0x05
+        0xAB, 0xCD, 0xEF, 0x01, 0x05
     };
     };
     // Check if option is valid in terms of code and carried data.
     // Check if option is valid in terms of code and carried data.
     testOption(*range1.first, 56, foo_expected, sizeof(foo_expected));
     testOption(*range1.first, 56, foo_expected, sizeof(foo_expected));
@@ -2909,8 +2905,8 @@ TEST_F(Dhcp4ParserTest, optionDataMultiplePools) {
 
 
     const OptionContainerTypeIndex& idx2 = options2->get<1>();
     const OptionContainerTypeIndex& idx2 = options2->get<1>();
     std::pair<OptionContainerTypeIndex::const_iterator,
     std::pair<OptionContainerTypeIndex::const_iterator,
-	      OptionContainerTypeIndex::const_iterator> range2 =
-	idx2.equal_range(23);
+              OptionContainerTypeIndex::const_iterator> range2 =
+        idx2.equal_range(23);
     ASSERT_EQ(1, std::distance(range2.first, range2.second));
     ASSERT_EQ(1, std::distance(range2.first, range2.second));
     const uint8_t foo2_expected[] = {
     const uint8_t foo2_expected[] = {
         0x01
         0x01

+ 4 - 4
src/bin/dhcp4/tests/get_config_unittest.cc

@@ -533,8 +533,8 @@ const char* EXTRACTED_CONFIGS[] = {
 "{\n"
 "{\n"
 "        \"option-def\": [\n"
 "        \"option-def\": [\n"
 "            {\n"
 "            {\n"
-"                \"code\": 213,\n"
-"                \"name\": \"access-network-domain-name\",\n"
+"                \"code\": 170,\n"
+"                \"name\": \"unassigned-option-170\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"type\": \"string\"\n"
 "                \"type\": \"string\"\n"
 "            }\n"
 "            }\n"
@@ -3210,9 +3210,9 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"option-def\": [\n"
 "        \"option-def\": [\n"
 "            {\n"
 "            {\n"
 "                \"array\": false,\n"
 "                \"array\": false,\n"
-"                \"code\": 213,\n"
+"                \"code\": 170,\n"
 "                \"encapsulate\": \"\",\n"
 "                \"encapsulate\": \"\",\n"
-"                \"name\": \"access-network-domain-name\",\n"
+"                \"name\": \"unassigned-option-170\",\n"
 "                \"record-types\": \"\",\n"
 "                \"record-types\": \"\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"type\": \"string\"\n"
 "                \"type\": \"string\"\n"