Project

General

Profile

Actions

Feature #3903

closed

EqualityComparable and FormattedOutputFunction for StatusDataset and other mgmt/nfd classes

Added by Junxiao Shi over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Management
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
4.50 h

Description

For TLV structs of NFD management protocol, including ChannelStatus FaceStatus FibEntry ForwarderStatus RibEntry StrategyChoice, implement EqualityComparable concept and FormattedOutputFunction:

bool operator==(const T& a, const T& b);
bool operator!=(const T& a, const T& b);
std::ostream& operator<<(std::ostream& os, const T&);

Then use these functions in NFD's RibManager FibManager StrategyChoiceManager test suites instead of NFD's own implementation.

Actions #1

Updated by Junxiao Shi about 7 years ago

  • Status changed from New to In Progress
  • Assignee set to Junxiao Shi
Actions #2

Updated by Junxiao Shi about 7 years ago

  • % Done changed from 0 to 20

https://gerrit.named-data.net/3562 adds the operators for ndn::nfd::StrategyChoice.

Actions #3

Updated by Junxiao Shi about 7 years ago

  • Assignee changed from Junxiao Shi to Davide Pesavento

I won't do anymore because nfdc test turns out doesn't need this. Davide is actively working on this so reassigning.

Actions #4

Updated by Davide Pesavento about 7 years ago

Junxiao Shi wrote:

I won't do anymore because nfdc test turns out doesn't need this. Davide is actively working on this so reassigning.

I have a use case for formatted output (mainly logging and debugging in some management stuff I'm working on), but I don't think I need operator== and operator!=. What was the reason for them? Should we still add them to the library without a use case?

Actions #5

Updated by Junxiao Shi about 7 years ago

== and != are useful to simplify some test cases.

Actions #6

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 20 to 30
Actions #7

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 30 to 40
Actions #8

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 40 to 50

https://gerrit.named-data.net/3678 has the implementation for ForwarderStatus, plus some minor adjustments to previous commits.

Actions #9

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 50 to 60

FibEntry (and NextHopRecord) https://gerrit.named-data.net/3691

Actions #10

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 60 to 70
Actions #11

Updated by Davide Pesavento about 7 years ago

  • % Done changed from 70 to 80

In https://gerrit.named-data.net/3703 I've implemented similar functionality for FaceEventNotification, although it's not strictly a Status Dataset item.

Actions #12

Updated by Junxiao Shi about 7 years ago

https://gerrit.named-data.net/3729 is merged and breaks NFD:

../tools/nfdc/rib-module.cpp: In static member function ‘static void nfd::tools::nfdc::RibModule::add(nfd::tools::nfdc::ExecuteContext&)’:
../tools/nfdc/rib-module.cpp:89:72: error: enumeral and non-enumeral type in conditional expression [-Werror]
     .setFlags((wantChildInherit ? ndn::nfd::ROUTE_FLAG_CHILD_INHERIT : 0) |
                                                                        ^
../tools/nfdc/rib-module.cpp:90:61: error: enumeral and non-enumeral type in conditional expression [-Werror]
               (wantCapture ? ndn::nfd::ROUTE_FLAG_CAPTURE : 0));
Actions #13

Updated by Davide Pesavento about 7 years ago

Weird, there's really no reason to throw an error on that code (it's actually a warning turned into an error by -Werror). The conversion rules for the conditional operator are very precise and clear, and the case of note-12 is perfectly fine, well-defined behavior.

In any case, we have to workaround the silly warning. Feel free to submit a patch as I won't have time in the next couple of days. Changing 0 into ndn::nfd::ROUTE_FLAGS_NONE should be sufficient.

Actions #14

Updated by Junxiao Shi about 7 years ago

https://gerrit.named-data.net/3762 makes use of RibEntry and FibEntry operator!= in NFD test cases.

Actions #15

Updated by Davide Pesavento about 7 years ago

Junxiao Shi wrote:

https://gerrit.named-data.net/3762 makes use of RibEntry and FibEntry operator!= in NFD test cases.

Why are you doing this? This bug is assigned to me, so you should at least coordinate with me before making any changes related to it. Moreover, I already submitted a WIP change with the same purpose (3708).

Actions #16

Updated by Junxiao Shi about 7 years ago

Reply to note-15:

I'm working on a change in rib-manager so I need this mess gone before I can continue.

Actions #18

Updated by Davide Pesavento almost 7 years ago

  • Subject changed from EqualityComparable and FormattedOutputFunction for StatusDataset structs to EqualityComparable and FormattedOutputFunction for StatusDataset and other mgmt/nfd classes
Actions #19

Updated by Junxiao Shi almost 7 years ago

What's missing in this issue, or is it completed?

Actions #20

Updated by Davide Pesavento almost 7 years ago

FaceQueryFilter is missing I think. Plus some simplifications can now be done in NFD's FaceManager tests.

Actions #21

Updated by Davide Pesavento over 6 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Actually, I'm not going to work on FaceQueryFilter. It's not listed in the ticket description, and I don't need it. In any case, the operators can be added later, when (if) needed.

Actions

Also available in: Atom PDF