Browse Source

[4271] Messages are now more terse.

Tomek Mrugalski 8 years ago
parent
commit
77848fb77e
3 changed files with 22 additions and 9 deletions
  1. 9 9
      src/lib/eval/eval_messages.mes
  2. 11 0
      src/lib/eval/tests/token_unittest.cc
  3. 2 0
      src/lib/eval/token.cc

+ 9 - 9
src/lib/eval/eval_messages.mes

@@ -112,49 +112,49 @@ This debug message indicates that the expression has been evaluated
 to said value. This message is mostly useful during debugging of the
 client classification expressions.
 
-% EVAL_DEBUG_VENDOR_NO_OPTION Vendor option (code %1) missing, pushing result %2
+% EVAL_DEBUG_VENDOR_NO_OPTION Option with code %1 missing, pushing result %2
 This debug message indicates that the expression has been evaluated
 and vendor option was not found. This message is mostly useful during
 debugging of the client classification expressions.
 
-% EVAL_DEBUG_VENDOR_ENTERPRISE_ID_MISMATCH Vendor option was found, but does not have expected enterprise-id (was looking for %1, option had %2), pushing result %3
+% EVAL_DEBUG_VENDOR_ENTERPRISE_ID_MISMATCH Was looking for %1, option had %2, pushing result %3
 This debug message indicates that the expression has been evaluated
 and vendor option was found, but has different enterprise-id than specified
 in the expression. This message is mostly useful during debugging of the
 client classification expressions.
 
-% EVAL_DEBUG_VENDOR_ENTERPRISE_ID Vendor option found, pushing enterprise-id %1 as result %2
+% EVAL_DEBUG_VENDOR_ENTERPRISE_ID Pushing enterprise-id %1 as result %2
 This debug message indicates that the expression has been evaluated and vendor
 option was found and its enterprise-id is being reported. This message is mostly
 useful during debugging of the client classification expressions.
 
-% EVAL_DEBUG_VENDOR_EXISTS Vendor option exists, pushing result %1
+% EVAL_DEBUG_VENDOR_EXISTS Option with enterprise-id %1 found, pushing result %2
 This debug message indicates that the expression has been evaluated and vendor
 option was found. This message is mostly useful during debugging of the client
 classification expressions.
 
-% EVAL_DEBUG_VENDOR_CLASS_NO_OPTION Vendor class option (code %1) missing, pushing result %2
+% EVAL_DEBUG_VENDOR_CLASS_NO_OPTION Option with code %1 missing, pushing result %2
 This debug message indicates that the expression has been evaluated
 and vendor class option was not found. This message is mostly useful during
 debugging of the client classification expressions.
 
-% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID_MISMATCH Vendor class option was found, but does not have expected enterprise-id (was looking for %1, option had %2), pushing result %3
+% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID_MISMATCH Was looking for %1, option had %2, pushing result %3
 This debug message indicates that the expression has been evaluated
 and vendor class option was found, but has different enterprise-id than specified
 in the expression. This message is mostly useful during debugging of the
 client classification expressions.
 
-% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID Vendor class option found, pushing enterprise-id %1 as result %2
+% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID Pushing enterprise-id %1 as result %2
 This debug message indicates that the expression has been evaluated and vendor
 class option was found and its enterprise-id is being reported. This message is mostly
 useful during debugging of the client classification expressions.
 
-% EVAL_DEBUG_VENDOR_CLASS_EXISTS Vendor class option exists, pushing result %1
+% EVAL_DEBUG_VENDOR_CLASS_EXISTS Option with enterprise-id %1 found, pushing result %2
 This debug message indicates that the expression has been evaluated and vendor
 class option was found. This message is mostly useful during debugging of the
 client classification expressions.
 
-% EVAL_DEBUG_VENDOR_CLASS_DATA Vendor class data %1 (out of %2 received) is pushed as %3
+% EVAL_DEBUG_VENDOR_CLASS_DATA Data %1 (out of %2 received) in vendor class found pushing as %3
 This debug message indicates that vendor class option was found and passed
 enterprise-id checks and has sufficient number of data chunks. Total numer
 of chunks and value pushed are reported as debugging aid.

+ 11 - 0
src/lib/eval/tests/token_unittest.cc

@@ -1923,6 +1923,17 @@ TEST_F(TokenTest, vendor4SpecificVendorExists) {
 
     // Case 3: option present and has matchin enterprise-id, should suceed
     testVendorExists(Option::V4, 4491, 4491, "true");
+
+
+    addString("EVAL_DEBUG_VENDOR_NO_OPTION Option with code 125 missing, "
+              "pushing result false");
+    addString("EVAL_DEBUG_VENDOR_ENTERPRISE_ID_MISMATCH Was looking for 4491, "
+              "option had 1234, pushing result false");
+    addString("EVAL_DEBUG_VENDOR_EXISTS Option with enterprise-id 4491 "
+              "found, pushing result true");
+
+    logCheckVerbose(true);
+    EXPECT_TRUE(checkFile());
 }
 
 // This test verifies if expression vendor[4491].exist works properly in DHCPv6.

+ 2 - 0
src/lib/eval/token.cc

@@ -696,6 +696,7 @@ void TokenVendor::evaluate(Pkt& pkt, ValueStack& values) {
         // We already passed all the checks: the option is there and has specified
         // enterprise-id.
         LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_EXISTS)
+            .arg(vendor->getVendorId())
             .arg("true");
         values.push("true");
         return;
@@ -801,6 +802,7 @@ void TokenVendorClass::evaluate(Pkt& pkt, ValueStack& values) {
         // We already passed all the checks: the option is there and has specified
         // enterprise-id.
         LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_EXISTS)
+            .arg(vendor->getVendorId())
             .arg("true");
         values.push("true");
         return;