Project

General

Profile

Actions

Task #1198

closed

nfdc: command line client of FIB and Face management protocols

Added by Alex Afanasyev almost 11 years ago. Updated almost 11 years ago.

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

100%

Estimated time:
16.00 h

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.


Related issues 5 (0 open5 closed)

Related to NFD - Task #1195: FaceManagerClosed

Actions
Related to NFD - Task #1223: Implement remaining FIB management commandsClosed02/04/2014

Actions
Blocked by NFD - Task #1123: Face management protocolClosedJunxiao Shi

Actions
Blocked by NFD - Task #1124: FIB management protocolClosedJunxiao Shi

Actions
Precedes NFD - Task #1287: nfdc: set-strategyClosedHila Ben Abraham02/25/201402/25/2014

Actions
Actions #1

Updated by Alex Afanasyev almost 11 years ago

  • Category set to Tools
  • Target version set to v0.1
Actions #2

Updated by Junxiao Shi almost 11 years ago

This tool is not necessary because it's the responsibility of NRD.

Actions #3

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.

Actions #4

Updated by Beichuan Zhang almost 11 years ago

  • Assignee set to Hila Ben Abraham
Actions #5

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
Actions #6

Updated by Junxiao Shi almost 11 years ago

  • Description updated (diff)
Actions #7

Updated by Alex Afanasyev almost 11 years ago

  • Description updated (diff)
Actions #8

Updated by Hila Ben Abraham almost 11 years ago

  • Status changed from New to In Progress
Actions #9

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.

Actions #10

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.

Actions #11

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).

Actions #12

Updated by Hila Ben Abraham almost 11 years ago

I understand. I assume that we still want to support the configfile option, right?

Actions #13

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.

Actions #14

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).

Actions #15

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.

Actions #16

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.

Actions #17

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:

  1. create the application local face (using the face mngmt protocol)
  2. (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).

Actions #18

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.

Actions #19

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.

Actions #20

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.

Actions #21

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?

Actions #22

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/

Actions #23

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.

Actions #24

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?

Actions #25

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.

Actions #26

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?

Actions #27

Updated by Alex Afanasyev almost 11 years ago

You need to run NFD as root (or at least with sudo)

sudo ./build/nfd
Actions #28

Updated by Hila Ben Abraham almost 11 years ago

  • Status changed from Feedback to Code review
Actions #29

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?

Actions #30

Updated by Junxiao Shi almost 11 years ago

Please reply to code review comments in Gerrit using Reply button. Do not enter replies here.

Actions #31

Updated by Junxiao Shi almost 11 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF