Task #1198
closednfdc: command line client of FIB and Face management protocols
100%
Description
Develop a command line client for FIB and Face management protocols.
This tool should make use of the protocol parsers and encoders in ndn-cpp-dev library. The library also provides ndn::nfd::Controller
, which should be used as a base class for main class for nfdc command.
This tool can reference the command line syntax and borrow implementation from ndnd2c.
Updated by Alex Afanasyev almost 11 years ago
- Category set to Tools
- Target version set to v0.1
Updated by Junxiao Shi almost 11 years ago
This tool is not necessary because it's the responsibility of NRD.
Updated by Alex Afanasyev almost 11 years ago
May be, but I would still like to see this tool. May be nrd will be using it (or re-use the implementation). Or we can reject this issue later, after nrd is fully designed/implemented.
Updated by Junxiao Shi almost 11 years ago
- Subject changed from nfdc: client side implementation of FIB and Face management protocols to nfdc: command line client of FIB and Face management protocols
Updated by Hila Ben Abraham almost 11 years ago
- Status changed from New to In Progress
Updated by Alex Afanasyev almost 11 years ago
Hila, just in case. The nfdc
command should have a slightly different interface to create faces (which will be simplification on your part) that it is in ndndc
. In particular, when face is created, one will specify URI for the face, as shown in examples in Face Management spec. You don't need to do parsing and many other things that are put in ndndc
.
Updated by Junxiao Shi almost 11 years ago
Assignee should design the command line syntax and let the team review.
Should the client verify the syntax of Uri?
I would say basic verification is needed.
The level of verification should be underlying protocol independent.
This means, the Uri should be verified to have at least a schema and a (possibly empty) authority.
Updated by Alex Afanasyev almost 11 years ago
I'll also vote to have only very basic checks, as you suggested. Though, I would restrict on having just schema. NFD is suppose to do actual error checking and report to nfdc all processing errors with explanation (which nfdc should print out the the user).
Updated by Hila Ben Abraham almost 11 years ago
I understand. I assume that we still want to support the configfile option, right?
Updated by Junxiao Shi almost 11 years ago
- Estimated time set to 12.00 h
Uri verification
The authority is "possibly empty" (as the Uri for UNIX stream), the verification regex is actually:
/^[a-z0-9]+\:\/\//
configfile isn't really necessary to be implemented in C++.
The operator can simply prepend nfdc
in front of each line, and execute the configfile in bash
.
Updated by Alex Afanasyev almost 11 years ago
Actually, I even prefer it this way (not supporting config file explicitly). It is less confusing and more consistent (list of commands in the script would be exactly the same as the ones an operator would type).
Updated by Hila Ben Abraham almost 11 years ago
- % Done changed from 0 to 80
status:
OK. so the program is much shorter now that I realize I can just send the uri as received without internal parsing. However, I'm facing issues in my tests. For some reason, the faceId is not set by the nfd::controller after the self registration is called, and therefore, the application can't really add or delete faces. not sure if it's something I'm doing wrong, or a problem in the lib. I'm currently trying to debug that.
Updated by Junxiao Shi almost 11 years ago
If you are testing against nfd
, please understand that only FIB management protocol is implemented there.
You may use netcat
to listen on 127.0.0.1:6363, and look at the packet received to make sure it’s correct.
Updated by Hila Ben Abraham almost 11 years ago
- Estimated time changed from 12.00 h to 9.00 h
yeah, I checked the port and no packet arrives. I debugged it for a while and I have a few questions:
The selfRegisterPrefix method under nfd::controller uses add-nexthop (FIB protocol). According to the documentation and the code, this command works only on existing FIB entries. which is not the case for a new application. The way I understand it, the nfdc application should:
- create the application local face (using the face mngmt protocol)
- (a) create a face for the input uri (face protocol) and (b) add its corresponding route into the FIB table (FIB protocol)
Am I missing anything?
If not, can I modify nfd:controller to implement also the face management protocol?
(I'm sorry for the delay, but I spend most of my time trying to understand the relationships between the lib, nfd and external application).
Updated by Junxiao Shi almost 11 years ago
fib/add-nexthop
command succeeds on existing FIB entry only.
The server side should return StatusCode=404 if the FIB entry does not exist.
If you think this design is incorrect, please comment on issue #1124.
Updated by Hila Ben Abraham almost 11 years ago
I'm not saying it's incorrect, I'm asking why is this command used to register self prefixes. It will always fail for new application.
I just want to make sure I understand it correctly, because I can fix my problem by changing the selfRegisterPrefix to use the face protocol (with the app prefix) instead of the current implementation.
Updated by Junxiao Shi almost 11 years ago
nfdc
is a command-line tool to issue commands in FaceMgmt and FibMgmt protocols.
Therefore, each command line should be directly mapped to a command in these protocols.
FibMgmt fib/add-nexthop
is not the correct command to register a prefix of a new application.
Instead, new application should register its prefix with NRD.
Updated by Hila Ben Abraham almost 11 years ago
so, do you agree with the set of operations I described? can I change the lib?
and also, what is NRD? should I be using it?
Updated by Hila Ben Abraham almost 11 years ago
- Status changed from In Progress to Feedback
- % Done changed from 80 to 100
- Estimated time changed from 9.00 h to 16.00 h
I still have a problem checking my code, I receive the next error message:
in !transport_->isConnected()
ERROR: error while connecting to the forwarder (No such file or directory)
I tried the consumer code and it also ends with the same problem. Do you know this error?
I will continue debugging, but I applied my code for your review just to make sure I'm not doing anything wrong here.
nfd patch: http://gerrit.named-data.net/#/c/324/
ndn-cpp-dev patch: http://gerrit.named-data.net/#/c/325/
Updated by Alex Afanasyev almost 11 years ago
For now, you have to do a couple of tricks to connect to NFD
First, you have to create Face with TCP transport toward 127.0.0.1 and port 6363. For example, you can use Face constructure
Face face("127.0.0.1"); // don't use "localhost" here, since it may not work---on some systems it resolves to IPv6 address and NFD right now is configured to listen on IPv4 only
Second, when running your app, set environment variable NFD=1. Either globally
export NFD=1
or for each individual run
NFD=1 ./build/bin/nfdc ...
Just in case. To use this you need to have the latest commit of ndn-cpp-dev
that I just pushed to github.
Updated by Hila Ben Abraham almost 11 years ago
fixed most of your comments, but I still can't test it. I now get an error when I start nfd: "terminate called throwing an exceptionAbort trap: 6."
are you familiar with this one?
Updated by Hila Ben Abraham almost 11 years ago
Hila Ben Abraham wrote:
fixed most of your comments, but I still can't test it. I now get an error when I start nfd: "terminate called throwing an exceptionAbort trap: 6."
are you familiar with this one?
-- Please ignore that, I found a conflict in my code that may have caused this. I'll try to fix it first.
Updated by Hila Ben Abraham almost 11 years ago
Hila Ben Abraham wrote:
Hila Ben Abraham wrote:
fixed most of your comments, but I still can't test it. I now get an error when I start nfd: "terminate called throwing an exceptionAbort trap: 6."
are you familiar with this one?
Nope, I still can't start nfd. is it just me?
Updated by Alex Afanasyev almost 11 years ago
You need to run NFD as root (or at least with sudo)
sudo ./build/nfd
Updated by Hila Ben Abraham almost 11 years ago
- Status changed from Feedback to Code review
Updated by Hila Ben Abraham almost 11 years ago
Hi Junxiao,
Regarding your last comments:
line 37:
I followed the specification as written here: http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
If you changed that, please remove that from the webpage as well.
line 177:
What do you mean by scheme name? and can you please explain me why it's not OK to check for the entire structure here and to save some of the forwarder work?
Updated by Junxiao Shi almost 11 years ago
Please reply to code review comments in Gerrit using Reply button. Do not enter replies here.
Updated by Junxiao Shi over 10 years ago
- Status changed from Code review to Closed